mbien opened a new pull request, #6094:
URL: https://github.com/apache/netbeans/pull/6094

   The code point '\u0000' breaks the Preferences storage as demonstrated in 
https://bugs.openjdk.org/browse/JDK-8068373, as preventive measure it can't be 
used in keys since https://bugs.openjdk.org/browse/JDK-8084823.
   
   There are many reports of windows users running into seemingly unrelated 
issues, but closer investigation showed that they all had at some point 
"invalid code point" exceptions in the log.
   
   this usually happens in a code pattern like this:
   ```java
   for (String k : pref.keys()) { // contains an invalid key
       ... = pref.get(key, null);  // throws IAE
   }
   ```
   It is not clear what causes the corruption, this PR adds some defensive code 
to cover some common cases and makes sure no corrupted properties files are 
imported from old configs on first launch.
   
   the jackpot rule:
   ```java
   $pref.keys() :: $pref instanceof java.util.prefs.Preferences;;
   ```
   had 70 hits - this PR covers only common cases + adds the import filter.
   
   ```
   org.apache.tools.ant.module.bridge.impl.BridgeImpl$PostRun
   java.lang.IllegalArgumentException: Key contains code point U+0000
        at 
java.prefs/java.util.prefs.AbstractPreferences.get(AbstractPreferences.java:296)
        at 
org.apache.tools.ant.module.api.IntrospectedInfo$3.load(IntrospectedInfo.java:681)
        at 
org.apache.tools.ant.module.AntSettings.getCustomDefs(AntSettings.java:119)
        at 
org.apache.tools.ant.module.bridge.impl.BridgeImpl$PostRun.run(BridgeImpl.java:443)
        at 
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
        at 
org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
        at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
   ```
   ```
   java.lang.IllegalArgumentException: Key contains code point U+0000
          at 
java.util.prefs.AbstractPreferences.get(AbstractPreferences.java:296)
          at 
java.util.prefs.AbstractPreferences.getBoolean(AbstractPreferences.java:531)
          at 
org.netbeans.core.windows.TopComponentTracker.load(TopComponentTracker.java:99)
          at 
org.netbeans.core.windows.PersistenceHandler.load(PersistenceHandler.java:126)
          at 
org.netbeans.core.windows.WindowSystemImpl.load(WindowSystemImpl.java:81)
          at org.netbeans.core.GuiRunLevel$InitWinSys.run(GuiRunLevel.java:229)
   ```
   ```
   java.lang.IllegalArgumentException: Key contains code point U+0000
         at 
java.prefs/java.util.prefs.AbstractPreferences.get(AbstractPreferences.java:296)
         at 
org.netbeans.modules.maven.queries.MavenFileOwnerQueryImpl.registerCoordinates(MavenFileOwnerQueryImpl.java:153)
         at 
org.netbeans.modules.maven.ProjectOpenedHookImpl.registerWithSubmodules(ProjectOpenedHookImpl.java:431)
         at 
org.netbeans.modules.maven.ProjectOpenedHookImpl.projectOpened(ProjectOpenedHookImpl.java:138)
         at 
org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectOpened(ProjectOpenedHook.java:60)
     [catch] at 
org.netbeans.modules.project.ui.OpenProjectList.notifyOpened(OpenProjectList.java:1273)
         at 
org.netbeans.modules.project.ui.OpenProjectList.doOpenProject(OpenProjectList.java:1354)
         at 
org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:798)
         at 
org.netbeans.modules.project.ui.OpenProjectList$6.run(OpenProjectList.java:650)
         at 
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
         at 
org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
         at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
         at 
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
   ```
   
   
   closes #6076
   closes #5147
   closes #5633
   closes #5634
   https://bz.apache.org/netbeans/show_bug.cgi?id=271652
   https://issues.apache.org/jira/browse/NETBEANS-3284


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to