You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/08/01 00:38:01 UTC
svn commit: r427351 -
/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/deployment/DescriptorFactory.java
Author: gnodet
Date: Mon Jul 31 15:38:01 2006
New Revision: 427351
URL: http://svn.apache.org/viewvc?rev=427351&view=rev
Log:
Avoid unneeded dependency on commons-lang
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/deployment/DescriptorFactory.java
Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/deployment/DescriptorFactory.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/deployment/DescriptorFactory.java?rev=427351&r1=427350&r2=427351&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/deployment/DescriptorFactory.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/deployment/DescriptorFactory.java Mon Jul 31 15:38:01 2006
@@ -26,7 +26,6 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.config.spring.XBeanProcessor;
@@ -132,7 +131,7 @@
if (component.getIdentification() == null) {
violations.add("The component has not identification");
} else {
- if (StringUtils.isBlank(component.getIdentification().getName())) {
+ if (isBlank(component.getIdentification().getName())) {
violations.add("The component name is not set");
}
}
@@ -157,7 +156,7 @@
if (serviceAssembly.getIdentification() == null) {
violations.add("The service assembly has not identification");
} else {
- if (StringUtils.isBlank(serviceAssembly.getIdentification().getName())) {
+ if (isBlank(serviceAssembly.getIdentification().getName())) {
violations.add("The service assembly name is not set");
}
}
@@ -190,7 +189,7 @@
if (sharedLibrary.getIdentification() == null) {
violations.add("The shared library has not identification");
} else {
- if (StringUtils.isBlank(sharedLibrary.getIdentification().getName())) {
+ if (isBlank(sharedLibrary.getIdentification().getName())) {
violations.add("The shared library name is not set");
}
}
@@ -218,6 +217,35 @@
}
}
return null;
+ }
+
+ /**
+ * <p>Checks if a String is whitespace, empty ("") or null.</p>
+ *
+ * <pre>
+ * StringUtils.isBlank(null) = true
+ * StringUtils.isBlank("") = true
+ * StringUtils.isBlank(" ") = true
+ * StringUtils.isBlank("bob") = false
+ * StringUtils.isBlank(" bob ") = false
+ * </pre>
+ *
+ * @param str the String to check, may be null
+ * @return <code>true</code> if the String is null, empty or whitespace
+ *
+ * Copied from org.apache.commons.lang.StringUtils#isBlanck
+ */
+ private static boolean isBlank(String str) {
+ int strLen;
+ if (str == null || (strLen = str.length()) == 0) {
+ return true;
+ }
+ for (int i = 0; i < strLen; i++) {
+ if ((Character.isWhitespace(str.charAt(i)) == false)) {
+ return false;
+ }
+ }
+ return true;
}
}