You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2019/03/03 09:32:38 UTC

svn commit: r1854679 - /xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Path.java

Author: centic
Date: Sun Mar  3 09:32:38 2019
New Revision: 1854679

URL: http://svn.apache.org/viewvc?rev=1854679&view=rev
Log:
XMLBEANS-521: Avoid throwing and catching NullPointerException

Modified:
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Path.java

Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Path.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Path.java?rev=1854679&r1=1854678&r2=1854679&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Path.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Path.java Sun Mar  3 09:32:38 2019
@@ -65,23 +65,26 @@ public abstract class Path
     private static boolean _xqrlAvailable = true;
     private static boolean _xqrl2002Available = true;
 
-    private static String _delIntfName;
+    private static final String _delIntfName;
     private static final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
 
     static
     {
         String id = "META-INF/services/org.apache.xmlbeans.impl.store.PathDelegate.SelectPathInterface";
         InputStream in = new DefaultClassLoaderResourceLoader().getResourceAsStream(id);
-        try
-        {
-            BufferedReader br = new BufferedReader(new InputStreamReader(in));
-            _delIntfName = br.readLine().trim();
-            br.close();
-        }
-        catch (Exception e)
-        {
-            _delIntfName = null;
+
+        String name = null;
+        if(in != null) {
+            try {
+                BufferedReader br = new BufferedReader(new InputStreamReader(in));
+                name = br.readLine().trim();
+                br.close();
+            } catch (Exception e) {
+                // set nothing
+            }
         }
+
+        _delIntfName = name;
     }
 
     protected final String _pathKey;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org