Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6789865
Votes 0
Synopsis Java Plugin isInNet implementation returns incorrect value in some cases
Category java_plugin:misc
Reported Against b12 , n_a
Release Fixed 6u14(b01), 6u12-rev(b06) (Bug ID:2173379)
State 11-Closed, Verified, bug
Priority: 2-High
Related Bugs 6786875
Submit Date 02-JAN-2009
Description
There is a problem in the Java plug-in when using an automatic configuration script (.pac file) to determine the address of an HTTP proxy. This problem is related to bug ID 6338075 (Java Plugin's isInNet implementation should support partial octet subnets).  
  
This bug is fixed in Java 6.0, however there are still some cases in Java 6.0 where the isInNet function returns an incorrect result when using partial octet subnets. 
  
The following implementation of the FindProxyForURL function demonstrates the issue: 
  
 function FindProxyForURL(url,host) { 
 if (isInNet("209.249.1.141", "209.249.112.0", "255.255.240.0" )) { 
      return "PROXY proxyhost1:80"; 
  } else { 
      return "PROXY proxyhost2:80"; 
  } 

When using the above code in the .pac file, the browser will use proxyhost2 as the HTTP proxy to download the html pages (as 209.249.1.141 does not belong to the 209.249.112.0 network considering the 255.255.240.0 mask). The Java plugin however uses proxyhost1 to download the applets. The java implementation of the isInNet function returns in this case true although it should return false. 
  
In the following cases everything works OK (in the first case proxyhost1 is correctly used, in the second case proxyhost2 is correctly used): 
 
 function FindProxyForURL(url,host) { 
 if (isInNet("209.249.113.141", "209.249.112.0", "255.255.240.0" )) { 
      return "PROXY proxyhost1:80"; 
  } else { 
      return "PROXY proxyhost2:80"; 
  } 
 
 function FindProxyForURL(url,host) { 
 if (isInNet("209.249.49.141", "209.249.112.0", "255.255.240.0" )) { 
      return "PROXY proxyhost1:80"; 
  } else { 
      return "PROXY proxyhost2:80"; 
  } 
  
The problems seems to appear only if the AND operation on the mask and ipaddress returns 0. (in the first example above: 240 & 1 = 0, as a result the isInNet function returns the wrong value).
Posted Date : 2009-01-02 23:12:42.0
Work Around
N/A
Evaluation
I did reproduce this bug in JRE 6u12, both new plugin and old plugin, will fix it in 6u14.
Posted Date : 2009-01-09 15:16:57.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang