fixed bug causing analyzer to hang reading from an empty error input steam

Former-commit-id: 1f4ed4fe5bb1900aff6ce2494e3f421312cd578f
This commit is contained in:
Jeremy Long
2014-03-28 04:06:42 -04:00
parent 25a72e3508
commit c16e85e7db

View File

@@ -28,13 +28,11 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath; import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathFactory;
import org.owasp.dependencycheck.Engine; import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException; import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
import org.owasp.dependencycheck.dependency.Confidence; import org.owasp.dependencycheck.dependency.Confidence;
@@ -120,7 +118,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
// Try evacuating the error stream // Try evacuating the error stream
final BufferedReader rdr = new BufferedReader(new InputStreamReader(proc.getErrorStream())); final BufferedReader rdr = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
String line = null; String line = null;
while ((line = rdr.readLine()) != null) { while (rdr.ready() && (line = rdr.readLine()) != null) {
LOG.warning("Error from GrokAssembly: " + line); LOG.warning("Error from GrokAssembly: " + line);
} }
int rc = 0; int rc = 0;
@@ -163,7 +161,6 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
LOG.warning("Return code " + rc + " from GrokAssembly"); LOG.warning("Return code " + rc + " from GrokAssembly");
} }
} catch (IOException ioe) { } catch (IOException ioe) {
throw new AnalysisException(ioe); throw new AnalysisException(ioe);
} catch (SAXException saxe) { } catch (SAXException saxe) {