Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

MalformedURLException in HttpURLConnection.getResponseCode()

Thread view: 
Twisted - 16 Nov 2006 17:35 GMT
As the Subject: says. I'm getting the odd MalformedURLException after
a) successfully constructing a URL, b) successfully obtaining a
URLConnection from it, c) successfully casting this to
HttpURLConnection, d) setting some header fields and actually invoking
connect() on it, and then, with zero exceptions having been thrown thus
far:

int rc = uc.getResponseCode();

throws.

It must be constructing new URLs under the hood. And making mistakes
sometimes.

java.net.MalformedURLException: Illegal character in URL
    at sun.net.www.http.HttpClient.getURLFile(HttpClient.java:537)
    at
sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:345)
    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1002)
    at
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
    at com.sourceforge.sphaera.SThread.spiderURL(SThread.java:344)
    at com.sourceforge.sphaera.SThread.run(SThread.java:169)

Looks like Sun's bug, not mine, unless there's something else users of
java.net should be checking for that I'm not besides the obvious.

It's another strange one.
Daniel Pitts - 16 Nov 2006 22:26 GMT
> As the Subject: says. I'm getting the odd MalformedURLException after
> a) successfully constructing a URL, b) successfully obtaining a
[quoted text clipped - 25 lines]
>
> It's another strange one.

Since you keep running into trouble, I would suggest you use a java 1.5
instead of 1.6.  If you still have trouble, think about what YOU could
do differently. This is the third post of yours where the "library" has
a bug.  With something as widely used as Java, this is highly unlikely.

If you're problem persists in Java 1.5, then it is probably *your* bug.
If it goes away, then it should be reported in Sun's bug database.

Try to create an sscce http://www.physci.org/codes/sscce/ that
recreates the problem.  If you can post that here (or for any of your
other threads), we might be able to help you understand why it isn't
working. Otherwise a blind stacktrace (even with some context) isn't
going to help us help you.

Good luck,
Daniel.
Twisted - 18 Nov 2006 21:58 GMT
> As the Subject: says. I'm getting the odd MalformedURLException after
> a) successfully constructing a URL, b) successfully obtaining a
[quoted text clipped - 25 lines]
>
> It's another strange one.

Does anyone have a useful response to this?

I construct an http URL -- no exception is thrown -- and open a
connection. Attempting to get the response code throws
MalformedURLException. This shouldn't be happening, as near as I can
tell.
Daniel Pitts - 19 Nov 2006 00:37 GMT
> > As the Subject: says. I'm getting the odd MalformedURLException after
> > a) successfully constructing a URL, b) successfully obtaining a
[quoted text clipped - 32 lines]
> MalformedURLException. This shouldn't be happening, as near as I can
> tell.

Please give us a short example that recreates the problem. Otherwise we
are operating blindly.
Twisted - 19 Nov 2006 07:54 GMT
> Please give us a short example that recreates the problem. Otherwise we
> are operating blindly.

It's not reproducible except statistically, with enough random
browsing. There may be "magic" sites that set it off reliably; I don't
know. But it (and the priorityqueue npe) seem to be POM-dependent. If
you use it a lot, it will explode in your face sooner or later, but if
you just test it once it will probably behave itself.

Surely you've seen that kind of behavior before, if you've any
experience in the field of computer programming?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.