0

I'm documenting something I can only qualify as a bug in the debug values of javax.net.ssl.HttpsURLConnection instances.

I created a Java EE project in Eclipse, another in Netbeans, and in both cases wrote a simple method which when called will execute the following code:

URL url = new URL(sHttpsEndpoint);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();

conn.setRequestMethod("POST");
System.out.println("Value for request method is: " + conn.getRequestMethod());

conn.setDoOutput(true);
System.out.println("Value for doOutput is : " + conn.getDoOutput());

My issue arises when I try to inspect the HttpsURLConnection instance I created.

  • In Eclipse, I double click conn and then right click - Inspect.
  • In Netbeans, I hover over conn while debugging.

It seems the data provided when I inspect the class instance is the class' default data, not the real data.

In both cases, if I log the data using System.out.println or watch it, the class' actual data is provided.

Please see the screenshots below.

enter image description here Eclipse

enter image description here Netbeans

Based on my research on SO and the web in general, it seems others have in fact found buggy behaviour inside this class. In addition, the Java bugs database has several bugs reported for this class. However, I haven't managed to find this particular issue reported anywhere yet.

How can this be explained? Can someone think of any other explanation for this behaviour?

  • Java version: 1.7
  • Eclipse version: Luna
  • Netbeans version: 8.1
  • OS: Windows 10
Chris Neve
  • 2,164
  • 2
  • 20
  • 33

0 Answers0