You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/07/24 17:27:28 UTC
svn commit: r224626 -
/portals/pluto/branches/pluto-1.1/container/src/java/org/apache/pluto/util/ArgumentUtility.java
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;
+ }
+ }
+}