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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7d47b98181 CustomIndexerImpl should handle broken property files a bit 
better.
     new 54e17afd7f Merge pull request #6945 from 
mbien/fix-custom-indexer-prop-loading
7d47b98181 is described below

commit 7d47b98181176b433d3c47fa7906614a8253039a
Author: Michael Bien <[email protected]>
AuthorDate: Thu Jan 11 06:17:33 2024 +0100

    CustomIndexerImpl should handle broken property files a bit better.
    
     - catch IAE which is thrown when illegal characters are read
     - log the event properly, the logic is resetting the properties file
       already, so there would be just one warning logged per corrupted
       properties file
---
 .../netbeans/modules/lsp/client/bindings/CustomIndexerImpl.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CustomIndexerImpl.java
 
b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CustomIndexerImpl.java
index 7834f26b6d..c46c3d4095 100644
--- 
a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CustomIndexerImpl.java
+++ 
b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CustomIndexerImpl.java
@@ -26,6 +26,8 @@ import java.util.HashSet;
 import java.util.Properties;
 import java.util.Set;
 import java.util.function.Consumer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.netbeans.api.editor.mimelookup.MimeRegistration;
 import org.netbeans.api.project.FileOwnerQuery;
 import org.netbeans.api.project.Project;
@@ -80,9 +82,9 @@ public class CustomIndexerImpl extends CustomIndexer {
 
         if (index != null) {
             try (InputStream in = index.getInputStream()) {
-                props.load(in);
-            } catch (IOException ex) {
-                //ignore...
+                props.load(in); // can throw IAE when illegal characters are 
read
+            } catch (IOException | IllegalArgumentException ex) {
+                
Logger.getLogger(CustomIndexerImpl.class.getName()).log(Level.WARNING, "can not 
load '"+FileUtil.toFile(index)+"', resetting", ex);
             }
         }
 


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