Menu

#151 MethodFault is missing fault string

5.0
open
Steve
API (125)
5
2012-12-15
2012-10-24
No

Hey Steve,

Its been awhile. =)

I came across an issue with 5.0 today. The fault string isn't making it into the MethodFault (or those classes that extend it). In XmlGen.parseSoapFault(...) the following is done to populate the Throwable that ultimately is cast to a RemoteException:

sfe.detail = (Throwable) fromXml(getVimClass(faultTypeName), faultE);

To get the fault string into the Throwable, I whipped up the following fix:

Object throwable = fromXml(getVimClass(faultTypeName), faultE);
if (throwable instanceof MethodFault) {
MethodFault mf = (MethodFault) throwable;
LocalizedMethodFault lmf = new LocalizedMethodFault();
lmf.fault = mf;
lmf.localizedMessage = sfe.getFaultString();
mf.faultCause = lmf;
}
sfe.detail = (Throwable) throwable;

Obviously we could reduce this a bit by adding a constructor to LocalizedMethodFault that takes the fault reference and localized message as well.

As always, thanks for considering this.

Cheers,
-Eric
----
Eric Forgette
Nimble Storage
http://www.nimblestorage.com/

Discussion