[jboss-cvs] JBossAS SVN: r80926 - in projects/vfs/trunk/src: main/java/org/jboss/virtual/plugins/context/helpers and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 13 06:42:58 EST 2008


Author: alesj
Date: 2008-11-13 06:42:58 -0500 (Thu, 13 Nov 2008)
New Revision: 80926

Added:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/helpers/
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/helpers/NamesExceptionHandler.java
Removed:
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/NameExceptionHandler.java
Modified:
   projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ExceptionHandlerTestCase.java
Log:
[JBVFS-80]; add names Eh.

Added: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/helpers/NamesExceptionHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/helpers/NamesExceptionHandler.java	                        (rev 0)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/helpers/NamesExceptionHandler.java	2008-11-13 11:42:58 UTC (rev 80926)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.virtual.plugins.context.helpers;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.virtual.plugins.context.AbstractExceptionHandler;
+
+/**
+ * Match names to ignore the exception.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class NamesExceptionHandler extends AbstractExceptionHandler
+{
+   private Set<String> names;
+
+   public NamesExceptionHandler(String name)
+   {
+      this(Collections.singleton(name));
+   }
+
+   public NamesExceptionHandler(Set<String> names)
+   {
+      if (names == null)
+         throw new IllegalArgumentException("Null names");
+
+      this.names = names;
+   }
+
+   @Override
+   public void handleZipEntriesInitException(Exception e, String zipName)
+   {
+      for (String name : names)
+      {
+         if (zipName.contains(name))
+         {
+            log.debug("Exception while reading " + zipName, e);
+            return;
+         }
+      }
+
+      super.handleZipEntriesInitException(e, zipName);
+   }
+}

Deleted: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/NameExceptionHandler.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/NameExceptionHandler.java	2008-11-13 11:31:54 UTC (rev 80925)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/NameExceptionHandler.java	2008-11-13 11:42:58 UTC (rev 80926)
@@ -1,46 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.virtual.support;
-
-import org.jboss.virtual.plugins.context.AbstractExceptionHandler;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class NameExceptionHandler extends AbstractExceptionHandler
-{
-   private String name;
-
-   public NameExceptionHandler(String name)
-   {
-      this.name = name;
-   }
-
-   @Override
-   public void handleZipEntriesInitException(Exception e, String name)
-   {
-      if (name.contains(this.name) == false)
-         super.handleZipEntriesInitException(e, name);
-      else
-         log.warn("Exception while initializing zip: " + name, e);
-   }
-}

Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ExceptionHandlerTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ExceptionHandlerTestCase.java	2008-11-13 11:31:54 UTC (rev 80925)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/ExceptionHandlerTestCase.java	2008-11-13 11:42:58 UTC (rev 80926)
@@ -27,7 +27,7 @@
 import junit.framework.Test;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.test.virtual.support.NameExceptionHandler;
+import org.jboss.virtual.plugins.context.helpers.NamesExceptionHandler;
 
 /**
  * ExceptionHandlerTestCase.
@@ -50,7 +50,7 @@
    {
       URL url = getResource("/vfs/test");
       VFS vfs = VFS.getVFS(url);
-      vfs.setExceptionHandler(new NameExceptionHandler("_sqljdbc.jar"));
+      vfs.setExceptionHandler(new NamesExceptionHandler("_sqljdbc.jar"));
       VirtualFile root = vfs.getRoot();
       VirtualFile zipeinit = root.findChild("zipeinit.jar");
       VirtualFile child = zipeinit.findChild("sqljdbc.jar");




More information about the jboss-cvs-commits mailing list