Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6789865

Java Plugin isInNet implementation returns incorrect value in some cases

    XMLWordPrintable

Details

    • b01
    • x86
    • windows, windows_2003, windows_xp
    • Verified

    Backports

      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).

        Attachments

          Issue Links

            Activity

              People

                dgu Dennis Gu (Inactive)
                tstatt Terry Statt (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: