jdk/src/share/classes/java/util/Formatter.java
changeset 3416 0dd4f82becda
parent 1939 5153d540b7a8
child 4185 8d87b7274c30
--- a/jdk/src/share/classes/java/util/Formatter.java	Thu Jul 23 14:06:51 2009 +0100
+++ b/jdk/src/share/classes/java/util/Formatter.java	Fri Jul 24 11:06:57 2009 -0700
@@ -2818,15 +2818,18 @@
         }
 
         private void printString(Object arg, Locale l) throws IOException {
-            if (arg == null) {
-                print("null");
-            } else if (arg instanceof Formattable) {
+            if (arg instanceof Formattable) {
                 Formatter fmt = formatter;
                 if (formatter.locale() != l)
                     fmt = new Formatter(formatter.out(), l);
                 ((Formattable)arg).formatTo(fmt, f.valueOf(), width, precision);
             } else {
-                print(arg.toString());
+                if (f.contains(Flags.ALTERNATE))
+                    failMismatch(Flags.ALTERNATE, 's');
+                if (arg == null)
+                    print("null");
+                else
+                    print(arg.toString());
             }
         }