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

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/plc4x-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new c0d9310  Site checkin for project PLC4X: Jenkins Tools
c0d9310 is described below

commit c0d931030437782aaec4c1308657dc829eb1bfb4
Author: jenkins <[email protected]>
AuthorDate: Wed May 26 20:30:17 2021 +0000

    Site checkin for project PLC4X: Jenkins Tools
---
 plc4j/index.html | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/plc4j/index.html b/plc4j/index.html
index 2f24d59..09c1d56 100644
--- a/plc4j/index.html
+++ b/plc4j/index.html
@@ -191,6 +191,7 @@ The format of an address greatly depends on the type of 
connection. Therefore <c
 
 import org.apache.plc4x.java.PlcDriverManager;
 import org.apache.plc4x.java.api.PlcConnection;
+import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
 import org.apache.plc4x.java.api.messages.PlcReadRequest;
 import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.api.types.PlcResponseCode;
@@ -262,31 +263,29 @@ public class HelloPlc4x {
 
             // Give the async request a little time...
             TimeUnit.MILLISECONDS.sleep(1000);
-        } catch (Exception e) {
-            e.printStackTrace();
+            System.exit(0);
         }
-        System.exit(0);
     }
 
     private static void printResponse(PlcReadResponse response) {
         for (String fieldName : response.getFieldNames()) {
-            if(response.getResponseCode(fieldName) == PlcResponseCode.OK) {
+            if (response.getResponseCode(fieldName) == PlcResponseCode.OK) {
                 int numValues = response.getNumberOfValues(fieldName);
                 // If it's just one element, output just one single line.
-                if(numValues == 1) {
-                    logger.info("Value[" + fieldName + "]: " + 
response.getObject(fieldName));
+                if (numValues == 1) {
+                    logger.info("Value[{}]: {}", fieldName, 
response.getObject(fieldName));
                 }
                 // If it's more than one element, output each in a single row.
                 else {
-                    logger.info("Value[" + fieldName + "]:");
-                    for(int i = 0; i &lt; numValues; i++) {
-                        logger.info(" - " + response.getObject(fieldName, i));
+                    logger.info("Value[{}]:", fieldName);
+                    for (int i = 0; i &lt; numValues; i++) {
+                        logger.info(" - {}", response.getObject(fieldName, i));
                     }
                 }
             }
             // Something went wrong, to output an error message instead.
             else {
-                logger.error("Error[" + fieldName + "]: " + 
response.getResponseCode(fieldName).name());
+                logger.error("Error[{}]: {}", fieldName, 
response.getResponseCode(fieldName).name());
             }
         }
     }

Reply via email to