You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by jf...@apache.org on 2009/05/22 23:46:01 UTC

svn commit: r777721 - in /webservices/juddi/branches/v3_trunk/juddi-core/src/main: java/org/apache/juddi/validation/ValidateInquiry.java java/org/apache/juddi/validation/ValidatePublish.java resources/messages_en.properties

Author: jfaath
Date: Fri May 22 21:46:01 2009
New Revision: 777721

URL: http://svn.apache.org/viewvc?rev=777721&view=rev
Log:
fixing more validation issues - not allowing names with blank values

Modified:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java?rev=777721&r1=777720&r2=777721&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java Fri May 22 21:46:01 2009
@@ -35,6 +35,7 @@
 import org.uddi.api_v3.FindTModel;
 import org.uddi.api_v3.FindRelatedBusinesses;
 import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.Name;
 import org.uddi.api_v3.ObjectFactory;
 import org.uddi.api_v3.TModelBag;
 
@@ -181,6 +182,7 @@
 			body.getIdentifierBag() == null && body.getDiscoveryURLs() == null && body.getFindRelatedBusinesses() == null)
 			throw new FatalErrorException(new ErrorMessage("errors.findbusiness.NoInput"));
 
+		validateNames(body.getName());
 		validateFindQualifiers(body.getFindQualifiers());
 		validateTModelBag(body.getTModelBag());
 		validateFindTModel(body.getFindTModel(), true);
@@ -199,6 +201,7 @@
 		if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName().size() == 0)
 			throw new FatalErrorException(new ErrorMessage("errors.findservice.NoInput"));
 
+		validateNames(body.getName());
 		validateFindQualifiers(body.getFindQualifiers());
 		validateTModelBag(body.getTModelBag());
 		validateFindTModel(body.getFindTModel(), true);
@@ -279,6 +282,15 @@
 		}
 			
 	}
+
+	public void validateNames(List<org.uddi.api_v3.Name> names) throws DispositionReportFaultMessage {
+		if (names != null) {
+			for (Name n : names) {
+				if (n.getValue() == null || n.getValue().length() == 0)
+					throw new ValueNotAllowedException(new ErrorMessage("errors.names.NoValue"));
+			}
+		}
+	}
 	
 	public void validateTModelBag(TModelBag tmodelBag) throws DispositionReportFaultMessage {
 		// tmodelBag is optional

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java?rev=777721&r1=777720&r2=777721&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java Fri May 22 21:46:01 2009
@@ -23,6 +23,7 @@
 import javax.xml.bind.JAXBElement;
 import javax.xml.ws.Holder;
 
+import org.uddi.api_v3.Name;
 import org.uddi.api_v3.ObjectFactory;
 import org.uddi.api_v3.DeleteBusiness;
 import org.uddi.api_v3.DeleteBinding;
@@ -759,6 +760,11 @@
 		if (names == null || names.size() == 0)
 			throw new ValueNotAllowedException(new ErrorMessage("errors.names.NoInput"));
 		
+		for (Name n : names) {
+			if (n.getValue() == null || n.getValue().length() == 0)
+				throw new ValueNotAllowedException(new ErrorMessage("errors.names.NoValue"));
+		}
+		
 	}
 	
 	public void validateContacts(org.uddi.api_v3.Contacts contacts) throws DispositionReportFaultMessage {

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties?rev=777721&r1=777720&r2=777721&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties Fri May 22 21:46:01 2009
@@ -111,6 +111,7 @@
 errors.businessservices.NoInput=A businessServices collection must contain at least one businessService
 errors.bindingtemplates.NoInput=A bindingTemplates collection must contain at least one bindingTemplate
 errors.names.NoInput=At least one name is required
+errors.names.NoValue=A name was provided with no value
 errors.contacts.NoInput=At least one contact is required
 errors.contact.NullInput=The contact structure cannot be blank
 errors.contact.NoPersonName=The contact structure must contain at least one personName
@@ -132,7 +133,7 @@
 errors.findqualifiers.DuplicateValue=A duplicate findQualifier was passed.  No duplicates are allowed
 errors.findqualifiers.InvalidCombo=An invalid findQualifier combination occurred
 errors.findbusiness.NoInput=At least one search criterion must be supplied
-errors.findservice.NoInput=At least one categoryBag, find_tModel or tModelBag or name must be supplied
+errors.findservice.NoInput=At least one name, categoryBag, find_tModel or tModelBag or name must be supplied
 errors.findbinding.NoInput=At least one categoryBag, find_tModel or tModelBag must be supplied
 errors.findtmodel.NoInput=At least one categoryBag, identifierBag or name must be supplied
 errors.findrelatedbusiness.NoInput=At least one businessKey, fromKey or toKey must be supplied



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org