jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes Https url connection ArrayIndeoutofBounds Exception java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Https url connection ArrayIndeoutofBounds Exception java" Watch "Https url connection ArrayIndeoutofBounds Exception java" New topic
Author

Https url connection ArrayIndeoutofBounds Exception java

krish dutt
Greenhorn

Joined: Feb 23, 2012
Posts: 5

run my code it throws below exception :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at sun.net.www.protocol.http.NTLMAuthentication.buildType3Msg(NTLMAuthentication.java:368)
at sun.net.www.protocol.http.NTLMAuthentication.setHeaders(NTLMAuthentication.java:225)
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:1557)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1139)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at ReadHttpsURL1.main(ReadHttpsURL1.java:29)
Brian Burress
Ranch Hand

Joined: Jun 30, 2003
Posts: 122
I tried pulling the code into my environment, but all of the classes do not resolve. In lieu of trying this out myself, I'll ask if the following code:




to something like this as it looks to me like you are opening the connection and then setting your request property. I don't know if the lack of the property when the connection is opened may be leading to the exception or not which is occuring later in the code..



krish dutt
Greenhorn

Joined: Feb 23, 2012
Posts: 5
Hi Brian Burress.
Thank you for your reply.I don't create HttpsUrlConnection object directly because it is an abstract class.
Brian Burress
Ranch Hand

Joined: Jun 30, 2003
Posts: 122
Krish,

My apologies, that's what I get for doing a quick read/reply

I have not done much with HTTPS (most of what I have been involved with is the setting the certificates on the server side). Hopefully someone with practical experience with HTTPS will see this and jump in.

In the meantime, have you looked at examples found from a google search? There are a number of examples that aren't exactly what you are doing but have some different properties (Example1) that are being set that you may want to look into to see how they are set up on your environment as well as dumping the certs and such to show you have a good connection (Example2):

Example1

Example2


As a side question, are you able to try making your connection using HTTP first to verify those mechanics work? If you are going through a proxy, I am wondering if you are trying to debug a proxy issue, an HTTPS issue or something else. Looking deeper at the stacktrace this site might be where you want to start as NTLMAuthentication is the class invoking the array copy:

NTLMAuthentication
krish dutt
Greenhorn

Joined: Feb 23, 2012
Posts: 5
Brian,

Thank you for your quick response.I tried those examples but not working for me . It throws same exception .The Proxy settings are only worked for Http protocol.I used Https it throws above exception.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Https url connection ArrayIndeoutofBounds Exception java
 
Similar Threads
having trouble with reading source of secure page
Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Requ
ArrayIndexOutOfBoundsException
Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Requ
Communicating with HTTPS server with Client Authentication