GeoTools
  1. GeoTools
  2. GEOT-2967

Access Restriction Exception due to the use of sun.misc.BASE64Encoder

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.7-M0
    • Fix Version/s: 2.6.3, 2.7-M0
    • Component/s: wfs plugin
    • Labels:
      None
    • Environment:
      Win7 64b
      java version "1.6.0_18"
      Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)

      Description

      Exception Stacktrace
      java.lang.Error: Unresolved compilation problems: 
      	Access restriction: The type BASE64Encoder is not accessible due to restriction on required library D:\Java\jdk1.6.0_18\jre\lib\rt.jar
      	Access restriction: The type BASE64Encoder is not accessible due to restriction on required library D:\Java\jdk1.6.0_18\jre\lib\rt.jar
      	Access restriction: The constructor BASE64Encoder() is not accessible due to restriction on required library D:\Java\jdk1.6.0_18\jre\lib\rt.jar
      	Access restriction: The type BASE64Encoder is not accessible due to restriction on required library D:\Java\jdk1.6.0_18\jre\lib\rt.jar
      	Access restriction: The method encode(byte[]) from the type CharacterEncoder is not accessible due to restriction on required library D:\Java\jdk1.6.0_18\jre\lib\rt.jar
      
      	at org.geotools.data.wfs.protocol.http.SimpleHttpProtocol.<init>(SimpleHttpProtocol.java:28)
      	at org.geotools.data.wfs.WFSDataStoreFactory.createDataStore(WFSDataStoreFactory.java:342)
      

      This one is caused by the use of sun.misc.BASE64Encoder. Using sun.* packages is considered being bad practice. Those classes are meant for JVM internal use only. Other vendors may not include them in theirs JVM.

      I've replaced it with a org.apache.commons.codec.binary.Base64 which should provide same functionality.

      SimpleHttpProtocol.patch is created by Eclipse (Team -> Create Patch).
      SimpleHttpProtocol.java is modified file.

      I'm not sure which one to attach.

      1. SimpleHttpProtocol.java
        5 kB
        Zdenek Farana
      2. SimpleHttpProtocol.patch
        1 kB
        Zdenek Farana

        Activity

        Hide
        Jody Garnett added a comment -
        2.6.x as of -r35067
        trunk as of -r35068
        Show
        Jody Garnett added a comment - 2.6.x as of -r35067 trunk as of -r35068

          People

          • Assignee:
            Jody Garnett
            Reporter:
            Zdenek Farana
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: