aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/util')
-rw-r--r--src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java2
-rw-r--r--src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java63
2 files changed, 35 insertions, 30 deletions
diff --git a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java
index d1857ffefc..b10e643831 100644
--- a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java
+++ b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java
@@ -28,7 +28,7 @@ public final class GregtechRecipe {
}
public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput) {
- Utils.LOG_INFO("Adding a GT Furnace/Alloy Smelter Recipe");
+ Utils.LOG_WARNING("Adding a GT Furnace/Alloy Smelter Recipe"+"| Input:"+aInput.getDisplayName()+" | Output:"+aOutput.getDisplayName()+" |");
return ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput);
}
diff --git a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java
index 9e7e033bed..bcfce5a71b 100644
--- a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java
+++ b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java
@@ -10,36 +10,41 @@ import java.net.URLConnection;
public class NetworkUtils {
public static String getContentFromURL(String args) {
-
- URL url;
-
- try {
- // get URL content
- url = new URL(args);
- URLConnection conn = url.openConnection();
-
- // open the stream and put it into BufferedReader
- BufferedReader br = new BufferedReader(
- new InputStreamReader(conn.getInputStream()));
-
- String inputLine;
- String tempLine = null;
-
-
-
-
- while ((inputLine = br.readLine()) != null) {
- tempLine = inputLine;
+ if (netIsAvailable()){
+ try {
+ URL url;
+ // get URL content
+ url = new URL(args);
+ URLConnection conn = url.openConnection();
+ // open the stream and put it into BufferedReader
+ BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ String inputLine;
+ String tempLine = null;
+ while ((inputLine = br.readLine()) != null) {
+ tempLine = inputLine;
+ }
+ br.close();
+ return tempLine;
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
}
-
- br.close();
- return tempLine;
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
+ }
return null;
}
-
+
+ private static boolean netIsAvailable() {
+ try {
+ final URL url = new URL("http://www.google.com");
+ final URLConnection conn = url.openConnection();
+ conn.connect();
+ return true;
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
}