Scarab commit: svn commit: r10706 - trunk/src/java/org/tigris/scarab/actions/ModifyIssue.java
Hussayn Dabbous <[email protected]>
| Newsgroups | gmane.comp.java.scarab.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: dabbous
Date: 2009-02-26 10:49:26-0800
New Revision: 10706
Modified:
trunk/src/java/org/tigris/scarab/actions/ModifyIssue.java
Log:
When an input pattern is associated to an attribute, the field value could be set to blank ("") when creating the issue, but later when modifying the attributes of an existing issue, Scarab insisted on adding values to the field, even if the field is not required.
Modified: trunk/src/java/org/tigris/scarab/actions/ModifyIssue.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/actions/ModifyIssue.java?view=diff&pathrev=10706&r1=10705&r2=10706
==============================================================================
--- trunk/src/java/org/tigris/scarab/actions/ModifyIssue.java (original)
+++ trunk/src/java/org/tigris/scarab/actions/ModifyIssue.java 2009-02-26 10:49:26-0800
@@ -216,31 +216,36 @@
Object fieldValue = field.getValue();
if(fieldValue != null)
{
- boolean exactMatch = true;
- String pattern = aval.getAttribute().getFormat();
- String hint = aval.getAttribute().getHint();
- if(pattern != null && pattern.length()>0)
+ String fieldValueAsString = fieldValue.toString();
+ if (fieldValueAsString != null && fieldValueAsString.length() > 0)
{
- String input = fieldValue.toString();
- RegexProcessor processor = new RegexProcessor();
- exactMatch = processor.matches(input, pattern);
- }
- if(!exactMatch)
- {
- if(hint==null || hint.length()==0) hint=pattern;
- String[] parameters = new String[]{aval.getAttribute().getName(), fieldValue.toString(), pattern, hint};
- LocalizationKey key;
- if(fieldValue.toString().equals(hint))
+ boolean exactMatch = true;
+ String pattern = aval.getAttribute().getFormat();
+ String hint = aval.getAttribute().getHint();
+ if (pattern != null && pattern.length() > 0)
{
- key = L10NKeySet.UnprocessedField;
+ RegexProcessor processor = new RegexProcessor();
+ exactMatch = processor.matches(fieldValueAsString, pattern);
}
- else
+ if (!exactMatch)
{
- key = L10NKeySet.InvalidFieldFormat;
+ if (hint == null || hint.length() == 0)
+ hint = pattern;
+ String[] parameters = new String[]
+ {
+ aval.getAttribute().getName(),
+ fieldValue.toString(), pattern, hint };
+ LocalizationKey key;
+ if (fieldValueAsString.equals(hint)) {
+ key = L10NKeySet.UnprocessedField;
+ } else {
+ key = L10NKeySet.InvalidFieldFormat;
+ }
+ L10NMessage l10nMessage = new L10NMessage(key,
+ parameters);
+ field.setMessage(l10nMessage.getMessage(l10n));
+ localFieldErrors = true;
}
- L10NMessage l10nMessage = new L10NMessage(key, parameters);
- field.setMessage(l10nMessage.getMessage(l10n));
- localFieldErrors = true;
}
}
------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=1234297