harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r495946 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/text/MaskFormatter.java test/api/java/common/javax/swing/text/MaskFormatterTest.java
Date Sat, 13 Jan 2007 19:07:43 GMT
Author: apetrenko
Date: Sat Jan 13 11:07:42 2007
New Revision: 495946

URL: http://svn.apache.org/viewvc?view=rev&rev=495946
Log:
Patch for HARMONY-1742 "[classlib][swing] javax.swing.text.MaskFormatter.valueToString(Object)
throws unspecified NPE"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/MaskFormatter.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/MaskFormatterTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/MaskFormatter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/MaskFormatter.java?view=diff&rev=495946&r1=495945&r2=495946
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/MaskFormatter.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/MaskFormatter.java
Sat Jan 13 11:07:42 2007
@@ -191,6 +191,9 @@
     }
 
     public String valueToString(final Object value) throws ParseException {
+        if ((mask == null) && (escapeMask == null) && (literalMask == null))
{
+            return "";
+        }
         String result = super.valueToString(value);
         result = fillAll(result);
         result = fillByPlaceholder(result);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/MaskFormatterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/MaskFormatterTest.java?view=diff&rev=495946&r1=495945&r2=495946
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/MaskFormatterTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/MaskFormatterTest.java
Sat Jan 13 11:07:42 2007
@@ -22,6 +22,7 @@
 
 import java.text.ParseException;
 import javax.swing.SwingTestCase;
+import javax.swing.JFormattedTextField;
 
 public class MaskFormatterTest extends SwingTestCase {
     MaskFormatter formatter;
@@ -294,5 +295,16 @@
         } catch (ParseException e) {
             assertTrue("Unexpected exception: " + e.getMessage(), false);
         }
+    }
+   
+    public void testValueToString_Object() throws ParseException{
+    	// Regression for HARMONY-1742 
+    	MaskFormatter obj = new MaskFormatter();
+        obj.valueToString(new Object());
+    } 
+    public void testInstall_JFormattedTextField() {
+    	// Regression for HARMONY-1742 
+        MaskFormatter obj = new MaskFormatter();
+        obj.install(new JFormattedTextField());
     }
 }



Mime
View raw message