You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ga...@apache.org on 2010/01/29 07:37:16 UTC

svn commit: r904391 - in /incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web: converter/impl/WarToWabConverterImpl.java url/WARConnection.java

Author: gawor
Date: Fri Jan 29 06:37:15 2010
New Revision: 904391

URL: http://svn.apache.org/viewvc?rev=904391&view=rev
Log:
minor fixes and improvments

Modified:
    incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterImpl.java
    incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WARConnection.java

Modified: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterImpl.java?rev=904391&r1=904390&r2=904391&view=diff
==============================================================================
--- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterImpl.java (original)
+++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterImpl.java Fri Jan 29 06:37:15 2010
@@ -71,7 +71,6 @@
   private boolean converted = false;
 
   // State used for updating the manifest
-  private ArrayList<String> fileNames;
   private Set<String> importPackages;
   private Set<String> exemptPackages;
   private Map<String, Manifest> manifests; 
@@ -79,7 +78,6 @@
 
   public WarToWabConverterImpl(InputStreamProvider warFile, String name, Properties properties) throws IOException {
     this.properties = properties;
-    fileNames = new ArrayList<String>();
     classPath = new ArrayList<String>();
     importPackages = new HashSet<String>();
     exemptPackages = new HashSet<String>();
@@ -97,8 +95,8 @@
       scanForDependencies(jarInput);
 
       // Add the new properties to the manifest byte stream
-      wabManifest = jarInput.getManifest();
-      wabManifest = updateManifest(wabManifest);
+      Manifest manifest = jarInput.getManifest();
+      wabManifest = updateManifest(manifest);
     } 
     finally {
       try { if (jarInput != null) jarInput.close(); } catch (IOException e) { e.printStackTrace(); }
@@ -136,7 +134,6 @@
     ZipEntry entry;
     
     while ((entry = jarInput.getNextEntry()) != null) {
-      fileNames.add(entry.getName());
       if (entry.getName().endsWith(".class")) {
         PackageFinder pkgFinder = new PackageFinder();
         new ClassReader(jarInput).accept(pkgFinder, ClassReader.SKIP_DEBUG);
@@ -182,7 +179,7 @@
     // Process manifests from jars in order to work out classpath dependencies
     ClassPathBuilder classPathBuilder = new ClassPathBuilder(manifests);
     for (String fileName : manifests.keySet())
-      if (fileName.startsWith("WEB-INF/lib")) {
+      if (fileName.startsWith(CLASSPATH_LIB_PREFIX)) {
         classPath.add(fileName);
         classPath = classPathBuilder.updatePath(fileName, classPath);
       }
@@ -244,10 +241,6 @@
     // Add any files from the WEB-INF/lib directory + their dependencies
     classpath.addAll(classPath);
     
-    for (String s : fileNames)
-      if (s.startsWith(CLASSPATH_LIB_PREFIX) && !classpath.contains(s))
-        classpath.add(s);
-
     // Get the list from the URL and add to classpath (removing duplicates)
     mergePathList(properties.getProperty(Constants.BUNDLE_CLASSPATH),
         classpath, ",");
@@ -338,9 +331,9 @@
     // Web-ContextPath
     //
 
-    String webCPath = manifest.getMainAttributes().getValue(WEB_CONTEXT_PATH);
+    String webCPath = properties.getProperty(WEB_CONTEXT_PATH);
     if (webCPath == null) {
-        webCPath = properties.getProperty(WEB_CONTEXT_PATH);
+        webCPath = manifest.getMainAttributes().getValue(WEB_CONTEXT_PATH);
     }
     if (webCPath == null) {
         properties.put(WEB_CONTEXT_PATH, DEFAULT_WEB_CONTEXT_PATH);

Modified: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WARConnection.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WARConnection.java?rev=904391&r1=904390&r2=904391&view=diff
==============================================================================
--- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WARConnection.java (original)
+++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WARConnection.java Fri Jan 29 06:37:15 2010
@@ -41,9 +41,10 @@
     
     // Validate properties
     
-    String bundleManifestVersion = (String)properties.get(Constants.BUNDLE_VERSION);
-    if (bundleManifestVersion != null && !bundleManifestVersion.equals("2"))
-      throw new MalformedURLException("Incorrect bundle version supplied in URL : "+bundleManifestVersion);
+    String bundleManifestVersion = (String) properties.get(Constants.BUNDLE_MANIFESTVERSION);
+    if (bundleManifestVersion != null && !bundleManifestVersion.equals("2")) {
+      throw new MalformedURLException("Incorrect bundle version supplied in URL : " + bundleManifestVersion);
+    }
     
   }