Reset repository URI after loading temporary content, otherwise it can return incorrect absolute URIs
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1184914 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java
index c77699d..ab32a94 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java
@@ -26,6 +26,7 @@
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 @@
*/
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 @@
try
{
m_repository = ( RepositoryImpl ) new DataModelHelperImpl().repository( m_repositoryXml.toURL() );
+ if ( setURI != null )
+ {
+ setURI.invoke( m_repository, ( String ) null );
+ }
}
catch ( Exception e )
{