• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IOException thrown where not declared?

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I got this stack trace:



How can javax.xml.ws.Service.<init> (the constructor protected Service(java.net.URL wsdlDocumentLocation, QName serviceName)) throw an IOException when it does not declare it in a throws clause ?

It is a checked exception that must be declared if thrown, right?

The code in com.fo.bar.FooService.<init>(FooService.java:77) is:
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not the stack trace - that's the cause of the stack trace. You can tell by the "caused by". Without seeing the complete stack trace I can't confirm, but I think that this IOException is wrapped into RuntimeException or a subclass of it.
 
David Balažic
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The begining is this:


The "Caused by" code is then called somewhere inside the MethodBindingMethodExpressionAdapter.invoke() call.

javax.faces.el.EvaluationException is a RuntimeException, but I don't see why javax.xml.ws code would be creating JSF classes ???

Doesn't the "Caused by" part tell what exception happened originally at what place ?
 
David Balažic
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also see that the source of the exception:
sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

declares:

public synchronized java.io.InputStream getInputStream() throws java.io.IOException

So to me it seems that an IOException was thrown there (in getInputStream()) and it somehow propagated thru the Service(x,z) constructor which does _not_ declare a throws IOException.

Confused....
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David, if you see the source of javax.xml.ws.Service class, then you'll see that it calls the javax.xml.ws.spi.Provider.createServiceDelegate to create the service delegate. That method calls some other method and that some other and finally the control reaches to the invoke method of MethodBindingMethodExpressionAdapter class whose invoke method wraps the IOException to EvaluationException as can be seen from this excerpt of the invoke method

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic