From 2437aea31a5cfb5202f5539ea0d5e3d6b6766c74 Mon Sep 17 00:00:00 2001 From: AlejandroP Date: Tue, 30 Jan 2024 17:30:18 -0300 Subject: [PATCH 1/2] - Fix SAP Transaction methods error when assigning empty scope before TransactionBegin/TransactionCommit Issue 106402 --- java/src/main/java/com/genexus/sap/SessionManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/src/main/java/com/genexus/sap/SessionManager.java b/java/src/main/java/com/genexus/sap/SessionManager.java index a6415aa6f..43d1ee037 100644 --- a/java/src/main/java/com/genexus/sap/SessionManager.java +++ b/java/src/main/java/com/genexus/sap/SessionManager.java @@ -153,7 +153,7 @@ public void TransactionBegin() try { destinationName = (String)destinationObj; - scopeName = (String)scopeObj; + scopeName = String.valueOf( scopeObj); Log.info("GX SAP - Begin Transaction " + destinationName); JCoDestination destination = null; if (scopeName.length() == 0) @@ -180,12 +180,12 @@ public void TransactionCommit() try { JCoDestination destination = null; - destinationName = (String)destinationObj; - if ( scopeObject == null || ((String)scopeObject).length() == 0 ) { + destinationName = (String)destinationObj; + scopeName = String.valueOf(scopeObject); + if ( scopeName.length() == 0 ) { destination = JCoDestinationManager.getDestination(destinationName); } else { - scopeName = (String)scopeObject; destination = JCoDestinationManager.getDestination(destinationName, scopeName); } Log.info("GX SAP - Commit Transaction " + destinationName); From c472c711d5f1e3bec5779098679e1d9186f2d408 Mon Sep 17 00:00:00 2001 From: Alejandro Panizza Carve Date: Fri, 2 Feb 2024 21:42:20 -0300 Subject: [PATCH 2/2] - Change zero length test for isEmpty --- java/src/main/java/com/genexus/sap/SessionManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/src/main/java/com/genexus/sap/SessionManager.java b/java/src/main/java/com/genexus/sap/SessionManager.java index 43d1ee037..2eb5be035 100644 --- a/java/src/main/java/com/genexus/sap/SessionManager.java +++ b/java/src/main/java/com/genexus/sap/SessionManager.java @@ -156,7 +156,7 @@ public void TransactionBegin() scopeName = String.valueOf( scopeObj); Log.info("GX SAP - Begin Transaction " + destinationName); JCoDestination destination = null; - if (scopeName.length() == 0) + if (scopeName.isEmpty()) destination = JCoDestinationManager.getDestination(destinationName); else destination = JCoDestinationManager.getDestination(destinationName, scopeName); @@ -182,7 +182,7 @@ public void TransactionCommit() JCoDestination destination = null; destinationName = (String)destinationObj; scopeName = String.valueOf(scopeObject); - if ( scopeName.length() == 0 ) { + if ( scopeName.isEmpty() ) { destination = JCoDestinationManager.getDestination(destinationName); } else { @@ -456,4 +456,4 @@ public void setRepositoryName(String value) { repositoryName = value; } -} \ No newline at end of file +}