File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Https url connection ArrayIndeoutofBounds Exception java

 
krish dutt
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic