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

svn commit: r1184914 - /felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java

Author: mcculls
Date: Sun Oct 16 19:56:22 2011
New Revision: 1184914

URL: http://svn.apache.org/viewvc?rev=1184914&view=rev
Log:
Reset repository URI after loading temporary content, otherwise it can return incorrect absolute URIs

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java?rev=1184914&r1=1184913&r2=1184914&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java Sun Oct 16 19:56:22 2011
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.lang.reflect.Method;
 import java.net.URI;
 import java.util.regex.Pattern;
 
@@ -49,7 +50,22 @@ import org.xmlpull.v1.XmlPullParser;
  */
 public class ObrUpdate
 {
-    private Pattern TIMESTAMP = Pattern.compile( "-[0-9]{8}\\.[0-9]{6}-[0-9]+" );
+    private static Pattern TIMESTAMP = Pattern.compile( "-[0-9]{8}\\.[0-9]{6}-[0-9]+" );
+
+    private static Method setURI;
+
+    static
+    {
+        try
+        {
+            setURI = RepositoryImpl.class.getDeclaredMethod( "setURI", String.class );
+            setURI.setAccessible( true );
+        }
+        catch ( Exception e )
+        {
+            setURI = null;
+        }
+    }
 
     /**
      * logger for this plugin.
@@ -298,6 +314,10 @@ public class ObrUpdate
             try
             {
                 m_repository = ( RepositoryImpl ) new DataModelHelperImpl().repository( m_repositoryXml.toURL() );
+                if ( setURI != null )
+                {
+                    setURI.invoke( m_repository, ( String ) null );
+                }
             }
             catch ( Exception e )
             {