Commits

Anonymous committed 7d60b04

Roll back locale sensitive Number -> String conversion.

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@334e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (2)

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

             result = df.format(value);
         } else if (value instanceof String[]) {
             result = TextUtils.join(", ", (String[]) value);
-        } else if (Number.class.isAssignableFrom(value.getClass())) {
-            NumberFormat numFormat = NumberFormat.getInstance(getLocale(context));
-            result = numFormat.format(value);
         }
 
         return result;

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

         assertEquals(dateString, converter.convertValue(context, null, null, null, date, String.class));
     }
 
-    public void testPrimitiveToString() {
-        Locale locale = Locale.GERMANY;
-        NumberFormat nf = NumberFormat.getInstance(locale);
-        context.put(ActionContext.LOCALE, locale);
-
-        String origValue = "123456789";
-        Long longValue = new Long(origValue);
-        String formattedValue = nf.format(new Long(origValue));
-        assertEquals(formattedValue, converter.convertValue(context, null, null, null, new Long(origValue), String.class));
-        assertEquals(longValue, converter.convertValue(context, null, null, null, formattedValue, Long.class));
-        assertEquals(longValue, converter.convertValue(context, null, null, null, origValue, Long.class));
-
-        origValue = "123456.789";
-
-        Float floatValue = new Float(origValue);
-        formattedValue = nf.format(new Float(origValue));
-        assertEquals(formattedValue, converter.convertValue(context, null, null, null, new Float(origValue), String.class));
-        assertEquals(floatValue, converter.convertValue(context, null, null, null, formattedValue, Float.class));
-    }
-
     public void testStringArrayToCollection() {
         List list = new ArrayList();
         list.add("foo");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.