Developer Transformation Guide > Java Transformation > Troubleshooting a Java Transformation
  

Troubleshooting a Java Transformation

In the Results window in the Compilation properties on any code entry tab, you can find and fix Java code errors.
Errors in a Java transformation can occur due to an error in code on a code entry tab or in the full code for the Java transformation class.
To troubleshoot a Java transformation, complete the following high-level steps:
  1. 1. Find the source of the error in the Java snippet code or in the full class code for the transformation.
  2. 2. Identify the type of error. Use the results of the compilation in the Results window and the location of the error to identify the type of error.
  3. 3. Fix the Java code on the code entry tab.
  4. 4. Compile the transformation again.

Finding the Source of Compilation Errors

To find the source of compilation errors, use the results of the compilation displayed in the Results window in the Compilation properties on a code entry tab or the Full Code tab.
When you double-click an error message in the Results window, the source code that caused the error is highlighted the in Java code window on the code entry tab or on the Full Code tab.
You can find errors on the Full Code tab, but you cannot edit Java code on the Full Code tab. To fix errors that you find on the Full Code tab, modify the code on the appropriate code entry tab. You might need to use the Full Code tab to view errors caused by adding user code to the full class code for the transformation.

Finding an Error on a Code Entry Tab or the Full Code Tab

You can find compilation errors on a code entry tab or the Full Code tab.
    1. In the Results window in the Compilation properties on any code entry tab or the Full Code tab, right-click an error message.
    2. Click either Show In > Snippet or Show In > Full Code Tab.
    The Developer tool highlights the source of the error on the selected tab.

Identifying the Source of Compilation Errors

Compilation errors can appear as a result of errors in the user code.
Errors in the user code might also generate an error in the non-user code for the class. Compilation errors occur in user and non-user code for the Java transformation.

User Code Errors

Errors can occur in the user code on the code entry tabs. User code errors include standard Java syntax and language errors.
User code errors might also occur when the Developer tool adds the user code from the code entry tabs to the full class code.
For example, a Java transformation has an input port with a name of int1 and an integer datatype. The full code for the class declares the input port variable with the following code:
int int1;
However, if you use the same variable name on the On Input tab, the Java compiler issues an error for a redeclaration of a variable. To fix the error, rename the variable on the On Input tab.

Non-User Code Errors

User code on the code entry tabs can cause errors in non-user code.
For example, a Java transformation has an input port and an output port, int1 and out1, with integer datatypes. You write the following code in the On Input code entry tab to calculate interest for input port int1 and assign it to the output port out1:
int interest;
interest = CallInterest(int1); // calculate interest
out1 = int1 + interest;
}
When you compile the transformation, the Developer tool adds the code from the On Input code entry tab to the full class code for the transformation. When the Java compiler compiles the Java code, the unmatched brace causes a method in the full class code to end prematurely, and the Java compiler issues an error.