aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1610404 - /aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
Date Mon, 14 Jul 2014 12:48:22 GMT
Author: jbonofre
Date: Mon Jul 14 12:48:22 2014
New Revision: 1610404

URL: http://svn.apache.org/r1610404
Log:
[ARIES-1200] JPA PersistenceBundleManager works with OSGi 4.2 and 4.3

Modified:
    aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java

Modified: aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java?rev=1610404&r1=1610403&r2=1610404&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
(original)
+++ aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
Mon Jul 14 12:48:22 2014
@@ -20,6 +20,8 @@
 package org.apache.aries.jpa.container.impl;
 
 import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -485,7 +487,26 @@ public class PersistenceBundleManager im
     boolean maxExclusive = false;
     
     for(VersionRange range : versionRanges) {
-      int minComparison = minVersion.compareTo(range.getMinimumVersion());
+      int minComparison = 0;
+      try {
+        minComparison = minVersion.compareTo(range.getMinimumVersion());
+      } catch (Exception t) {
+        // this is to catch a NoSuchMethodException that occurs due to a building against
a newer version of OSGi than
+        // the one run with, need to call using Object version of method
+        try {
+          Method m = minVersion.getClass().getMethod("compareTo", Object.class);
+          Object ret = m.invoke(minVersion, range.getMinimumVersion());
+          minComparison = ((Integer) ret).intValue();
+        } catch (NoSuchMethodException e) {
+          throw new RuntimeException("PersistenceBundleManager.combineVersionRanges reflection
compareTo failed",e);
+        } catch (IllegalAccessException e) {
+          throw new RuntimeException("PersistenceBundleManager.combineVersionRanges reflection
compareTo failed",e);
+        } catch (IllegalArgumentException e) {
+          throw new RuntimeException("PersistenceBundleManager.combineVersionRanges reflection
compareTo failed",e);
+        } catch (InvocationTargetException e) {
+          throw new RuntimeException("PersistenceBundleManager.combineVersionRanges reflection
compareTo failed",e);
+        }
+      }
       //If minVersion is smaller then we have a new, larger, minimum
       if(minComparison < 0) {
         minVersion = range.getMinimumVersion();



Mime
View raw message