incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahrw...@apache.org
Subject svn commit: r911511 - in /incubator/aries/trunk/application/application-converters: pom.xml src/main/java/org/apache/aries/application/converters/WabConverterService.java
Date Thu, 18 Feb 2010 18:28:49 GMT
Author: mahrwald
Date: Thu Feb 18 18:28:49 2010
New Revision: 911511

URL: http://svn.apache.org/viewvc?rev=911511&view=rev
Log:
ARIES-115 Log conversion exception and don't try to convert things that are not wars

Modified:
    incubator/aries/trunk/application/application-converters/pom.xml
    incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java

Modified: incubator/aries/trunk/application/application-converters/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-converters/pom.xml?rev=911511&r1=911510&r2=911511&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-converters/pom.xml (original)
+++ incubator/aries/trunk/application/application-converters/pom.xml Thu Feb 18 18:28:49 2010
@@ -57,6 +57,10 @@
             <artifactId>org.apache.aries.web.urlhandler</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

Modified: incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java?rev=911511&r1=911510&r2=911511&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java
(original)
+++ incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java
Thu Feb 18 18:28:49 2010
@@ -27,29 +27,37 @@
 import org.apache.aries.application.management.BundleConverter;
 import org.apache.aries.web.converter.WarToWabConverter;
 import org.apache.aries.web.converter.WarToWabConverter.InputStreamProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class WabConverterService implements BundleConverter {
-  private WarToWabConverter wabConverter;
-  
-  public WarToWabConverter getWabConverter() {
-    return wabConverter;
-  }
+    private static final String WAR_FILE_EXTENSION = ".war";
+    private static final Logger LOGGER = LoggerFactory.getLogger(WabConverterService.class);
+    
+    private WarToWabConverter wabConverter;
 
-  public void setWabConverter(WarToWabConverter wabConverter) {
-    this.wabConverter = wabConverter;
-  }
+    public WarToWabConverter getWabConverter() {
+        return wabConverter;
+    }
 
-  public InputStream convert(IDirectory parentEba, final IFile toBeConverted) {
-    try {
-      return wabConverter.convert(new InputStreamProvider() {
-        public InputStream getInputStream() throws IOException {
-          return toBeConverted.open();
-        }
-      }, toBeConverted.getName(), new Properties());
-    } catch (IOException e) {
-      // TODO what to do with the Exception
-      return null;
+    public void setWabConverter(WarToWabConverter wabConverter) {
+        this.wabConverter = wabConverter;
     }
-  }
 
+    public InputStream convert(IDirectory parentEba, final IFile toBeConverted) {
+        if (toBeConverted.getName().endsWith(WAR_FILE_EXTENSION)) {
+            try {
+                return wabConverter.convert(new InputStreamProvider() {
+                    public InputStream getInputStream() throws IOException {
+                        return toBeConverted.open();
+                    }
+                }, toBeConverted.getName(), new Properties());
+            } catch (IOException e) {
+                LOGGER.error("Encountered an exception while converting " + toBeConverted.getName()

+                        + " in " + parentEba.getName(), e);
+            }
+        }
+
+        return null;
+    }
 }



Mime
View raw message