Merge
authorlana
Thu, 04 Mar 2010 13:07:48 -0800
changeset 4971 2e385fe87079
parent 4970 256bdcae527c (current diff)
parent 4969 5a6e31d5ab6d (diff)
child 4972 66c8956aa4c8
child 5129 8776068d7eb7
Merge
--- a/jdk/src/share/classes/java/beans/XMLEncoder.java	Mon Mar 01 18:30:05 2010 -0800
+++ b/jdk/src/share/classes/java/beans/XMLEncoder.java	Thu Mar 04 13:07:48 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -214,8 +214,8 @@
     private Object owner;
     private int indentation = 0;
     private boolean internal = false;
-    private Map valueToExpression;
-    private Map targetToStatementList;
+    private Map<Object, ValueData> valueToExpression;
+    private Map<Object, List<Statement>> targetToStatementList;
     private boolean preambleWritten = false;
     private NameGenerator nameGenerator;
 
@@ -287,8 +287,8 @@
         this.declaration = declaration;
         this.indentation = indentation;
         this.out = new OutputStreamWriter(out, cs.newEncoder());
-        valueToExpression = new IdentityHashMap();
-        targetToStatementList = new IdentityHashMap();
+        valueToExpression = new IdentityHashMap<Object, ValueData>();
+        targetToStatementList = new IdentityHashMap<Object, List<Statement>>();
         nameGenerator = new NameGenerator();
     }
 
@@ -331,13 +331,12 @@
         }
     }
 
-    private Vector statementList(Object target) {
-        Vector list = (Vector)targetToStatementList.get(target);
-        if (list != null) {
-            return list;
+    private List<Statement> statementList(Object target) {
+        List<Statement> list = targetToStatementList.get(target);
+        if (list == null) {
+            list = new ArrayList<Statement>();
+            targetToStatementList.put(target, list);
         }
-        list = new Vector();
-        targetToStatementList.put(target, list);
         return list;
     }
 
@@ -363,13 +362,13 @@
         }
         d.marked = true;
         Object target = exp.getTarget();
+        mark(exp);
         if (!(target instanceof Class)) {
             statementList(target).add(exp);
             // Pending: Why does the reference count need to
             // be incremented here?
             d.refs++;
         }
-        mark(exp);
     }
 
     private void mark(Statement stm) {
@@ -463,9 +462,9 @@
             preambleWritten = true;
         }
         indentation++;
