From 9f9f94d2685be86623708c24714fdecd2cb84700 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Fri, 8 Jun 2012 23:14:04 +0200 Subject: [PATCH] SelfHoster: Avoid some compiler warnings. * src/test/java/org/glom/web/server/SelfHoster.java executeCommandLineAndWait(): executeCommandLineAndWaitUntilSecondCommandReturnsSuccess(): Comment out the now-unused streams for stdout and stderr from the command Processes. These are not used because readln() hangs while waiting for a new line, where there may be no next line. The commented out code is still there to help us figure out how to do this properly. --- ChangeLog | 12 +++++++++++ src/test/java/org/glom/web/server/SelfHoster.java | 26 +++++++++++------------ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18034d5..7b3b79b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2012-06-08 Murray Cumming + SelfHoster: Avoid some compiler warnings. + + * src/test/java/org/glom/web/server/SelfHoster.java + executeCommandLineAndWait(): + executeCommandLineAndWaitUntilSecondCommandReturnsSuccess(): Comment out + the now-unused streams for stdout and stderr from the command Processes. + These are not used because readln() hangs while waiting for a new line, + where there may be no next line. The commented out code is still there + to help us figure out how to do this properly. + +2012-06-08 Murray Cumming + LayoutItemPortalDeepCloneTest: Test something to avoid warnings. * src/test/java/org/glom/web/server/libglom/LayoutItemPortalDeepCloneTest.java: diff --git a/src/test/java/org/glom/web/server/SelfHoster.java b/src/test/java/org/glom/web/server/SelfHoster.java index 218b7a5..79642fc 100644 --- a/src/test/java/org/glom/web/server/SelfHoster.java +++ b/src/test/java/org/glom/web/server/SelfHoster.java @@ -19,13 +19,10 @@ package org.glom.web.server; -import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; import java.net.ServerSocket; import java.sql.Connection; import java.sql.DriverManager; @@ -369,11 +366,11 @@ public class SelfHoster { return false; } - final InputStream stderr = process.getInputStream(); - final InputStreamReader isr = new InputStreamReader(stderr); - final BufferedReader br = new BufferedReader(isr); - String output = ""; - String line; + // final InputStream stderr = process.getInputStream(); + // final InputStreamReader isr = new InputStreamReader(stderr); + // final BufferedReader br = new BufferedReader(isr); + // String output = ""; + // String line; /* * try { //TODO: readLine() can hang, waiting for an end of line that never comes. while ((line = br.readLine()) * != null) { output += line + "\n"; } } catch (final IOException e1) { e1.printStackTrace(); return false; } @@ -390,7 +387,7 @@ public class SelfHoster { if (result != 0) { System.out.println("executeCommandLineAndWait(): Command failed: " + command.command().toString()); - System.out.print(" Output: " + output); + // System.out.print(" Output: " + output); return false; } @@ -402,18 +399,19 @@ public class SelfHoster { command.redirectErrorStream(true); // Run the first command, and do not wait for it to return: - Process process = null; + // Process process = null; try { - process = command.start(); + // Process process = + command.start(); } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return false; } - final InputStream stderr = process.getInputStream(); - final InputStreamReader isr = new InputStreamReader(stderr); - final BufferedReader br = new BufferedReader(isr); + // final InputStream stderr = process.getInputStream(); + // final InputStreamReader isr = new InputStreamReader(stderr); + // final BufferedReader br = new BufferedReader(isr); /* * We do not wait, because this (postgres, for instance), does not return: final int result = process.waitFor(); -- 2.1.4