jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1481374 - /jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/ontology/impl/OntModelImpl.java
Date Sat, 11 May 2013 17:00:53 GMT
Author: andy
Date: Sat May 11 17:00:52 2013
New Revision: 1481374

URL: http://svn.apache.org/r1481374
Log:
JENA-450
Protect setting prefixes against exceptions from read-only graphs.

Modified:
    jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/ontology/impl/OntModelImpl.java

Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/ontology/impl/OntModelImpl.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/ontology/impl/OntModelImpl.java?rev=1481374&r1=1481373&r2=1481374&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/ontology/impl/OntModelImpl.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/ontology/impl/OntModelImpl.java Sat
May 11 17:00:52 2013
@@ -153,11 +153,15 @@ public class OntModelImpl extends ModelC
 
         // set the default prefixes
         if (spec != null && spec.getKnownPrefixes() != null) {
-            String[][] p = spec.getKnownPrefixes();
-            for (int i = 0; i < p.length; i++) {
-                String[] pair = p[i];
-                setNsPrefix( pair[0], pair[1] );
-            }
+            try {
+                // Protect in case the graph is read-only.
+                // Prefixes are hints
+                String[][] p = spec.getKnownPrefixes();
+                for (int i = 0; i < p.length; i++) {
+                    String[] pair = p[i];
+                    setNsPrefix( pair[0], pair[1] );
+                }
+            } catch (Exception ex) {}
         }
 
         // force the inference engine, if we have one, to see the new graph data



Mime
View raw message