Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

IOException thrown where not declared?  RSS feed

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • 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: 21689
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 9643
42
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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

 
What's gotten into you? Could it be this tiny ad?
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!