incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahrw...@apache.org
Subject svn commit: r898272 - /incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WarToWabConverter.java
Date Tue, 12 Jan 2010 10:16:13 GMT
Author: mahrwald
Date: Tue Jan 12 10:16:12 2010
New Revision: 898272

URL: http://svn.apache.org/viewvc?rev=898272&view=rev
Log:
ARIES-114 Merge UrlHandlerTest into existing tests in trunk

Modified:
    incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WarToWabConverter.java

Modified: incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WarToWabConverter.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WarToWabConverter.java?rev=898272&r1=898271&r2=898272&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WarToWabConverter.java
(original)
+++ incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WarToWabConverter.java
Tue Jan 12 10:16:12 2010
@@ -67,6 +67,7 @@
 
   // InputStream for the new WAB file
   private byte[] wabFile;
+  private Manifest wabManifest;
   private String warName;
   
   private boolean converted = false;
@@ -95,14 +96,13 @@
     ZipEntry entry;
     JarInputStream jarInput = null;
 
-    Manifest manifest;
     try {
       jarInput = new JarInputStream(warFile.open());
       scanForDependencies(jarInput);
 
       // Add the new properties to the manifest byte stream
-      manifest = jarInput.getManifest();
-      manifest = updateManifest(manifest);
+      wabManifest = jarInput.getManifest();
+      wabManifest = updateManifest(wabManifest);
     } 
     finally {
       try { if (jarInput != null) jarInput.close(); } catch (IOException e) { e.printStackTrace();
}
@@ -116,7 +116,7 @@
     // Copy across all entries from the original jar
     int val;
     try {
-      jarOutput = new JarOutputStream(output, manifest);
+      jarOutput = new JarOutputStream(output, wabManifest);
       jarInput = new JarInputStream(warFile.open());
       while ((entry = jarInput.getNextEntry()) != null) {
         jarOutput.putNextEntry(entry);
@@ -254,17 +254,17 @@
 
     // Get the list from the URL and add to classpath (removing duplicates)
     mergePathList(properties.getProperty(Constants.BUNDLE_CLASSPATH),
-        classpath, ";");
+        classpath, ",");
 
     // Get the existing list from the manifest file and add to classpath
     // (removing duplicates)
     mergePathList(manifest.getMainAttributes().getValue(
-        Constants.BUNDLE_CLASSPATH), classpath, ";");
+        Constants.BUNDLE_CLASSPATH), classpath, ",");
 
     // Construct the classpath string and set it into the properties
     StringBuffer classPathValue = new StringBuffer();
     for (String entry : classpath) {
-      classPathValue.append(";");
+      classPathValue.append(",");
       classPathValue.append(entry);
     }
 
@@ -386,21 +386,25 @@
   }
 
   public InputStream getWAB() throws IOException {
-    if (!!!converted) {
-      convert();
-      converted = true;
-    }
-    
+    ensureConverted();
     return new ByteArrayInputStream(wabFile);
   }
+  
+  public Manifest getWABManifest() throws IOException {
+    ensureConverted();
+    return wabManifest;
+  }
 
   public int getWabLength() throws IOException {
+    ensureConverted();
+    return wabFile.length;
+  }
+  
+  private void ensureConverted() throws IOException {
     if (!!!converted) {
       convert();
       converted = true;
     }
-
-    return wabFile.length;
   }
 
 }



Mime
View raw message