You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/06/12 14:27:34 UTC

[sling-whiteboard] 11/11: Prevent NPE in test

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 1b101fd4e697edd809a74b6c3e9286b528b28a8d
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Wed Jun 12 16:23:16 2019 +0200

    Prevent NPE in test
---
 .../src/test/java/org/apache/sling/uca/impl/AgentIT.java            | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/url-connection-agent/src/test/java/org/apache/sling/uca/impl/AgentIT.java b/url-connection-agent/src/test/java/org/apache/sling/uca/impl/AgentIT.java
index dd2bbfe..e8b6ac8 100644
--- a/url-connection-agent/src/test/java/org/apache/sling/uca/impl/AgentIT.java
+++ b/url-connection-agent/src/test/java/org/apache/sling/uca/impl/AgentIT.java
@@ -138,15 +138,15 @@ public class AgentIT {
         int exitCode = process.exitValue();
         LOG.info("Exited with code {}", exitCode);
         
-        if ( exitCode != 0 ) {
+        if ( exitCode == 0 ) {
+            throw new RuntimeException("Command terminated successfully. That is unexpected.");
+        } else {
             return Files.lines(STDERR)
                 .filter( l -> l.startsWith("Exception in thread \"main\""))
                 .map( l -> newRecordedThrowable(l) )
                 .findFirst()
                 .orElseThrow(() -> new RuntimeException("Exit code was zero but did not find any exception information in stderr.txt"));
         }
-        
-        return null;
     }
     
     private Process runForkedCommandWithAgent(URL url, int connectTimeoutSeconds, int readTimeoutSeconds, ClientType clientType) throws IOException {