This is an automated email from the ASF dual-hosted git repository.

neilcsmith pushed a commit to branch delivery
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/delivery by this push:
     new 97438e5b35 Fix option import regression
     new 49b653966b Merge pull request #6220 from 
mbien/fix-option-import_delivery
97438e5b35 is described below

commit 97438e5b355ba6113cce48c49a1efbea3f94975d
Author: Michael Bien <mbie...@gmail.com>
AuthorDate: Tue Jul 18 17:00:13 2023 +0200

    Fix option import regression
    
    there was a bug in the boolean logic of checkIntegrity()
---
 .../org/netbeans/modules/options/export/OptionsExportModel.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/platform/options.api/src/org/netbeans/modules/options/export/OptionsExportModel.java
 
b/platform/options.api/src/org/netbeans/modules/options/export/OptionsExportModel.java
index 7a48551aa5..f440ed0577 100644
--- 
a/platform/options.api/src/org/netbeans/modules/options/export/OptionsExportModel.java
+++ 
b/platform/options.api/src/org/netbeans/modules/options/export/OptionsExportModel.java
@@ -746,23 +746,24 @@ public final class OptionsExportModel {
             Enumeration<? extends ZipEntry> entries = zipFile.entries();
             while (entries.hasMoreElements()) {
                 ZipEntry zipEntry = entries.nextElement();
-                if (!zipEntry.isDirectory() && !checkIntegrity(zipEntry)) {
+                if (!zipEntry.isDirectory() && checkIntegrity(zipEntry)) {
                     copyFile(zipEntry.getName());
                 }
             }
         }
     }
 
+    // true if ok
     private boolean checkIntegrity(ZipEntry entry) throws IOException {
         if (entry.getName().endsWith(".properties")) {
             try (ZipFile zip = new ZipFile(source);
                  BufferedReader reader = new BufferedReader(new 
InputStreamReader(zip.getInputStream(entry), StandardCharsets.UTF_8))) {
                 // invalid code point check JDK-8075156
-                boolean corrupted = reader.lines().anyMatch(l -> 
l.indexOf('\u0000') != -1);
-                if (corrupted) {
+                boolean ok = reader.lines().noneMatch(l -> l.indexOf('\u0000') 
!= -1);
+                if (!ok) {
                     LOGGER.log(Level.WARNING, "ignoring corrupted properties 
file at {0}", entry.getName());
                 }
-                return corrupted;
+                return ok;
             }
         }
         return true;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

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

Reply via email to