Exception Handling
As a result of changes to exception handling, instead of enhancing of java.lang.RuntimeException, java.lang.Exception has been introduced as a new parent class.
When using RuntimeExceptions, it was not mandatory that exceptions be added to a throws clause. However, when using 'normal' exceptions you must always decide whether an exception is to be handled explicitly or if it is to be added to the throws clause.
You have not previously set any try-catch [-finally]blocks for exception handling.
To adapt your code, either set try-catch [-finally]blocks, or add your exceptions to a throw clause.
JCo
2.x
public void executeFunction(JCO.Function function, String where) { JCO.Client client = JCO.getClient(where); client.execute(function); }
|
JCo 3.0 (Option
1)
public void executeFunction(JCO.Function function, String where) throws JCoException { JCoDestination destination=JCoDestinationManager.getDestination(where); function.execute(destination); }
|
JCo 3.0 (Option
2)
public int executeFunction(JCO.Function function, String where) { int returnCode=0; try { JCoDestination destination=JCoDestinationManager.getDestination(where); function.execute(destination); }
catch (AbapException ex) { handleAbapException(function, ex); returnCode=1; } catch (JCoException ex) { logSystemFailure(ex); returnCode=2; } return returnCode; } |