Home > Software design >  Exception never seems to get thrown when an AxisFault is found
Exception never seems to get thrown when an AxisFault is found

Time:04-22

I have this catch statement:

} catch (Exception e) {
    if (e instanceof AxisFault) {
        LOGGER.info("AxisFault: "   e);
        if (((AxisFault) e).getFaultReason().contains("My error text")) {
            throw new MyServiceException(HPDatastoreProviderImpl.class.toString(),
                    "My error text");
        }
    } else {
        LOGGER.info("Failed: "   e);
    }
}

When it's hit I can see that LOGGER.info("AxisFault: " e); seems to be ignored. The if statement is entered and I can see the debugger on line throw new MyServiceException(HiPlusDatastoreProviderImpl.class.toString(), "My error text"); but then it jumps to LOGGER.info("Failed: " e);.

If I remove LOGGER.info("AxisFault: " e); the if is never entered. It jumps straight to the else. MyServiceException never actually seems to be thrown. How do I resolve this?

Update

I updated my catch to:

} catch (Exception e) {
    if (e.getMessage().contains("My error text")) {
        throw new MyServiceException(HPDatastoreProviderImpl.class.toString(),
                "My error text");
    } else {
        LOGGER.info("Failed: "   e);
    }
}

The if doesn't get entered but on the catch I can see e={AxisFault@1914} "My error text in my debugger. That's the reason I thought this was an access fault. I feel I'm no further on with this.

CodePudding user response:

There seems to have been some issue with my environment. After clearing my browser cache, restarting my laptop, then rebuilding the application it finally worked. Sorry for wasting everyone's time.

  • Related