Commits

Anonymous committed 585af68
  • Participants
  • Parent commits 50a6ba0
  • Branches CONF-27294, xwork_1-0-3 1
    1. xwork_1-0-3_branch

Comments (0)

Files changed (7)

src/java/com/opensymphony/xwork/util/XWorkBasicConverter.java

 package com.opensymphony.xwork.util;
 
 import com.opensymphony.util.TextUtils;
+
 import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.XworkException;
+
 import ognl.DefaultTypeConverter;
 import ognl.Ognl;
 import ognl.TypeConverter;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.Member;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
+
 import java.text.DateFormat;
 import java.text.NumberFormat;
 import java.text.ParseException;
+
 import java.util.*;
 
 

src/java/com/opensymphony/xwork/util/XWorkConverter.java

         // class instances through the use of wacky classloaders. This sync
         // prevents multiple requests from causes configuration to be loaded
         // multiple times.
-        synchronized(clazz.toString().intern()) {
-        if ((property != null) && !noMapping.contains(clazz)) {
+        synchronized (clazz.toString().intern()) {
+            if ((property != null) && !noMapping.contains(clazz)) {
                 try {
                     Map mapping = (Map) mappings.get(clazz);
 

src/java/com/opensymphony/xwork/validator/ActionValidatorManager.java

  * @author Mark Woon
  */
 public class ActionValidatorManager {
+    //~ Static fields/initializers /////////////////////////////////////////////
 
     /** The file suffix for any validation file. */
     protected static final String VALIDATION_CONFIG_SUFFIX = "-validation.xml";
-
     private static final Map validatorCache = Collections.synchronizedMap(new HashMap());
     private static final Map validatorFileCache = Collections.synchronizedMap(new HashMap());
     private static final Log LOG = LogFactory.getLog(ActionValidatorManager.class);
 
+    //~ Methods ////////////////////////////////////////////////////////////////
+
     /**
      * Returns a list of validators for the given class and context. This is the primary
      * lookup method for validators.
         StringBuffer sb = new StringBuffer(clazz.getName());
         sb.append("/");
         sb.append(context);
+
         return sb.toString();
     }
 

src/java/com/opensymphony/xwork/validator/DelegatingValidatorContext.java

  * @author Jason Carreira
  */
 public class DelegatingValidatorContext implements ValidatorContext {
+    //~ Instance fields ////////////////////////////////////////////////////////
 
     private LocaleProvider localeProvider;
     private TextProvider textProvider;
     private ValidationAware validationAware;
 
+    //~ Constructors ///////////////////////////////////////////////////////////
+
     /**
      * Creates a new validation context given a ValidationAware object, and a text and locale provider. These objects
      * are used internally to set errors and get and set error text.
      */
-    public DelegatingValidatorContext(ValidationAware validationAware, TextProvider textProvider,
-            LocaleProvider localeProvider)
-    {
+    public DelegatingValidatorContext(ValidationAware validationAware, TextProvider textProvider, LocaleProvider localeProvider) {
         this.textProvider = textProvider;
         this.validationAware = validationAware;
         this.localeProvider = localeProvider;
         validationAware = new LoggingValidationAware(clazz);
     }
 
+    //~ Methods ////////////////////////////////////////////////////////////////
+
     public void setActionErrors(Collection errorMessages) {
         validationAware.setActionErrors(errorMessages);
     }
         return validationAware;
     }
 
+    //~ Inner Classes //////////////////////////////////////////////////////////
+
     /**
      * An implementation of LocaleProvider which gets the locale from the action context.
      */
     }
 
     /**
-     * An implementation of ValidationAware which logs errors and messages. 
+     * An implementation of ValidationAware which logs errors and messages.
      */
     private static class LoggingValidationAware implements ValidationAware {
-
         private Log log;
 
         public LoggingValidationAware(Class clazz) {
         }
 
         public void setActionErrors(Collection errorMessages) {
-            for (Iterator iterator = errorMessages.iterator(); iterator.hasNext();) {
+            for (Iterator iterator = errorMessages.iterator();
+                    iterator.hasNext();) {
                 String s = (String) iterator.next();
                 addActionError(s);
             }
         }
 
         public void setFieldErrors(Map errorMap) {
-            for (Iterator iterator = errorMap.entrySet().iterator(); iterator.hasNext();) {
+            for (Iterator iterator = errorMap.entrySet().iterator();
+                    iterator.hasNext();) {
                 Map.Entry entry = (Map.Entry) iterator.next();
                 addFieldError((String) entry.getKey(), (String) entry.getValue());
             }

src/java/com/opensymphony/xwork/validator/ValidationInterceptor.java

  * @author Jason Carreira
  */
 public class ValidationInterceptor extends AroundInterceptor {
+    //~ Methods ////////////////////////////////////////////////////////////////
 
     /**
      * Does nothing in this implementation.
         String context = invocation.getProxy().getActionName();
 
         if (log.isDebugEnabled()) {
-            log.debug("Validating "
-                    + invocation.getProxy().getNamespace() + "/" + invocation.getProxy().getActionName() + ".");
+            log.debug("Validating " + invocation.getProxy().getNamespace() + "/" + invocation.getProxy().getActionName() + ".");
         }
 
         ActionValidatorManager.validate(action, context);

src/java/com/opensymphony/xwork/validator/ValidatorContext.java

  * @author Jason Carreira
  */
 public interface ValidatorContext extends ValidationAware, TextProvider, LocaleProvider {
+    //~ Methods ////////////////////////////////////////////////////////////////
 
     /**
      * Translates a simple field name into a full field name in OGNL syntax.

src/test/com/opensymphony/xwork/util/LocalizedTextUtilTest.java

 import junit.framework.TestCase;
 
 import java.util.Collections;
+import java.util.Date;
 import java.util.Locale;
 import java.util.MissingResourceException;
-import java.util.Date;
 
 
 /**
         }
     }
 
+    public void testLocalizedDateFormatIsUsed() {
+        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork/util/LocalizedTextUtilTest");
+
+        Object[] params = new Object[] {new Date()};
+        String usDate = LocalizedTextUtil.findDefaultText("test.format.date", Locale.US, params);
+        String frenchDate = LocalizedTextUtil.findDefaultText("test.format.date", Locale.FRANCE, params);
+        assertFalse(usDate.equals(frenchDate));
+    }
+
     public void testParameterizedDefaultMessage() {
         try {
             String message = LocalizedTextUtil.findDefaultText(XWorkMessages.MISSING_ACTION_EXCEPTION, Locale.getDefault(), new String[] {
         }
     }
 
-    public void testLocalizedDateFormatIsUsed() {
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork/util/LocalizedTextUtilTest");
-        Object[] params = new Object[] {new Date()};
-        String usDate = LocalizedTextUtil.findDefaultText("test.format.date",Locale.US,params);
-        String frenchDate = LocalizedTextUtil.findDefaultText("test.format.date",Locale.FRANCE,params);
-        assertFalse(usDate.equals(frenchDate));
-    }
-
     protected void setUp() throws Exception {
         super.setUp();
         ConfigurationManager.destroyConfiguration();