felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r1184903 - /felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java
Date Sun, 16 Oct 2011 19:20:39 GMT
Author: mcculls
Date: Sun Oct 16 19:20:39 2011
New Revision: 1184903

URL: http://svn.apache.org/viewvc?rev=1184903&view=rev
Log:
FELIX-3031: handle local snapshot vs remote timestamp in Maven3 when deploying to a remote
OBR

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=1184903&r1=1184902&r2=1184903&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:20:39 2011
@@ -27,6 +27,7 @@ import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.net.URI;
+import java.util.regex.Pattern;
 
 import org.apache.felix.bundlerepository.Resource;
 import org.apache.felix.bundlerepository.impl.DataModelHelperImpl;
@@ -48,6 +49,8 @@ import org.xmlpull.v1.XmlPullParser;
  */
 public class ObrUpdate
 {
+    private Pattern TIMESTAMP = Pattern.compile( "-[0-9]{8}\\.[0-9]{6}-[0-9]+" );
+
     /**
      * logger for this plugin.
      */
@@ -135,6 +138,7 @@ public class ObrUpdate
         m_logger.debug( " (f) repositoryXml = " + m_repositoryXml );
         m_logger.debug( " (f) bundleJar = " + bundleJar );
         m_logger.debug( " (f) sourceJar = " + sourceJar );
+        m_logger.debug( " (f) docJar = " + docJar );
         m_logger.debug( " (f) obrXml = " + m_obrXml );
 
         if ( m_repository == null )
@@ -144,6 +148,11 @@ public class ObrUpdate
 
         // get the file size
         File bundleFile = new File( bundleJar );
+        if ( !bundleFile.exists() )
+        {
+            String snapshot = TIMESTAMP.matcher( bundleFile.getName() ).replaceFirst( "-SNAPSHOT"
);
+            bundleFile = new File( bundleFile.getParentFile(), snapshot );
+        }
         if ( bundleFile.exists() )
         {
             URI resourceURI = m_userConfig.getRemoteBundle();
@@ -167,7 +176,7 @@ public class ObrUpdate
 
             try
             {
-                m_resourceBundle = ( ResourceImpl ) new DataModelHelperImpl().createResource(
bundleJar.toURL() );
+                m_resourceBundle = ( ResourceImpl ) new DataModelHelperImpl().createResource(
bundleFile.toURL() );
                 if ( m_resourceBundle == null )
                 {
                     return;



Mime
View raw message