Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

URLConnection.getInputStream compatibility issue between jdk 1.1.8 and jdk 1.3?

3 views
Skip to first unread message

Alfio Astanti

unread,
Dec 20, 2000, 2:55:53 PM12/20/00
to
Hello all,

I have encountered the following problem while fixing a chat applet that
is used by a mailinglist server: recompiling and running the applet
through the appletviewer with jdk 1.1.8 works fine, but if I try with
jdk 1.3 the method URLConnection.getInputStream raises an IOException.

*******************CUT HERE 1*******************
java.net.ConnectException: Connection refused: no further information
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:312)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
at java.net.Socket.<init>(Socket.java:273)
at java.net.Socket.<init>(Socket.java:100)
at sun.net.NetworkClient.doConnect(NetworkClient.java:50)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:331)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:517)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:277)
at sun.net.www.http.HttpClient.New(HttpClient.java:289)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:379)

at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:472)

at Session.run(Session.java:34)
*******************CUT HERE 1*******************

The whole story is that I have extended the applet because I am not
satisfied by the provided behaviour (ie: no way to log the chat because
is rendered as an image), so I have downloaded and jad-ed the original
class files, added the desired behaviour and it works fine through the
appletviewer under jdk 1.1.8.
I have decided to check if it works also under jdk 1.3 so I have
recompiled everything, produced a policy file with policytool to give it
the right permissions (btw: any better idea than that?) and surprisingly
found the above exception. I have searched the documentation and the web
with no useful hints. Do you have any ideas?

This is the code that produces the exception (see ^^^^).

*******************CUT HERE 2*******************
public class Session extends Thread
{
[...]

public void run()
{
try
{
downstreamURL = new URL(sessionMgr.chatClient.serverURL +
"chat/new_session");
}
catch(MalformedURLException e)
{
sessionMgr.connectFailed();
return;
}
try
{
URLConnection conn = downstreamURL.openConnection();
conn.setUseCaches(false);
conn.setRequestProperty("Cache-Control", "no-cache");
dis = new DataInputStream(conn.getInputStream());
^^^^^^^^^^^^^^^^^^^^^
}
catch(IOException e)
{
sessionMgr.connectFailed();
return;
}
[...]
}

[...]
}
*******************CUT HERE 2*******************

Thanks!
Alfio

PS: I'm working under NT and behind a proxy, so I also pass parameters
to the JVM using -J-DproxySet=true and so on.

0 new messages