Hi guys,

I appreciate the comments - thanks!

I agree...just because it has Runtime in the name doesn't mean anything.

My problem is that the object they are throwing is from a class that does
not derive from Throwable at all...not only does it not derive from
RuntimeException or Exception, it just simply does not derive from
Throwable...yet they are throwing it.

Here is the sample code:

http://www.vmware.com/communities/content/developer/samplecode/java/CreateVmfsDatastore.html

retrieveProperties throws this exception:

http://www.jarvana.com/jarvana/view/net/java/dev/vcc/thirdparty/vi-api/4.0.0-2/vi-api-4.0.0-2-javadoc.jar!/com/vmware/vim25/RuntimeFault.html

Here is the specific code:

       ObjectContent[] ocs = service.retrieveProperties(

             content.getPropertyCollector(),

             new PropertyFilterSpec[] {pfSpec});
When I tell Eclipse to generate a try/catch block, this is what it
generates:

       ObjectContent[] ocs;

try {

 ocs = service.retrieveProperties(

         content.getPropertyCollector(),

         new PropertyFilterSpec[] {pfSpec});

} catch (InvalidProperty e) {

 // TODO Auto-generated catch block

 e.printStackTrace();

} catch (RuntimeFault e) {

 // TODO Auto-generated catch block

 e.printStackTrace();

}

The funny part is, once it generates this code, it complains that both
InvalidProperty and RuntimeFault must extend Throwable and don't.

Thoughts on this?

On Mon, Mar 18, 2013 at 5:16 PM, Kelven Yang <kelven.y...@citrix.com> wrote:

> VMware API is web-service based, how a web service fault class is mapped
> to a java class is determined by the underlying web-service tool.
>
> In vSphere 4.0/4.1 SDK, it uses Axis 1.4, all web server fault class is
> derived from org.apache.axis.AxisFault which in turn derives from java
> Exception class.
>
> for vSphere 5.1 SDK as Min just pointed, it derives from other class.
>
> Please pay attention, Although there is "RunTime" in the word of
> RuntimeFault, it does not necessarily be mapped to a Java RuntimeException
> class, in both 4.1/5.1 VMWare sdk, it is mapped to a java class that
> derived from java.lang.Exception (checked exception)
>
> Kelven
>
> On 3/18/13 4:06 PM, "Mike Tutkowski" <mike.tutkow...@solidfire.com> wrote:
>
> >Here is some of the problematic sample code:
> >
> >       ObjectContent[] ocs = service.retrieveProperties(
> >
> >             content.getPropertyCollector(),
> >
> >             new PropertyFilterSpec[] {pfSpec});
> >
> >
> >It claims to throw a RuntimeFault exception.  However, when I look at the
> >API docs for RuntimeFault, as you say, it does not extend Throwable.
> >
> >
> >Why then is the method claiming to throw RuntimeFault?
> >
> >
> >Do you know about that, Min?
> >
> >
> >Thanks!
> >
> >
> >On Mon, Mar 18, 2013 at 5:01 PM, Min Chen <min.c...@citrix.com> wrote:
> >
> >> In Vmware 5.1 SDK, RuntimeFaultFaultMsg is the exception class for
> >> RuntimeFault. RuntimeFault itself is not extended from Throwable.
> >>
> >> Thanks
> >> -min
> >>
> >> On 3/18/13 3:39 PM, "Mike Tutkowski" <mike.tutkow...@solidfire.com>
> >>wrote:
> >>
> >> >Hi,
> >> >
> >> >I've been playing around with VMware API commands to create a
> >>datastore.
> >> >
> >> >In sample code I've found, they are throwing a RuntimeFault exception.
> >> >
> >> >The problem is this class does not extend Throwable.
> >> >
> >> >I admit...I'm totally confused about this.  How are they throwing an
> >> >exception that doesn't extend Throwable?  When I ask Eclipse to create
> >>a
> >> >try/catch block for me, it seems confused, as well?
> >> >
> >> >Anyone know anything about this?
> >> >
> >> >Thanks!
> >> >
> >> >--
> >> >*Mike Tutkowski*
> >> >*Senior CloudStack Developer, SolidFire Inc.*
> >> >e: mike.tutkow...@solidfire.com
> >> >o: 303.746.7302
> >> >Advancing the way the world uses the
> >> >cloud<http://solidfire.com/solution/overview/?video=play>
> >> >* *
> >>
> >>
> >
> >
> >--
> >*Mike Tutkowski*
> >*Senior CloudStack Developer, SolidFire Inc.*
> >e: mike.tutkow...@solidfire.com
> >o: 303.746.7302
> >Advancing the way the world uses the
> >cloud<http://solidfire.com/solution/overview/?video=play>
> >* *
>
>


-- 
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: mike.tutkow...@solidfire.com
o: 303.746.7302
Advancing the way the world uses the
cloud<http://solidfire.com/solution/overview/?video=play>
*™*

Reply via email to