changeset 8249:84c9465241bf jdk7u80-b13

Merge
author asaha
date Thu, 09 Apr 2015 22:00:25 -0700
parents 054ab3cddc22 (current diff) 50cc0787ccbf (diff)
children 5ab6690a0002
files .hgtags
diffstat 19 files changed, 841 insertions(+), 160 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Apr 09 21:57:37 2015 -0700
+++ b/.hgtags	Thu Apr 09 22:00:25 2015 -0700
@@ -567,6 +567,7 @@
 a476addbc2a4c88b34e5aacfe00bfc635f895c14 jdk7u79-b10
 fd0139b86bc186ebfc2715266b70da08b0af6132 jdk7u79-b11
 ed6e798f44e1698dfe766ee9e0763e035968c3a6 jdk7u79-b12
+efc8369247fc9ace2ce2008192349e1e49949e7d jdk7u79-b13
 f33e6ea5f4832468dd86a8d48ef50479ce91111e jdk7u80-b06
 feb04280659bf05b567dc725ff53e2a2077bdbb7 jdk7u80-b07
 f1334857fa99e6472870986b6071f9405c29ced4 jdk7u80-b08
--- a/THIRD_PARTY_README	Thu Apr 09 21:57:37 2015 -0700
+++ b/THIRD_PARTY_README	Thu Apr 09 22:00:25 2015 -0700
@@ -1001,7 +1001,7 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to libpng 1.5.4, which is 
+%% This notice is provided with respect to libpng 1.6.16, which is 
 included with JRE 7, JDK 7, and OpenJDK 7.
 
 --- begin of LICENSE ---
@@ -1017,7 +1017,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
+libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
 Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
@@ -1115,7 +1115,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-July 7, 2011
+December 22, 2014
 
 --- end of LICENSE ---
 
--- a/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Thu Apr 09 22:00:25 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. 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
@@ -508,10 +508,10 @@
                 // set interim reasons mask to the intersection of
                 // reasons in the DP and onlySomeReasons in the IDP
                 boolean[] idpReasonFlags = reasons.getFlags();
-                for (int i = 0; i < idpReasonFlags.length; i++) {
-                    if (idpReasonFlags[i] && pointReasonFlags[i]) {
-                        interimReasonsMask[i] = true;
-                    }
+                for (int i = 0; i < interimReasonsMask.length; i++) {
+                    interimReasonsMask[i] =
+                        (i < idpReasonFlags.length && idpReasonFlags[i]) &&
+                        (i < pointReasonFlags.length && pointReasonFlags[i]);
                 }
             } else {
                 // set interim reasons mask to the value of
@@ -525,7 +525,6 @@
                 interimReasonsMask = pointReasonFlags.clone();
             } else {
                 // set interim reasons mask to the special value all-reasons
-                interimReasonsMask = new boolean[9];
                 Arrays.fill(interimReasonsMask, true);
             }
         }
@@ -533,8 +532,10 @@
         // verify that interim reasons mask includes one or more reasons
         // not included in the reasons mask
         boolean oneOrMore = false;
