jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject jena git commit: JENA-927: Output warning if class name converted (ja:LoadClass).
Date Tue, 12 May 2015 10:48:50 GMT
Repository: jena
Updated Branches:
  refs/heads/master acd46a241 -> c51aa0800


JENA-927: Output warning if class name converted (ja:LoadClass).


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/c51aa080
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/c51aa080
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/c51aa080

Branch: refs/heads/master
Commit: c51aa08005de96cfc8230f6fd43fae51bb30cabd
Parents: acd46a2
Author: Andy Seaborne <andy@apache.org>
Authored: Tue May 12 11:20:49 2015 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Tue May 12 11:48:24 2015 +0100

----------------------------------------------------------------------
 .../apache/jena/assembler/AssemblerHelp.java    | 33 +++++++++++++++-----
 1 file changed, 26 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/c51aa080/jena-core/src/main/java/org/apache/jena/assembler/AssemblerHelp.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/assembler/AssemblerHelp.java b/jena-core/src/main/java/org/apache/jena/assembler/AssemblerHelp.java
index ac5d031..a3ca376 100644
--- a/jena-core/src/main/java/org/apache/jena/assembler/AssemblerHelp.java
+++ b/jena-core/src/main/java/org/apache/jena/assembler/AssemblerHelp.java
@@ -18,15 +18,26 @@
 
 package org.apache.jena.assembler;
 
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.reflect.Constructor ;
+import java.lang.reflect.Method ;
+import java.util.ArrayList ;
+import java.util.HashSet ;
+import java.util.List ;
+import java.util.Set ;
 
 import org.apache.jena.assembler.assemblers.AssemblerGroup ;
-import org.apache.jena.assembler.exceptions.* ;
+import org.apache.jena.assembler.exceptions.AmbiguousSpecificTypeException ;
+import org.apache.jena.atlas.lib.CacheFactory ;
+import org.apache.jena.atlas.lib.CacheSet ;
+import org.apache.jena.atlas.logging.Log ;
 import org.apache.jena.datatypes.xsd.XSDDatatype ;
 import org.apache.jena.rdf.model.* ;
-import org.apache.jena.shared.* ;
-import org.apache.jena.vocabulary.* ;
+import org.apache.jena.shared.BadDescriptionMultipleRootsException ;
+import org.apache.jena.shared.BadDescriptionNoRootException ;
+import org.apache.jena.shared.JenaException ;
+import org.apache.jena.shared.PrefixMapping ;
+import org.apache.jena.vocabulary.RDF ;
+import org.apache.jena.vocabulary.RDFS ;
 
 /**
     AssemblerHelp provides utility methods used by, and useful for working with,
@@ -137,12 +148,20 @@ public class AssemblerHelp
         return loaded;
         }
     
+    /** Small cache to suppress some repeat warnings */ 
+    static CacheSet<String> warningsMap = CacheFactory.createCacheSet(10) ;  
+    
     private static Class<?> loadClassNamedBy( Statement s )
     {
         String x = getString( s ) ;
         // Jena2 -> Jena3 transition 
-        if ( x.startsWith("com.hp.hpl.jena") )
-            x = x.replaceFirst("com.hp.hpl.jena", "org.apache.jena") ;
+        if ( x.startsWith("com.hp.hpl.jena") ) {
+            String x1 = x.replaceFirst("com.hp.hpl.jena", "org.apache.jena") ;
+            if ( ! warningsMap.contains(x) )
+                Log.warn(AssemblerHelp.class, "ja:loadClass: Migration to Jena3: Converting
"+x+" to "+x1) ;
+            warningsMap.add(x);
+            x = x1 ;
+        }
         try { return Class.forName(x); }
         catch (Exception e) { throw new JenaException( e ); }
     }


Mime
View raw message