You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2006/06/27 21:24:59 UTC

svn commit: r417561 - /cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java

Author: reinhard
Date: Tue Jun 27 12:24:59 2006
New Revision: 417561

URL: http://svn.apache.org/viewvc?rev=417561&view=rev
Log:
fix a problem: if there aren't any libraries, the rewritting algorithm failed

Modified:
    cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java

Modified: cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java?rev=417561&r1=417560&r2=417561&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java (original)
+++ cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java Tue Jun 27 12:24:59 2006
@@ -79,7 +79,9 @@
             while ((str = in.readLine()) != null) {
                 if(inBundleClasspathEntry && str.indexOf(":") > -1) {
                     inBundleClasspathEntry = false;
-                    manifestSb.append(str + "\n");
+                    if(str.length > 0) {
+                        manifestSb.append(str + "\n");
+                    }
                 }
                 else if(str.indexOf(ENTRY_BUNDLE_CLASSPATH) > -1) 
                 {
@@ -110,26 +112,27 @@
      */
     protected String addBundleClasspathEntries(String libdir) 
     {
-        StringBuffer bundleClasspathSb = new StringBuffer();
+        StringBuffer bundleClasspathSb = new StringBuffer(ENTRY_BUNDLE_CLASSPATH);
         int countAddedLibs = 0;                
         for( int i = 0; i < this.deps.length; i++ ) 
         {
-            if( !this.deps[i].isProvided() || !this.deps[i].isReferencedProject() )
+            if( !this.deps[i].isProvided() && !this.deps[i].isReferencedProject() )
             {
                 if( countAddedLibs != 0 )
                 {
                     // TODO problems with line endings might appear
                     bundleClasspathSb.append(",\n");
                 }
+                System.out.println("artifact: " + this.deps[i].getArtifactId());
                 bundleClasspathSb.append(" " + libdir + "/" + this.deps[i].getFile().getName() + "");
                 countAddedLibs++;
             }
         }        
         // only insert the name of the property if there are local libraries
-        if( bundleClasspathSb.length() > 0 ) {             
-            bundleClasspathSb.insert(0, ENTRY_BUNDLE_CLASSPATH);
+        if( countAddedLibs > 0 ) {             
+            return bundleClasspathSb.toString();
         }
-        return bundleClasspathSb.toString();
+        return "";
     }
     
-}
+}
\ No newline at end of file