-        for (int i=0; i < interimReasonsMask.length && !oneOrMore; i++) {
-            if (!reasonsMask[i] && interimReasonsMask[i]) {
+        for (int i = 0; i < interimReasonsMask.length && !oneOrMore; i++) {
+            if (interimReasonsMask[i] &&
+                    !(i < reasonsMask.length && reasonsMask[i]))
+            {
                 oneOrMore = true;
             }
         }
@@ -652,11 +653,11 @@
         }
 
         // update reasonsMask
-        for (int i=0; i < interimReasonsMask.length; i++) {
-            if (!reasonsMask[i] && interimReasonsMask[i]) {
-                reasonsMask[i] = true;
-            }
+        for (int i = 0; i < interimReasonsMask.length; i++) {
+            reasonsMask[i] = reasonsMask[i] ||
+                    (i < interimReasonsMask.length && interimReasonsMask[i]);
         }
+
         return true;
     }
 
--- a/src/share/classes/sun/security/x509/KeyUsageExtension.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/share/classes/sun/security/x509/KeyUsageExtension.java	Thu Apr 09 22:00:25 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. 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
@@ -83,7 +83,8 @@
      * @param position the position in the bit string to check.
      */
     private boolean isSet(int position) {
-        return bitString[position];
+        return (position < bitString.length) &&
+                bitString[position];
     }
 
     /**
@@ -275,41 +276,40 @@
      * Returns a printable representation of the KeyUsage.
      */
     public String toString() {
-        String s = super.toString() + "KeyUsage [\n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(super.toString());
+        sb.append("KeyUsage [\n");
 
-        try {
-            if (isSet(0)) {
-                s += "  DigitalSignature\n";
-            }
-            if (isSet(1)) {
-                s += "  Non_repudiation\n";
-            }
-            if (isSet(2)) {
-                s += "  Key_Encipherment\n";
-            }
-            if (isSet(3)) {
-                s += "  Data_Encipherment\n";
-            }
-            if (isSet(4)) {
-                s += "  Key_Agreement\n";
-            }
-            if (isSet(5)) {
-                s += "  Key_CertSign\n";
-            }
-            if (isSet(6)) {
-                s += "  Crl_Sign\n";
-            }
-            if (isSet(7)) {
-                s += "  Encipher_Only\n";
-            }
-            if (isSet(8)) {
-                s += "  Decipher_Only\n";
-            }
-        } catch (ArrayIndexOutOfBoundsException ex) {}
+        if (isSet(0)) {
+            sb.append("  DigitalSignature\n");
+        }
+        if (isSet(1)) {
+            sb.append("  Non_repudiation\n");
+        }
+        if (isSet(2)) {
+            sb.append("  Key_Encipherment\n");
+        }
+        if (isSet(3)) {
+            sb.append("  Data_Encipherment\n");
+        }
+        if (isSet(4)) {
+            sb.append("  Key_Agreement\n");
+        }
+        if (isSet(5)) {
+            sb.append("  Key_CertSign\n");
+        }
+        if (isSet(6)) {
+            sb.append("  Crl_Sign\n");
+        }
+        if (isSet(7)) {
+            sb.append("  Encipher_Only\n");
+        }
+        if (isSet(8)) {
+            sb.append("  Decipher_Only\n");
+        }
+        sb.append("]\n");
 
-        s += "]\n";
-
-        return (s);
+        return sb.toString();
     }
 
     /**
--- a/src/share/classes/sun/security/x509/NetscapeCertTypeExtension.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/share/classes/sun/security/x509/NetscapeCertTypeExtension.java	Thu Apr 09 22:00:25 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. 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
@@ -136,7 +136,8 @@
      * @param position the position in the bit string to check.
      */
     private boolean isSet(int position) {
-        return bitString[position];
+        return (position < bitString.length) &&
+                bitString[position];
     }
 
     /**
@@ -236,27 +237,34 @@
      * Returns a printable representation of the NetscapeCertType.
      */
     public String toString() {
-        String s = super.toString() + "NetscapeCertType [\n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(super.toString());
+        sb.append("NetscapeCertType [\n");
 
-        try {
-           if (isSet(getPosition(SSL_CLIENT)))
-               s += "   SSL client\n";
-           if (isSet(getPosition(SSL_SERVER)))
-               s += "   SSL server\n";
-           if (isSet(getPosition(S_MIME)))
-               s += "   S/MIME\n";
-           if (isSet(getPosition(OBJECT_SIGNING)))
-               s += "   Object Signing\n";
-           if (isSet(getPosition(SSL_CA)))
-               s += "   SSL CA\n";
-           if (isSet(getPosition(S_MIME_CA)))
-               s += "   S/MIME CA\n";
-           if (isSet(getPosition(OBJECT_SIGNING_CA)))
-               s += "   Object Signing CA" ;
-        } catch (Exception e) { }
+        if (isSet(0)) {
+            sb.append("   SSL client\n");
+        }
+        if (isSet(1)) {
+            sb.append("   SSL server\n");
+        }
+        if (isSet(2)) {
+            sb.append("   S/MIME\n");
+        }
+        if (isSet(3)) {
+            sb.append("   Object Signing\n");
+        }
+        if (isSet(5)) {
+            sb.append("   SSL CA\n");
+        }
+        if (isSet(6)) {
+            sb.append("   S/MIME CA\n");
+        }
+        if (isSet(7)) {
+            sb.append("   Object Signing CA");
+        }
 
-        s += "]\n";
-        return (s);
+        sb.append("]\n");
+        return sb.toString();
     }
 
     /**
--- a/src/share/classes/sun/security/x509/ReasonFlags.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/share/classes/sun/security/x509/ReasonFlags.java	Thu Apr 09 22:00:25 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. 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
@@ -99,7 +99,8 @@
      * @param position the position in the bit string to check.
      */
     private boolean isSet(int position) {
-        return bitString[position];
+        return (position < bitString.length) &&
+                bitString[position];
     }
 
     /**
@@ -199,23 +200,38 @@
      * Returns a printable representation of the ReasonFlags.
      */
     public String toString() {
-        String s = "Reason Flags [\n";
+        StringBuilder sb = new StringBuilder("Reason Flags [\n");
 
-        try {
-            if (isSet(0)) s += "  Unused\n";
-            if (isSet(1)) s += "  Key Compromise\n";
-            if (isSet(2)) s += "  CA Compromise\n";
-            if (isSet(3)) s += "  Affiliation_Changed\n";
-            if (isSet(4)) s += "  Superseded\n";
-            if (isSet(5)) s += "  Cessation Of Operation\n";
-            if (isSet(6)) s += "  Certificate Hold\n";
-            if (isSet(7)) s += "  Privilege Withdrawn\n";
-            if (isSet(8)) s += "  AA Compromise\n";
-        } catch (ArrayIndexOutOfBoundsException ex) {}
+        if (isSet(0)) {
+            sb.append("  Unused\n");
+        }
+        if (isSet(1)) {
+            sb.append("  Key Compromise\n");
+        }
+        if (isSet(2)) {
+            sb.append("  CA Compromise\n");
+        }
+        if (isSet(3)) {
+            sb.append("  Affiliation_Changed\n");
+        }
+        if (isSet(4)) {
+            sb.append("  Superseded\n");
+        }
+        if (isSet(5)) {
+            sb.append("  Cessation Of Operation\n");
+        }
+        if (isSet(6)) {
+            sb.append("  Certificate Hold\n");
+        }
+        if (isSet(7)) {
+            sb.append("  Privilege Withdrawn\n");
+        }
+        if (isSet(8)) {
+            sb.append("  AA Compromise\n");
+        }
+        sb.append("]\n");
 
-        s += "]\n";
-
-        return (s);
+        return sb.toString();
     }
 
     /**
--- a/src/solaris/classes/sun/awt/X11/XButtonPeer.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/solaris/classes/sun/awt/X11/XButtonPeer.java	Thu Apr 09 22:00:25 2015 -0700
@@ -82,9 +82,15 @@
         return true;
     }
 
-    public void  setLabel(java.lang.String label) {
-        this.label = label;
-        repaint();
+    @Override
+    public void setLabel(String label) {
+        if (label == null) {
+            label = "";
+        }
+        if (!label.equals(this.label)) {
+            this.label = label;
+            repaint();
+        }
     }
 
     public void paint(Graphics g) {
@@ -277,10 +283,6 @@
         drawMotif3DRect(g, x, y, w-1, h-1, pressed);
     }
 
-    public void setFont(Font f) {
-        super.setFont(f);
-        target.repaint();
-    }
     protected void paintFocus(Graphics g, int x, int y, int w, int h){
         g.setColor(focusColor);
         g.drawRect(x,y,w,h);
--- a/src/solaris/classes/sun/awt/X11/XCanvasPeer.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/solaris/classes/sun/awt/X11/XCanvasPeer.java	Thu Apr 09 22:00:25 2015 -0700
@@ -103,15 +103,4 @@
     protected boolean doEraseBackground() {
         return !eraseBackgroundDisabled;
     }
-    public void setBackground(Color c) {
-        boolean doRepaint = false;
-        if( getPeerBackground() == null ||
-           !getPeerBackground().equals( c ) ) {
-            doRepaint = true;
-        }
-        super.setBackground(c);
-        if( doRepaint ) {
-            target.repaint();
-        }
-    }
 }
--- a/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java	Thu Apr 09 22:00:25 2015 -0700
@@ -31,6 +31,7 @@
 import java.awt.image.BufferedImage;
 import javax.swing.plaf.basic.BasicGraphicsUtils;
 import java.awt.geom.AffineTransform;
+import java.util.Objects;
 
 import sun.util.logging.PlatformLogger;
 
@@ -135,14 +136,15 @@
 
     public void keyReleased(KeyEvent e) {}
 
-    public void  setLabel(java.lang.String label) {
-        if ( label == null ) {
-            this.label = "";
-        } else {
+    public void setLabel(String label) {
+        if (label == null) {
+            label = "";
+        }
+        if (!label.equals(this.label)) {
             this.label = label;
+            layout();
+            repaint();
         }
-        layout();
-        repaint();
     }
 
     void handleJavaMouseEvent(MouseEvent e) {
@@ -384,10 +386,6 @@
             g.drawImage(buffer, x, y, null);
         }
     }
-    public void setFont(Font f) {
-        super.setFont(f);
-        target.repaint();
-    }
 
     public void paintRadioButton(Graphics g, int x, int y, int w, int h) {
 
@@ -437,10 +435,12 @@
             repaint();
         }
     }
-    public void setCheckboxGroup(CheckboxGroup g) {
-        // If changed from grouped/ungrouped, need to repaint()
-        checkBoxGroup = g;
-        repaint();
+    public void setCheckboxGroup(final CheckboxGroup g) {
+        if (!Objects.equals(g, checkBoxGroup)) {
+            // If changed from grouped/ungrouped, need to repaint()
+            checkBoxGroup = g;
+            repaint();
+        }
     }
 
     // NOTE: This method is called by privileged threads.
--- a/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Thu Apr 09 22:00:25 2015 -0700
@@ -63,6 +63,7 @@
 import java.lang.reflect.*;
 import java.security.*;
 import java.util.Collection;
+import java.util.Objects;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.Vector;
@@ -647,18 +648,26 @@
         g.drawLine(x+width, y+height, x+width, y+1);  // right
     }
 
+    @Override
     public void setBackground(Color c) {
         if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set background to " + c);
         synchronized (getStateLock()) {
+            if (Objects.equals(background, c)) {
+                return;
+            }
             background = c;
         }
         super.setBackground(c);
         repaint();
     }
 
+    @Override
     public void setForeground(Color c) {
         if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set foreground to " + c);
         synchronized (getStateLock()) {
+            if (Objects.equals(foreground, c)) {
+                return;
+            }
             foreground = c;
         }
         repaint();
@@ -680,18 +689,21 @@
         return sun.font.FontDesignMetrics.getMetrics(font);
     }
 
+    @Override
     public void setFont(Font f) {
+        if (f == null) {
+            f = XWindow.getDefaultFont();
+        }
         synchronized (getStateLock()) {
-            if (f == null) {
-                f = XWindow.getDefaultFont();
+            if (f.equals(font)) {
+                return;
             }
             font = f;
         }
-        // as it stands currently we dont need to do layout or repaint since
+        // as it stands currently we dont need to do layout since
         // layout is done in the Component upon setFont.
         //layout();
-        // target.repaint();
-        //repaint()?
+        repaint();
     }
 
     public Font getFont() {
--- a/src/solaris/classes/sun/awt/X11/XContentWindow.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/solaris/classes/sun/awt/X11/XContentWindow.java	Thu Apr 09 22:00:25 2015 -0700
@@ -140,7 +140,7 @@
     }
 
 
-    public void handleExposeEvent(Component target, int x, int y, int w, int h) {
+    public void postPaintEvent(Component target, int x, int y, int w, int h) {
         // TODO: ?
         // get rid of 'istanceof' by subclassing:
         // XContentWindow -> XFrameContentWindow
@@ -158,13 +158,13 @@
             iconifiedExposeEvents.add(new SavedExposeEvent(target, x, y, w, h));
         } else {
             // Normal case: [it is not a frame or] the frame is not iconified.
-            super.handleExposeEvent(target, x, y, w, h);
+            super.postPaintEvent(target, x, y, w, h);
         }
     }
 
     void purgeIconifiedExposeEvents() {
         for (SavedExposeEvent evt : iconifiedExposeEvents) {
-            super.handleExposeEvent(evt.target, evt.x, evt.y, evt.w, evt.h);
+            super.postPaintEvent(evt.target, evt.x, evt.y, evt.w, evt.h);
         }
         iconifiedExposeEvents.clear();
     }
--- a/src/solaris/classes/sun/awt/X11/XLabelPeer.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/solaris/classes/sun/awt/X11/XLabelPeer.java	Thu Apr 09 22:00:25 2015 -0700
@@ -131,20 +131,22 @@
         }
     }
 
-    public void setText(String text) {
-        label = text;
+    @Override
+    public void setText(String label) {
         if (label == null) {
             label = "";
         }
-        repaint();
-    }
-    public void setFont(Font f) {
-        super.setFont(f);
-        repaint();
+        if (!label.equals(this.label)) {
+            this.label = label;
+            repaint();
+        }
     }
 
-    public void setAlignment(int align) {
-        alignment = align;
-        repaint();
+    @Override
+    public void setAlignment(final int alignment) {
+        if (this.alignment != alignment) {
+            this.alignment = alignment;
+            repaint();
+        }
     }
 }
--- a/src/solaris/classes/sun/awt/X11/XListPeer.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/solaris/classes/sun/awt/X11/XListPeer.java	Thu Apr 09 22:00:25 2015 -0700
@@ -31,8 +31,8 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.peer.*;
+import java.util.Objects;
 import java.util.Vector;
-import java.awt.geom.*;
 import java.awt.image.*;
 import sun.util.logging.PlatformLogger;
 
@@ -413,6 +413,7 @@
         Graphics g = getGraphics();
         try {
             painter.paint(g, firstItem, lastItem, options, source, distance);
+            postPaintEvent(target, 0, 0, getWidth(), getHeight());
         } finally {
             g.dispose();
         }
@@ -1659,11 +1660,13 @@
      * The bug is due to incorrent caching of the list item size
      * So we should recalculate font metrics on setFont
      */
-    public void setFont(Font f){
-        super.setFont(f);
-        initFontMetrics();
-        layout();
-        repaint();
+    public void setFont(Font f) {
+        if (!Objects.equals(getFont(), f)) {
+            super.setFont(f);
+            initFontMetrics();
+            layout();
+            repaint();
+        }
     }
 
     /**
--- a/src/solaris/classes/sun/awt/X11/XWindow.java	Thu Apr 09 21:57:37 2015 -0700
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java	Thu Apr 09 22:00:25 2015 -0700
@@ -32,7 +32,6 @@
 
 import java.lang.ref.WeakReference;
 
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
 import sun.util.logging.PlatformLogger;
@@ -491,14 +490,14 @@
         return embedded;
     }
 
-    public  void repaint(int x,int y, int width, int height) {
+    public final void repaint(int x,int y, int width, int height) {
         if (!isVisible()) {
             return;
         }
         Graphics g = getGraphics();
         if (g != null) {
             try {
-                g.setClip(x,y,width,height);
+                g.setClip(x, y, width, height);
                 paint(g);
             } finally {
                 g.dispose();
@@ -507,17 +506,7 @@
     }
 
     public  void repaint() {
-        if (!isVisible()) {
-            return;
-        }
-        Graphics g = getGraphics();
-        if (g != null) {
-            try {
-                paint(g);
-            } finally {
-                g.dispose();
-            }
-        }
+        repaint(0, 0, getWidth(), getHeight());
     }
 
     void paint(Graphics g) {
@@ -556,11 +545,11 @@
             && compAccessor.getWidth(target) != 0
             && compAccessor.getHeight(target) != 0)
         {
-            handleExposeEvent(target, x, y, w, h);
+            postPaintEvent(target, x, y, w, h);
         }
     }
 
-    public void handleExposeEvent(Component target, int x, int y, int w, int h) {
+    public void postPaintEvent(Component target, int x, int y, int w, int h) {
         PaintEvent event = PaintEventDispatcher.getPaintEventDispatcher().
             createPaintEvent(target, x, y, w, h);
         if (event != null) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Paint/ButtonRepaint.java	Thu Apr 09 22:00:25 2015 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import java.awt.peer.ButtonPeer;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ */
+public final class ButtonRepaint extends Button {
+
+    public static void main(final String[] args) {
+        for (int i = 0; i < 10; ++i) {
+            final Frame frame = new Frame();
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            ButtonRepaint button = new ButtonRepaint();
+            frame.add(button);
+            frame.setVisible(true);
+            sleep();
+            button.test();
+            frame.dispose();
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        super.paint(g);
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("Wrong thread");
+        }
+        test();
+    }
+
+    void test() {
+        setLabel("");
+        setLabel(null);
+        setLabel(getLabel());
+        ((ButtonPeer) getPeer()).setLabel("");
+        ((ButtonPeer) getPeer()).setLabel(null);
+        ((ButtonPeer) getPeer()).setLabel(getLabel());
+
+        setFont(null);
+        setFont(getFont());
+        getPeer().setFont(getFont());
+
+        setBackground(null);
+        setBackground(getBackground());
+        getPeer().setBackground(getBackground());
+
+        setForeground(null);
+        setForeground(getForeground());
+        getPeer().setForeground(getForeground());
+
+        setEnabled(isEnabled());
+        getPeer().setEnabled(isEnabled());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Paint/CheckboxRepaint.java	Thu Apr 09 22:00:25 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.peer.CheckboxPeer;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ */
+public final class CheckboxRepaint extends Checkbox {
+
+    public static void main(final String[] args) {
+        for (int i = 0; i < 10; ++i) {
+            final Frame frame = new Frame();
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            CheckboxRepaint checkbox = new CheckboxRepaint();
+            frame.add(checkbox);
+            frame.setVisible(true);
+            sleep();
+            checkbox.test();
+            frame.dispose();
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        super.paint(g);
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("Wrong thread");
+        }
+        test();
+    }
+
+    void test() {
+        setState(getState());
+        ((CheckboxPeer) getPeer()).setState(getState());
+
+        setCheckboxGroup(getCheckboxGroup());
+        ((CheckboxPeer) getPeer()).setCheckboxGroup(getCheckboxGroup());
+
+        setLabel("");
+        setLabel(null);
+        setLabel(getLabel());
+        ((CheckboxPeer) getPeer()).setLabel("");
+        ((CheckboxPeer) getPeer()).setLabel(null);
+        ((CheckboxPeer) getPeer()).setLabel(getLabel());
+
+        setFont(null);
+        setFont(getFont());
+        getPeer().setFont(getFont());
+
+        setBackground(null);
+        setBackground(getBackground());
+        getPeer().setBackground(getBackground());
+
+        setForeground(null);
+        setForeground(getForeground());
+        getPeer().setForeground(getForeground());
+
+        setEnabled(isEnabled());
+        getPeer().setEnabled(isEnabled());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Paint/ExposeOnEDT.java	Thu Apr 09 22:00:25 2015 -0700
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ * @run main ExposeOnEDT
+ */
+public final class ExposeOnEDT {
+
+    private static final Button buttonStub = new Button() {
+        @Override
+        public void paint(final Graphics g) {
+            buttonPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Canvas canvasStub = new Canvas() {
+        @Override
+        public void paint(final Graphics g) {
+            canvasPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Checkbox checkboxStub = new Checkbox() {
+        @Override
+        public void paint(final Graphics g) {
+            checkboxPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Choice choiceStub = new Choice() {
+        @Override
+        public void paint(final Graphics g) {
+            choicePainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Component lwComponentStub = new Component() {
+        @Override
+        public void paint(final Graphics g) {
+            lwPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Container containerStub = new Container() {
+        @Override
+        public void paint(final Graphics g) {
+            containerPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Frame frame = new Frame() {
+        @Override
+        public void paint(final Graphics g) {
+            super.paint(g);
+            framePainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Label labelStub = new Label() {
+        @Override
+        public void paint(final Graphics g) {
+            labelPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final List listStub = new List() {
+        @Override
+        public void paint(final Graphics g) {
+            listPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Panel panelStub = new Panel() {
+        @Override
+        public void paint(final Graphics g) {
+            panelPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Scrollbar scrollbarStub = new Scrollbar() {
+        @Override
+        public void paint(final Graphics g) {
+            scrollbarPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final ScrollPane scrollPaneStub = new ScrollPane() {
+        @Override
+        public void paint(final Graphics g) {
+            scrollPanePainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final TextArea textAreaStub = new TextArea() {
+        @Override
+        public void paint(final Graphics g) {
+            textAreaPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final TextField textFieldStub = new TextField() {
+        @Override
+        public void paint(final Graphics g) {
+            textFieldPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static volatile boolean lwPainted;
+    private static volatile boolean buttonPainted;
+    private static volatile boolean canvasPainted;
+    private static volatile boolean checkboxPainted;
+    private static volatile boolean choicePainted;
+    private static volatile boolean containerPainted;
+    private static volatile boolean framePainted;
+    private static volatile boolean labelPainted;
+    private static volatile boolean listPainted;
+    private static volatile boolean panelPainted;
+    private static volatile boolean scrollbarPainted;
+    private static volatile boolean scrollPanePainted;
+    private static volatile boolean textAreaPainted;
+    private static volatile boolean textFieldPainted;
+
+    public static void main(final String[] args) throws Exception {
+        //Frame initialisation
+        frame.setLayout(new GridLayout());
+        frame.setSize(new Dimension(200, 200));
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+        sleep();
+
+        frame.add(buttonStub);
+        frame.add(canvasStub);
+        frame.add(checkboxStub);
+        frame.add(choiceStub);
+        frame.add(lwComponentStub);
+        frame.add(containerStub);
+        frame.add(labelStub);
+        frame.add(listStub);
+        frame.add(panelStub);
+        frame.add(scrollbarStub);
+        frame.add(scrollPaneStub);
+        frame.add(textAreaStub);
+        frame.add(textFieldStub);
+        frame.validate();
+        sleep();
+
+        // Force expose event from the native system.
+        initPaintedFlags();
+        frame.setSize(300, 300);
+        frame.validate();
+        sleep();
+
+        //Check results.
+        validation();
+
+        cleanup();
+    }
+
+    private static void initPaintedFlags() {
+        lwPainted = false;
+        buttonPainted = false;
+        canvasPainted = false;
+        checkboxPainted = false;
+        choicePainted = false;
+        containerPainted = false;
+        framePainted = false;
+        labelPainted = false;
+        listPainted = false;
+        panelPainted = false;
+        scrollbarPainted = false;
+        scrollPanePainted = false;
+        textAreaPainted = false;
+        textFieldPainted = false;
+    }
+
+    private static void validation() {
+        if (!buttonPainted) {
+            fail("Paint is not called a Button ");
+        }
+        if (!canvasPainted) {
+            fail("Paint is not called a Canvas ");
+        }
+        if (!checkboxPainted) {
+            fail("Paint is not called a Checkbox ");
+        }
+        if (!choicePainted) {
+            fail("Paint is not called a Choice ");
+        }
+        if (!lwPainted) {
+            fail("Paint is not called on a lightweight");
+        }
+        if (!containerPainted) {
+            fail("Paint is not called on a Container");
+        }
+        if (!labelPainted) {
+            fail("Paint is not called on a Label");
+        }
+        if (!listPainted) {
+            fail("Paint is not called on a List");
+        }
+        if (!panelPainted) {
+            fail("Paint is not called on a Panel");
+        }
+        if (!scrollbarPainted) {
+            fail("Paint is not called on a Scrollbar");
+        }
+        if (!scrollPanePainted) {
+            fail("Paint is not called on a ScrollPane");
+        }
+        if (!textAreaPainted) {
+            fail("Paint is not called on a TextArea");
+        }
+        if (!textFieldPainted) {
+            fail("Paint is not called on a TextField");
+        }
+        if (!framePainted) {
+            fail("Paint is not called on a Frame when paintAll()");
+        }
+    }
+
+    private static void sleep() {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(1000L);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    private static void fail(final String message) {
+        cleanup();
+        throw new RuntimeException(message);
+    }
+
+    private static void cleanup() {
+        frame.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Paint/LabelRepaint.java	Thu Apr 09 22:00:25 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Label;
+import java.awt.peer.LabelPeer;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ */
+public final class LabelRepaint extends Label {
+
+    public static void main(final String[] args) {
+        for (int i = 0; i < 10; ++i) {
+            final Frame frame = new Frame();
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            LabelRepaint label = new LabelRepaint();
+            frame.add(label);
+            frame.setVisible(true);
+            sleep();
+            label.test();
+            frame.dispose();
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        super.paint(g);
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("Wrong thread");
+        }
+        test();
+    }
+
+    void test() {
+        setAlignment(getAlignment());
+        ((LabelPeer) getPeer()).setAlignment(getAlignment());
+
+        setText("");
+        setText(null);
+        setText(getText());
+        ((LabelPeer) getPeer()).setText("");
+        ((LabelPeer) getPeer()).setText(null);
+        ((LabelPeer) getPeer()).setText(getText());
+
+        setFont(null);
+        setFont(getFont());
+        getPeer().setFont(getFont());
+
+        setBackground(null);
+        setBackground(getBackground());
+        getPeer().setBackground(getBackground());
+
+        setForeground(null);
+        setForeground(getForeground());
+        getPeer().setForeground(getForeground());
+
+        setEnabled(isEnabled());
+        getPeer().setEnabled(isEnabled());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Paint/ListRepaint.java	Thu Apr 09 22:00:25 2015 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.List;
+import java.awt.peer.ListPeer;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ */
+public final class ListRepaint extends List {
+
+    public static void main(final String[] args) {
+        for (int i = 0; i < 10; ++i) {
+            final Frame frame = new Frame();
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            ListRepaint list = new ListRepaint();
+            list.add("1");
+            list.add("2");
+            list.add("3");
+            list.add("4");
+            list.select(0);
+            frame.add(list);
+            frame.setVisible(true);
+            sleep();
+            list.test();
+            frame.dispose();
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        super.paint(g);
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("Wrong thread");
+        }
+        test();
+    }
+
+    void test() {
+        select(0);
+        ((ListPeer) getPeer()).select(getSelectedIndex());
+
+        setFont(null);
+        setFont(getFont());
+        getPeer().setFont(getFont());
+
+        setBackground(null);
+        setBackground(getBackground());
+        getPeer().setBackground(getBackground());
+
+        setForeground(null);
+        setForeground(getForeground());
+        getPeer().setForeground(getForeground());
+
+        setEnabled(isEnabled());
+        getPeer().setEnabled(isEnabled());
+    }
+}