You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/10/15 22:59:25 UTC

svn commit: r1183703 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: BundleImpl.java Felix.java

Author: rickhall
Date: Sat Oct 15 20:59:25 2011
New Revision: 1183703

URL: http://svn.apache.org/viewvc?rev=1183703&view=rev
Log:
Apply patch to implement Bundle.getDataFile() and Bundle.compareTo(). (FELIX-3156)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java?rev=1183703&r1=1183702&r2=1183703&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java Sat Oct 15 20:59:25 2011
@@ -1069,12 +1069,14 @@ class BundleImpl implements Bundle, Bund
 
     public File getDataFile(String filename)
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        return getFramework().getDataFile(this, filename);
     }
 
     public int compareTo(Bundle t)
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        long thisBundleId = this.getBundleId();
+        long thatBundleId = t.getBundleId();
+        return (thisBundleId < thatBundleId ? -1 : (thisBundleId == thatBundleId ? 0 : 1));
     }
 
     public String toString()

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1183703&r1=1183702&r2=1183703&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Sat Oct 15 20:59:25 2011
@@ -3434,6 +3434,14 @@ public class Felix extends BundleImpl im
 
     File getDataFile(BundleImpl bundle, String s)
     {
+        if (bundle.getState() == Bundle.UNINSTALLED)
+        {
+            throw new IllegalStateException("Bundle has been uninstalled");
+        }
+        else if (Util.isFragment(adapt(BundleRevision.class)))
+        {
+            return null;
+        }
         try
         {
             if (bundle == this)