wasSuccessful and getExportException return incorrect output

book

Article ID: 103185

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine AUTOMIC WORKLOAD AUTOMATION

Issue/Introduction

When an export fails using the ExportObject class, the functions wasSuccessful and getExportException return values that indicate the export was successful.

Sample code:

System.out.println(obj.getExportException());
System.out.println("Success:" + obj.wasSuccessful());

Expected Result:

Could not find the object. It may have been deleted or renamed. 
Success: false

Actual Result:

Null
Success: true

Cause

A check for getmessagebox()!=null must always follow a sendrequestandwait() call. Evaluating a response when getmessagebox() == null will be working in an undefined condition. 

Environment

Release: AUTWAB99000-11.2-Automic Workload Automation-Base Edition
Component:

Resolution

Add a check for getmessagebox() != null before calling the wasSuccessful() and getExportException() functions. 

Sample code:

if (obj.getMessageBox() != null) {
    System.out.println(obj.getExportException());
    System.out.println(obj.wasSuccessful());
    System.out.println("Export failed");
}
else {
    if (obj.wasSuccessful() == true) {
        System.out.println(obj.getExportException());
        System.out.println("Success");
    }
}