-        Vector roots = statementList(this);
-        for(int i = 0; i < roots.size(); i++) {
-            Statement s = (Statement)roots.get(i);
+        List<Statement> statements = statementList(this);
+        while (!statements.isEmpty()) {
+            Statement s = statements.remove(0);
             if ("writeObject".equals(s.getMethodName())) {
                 outputValue(s.getArguments()[0], this, true);
             }
@@ -513,7 +512,7 @@
     }
 
     private ValueData getValueData(Object o) {
-        ValueData d = (ValueData)valueToExpression.get(o);
+        ValueData d = valueToExpression.get(o);
         if (d == null) {
             d = new ValueData();
             valueToExpression.put(o, d);
@@ -619,11 +618,11 @@
         }
 
         if (d.name != null) {
-            writeln("<object idref=" + quote(d.name) + "/>");
-            return;
+            outputXML(isArgument ? "object" : "void", " idref=" + quote(d.name), value);
         }
-
-        outputStatement(d.exp, outer, isArgument);
+        else if (d.exp != null) {
+            outputStatement(d.exp, outer, isArgument);
+        }
     }
 
     private static String quoteCharCode(int code) {
@@ -683,13 +682,6 @@
         String tag = (expression && isArgument) ? "object" : "void";
         String attributes = "";
         ValueData d = getValueData(value);
-        if (expression) {
-            if (d.refs > 1) {
-                String instanceName = nameGenerator.instanceName(value);
-                d.name = instanceName;
-                attributes = attributes + " id=" + quote(instanceName);
-            }
-        }
 
         // Special cases for targets.
         if (target == outer) {
@@ -706,13 +698,19 @@
         else {
             d.refs = 2;
             getValueData(target).refs++;
+            List<Statement> statements = statementList(target);
+            if (!statements.contains(exp)) {
+                statements.add(exp);
+            }
             outputValue(target, outer, false);
-            if (isArgument) {
-                outputValue(value, outer, false);
-            }
+            outputValue(value, outer, isArgument);
             return;
         }
-
+        if (expression && (d.refs > 1)) {
+            String instanceName = nameGenerator.instanceName(value);
+            d.name = instanceName;
+            attributes = attributes + " id=" + quote(instanceName);
+        }
 
         // Special cases for methods.
         if ((!expression && methodName.equals("set") && args.length == 2 &&
@@ -730,8 +728,11 @@
         else if (!methodName.equals("new") && !methodName.equals("newInstance")) {
             attributes = attributes + " method=" + quote(methodName);
         }
+        outputXML(tag, attributes, value, args);
+    }
 
-        Vector statements = statementList(value);
+    private void outputXML(String tag, String attributes, Object value, Object... args) {
+        List<Statement> statements = statementList(value);
         // Use XML's short form when there is no body.
         if (args.length == 0 && statements.size() == 0) {
             writeln("<" + tag + attributes + "/>");
@@ -745,8 +746,8 @@
             outputValue(args[i], null, true);
         }
 
-        for(int i = 0; i < statements.size(); i++) {
-            Statement s = (Statement)statements.get(i);
+        while (!statements.isEmpty()) {
+            Statement s = statements.remove(0);
             outputStatement(s, value, false);
         }
 
--- a/jdk/src/share/classes/javax/swing/JTable.java	Mon Mar 01 18:30:05 2010 -0800
+++ b/jdk/src/share/classes/javax/swing/JTable.java	Thu Mar 04 13:07:48 2010 -0800
@@ -2506,10 +2506,7 @@
         Color old = this.selectionForeground;
         this.selectionForeground = selectionForeground;
         firePropertyChange("selectionForeground", old, selectionForeground);
-        if ( !selectionForeground.equals(old) )
-        {
-            repaint();
-        }
+        repaint();
     }
 
     /**
@@ -2547,10 +2544,7 @@
         Color old = this.selectionBackground;
         this.selectionBackground = selectionBackground;
         firePropertyChange("selectionBackground", old, selectionBackground);
-        if ( !selectionBackground.equals(old) )
-        {
-            repaint();
-        }
+        repaint();
     }
 
     /**
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Mon Mar 01 18:30:05 2010 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Thu Mar 04 13:07:48 2010 -0800
@@ -62,6 +62,7 @@
                      (scrollbar.getLayout() instanceof UIResource)) {
             scrollbar.setLayout(this);
         }
+        configureScrollBarColors();
         updateStyle(scrollbar);
     }
 
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Mon Mar 01 18:30:05 2010 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Thu Mar 04 13:07:48 2010 -0800
@@ -45,8 +45,7 @@
 import javax.swing.JTable;
 import javax.swing.LookAndFeel;
 import javax.swing.border.Border;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.UIResource;
+import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicTableUI;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.JTableHeader;
@@ -158,7 +157,7 @@
                 if (gridColor == null) {
                     gridColor = style.getColor(context, ColorType.FOREGROUND);
                 }
-                table.setGridColor(gridColor);
+                table.setGridColor(gridColor == null ? new ColorUIResource(Color.GRAY) : gridColor);
             }
 
             useTableColors = style.getBoolean(context,
--- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java	Mon Mar 01 18:30:05 2010 -0800
+++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java	Thu Mar 04 13:07:48 2010 -0800
@@ -1461,13 +1461,17 @@
                             // Make sure the new visible location contains
                             // the location of dot, otherwise Caret will
                             // cause an additional scroll.
-                            adjustScrollIfNecessary(target, newVis, initialY,
-                                                    newIndex);
-                            if (select) {
-                                target.moveCaretPosition(newIndex);
-                            }
-                            else {
-                                target.setCaretPosition(newIndex);
+                            int newY = getAdjustedY(target, newVis, newIndex);
+
+                            if (direction == -1 && newY <= initialY || direction == 1 && newY >= initialY) {
+                                // Change index and correct newVis.y only if won't cause scrolling upward
+                                newVis.y = newY;
+
+                                if (select) {
+                                    target.moveCaretPosition(newIndex);
+                                } else {
+                                    target.setCaretPosition(newIndex);
+                                }
                             }
                         }
                     } catch (BadLocationException ble) { }
@@ -1513,34 +1517,27 @@
         }
 
         /**
-         * Adjusts the rectangle that indicates the location to scroll to
+         * Returns adjustsed {@code y} position that indicates the location to scroll to
          * after selecting <code>index</code>.
          */
-        private void adjustScrollIfNecessary(JTextComponent text,
-                                             Rectangle visible, int initialY,
-                                             int index) {
+        private int getAdjustedY(JTextComponent text, Rectangle visible, int index) {
+            int result = visible.y;
+
             try {
                 Rectangle dotBounds = text.modelToView(index);
 
-                if (dotBounds.y < visible.y ||
-                       (dotBounds.y > (visible.y + visible.height)) ||
-                       (dotBounds.y + dotBounds.height) >
-                       (visible.y + visible.height)) {
-                    int y;
-
-                    if (dotBounds.y < visible.y) {
-                        y = dotBounds.y;
-                    }
-                    else {
-                        y = dotBounds.y + dotBounds.height - visible.height;
-                    }
-                    if ((direction == -1 && y < initialY) ||
-                                        (direction == 1 && y > initialY)) {
-                        // Only adjust if won't cause scrolling upward.
-                        visible.y = y;
+                if (dotBounds.y < visible.y) {
+                    result = dotBounds.y;
+                } else {
+                    if ((dotBounds.y > visible.y + visible.height) ||
+                            (dotBounds.y + dotBounds.height > visible.y + visible.height)) {
+                        result = dotBounds.y + dotBounds.height - visible.height;
                     }
                 }
-            } catch (BadLocationException ble) {}
+            } catch (BadLocationException ble) {
+            }
+
+            return result;
         }
 
         /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/Test5023550.java	Thu Mar 04 13:07:48 2010 -0800
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5023550
+ * @summary Tests complex references to owner
+ * @author Sergey Malenkov
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+
+public class Test5023550 extends AbstractTest {
+    public static void main(String[] args) {
+        new Test5023550().test(true);
+    }
+
+    private final Owner owner = new Owner();
+
+    @Override
+    protected void initialize(XMLEncoder encoder) {
+        encoder.setOwner(this.owner);
+        encoder.setPersistenceDelegate(A.class, new ADelegate());
+        encoder.setPersistenceDelegate(B.class, new BDelegate());
+        encoder.setPersistenceDelegate(C.class, new CDelegate());
+    }
+
+    @Override
+    protected void initialize(XMLDecoder decoder) {
+        decoder.setOwner(this.owner);
+    }
+
+    protected Object getObject() {
+        return this.owner.newA(this.owner.newB().newC());
+    }
+
+    public static class Owner {
+        public A newA(C c) {
+            return new A(c);
+        }
+
+        public B newB() {
+            return new B();
+        }
+    }
+
+    public static class A {
+        private final C c;
+
+        private A(C c) {
+            this.c = c;
+        }
+
+        public C getC() {
+            return this.c;
+        }
+    }
+
+    public static class B {
+        public C newC() {
+            return new C(this);
+        }
+    }
+
+    public static class C {
+        private final B b;
+
+        private C(B b) {
+            this.b = b;
+        }
+
+        public B getB() {
+            return this.b;
+        }
+    }
+
+    public static class ADelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            XMLEncoder encoder = (XMLEncoder) out;
+            A a = (A) old;
+            return new Expression(old, encoder.getOwner(), "newA", new Object[] { a.getC() });
+        }
+    }
+
+    public static class BDelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            XMLEncoder encoder = (XMLEncoder) out;
+            return new Expression(old, encoder.getOwner(), "newB", new Object[0]);
+        }
+    }
+
+    public static class CDelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            C c = (C) old;
+            return new Expression(c, c.getB(), "newC", new Object[0]);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/Test5023557.java	Thu Mar 04 13:07:48 2010 -0800
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5023557
+ * @summary Tests complex references
+ * @author Sergey Malenkov
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.XMLEncoder;
+
+public class Test5023557 extends AbstractTest {
+    public static void main(String[] args) {
+        new Test5023557().test(true);
+    }
+
+    @Override
+    protected void initialize(XMLEncoder encoder) {
+        encoder.setPersistenceDelegate(B.class, new BDelegate());
+        encoder.setPersistenceDelegate(C.class, new CDelegate());
+    }
+
+    protected Object getObject() {
+        A a = new A();
+        return a.newC(a.newB());
+    }
+
+    public static class A {
+        public B newB() {
+            return new B(this);
+        }
+
+        public C newC(B b) {
+            return new C(b);
+        }
+    }
+
+    public static class B {
+        private final A a;
+
+        private B(A a) {
+            this.a = a;
+        }
+
+        public A getA() {
+            return this.a;
+        }
+    }
+
+    public static class C {
+        private final B b;
+
+        private C(B b) {
+            this.b = b;
+        }
+
+        public B getB() {
+            return this.b;
+        }
+    }
+
+    public static class BDelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            B b = (B) old;
+            return new Expression(b, b.getA(), "newB", new Object[0]);
+        }
+    }
+
+    public static class CDelegate extends DefaultPersistenceDelegate {
+        protected Expression instantiate(Object old, Encoder out) {
+            C c = (C) old;
+            return new Expression(c, c.getB().getA(), "newC", new Object[] { c.getB() });
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/Test6921644.java	Thu Mar 04 13:07:48 2010 -0800
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6921644
+ * @summary Tests references to cached integer
+ * @author Sergey Malenkov
+ */
+
+import java.beans.ConstructorProperties;
+import java.util.ArrayList;
+import java.util.List;
+
+public final class Test6921644 extends AbstractTest {
+    public static void main(String[] args) {
+        new Test6921644().test(true);
+    }
+
+    protected Object getObject() {
+        Owner<Author> o = new Owner<Author>(100); // it works if ID >= 128
+
+        Category c = new Category(o);
+
+        Document d1 = new Document(o);
+        Document d2 = new Document(o);
+        Document d3 = new Document(o);
+
+        Author a1 = new Author(o);
+        Author a2 = new Author(o);
+        Author a3 = new Author(o);
+
+        o.getList().add(a1);
+        o.getList().add(a2);
+        o.getList().add(a3);
+
+        a3.setRef(o.getId());
+
+        d2.setCategory(c);
+        d3.setCategory(c);
+
+        a1.addDocument(d1);
+        a1.addDocument(d2);
+        a3.addDocument(d3);
+
+        c.addDocument(d2);
+        c.addDocument(d3);
+
+        return o;
+    }
+
+    public static class Owner<T> {
+        private int id;
+        private List<T> list = new ArrayList<T>();
+
+        @ConstructorProperties("id")
+        public Owner(int id) {
+            this.id = id;
+        }
+
+        public int getId() {
+            return this.id;
+        }
+
+        public List<T> getList() {
+            return this.list;
+        }
+
+        public void setList(List<T> list) {
+            this.list = list;
+        }
+    }
+
+    public static class Author {
+        private int id;
+        private int ref;
+        private Owner owner;
+        private List<Document> list = new ArrayList<Document>();
+
+        @ConstructorProperties("owner")
+        public Author(Owner<Author> owner) {
+            this.owner = owner;
+            this.id = owner.getId();
+        }
+
+        public Owner getOwner() {
+            return this.owner;
+        }
+
+        public Integer getId() {
+            return this.id;
+        }
+
+        public void setId(Integer id) {
+            this.id = id;
+        }
+
+        public Integer getRef() {
+            return this.ref;
+        }
+
+        public void setRef(Integer ref) {
+            this.ref = ref;
+        }
+
+        public List<Document> getList() {
+            return this.list;
+        }
+
+        public void setList(List<Document> list) {
+            this.list = list;
+        }
+
+        public void addDocument(Document document) {
+            this.list.add(document);
+            document.setAuthor(this);
+        }
+    }
+
+    public static class Category {
+        private Owner owner;
+        private List<Document> list = new ArrayList<Document>();
+
+        @ConstructorProperties("owner")
+        public Category(Owner owner) {
+            this.owner = owner;
+        }
+
+        public Owner getOwner() {
+            return this.owner;
+        }
+
+        public List<Document> getList() {
+            return this.list;
+        }
+
+        public void setList(List<Document> list) {
+            this.list = list;
+        }
+
+        public void addDocument(Document document) {
+            this.list.add(document);
+            document.setCategory(this);
+        }
+    }
+
+    public static class Document {
+        private Owner owner;
+        private Author author;
+        private Category category;
+
+        @ConstructorProperties("owner")
+        public Document(Owner owner) {
+            this.owner = owner;
+        }
+
+        public Owner getOwner() {
+            return this.owner;
+        }
+
+        public Author getAuthor() {
+            return this.author;
+        }
+
+        public void setAuthor(Author author) {
+            this.author = author;
+        }
+
+        public Category getCategory() {
+            return this.category;
+        }
+
+        public void setCategory(Category category) {
+            this.category = category;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JEditorPane/6917744/bug6917744.java	Thu Mar 04 13:07:48 2010 -0800
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6917744
+ * @summary JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents
+ * @author Pavel Porvatov
+ * @run main bug6917744
+ */
+
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import java.io.IOException;
+import javax.swing.*;
+
+import sun.awt.SunToolkit;
+
+public class bug6917744 {
+    private static JFrame frame;
+
+    private static JEditorPane editorPane;
+
+    private static JScrollPane scrollPane;
+
+    private static Robot robot;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        robot = new Robot();
+        robot.setAutoDelay(100);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new JFrame();
+
+                editorPane = new JEditorPane();
+
+                try {
+                    editorPane.setPage(bug6917744.class.getResource("/test.html"));
+                } catch (IOException e) {
+                    throw new RuntimeException("HTML resource not found", e);
+                }
+
+                scrollPane = new JScrollPane(editorPane);
+
+                frame.getContentPane().add(scrollPane);
+                frame.setSize(400, 300);
+                frame.setVisible(true);
+            }
+        });
+
+        toolkit.realSync();
+
+        for (int i = 0; i < 50; i++) {
+            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+        }
+
+        toolkit.realSync();
+
+        // Check that we at the end of document
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
+
+                if (model.getValue() + model.getExtent() != model.getMaximum()) {
+                    throw new RuntimeException("Invalid HTML position");
+                }
+            }
+        });
+
+        toolkit.realSync();
+
+        for (int i = 0; i < 50; i++) {
+            robot.keyPress(KeyEvent.VK_PAGE_UP);
+        }
+
+        toolkit.realSync();
+
+        // Check that we at the begin of document
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
+
+                if (model.getValue() != model.getMinimum()) {
+                    throw new RuntimeException("Invalid HTML position");
+                }
+
+                frame.dispose();
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JEditorPane/6917744/test.html	Thu Mar 04 13:07:48 2010 -0800
@@ -0,0 +1,494 @@
+<html>
+<body bgcolor="#ffffff">
+<table border="0">
+<tr>
+<td>&nbsp;</td>
+<td valign="top">
+
+<font size="+1" face="Arial, Helvetica, sans-serif">
+    <b>TEST FOR JScrollPane BUG</b> <br>
+</font>
+<font face="Arial, Helvetica, sans-serif" size="-1">
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+This is a test html file.
+<br>
+<font size="+1" face="Arial, Helvetica, sans-serif">
+    <b>END OF TEST FOR JScrollPane BUG</b> <br>
+</font>
+</font>
+</td>
+<td>&nbsp;</td>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JScrollBar/6924059/bug6924059.java	Thu Mar 04 13:07:48 2010 -0800
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6924059
+ * @summary SynthScrollBarUI.configureScrollBarColors() should have spec different from the overridden method
+ * @author Pavel Porvatov
+ * @run main bug6924059
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import javax.swing.plaf.synth.SynthScrollBarUI;
+
+public class bug6924059 {
+    private static boolean isMethodCalled;
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                new JScrollBar().setUI(new SynthScrollBarUI() {
+                    protected void configureScrollBarColors() {
+                        super.configureScrollBarColors();
+                        isMethodCalled = true;
+                    }
+                });
+
+                if (!isMethodCalled) {
+                    throw new RuntimeException("The configureScrollBarColors was not called");
+                }
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/6913768/bug6913768.java	Thu Mar 04 13:07:48 2010 -0800
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6913768
+ * @summary With default SynthLookAndFeel instance installed new JTable creation leads to throwing NPE
+ * @author Pavel Porvatov
+ * @run main bug6913768
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+
+public class bug6913768 {
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JFrame frame = new JFrame();
+
+                JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
+                        new Object[]{"col1", "col2"});
+
+                frame.getContentPane().add(new JScrollPane(table));
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.setSize(300, 200);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            }
+        });
+    }
+}