You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/05/02 03:36:32 UTC
svn commit: r940142 - in
/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom:
comparetovalidator/AbstractCompareToValidator.java
csvvalidator/AbstractCSVValidator.java isbnvalidator/ISBNValidator.java
Author: lu4242
Date: Sun May 2 01:36:31 2010
New Revision: 940142
URL: http://svn.apache.org/viewvc?rev=940142&view=rev
Log:
MYFACES-2691 Enhance MessageUtils adding methods when custom library bundle should be scanned
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/comparetovalidator/AbstractCompareToValidator.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/isbnvalidator/ISBNValidator.java
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/comparetovalidator/AbstractCompareToValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/comparetovalidator/AbstractCompareToValidator.java?rev=940142&r1=940141&r2=940142&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/comparetovalidator/AbstractCompareToValidator.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/comparetovalidator/AbstractCompareToValidator.java Sun May 2 01:36:31 2010
@@ -36,6 +36,7 @@ import javax.faces.validator.ValidatorEx
import org.apache.myfaces.shared_tomahawk.util.MessageUtils;
import org.apache.myfaces.shared_tomahawk.util._ComponentUtils;
+import org.apache.myfaces.tomahawk.util.Constants;
import org.apache.myfaces.validator.ValidatorBase;
/**
@@ -293,7 +294,7 @@ public abstract class AbstractCompareToV
{
if (false == validateOperatorOnComparisonResult(operator, comparator.compare(value, foreignValue)))
{
- throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, message, args));
+ throw new ValidatorException(MessageUtils.getMessage(Constants.TOMAHAWK_DEFAULT_BUNDLE, FacesMessage.SEVERITY_ERROR, message, args, facesContext));
}
}
else if ( (value instanceof Comparable) && (foreignValue instanceof Comparable) )
@@ -302,7 +303,7 @@ public abstract class AbstractCompareToV
{
if (false == validateOperatorOnComparisonResult(operator, ((Comparable)value).compareTo(foreignValue)))
{
- throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, message, args));
+ throw new ValidatorException(MessageUtils.getMessage(Constants.TOMAHAWK_DEFAULT_BUNDLE, FacesMessage.SEVERITY_ERROR, message, args, facesContext));
}
}
catch (RuntimeException exception)
@@ -313,7 +314,7 @@ public abstract class AbstractCompareToV
}
else
{
- throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, message + ": " + exception.getLocalizedMessage(), args));
+ throw new ValidatorException(MessageUtils.getMessage(Constants.TOMAHAWK_DEFAULT_BUNDLE, FacesMessage.SEVERITY_ERROR, message + ": " + exception.getLocalizedMessage(), args, facesContext));
}
}
}
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java?rev=940142&r1=940141&r2=940142&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/csvvalidator/AbstractCSVValidator.java Sun May 2 01:36:31 2010
@@ -24,6 +24,7 @@ import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import org.apache.myfaces.shared_tomahawk.util.MessageUtils;
+import org.apache.myfaces.tomahawk.util.Constants;
import org.apache.myfaces.validator.ValidatorBase;
/**
@@ -90,7 +91,7 @@ public abstract class AbstractCSVValidat
detailMessageText = oldMsg.getDetail();
}
Object[] args = { new Integer(index + 1) };
- FacesMessage suffixMessage = MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, suffixMessageKey, args);
+ FacesMessage suffixMessage = MessageUtils.getMessage(Constants.TOMAHAWK_DEFAULT_BUNDLE, FacesMessage.SEVERITY_ERROR, suffixMessageKey, args);
String summarySuffix = suffixMessage.getSummary();
String detailSuffix = suffixMessage.getDetail();
if (summarySuffix == null)
@@ -127,7 +128,7 @@ public abstract class AbstractCSVValidat
// value must be a String
if (!(value instanceof String)) {
Object[] args = { value };
- throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, CSV_NOT_STRING_MESSAGE_ID, args));
+ throw new ValidatorException(MessageUtils.getMessage(Constants.TOMAHAWK_DEFAULT_BUNDLE, FacesMessage.SEVERITY_ERROR, CSV_NOT_STRING_MESSAGE_ID, args, facesContext));
}
Validator validator = facesContext.getApplication().createValidator(getSubvalidatorId());
if (getSeparator() == null)
@@ -138,7 +139,7 @@ public abstract class AbstractCSVValidat
}
catch (PatternSyntaxException e) {
Object[] args = { getSeparator() };
- throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, CSV_INVALID_SEPARATOR_MESSAGE_ID, args));
+ throw new ValidatorException(MessageUtils.getMessage(Constants.TOMAHAWK_DEFAULT_BUNDLE, FacesMessage.SEVERITY_ERROR, CSV_INVALID_SEPARATOR_MESSAGE_ID, args, facesContext));
}
// loop through the separated values and validate each one
for (int i = 0; i < values.length; i++) {
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/isbnvalidator/ISBNValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/isbnvalidator/ISBNValidator.java?rev=940142&r1=940141&r2=940142&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/isbnvalidator/ISBNValidator.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/isbnvalidator/ISBNValidator.java Sun May 2 01:36:31 2010
@@ -24,6 +24,7 @@ import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
import org.apache.myfaces.shared_tomahawk.util.MessageUtils;
+import org.apache.myfaces.tomahawk.util.Constants;
import org.apache.myfaces.validator.ValidatorBase;
/**
@@ -83,7 +84,7 @@ public class ISBNValidator extends Valid
String message = getMessage();
if (null == message) message = ISBN_MESSAGE_ID;
- throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, message, args));
+ throw new ValidatorException(MessageUtils.getMessage(Constants.TOMAHAWK_DEFAULT_BUNDLE, FacesMessage.SEVERITY_ERROR, message, args, facesContext));
}