changeset 1258:d4c82942a0e7

FlowError more codes
author Devel 2
date Thu, 02 Jul 2020 10:50:54 +0200
parents a0e5df7b0e45
children 0c295fc300dd
files stress-tester/src/main/java/com/passus/st/client/FlowError.java
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/FlowError.java	Thu Jul 02 10:50:38 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/FlowError.java	Thu Jul 02 10:50:54 2020 +0200
@@ -33,13 +33,14 @@
     public static final byte CODE_IDE_TIMEOUT = 18;
 
     public static final byte BIND_ADDRESS_ALREADY_IN_USE = 19;
-    public static final byte BIND_CANNOT_ASSIGN_ADDRESS = 20;
-    public static final byte BIND_MAPPER_INVALID = 21;
-    public static final byte BIND_OTHER = 22;
+    public static final byte BIND_PORT_ALREADY_IN_USE = 20;
+    public static final byte BIND_CANNOT_ASSIGN_ADDRESS = 21;
+    public static final byte BIND_MAPPER_INVALID = 22;
+    public static final byte BIND_OTHER = 23;
 
-    public static final byte CODE_SSL_ERROR = 23;
-    public static final byte CODE_SSL_UNRECOGNIZED_MESSAGE_ERROR = 24;
-    public static final byte CODE_SSL_HANDSHAKE_ERROR = 25;
+    public static final byte CODE_SSL_ERROR = 24;
+    public static final byte CODE_SSL_UNRECOGNIZED_MESSAGE_ERROR = 25;
+    public static final byte CODE_SSL_HANDSHAKE_ERROR = 26;
 
     public static final byte CODE_INTERNAL_ERROR = (byte) 255;
 
@@ -82,6 +83,8 @@
 
     public static String codeToString(int code) {
         switch (code) {
+            case BIND_PORT_ALREADY_IN_USE:
+                return "Bind error. Port already in use.";
             case BIND_ADDRESS_ALREADY_IN_USE:
                 return "Bind error. Address already in use.";
             case BIND_CANNOT_ASSIGN_ADDRESS:
@@ -152,9 +155,12 @@
     }
 
     public static FlowError interpret(Throwable ex, String stackTrace) {
+        ex.printStackTrace();
         if (ex instanceof BindException) {
             String msg = ex.getMessage();
-            if (msg.contains("Address already in use")) {
+            if (msg.contains("Port already in use")) {
+                return new FlowError(BIND_PORT_ALREADY_IN_USE, ex);
+            } else if (msg.contains("Address already in use")) {
                 return new FlowError(BIND_ADDRESS_ALREADY_IN_USE, ex);
             } else if (msg.contains("Cannot assign requested address")) {
                 return new FlowError(BIND_CANNOT_ASSIGN_ADDRESS, ex);