portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddew...@apache.org
Subject svn commit: r224626 - /portals/pluto/branches/pluto-1.1/container/src/java/org/apache/pluto/util/ArgumentUtility.java
Date Sun, 24 Jul 2005 15:27:28 GMT
Author: ddewolf
Date: Sun Jul 24 08:27:25 2005
New Revision: 224626

URL: http://svn.apache.org/viewcvs?rev=224626&view=rev
Log: (empty)

Added:
    portals/pluto/branches/pluto-1.1/container/src/java/org/apache/pluto/util/ArgumentUtility.java

Added: portals/pluto/branches/pluto-1.1/container/src/java/org/apache/pluto/util/ArgumentUtility.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/container/src/java/org/apache/pluto/util/ArgumentUtility.java?rev=224626&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/container/src/java/org/apache/pluto/util/ArgumentUtility.java
(added)
+++ portals/pluto/branches/pluto-1.1/container/src/java/org/apache/pluto/util/ArgumentUtility.java
Sun Jul 24 08:27:25 2005
@@ -0,0 +1,36 @@
+package org.apache.pluto.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Created by IntelliJ IDEA. User: David Date: Jun 3, 2005 Time: 9:26:17 PM To
+ * change this template use File | Settings | File Templates.
+ */
+public class ArgumentUtility {
+
+    public static final Log LOG = LogFactory.getLog(ArgumentUtility.class);
+
+    public static void validateNotNull(String argumentName, Object argument)
+    throws IllegalArgumentException {
+        if(argument == null) {
+            IllegalArgumentException exception =
+                new IllegalArgumentException("Illegal Argument: "+argumentName+". Argument
may not be null.");
+            if(LOG.isInfoEnabled()) {
+                LOG.info("Validation Error for argument: "+argumentName+". Argument may not
be null.", exception);
+            }
+            throw exception;
+        }
+    }
+
+    public static void validateNotEmpty(String argumentName, String argument) {
+        if(argument == null || "".equals(argument)) {
+            IllegalArgumentException exception =
+                new IllegalArgumentException("Illegal Argument: "+argumentName+". Argument
may not be null or empty.");
+            if(LOG.isInfoEnabled()) {
+                LOG.info("Validation Error for argument: "+argumentName+". Argument may not
be null or empty.", exception);
+            }
+            throw exception;
+        }
+    }
+}



Mime
View raw message