Debugging maps

This section provides the following information about debugging a map:

For information on how to test relationships, see "Testing maps that contain relationships".

Resolving run-time errors

Even if your map compiled successfully, you can get a run-time error during the map execution in the Debugger.

Example 1: You have an outbound map with the generic business object on one side and an application specific business object on the other side. Let us assume that this map has an identity relationship in it.

  1. Go to the Test tab and select the calling context SERVICE_CALL_REQUEST.
  2. Select the verb "Update."
  3. Run the test.

    Result: An error message like the one below displays:

    Exception at step 17, 
    attribute <attribute name>,
    java.lang.nullpointerexception
    

This exception is happening because the map is trying to update an entry in the repository that is not created in the first place. Ideally, you should ensure that the sequence of steps is correct. You should look at the database for relationship entries pertaining to the map in question. You should then draw the conclusions based on whether it is ready for SERVICE_CALL_REQUEST or not.

Example 2: You have the following line of the mapping code for Customer.CustomerId:

_cw_CpBTBSourceValue = ObjSAP_CustomerMaster.get("CustomerIdd");

Clearly, it contains a typo (an extra letter d in the name of the attribute). Unfortunately, the compiler does not catch this error because the error is in a string constant. There is no way for the compiler to verify what a "correct" constant value should be. However, when you run the map, the following ICS Express error dialog displays:

ICS Error: Exception at step 3, attribute CustomerId, Exception msg 
number - 11030, Error11030 Attribute CustomerIdd doesn't exist in business 
object SAP_CustomerMaster.

When you get this run-time error, leave the Test tab and fix the map.

Debugging tips

This section provides the following tips for making the debugging of a map easier:

Using logging messages

Use the logInfo() method for tracking the map execution. It takes a String as an argument, which is sent on the InterChange Server Express log. You need to type it in Activity Editor for the attribute whose execution needs to be tracked. To make sure that the submap is executed, create a custom transformation rule and use the "Log Information" function block to customize the activity or write the code directly.

Example: The code can be as simple as the following:

logInfo("in submap");

Put it on the first line of code of the destination object's first attribute in the submap.

Example: If you need to track the value of the specific attribute SAP.CustomerName, use:

logInfo(ObjSAP_CustomerMaster.getString("CustomerName"));

You might not always want to see this message. If this is the case, change the DataValidationLevel property of the map.

To set the DataValidationLevel, select the Map Properties option from the Edit menu of Map Designer Express and change 0 to 1 or a greater number. The settings are as follows:

0 No data validation
1 IBM data validation level
2 or greater User-defined data validation

To ensure that the logInfo message is not displayed, set DataValidationLevel to 1. In your code, before calling the logInfo() method, check for a data validation level. Here is the code:

if (dataValidationLevel > 1)
   logInfo(ObjSAP_CustomerMaster.getString("CustomerName"));

This ensures that logInfo is executed only if the data validation level is set to a number greater than 1. If you decide to display the message, change the data validation level setting in the Map Properties to 2.

Writing safe mapping code

If you customize your transformation rule in Activity Editor or write your own mapping code, you are not guaranteed that it will work properly during run time. To make sure that the map continues executing when an error occurs and you get a notification of an error, use the "Catch Error" function block in Activity Editor or follow Java's way of handling exceptions.

Example: Put your code inside the try block, for example:

try 
   {
   BusObj temp = new BusObj("SAP_Order");
// rest of your code
   }

Then use a catch block to catch whatever exceptions might occur when the code runs:

catch (Exception e) 
   {
   logInfo(e.toString());
   }

The logInfo() method can be used to send system-generated error messages to the InterChange Server Express log.

Copyright IBM Corp. 2004