changeset 5418:7fdc1af4bf3f

Merge
author vinnie
date Wed, 20 Jun 2012 19:39:01 +0100
parents 52ab0f489dab (current diff) 19fb8a44120c (diff)
children e3977d38ecf1
files
diffstat 30 files changed, 1261 insertions(+), 630 deletions(-) [+]
line wrap: on
line diff
--- a/make/jprt.properties	Wed Jun 20 19:35:47 2012 +0100
+++ b/make/jprt.properties	Wed Jun 20 19:39:01 2012 +0100
@@ -89,6 +89,7 @@
     ${jprt.my.test.target.set:TESTNAME=jdk_text},		\
     ${jprt.my.test.target.set:TESTNAME=jdk_tools1},		\
     ${jprt.my.test.target.set:TESTNAME=jdk_tools2},		\
+    ${jprt.my.test.target.set:TESTNAME=jdk_jfr},		\
     ${jprt.my.test.target.set:TESTNAME=jdk_misc}
 
 # All vm test targets (testset=all)
--- a/src/macosx/classes/sun/awt/CGraphicsDevice.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/classes/sun/awt/CGraphicsDevice.java	Wed Jun 20 19:39:01 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -29,6 +29,7 @@
 import java.awt.GraphicsDevice;
 import java.awt.Window;
 import java.awt.AWTPermission;
+import java.awt.DisplayMode;
 
 import sun.java2d.opengl.CGLGraphicsConfig;
 
@@ -178,4 +179,36 @@
             peer.exitFullScreenMode();
         }
     }
+
+    @Override
+    public boolean isDisplayChangeSupported() {
+        return true;
+    }
+
+    @Override
+    public void setDisplayMode(DisplayMode dm) {
+        if (dm == null) {
+            throw new IllegalArgumentException("Attempt to set null as a DisplayMode");
+        }
+        nativeSetDisplayMode(displayID, dm.getWidth(), dm.getHeight(), dm.getBitDepth(), dm.getRefreshRate());
+        if (isFullScreenSupported() && getFullScreenWindow() != null) {
+            getFullScreenWindow().setSize(dm.getWidth(), dm.getHeight());
+        }
+    }
+
+    @Override
+    public DisplayMode getDisplayMode() {
+        return nativeGetDisplayMode(displayID);
+    }
+
+    @Override
+    public DisplayMode[] getDisplayModes() {
+        return nativeGetDisplayModes(displayID);
+    }
+
+    private native void nativeSetDisplayMode(int displayID, int w, int h, int bpp, int refrate);
+
+    private native DisplayMode nativeGetDisplayMode(int displayID);
+
+    private native DisplayMode[] nativeGetDisplayModes(int displayID);
 }
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Jun 20 19:39:01 2012 +0100
@@ -613,6 +613,17 @@
                 windowLocation.y + locationInWindow.y);
     }
 
+    /**
+     * Returns the cursor of the peer, which is cursor of the target by default,
+     * but peer can override this behavior.
+     *
+     * @param p Point relative to the peer.
+     * @return Cursor of the peer or null if default cursor should be used.
+     */
+    protected Cursor getCursor(final Point p) {
+        return getTarget().getCursor();
+    }
+
     @Override
     public void setBackground(final Color c) {
         final Color oldBg = getBackground();
--- a/src/macosx/classes/sun/lwawt/LWCursorManager.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/classes/sun/lwawt/LWCursorManager.java	Wed Jun 20 19:39:01 2012 +0100
@@ -36,32 +36,34 @@
 
 public abstract class LWCursorManager {
 
-    // A flag to indicate if the update is scheduled, so we don't
-    // process it twice
-    private AtomicBoolean updatePending = new AtomicBoolean(false);
+    /**
+     * A flag to indicate if the update is scheduled, so we don't process it
+     * twice.
+     */
+    private final AtomicBoolean updatePending = new AtomicBoolean(false);
 
     protected LWCursorManager() {
     }
 
-    /*
+    /**
      * Sets the cursor to correspond the component currently under mouse.
      *
      * This method should not be executed on the toolkit thread as it
      * calls to user code (e.g. Container.findComponentAt).
      */
-    public void updateCursor() {
+    public final void updateCursor() {
         updatePending.set(false);
         updateCursorImpl();
     }
 
-    /*
+    /**
      * Schedules updating the cursor on the corresponding event dispatch
      * thread for the given window.
      *
      * This method is called on the toolkit thread as a result of a
      * native update cursor request (e.g. WM_SETCURSOR on Windows).
      */
-    public void updateCursorLater(LWWindowPeer window) {
+    public final void updateCursorLater(final LWWindowPeer window) {
         if (updatePending.compareAndSet(false, true)) {
             Runnable r = new Runnable() {
                 @Override
@@ -74,45 +76,58 @@
     }
 
     private void updateCursorImpl() {
-        LWWindowPeer windowUnderCursor = LWWindowPeer.getWindowUnderCursor();
-        Point cursorPos = getCursorPosition();
-        LWComponentPeer<?, ?> componentUnderCursor = null;
-        // TODO: it's possible to get the component under cursor directly as
-        // it's stored in LWWindowPee anyway (lastMouseEventPeer)
-        if (windowUnderCursor != null) {
-            componentUnderCursor = windowUnderCursor.findPeerAt(cursorPos.x, cursorPos.y);
+        final Point cursorPos = getCursorPosition();
+        final Component c = findComponent(cursorPos);
+        final Cursor cursor;
+        final Object peer = LWToolkit.targetToPeer(c);
+        if (peer instanceof LWComponentPeer) {
+            final LWComponentPeer<?, ?> lwpeer = (LWComponentPeer<?, ?>) peer;
+            final Point p = lwpeer.getLocationOnScreen();
+            cursor = lwpeer.getCursor(new Point(cursorPos.x - p.x,
+                                                cursorPos.y - p.y));
+        } else {
+            cursor = (c != null) ? c.getCursor() : null;
         }
-        Cursor cursor = null;
-        if (componentUnderCursor != null) {
-            Component c = componentUnderCursor.getTarget();
+        setCursor(cursor);
+    }
+
+    /**
+     * Returns the first visible, enabled and showing component under cursor.
+     * Returns null for modal blocked windows.
+     *
+     * @param cursorPos Current cursor position.
+     * @return Component or null.
+     */
+    private static final Component findComponent(final Point cursorPos) {
+        final LWComponentPeer<?, ?> peer = LWWindowPeer.getPeerUnderCursor();
+        Component c = null;
+        if (peer != null && peer.getWindowPeerOrSelf().getBlocker() == null) {
+            c = peer.getTarget();
             if (c instanceof Container) {
-                Point p = componentUnderCursor.getLocationOnScreen();
-                c = ((Container)c).findComponentAt(cursorPos.x - p.x, cursorPos.y - p.y);
+                final Point p = peer.getLocationOnScreen();
+                c = ((Container) c).findComponentAt(cursorPos.x - p.x,
+                                                    cursorPos.y - p.y);
             }
-            // Traverse up to the first visible, enabled and showing component
             while (c != null) {
                 if (c.isVisible() && c.isEnabled() && (c.getPeer() != null)) {
                     break;
                 }
                 c = c.getParent();
             }
-            if (c != null) {
-                cursor = c.getCursor();
-            }
         }
-        // TODO: default cursor for modal blocked windows
-        setCursor(windowUnderCursor, cursor);
+        return c;
     }
 
-    /*
+    /**
      * Returns the current cursor position.
      */
     // TODO: make it public to reuse for MouseInfo
     protected abstract Point getCursorPosition();
 
-    /*
-     * Sets a cursor. The cursor can be null if the mouse is not over a Java window.
+    /**
+     * Sets a cursor. The cursor can be null if the mouse is not over a Java
+     * window.
+     * @param cursor the new {@code Cursor}.
      */
-    protected abstract void setCursor(LWWindowPeer windowUnderCursor, Cursor cursor);
-
+    protected abstract void setCursor(Cursor cursor);
 }
--- a/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Wed Jun 20 19:39:01 2012 +0100
@@ -27,6 +27,7 @@
 package sun.lwawt;
 
 import java.awt.Component;
+import java.awt.Cursor;
 import java.awt.Dimension;
 import java.awt.Point;
 import java.awt.TextArea;
@@ -72,6 +73,15 @@
     }
 
     @Override
+    protected Cursor getCursor(final Point p) {
+        final boolean isContains;
+        synchronized (getDelegateLock()) {
+            isContains = getDelegate().getViewport().getBounds().contains(p);
+        }
+        return isContains ? super.getCursor(p) : null;
+    }
+
+    @Override
     protected Component getDelegateFocusOwner() {
         return getTextComponent();
     }
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Jun 20 19:39:01 2012 +0100
@@ -807,9 +807,8 @@
                 }
                 mouseClickButtons &= ~eventButtonMask;
             }
-
-            notifyUpdateCursor();
         }
+        notifyUpdateCursor();
     }
 
     public void dispatchMouseWheelEvent(long when, int x, int y, int modifiers,
@@ -1070,6 +1069,10 @@
         return lastMouseEventPeer != null ? lastMouseEventPeer.getWindowPeerOrSelf() : null;
     }
 
+    public static LWComponentPeer<?, ?> getPeerUnderCursor() {
+        return lastMouseEventPeer;
+    }
+
     /*
      * Requests platform to set native focus on a frame/dialog.
      * In case of a simple window, triggers appropriate java focus change.
--- a/src/macosx/classes/sun/lwawt/macosx/CCursorManager.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/classes/sun/lwawt/macosx/CCursorManager.java	Wed Jun 20 19:39:01 2012 +0100
@@ -25,12 +25,14 @@
 
 package sun.lwawt.macosx;
 
-import java.awt.*;
+import sun.lwawt.LWCursorManager;
+
+import java.awt.Cursor;
+import java.awt.Point;
 import java.awt.geom.Point2D;
 
-import sun.lwawt.*;
+final class CCursorManager extends LWCursorManager {
 
-public class CCursorManager extends LWCursorManager {
     private static native Point2D nativeGetCursorPosition();
     private static native void nativeSetBuiltInCursor(final int type, final String name);
     private static native void nativeSetCustomCursor(final long imgPtr, final double x, final double y);
@@ -38,12 +40,12 @@
 
     private static final int NAMED_CURSOR = -1;
 
-    private final static CCursorManager theInstance = new CCursorManager();
+    private static final CCursorManager theInstance = new CCursorManager();
     public static CCursorManager getInstance() {
         return theInstance;
     }
 
-    Cursor currentCursor;
+    private volatile Cursor currentCursor;
 
     private CCursorManager() { }
 
@@ -63,8 +65,11 @@
     }
 
     @Override
-    protected void setCursor(final LWWindowPeer windowUnderCursor, final Cursor cursor) {
-        if (cursor == currentCursor) return;
+    protected void setCursor(final Cursor cursor) {
+        if (cursor == currentCursor) {
+            return;
+        }
+        currentCursor = cursor;
 
         if (cursor == null) {
             nativeSetBuiltInCursor(Cursor.DEFAULT_CURSOR, null);
@@ -72,10 +77,12 @@
         }
 
         if (cursor instanceof CCustomCursor) {
-            final CCustomCursor customCursor = ((CCustomCursor)cursor);
+            final CCustomCursor customCursor = (CCustomCursor) cursor;
             final long imagePtr = customCursor.getImageData();
-            final Point hotSpot = customCursor.getHotSpot();
-            if(imagePtr != 0L) nativeSetCustomCursor(imagePtr, hotSpot.x, hotSpot.y);
+            if (imagePtr != 0L) {
+                final Point hotSpot = customCursor.getHotSpot();
+                nativeSetCustomCursor(imagePtr, hotSpot.x, hotSpot.y);
+            }
             return;
         }
 
@@ -95,13 +102,6 @@
         throw new RuntimeException("Unimplemented");
     }
 
-    static long getNativeWindow(final LWWindowPeer window) {
-        if (window == null) return 0;
-        final CPlatformWindow platformWindow = (CPlatformWindow)window.getPlatformWindow();
-        if (platformWindow == null) return 0;
-        return platformWindow.getNSWindowPtr();
-    }
-
     // package private methods to handle cursor change during drag-and-drop
     private boolean isDragging = false;
     private Point dragPos = null;
@@ -110,9 +110,7 @@
         if (isDragging) {
             throw new RuntimeException("Invalid Drag state in CCursorManager!");
         }
-
         isDragging = true;
-
         dragPos = new Point(x, y);
     }
 
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jun 20 19:39:01 2012 +0100
@@ -368,9 +368,11 @@
             CWrapper.NSObject.release(screen);
         }
         // Convert between Cocoa's coordinate system and Java.
-        return new Insets(fullScreen.height - workArea.height - workArea.y,
-                          workArea.x, workArea.y,
-                          fullScreen.width - workArea.width - workArea.x);
+        int bottom = workArea.y - fullScreen.y;
+        int top = fullScreen.height - workArea.height - bottom;
+        int left = workArea.x - fullScreen.x;
+        int right = fullScreen.width - workArea.width - left;
+        return  new Insets(top, left, bottom, right);
     }
 
     @Override
--- a/src/macosx/native/sun/awt/AWTView.m	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/native/sun/awt/AWTView.m	Wed Jun 20 19:39:01 2012 +0100
@@ -188,7 +188,9 @@
 #endif
         }
     } else {
+#if IM_DEBUG
         NSLog(@"-> IM does not want to handle event");
+#endif
         [self deliverJavaMouseEvent: event];
     }
 }
--- a/src/macosx/native/sun/awt/CGraphicsDevice.m	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/macosx/native/sun/awt/CGraphicsDevice.m	Wed Jun 20 19:39:01 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -26,6 +26,84 @@
 #include "LWCToolkit.h"
 
 /*
+ * Convert the mode string to the more convinient bits per pixel value
+ */
+static int getBPPFromModeString(CFStringRef mode) 
+{
+    if ((CFStringCompare(mode, CFSTR(kIO30BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)) {
+        // This is a strange mode, where we using 10 bits per RGB component and pack it into 32 bits
+        // Java is not ready to work with this mode but we have to specify it as supported
+        return 30;
+    }
+    else if (CFStringCompare(mode, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+        return 32;
+    }
+    else if (CFStringCompare(mode, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+        return 16;
+    }
+    else if (CFStringCompare(mode, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+        return 8;
+    }
+    
+    return 0;
+}
+
+/*
+ * Find the best possible match in the list of display modes that we can switch to based on
+ * the provided parameters.
+ */
+static CGDisplayModeRef getBestModeForParameters(CFArrayRef allModes, int w, int h, int bpp, int refrate) {
+    CGDisplayModeRef bestGuess = NULL;
+    CFIndex numModes = CFArrayGetCount(allModes), n;
+    int thisBpp = 0;
+    for(n = 0; n < numModes; n++ ) {
+        CGDisplayModeRef cRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(allModes, n);
+        if(cRef == NULL) {
+            continue;
+        }
+        CFStringRef modeString = CGDisplayModeCopyPixelEncoding(cRef);
+        thisBpp = getBPPFromModeString(modeString);
+        CFRelease(modeString);
+        if (thisBpp != bpp || (int)CGDisplayModeGetHeight(cRef) != h || (int)CGDisplayModeGetWidth(cRef) != w) {
+            // One of the key parameters does not match
+            continue;
+        }
+        // Refresh rate might be 0 in display mode and we ask for specific display rate
+        // but if we do not find exact match then 0 refresh rate might be just Ok
+        if (CGDisplayModeGetRefreshRate(cRef) == refrate) {
+            // Exact match
+            return cRef;
+        }
+        if (CGDisplayModeGetRefreshRate(cRef) == 0) {
+            // Not exactly what was asked for, but may fit our needs if we don't find an exact match
+            bestGuess = cRef;
+        }
+    }
+    return bestGuess;
+}
+
+/*
+ * Create a new java.awt.DisplayMode instance based on provided CGDisplayModeRef
+ */
+static jobject createJavaDisplayMode(CGDisplayModeRef mode, JNIEnv *env, jint displayID) {
+    jobject ret = NULL;
+    jint h, w, bpp, refrate;
+    JNF_COCOA_ENTER(env);
+    CFStringRef currentBPP = CGDisplayModeCopyPixelEncoding(mode);
+    bpp = getBPPFromModeString(currentBPP);
+    refrate = CGDisplayModeGetRefreshRate(mode);
+    h = CGDisplayModeGetHeight(mode);
+    w = CGDisplayModeGetWidth(mode);
+    CFRelease(currentBPP);
+    static JNF_CLASS_CACHE(jc_DisplayMode, "java/awt/DisplayMode");
+    static JNF_CTOR_CACHE(jc_DisplayMode_ctor, jc_DisplayMode, "(IIII)V");
+    ret = JNFNewObject(env, jc_DisplayMode_ctor, w, h, bpp, refrate);
+    JNF_COCOA_EXIT(env);
+    return ret;
+}
+
+
+/*
  * Class:     sun_awt_CGraphicsDevice
  * Method:    nativeGetXResolution
  * Signature: (I)D
@@ -62,3 +140,89 @@
     jfloat dpi = rect.size.height / inches;
     return dpi;
 }
+
+/*
+ * Class:     sun_awt_CGraphicsDevice
+ * Method:    nativeSetDisplayMode
+ * Signature: (IIIII)V
+ */
+JNIEXPORT void JNICALL
+Java_sun_awt_CGraphicsDevice_nativeSetDisplayMode
+(JNIEnv *env, jclass class, jint displayID, jint w, jint h, jint bpp, jint refrate)
+{
+    JNF_COCOA_ENTER(env);
+    CFArrayRef allModes = CGDisplayCopyAllDisplayModes(displayID, NULL);
+    CGDisplayModeRef closestMatch = getBestModeForParameters(allModes, (int)w, (int)h, (int)bpp, (int)refrate);
+    if (closestMatch != NULL) {
+        [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+            CGDisplayConfigRef config;
+            CGError retCode = CGBeginDisplayConfiguration(&config);
+            if (retCode == kCGErrorSuccess) {
+                CGConfigureDisplayWithDisplayMode(config, displayID, closestMatch, NULL);
+                CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly);
+                if (config != NULL) {
+                    CFRelease(config);
+                }
+            }
+        }];
+    }
+    CFRelease(allModes);
+    JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class:     sun_awt_CGraphicsDevice
+ * Method:    nativeGetDisplayMode
+ * Signature: (I)Ljava/awt/DisplayMode
+ */
+JNIEXPORT jobject JNICALL
+Java_sun_awt_CGraphicsDevice_nativeGetDisplayMode
+(JNIEnv *env, jclass class, jint displayID)
+{
+    jobject ret = NULL;
+    CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(displayID);
+    ret = createJavaDisplayMode(currentMode, env, displayID);
+    CGDisplayModeRelease(currentMode);
+    return ret;
+}
+
+/*
+ * Class:     sun_awt_CGraphicsDevice
+ * Method:    nativeGetDisplayMode
+ * Signature: (I)[Ljava/awt/DisplayModes
+ */
+JNIEXPORT jobjectArray JNICALL
+Java_sun_awt_CGraphicsDevice_nativeGetDisplayModes
+(JNIEnv *env, jclass class, jint displayID)
+{
+    jobjectArray jreturnArray = NULL;
+    JNF_COCOA_ENTER(env);
+    CFArrayRef allModes = CGDisplayCopyAllDisplayModes(displayID, NULL);
+    CFIndex numModes = CFArrayGetCount(allModes);
+    static JNF_CLASS_CACHE(jc_DisplayMode, "java/awt/DisplayMode");
+
+    jreturnArray = JNFNewObjectArray(env, &jc_DisplayMode, (jsize) numModes);
+    if (!jreturnArray) {
+        NSLog(@"CGraphicsDevice can't create java array of DisplayMode objects");
+        return nil;
+    }
+
+    CFIndex n;
+    for (n=0; n < numModes; n++) {
+        CGDisplayModeRef cRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(allModes, n);
+        if (cRef != NULL) {
+            jobject oneMode = createJavaDisplayMode(cRef, env, displayID);
+            (*env)->SetObjectArrayElement(env, jreturnArray, n, oneMode);
+            if ((*env)->ExceptionOccurred(env)) {
+                (*env)->ExceptionDescribe(env);
+                (*env)->ExceptionClear(env);
+                continue;
+            }
+            (*env)->DeleteLocalRef(env, oneMode);
+        }
+    }
+    CFRelease(allModes);
+    JNF_COCOA_EXIT(env);
+
+    return jreturnArray;
+}
--- a/src/share/classes/com/sun/beans/TypeResolver.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/share/classes/com/sun/beans/TypeResolver.java	Wed Jun 20 19:39:01 2012 +0100
@@ -154,7 +154,7 @@
      * @see #resolve(Type)
      */
     public static Type resolve(Type actual, Type formal) {
-        return new TypeResolver(actual).resolve(formal);
+        return getTypeResolver(actual).resolve(formal);
     }
 
     /**
@@ -169,7 +169,7 @@
      * @see #resolve(Type[])
      */
     public static Type[] resolve(Type actual, Type[] formals) {
-        return new TypeResolver(actual).resolve(formals);
+        return getTypeResolver(actual).resolve(formals);
     }
 
     /**
@@ -228,9 +228,20 @@
         return classes;
     }
 
+    public static TypeResolver getTypeResolver(Type type) {
+        synchronized (CACHE) {
+            TypeResolver resolver = CACHE.get(type);
+            if (resolver == null) {
+                resolver = new TypeResolver(type);
+                CACHE.put(type, resolver);
+            }
+            return resolver;
+        }
+    }
 
-    private final Map<TypeVariable<?>, Type> map
-        = new HashMap<TypeVariable<?>, Type>();
+    private static final WeakCache<Type, TypeResolver> CACHE = new WeakCache<>();
+
+    private final Map<TypeVariable<?>, Type> map = new HashMap<>();
 
     /**
      * Constructs the type resolver for the given actual type.
--- a/src/share/classes/java/awt/Dialog.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/share/classes/java/awt/Dialog.java	Wed Jun 20 19:39:01 2012 +0100
@@ -1037,7 +1037,7 @@
                 predictedFocusOwner = getMostRecentFocusOwner();
                 if (conditionalShow(predictedFocusOwner, time)) {
                     modalFilter = ModalEventFilter.createFilterForDialog(this);
-                    Conditional cond = new Conditional() {
+                    final Conditional cond = new Conditional() {
                         @Override
                         public boolean evaluate() {
                             return windowClosingException == null;
@@ -1067,7 +1067,12 @@
 
                     modalityPushed();
                     try {
-                        EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+                        final EventQueue eventQueue = AccessController.doPrivileged(
+                            new PrivilegedAction<EventQueue>() {
+                                public EventQueue run() {
+                                    return Toolkit.getDefaultToolkit().getSystemEventQueue();
+                                }
+                        });
                         secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0);
                         if (!secondaryLoop.enter()) {
                             secondaryLoop = null;
--- a/src/share/classes/java/io/SerialCallbackContext.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/share/classes/java/io/SerialCallbackContext.java	Wed Jun 20 19:39:01 2012 +0100
@@ -1,54 +1,74 @@
-  /*
-   * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-   * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-   */
-
-  package java.io;
+/*
+ * Copyright (c) 2006, 2012, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
 
-  /**
-   * Context during upcalls from object stream to class-defined
-   * readObject/writeObject methods.
-   * Holds object currently being deserialized and descriptor for current class.
-   *
-   * This context keeps track of the thread it was constructed on, and allows
-   * only a single call of defaultReadObject, readFields, defaultWriteObject
-   * or writeFields which must be invoked on the same thread before the class's
-   * readObject/writeObject method has returned.
-   * If not set to the current thread, the getObj method throws NotActiveException.
-   */
-  final class SerialCallbackContext {
-      private final Object obj;
-      private final ObjectStreamClass desc;
-      /**
-       * Thread this context is in use by.
-       * As this only works in one thread, we do not need to worry about thread-safety.
-       */
-      private Thread thread;
+package java.io;
 
-      public SerialCallbackContext(Object obj, ObjectStreamClass desc) {
-          this.obj = obj;
-          this.desc = desc;
-          this.thread = Thread.currentThread();
-      }
-
-      public Object getObj() throws NotActiveException {
-          checkAndSetUsed();
-          return obj;
-      }
+/**
+ * Context during upcalls from object stream to class-defined
+ * readObject/writeObject methods.
+ * Holds object currently being deserialized and descriptor for current class.
+ *
+ * This context keeps track of the thread it was constructed on, and allows
+ * only a single call of defaultReadObject, readFields, defaultWriteObject
+ * or writeFields which must be invoked on the same thread before the class's
+ * readObject/writeObject method has returned.
+ * If not set to the current thread, the getObj method throws NotActiveException.
+ */
+final class SerialCallbackContext {
+    private final Object obj;
+    private final ObjectStreamClass desc;
+    /**
+     * Thread this context is in use by.
+     * As this only works in one thread, we do not need to worry about thread-safety.
+     */
+    private Thread thread;
 
-      public ObjectStreamClass getDesc() {
-          return desc;
-      }
+    public SerialCallbackContext(Object obj, ObjectStreamClass desc) {
+        this.obj = obj;
+        this.desc = desc;
+        this.thread = Thread.currentThread();
+    }
+
+    public Object getObj() throws NotActiveException {
+        checkAndSetUsed();
+        return obj;
+    }
 
-      private void checkAndSetUsed() throws NotActiveException {
-          if (thread != Thread.currentThread()) {
-               throw new NotActiveException(
-                "not in readObject invocation or fields already read");
-          }
-          thread = null;
-      }
+    public ObjectStreamClass getDesc() {
+        return desc;
+    }
 
-      public void setUsed() {
-          thread = null;
-      }
-  }
+    private void checkAndSetUsed() throws NotActiveException {
+        if (thread != Thread.currentThread()) {
+             throw new NotActiveException(
+              "not in readObject invocation or fields already read");
+        }
+        thread = null;
+    }
+
+    public void setUsed() {
+        thread = null;
+    }
+}
--- a/src/share/classes/javax/swing/text/html/parser/Parser.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/share/classes/javax/swing/text/html/parser/Parser.java	Wed Jun 20 19:39:01 2012 +0100
@@ -1986,8 +1986,6 @@
             if (i == SCRIPT_END_TAG.length) {
 
                 /*  '</script>' tag detected */
-                /* Here, ch == '>' */
-                ch = readCh();
                 /* Here, ch == the first character after </script> */
                 return;
             } else {
@@ -2060,6 +2058,8 @@
                 handleComment(str.toCharArray());
                 endTag(false);
                 lastBlockStartPos = currentPosition;
+
+                continue;
             } else {
                 switch (c) {
                   case '<':
--- a/src/share/classes/sun/print/ServiceDialog.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/share/classes/sun/print/ServiceDialog.java	Wed Jun 20 19:39:01 2012 +0100
@@ -429,6 +429,7 @@
         ValidatingFileChooser jfc = new ValidatingFileChooser();
         jfc.setApproveButtonText(getMsg("button.ok"));
         jfc.setDialogTitle(getMsg("dialog.printtofile"));
+        jfc.setDialogType(JFileChooser.SAVE_DIALOG);
         jfc.setSelectedFile(fileDest);
 
         int returnVal = jfc.showDialog(this, null);
--- a/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	Wed Jun 20 19:39:01 2012 +0100
@@ -337,7 +337,7 @@
     /* Save the data currently in the buffer */
     offset = src->pub.bytes_in_buffer;
     if (src->pub.next_input_byte > src->inbuf) {
-        memcpy(src->inbuf, src->pub.next_input_byte, offset);
+        memmove(src->inbuf, src->pub.next_input_byte, offset);
     }
     RELEASE_ARRAYS(env, src);
     buflen = (*env)->GetArrayLength(env, src->hInputBuffer) - offset;
--- a/src/solaris/native/sun/awt/swing_GTKEngine.c	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/solaris/native/sun/awt/swing_GTKEngine.c	Wed Jun 20 19:39:01 2012 +0100
@@ -323,9 +323,8 @@
 JNIEXPORT void JNICALL Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1switch_1theme(
         JNIEnv *env, jobject this)
 {
-    fp_gdk_threads_enter();
+    // Note that flush_gtk_event_loop takes care of locks (7053002)
     flush_gtk_event_loop();
-    fp_gdk_threads_leave();
 }
 
 /*
--- a/src/windows/native/sun/windows/awt_TextArea.cpp	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/windows/native/sun/windows/awt_TextArea.cpp	Wed Jun 20 19:39:01 2012 +0100
@@ -74,135 +74,10 @@
     AwtTextComponent::Dispose();
 }
 
-LPCTSTR AwtTextArea::GetClassName() {
-    static BOOL richedLibraryLoaded = FALSE;
-    if (!richedLibraryLoaded) {
-        JDK_LoadSystemLibrary("RICHED20.DLL");
-        richedLibraryLoaded = TRUE;
-    }
-    return RICHEDIT_CLASS;
-}
-
 /* Create a new AwtTextArea object and window.   */
 AwtTextArea* AwtTextArea::Create(jobject peer, jobject parent)
 {
-    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
-    jobject target = NULL;
-    AwtTextArea* c = NULL;
-
-    try {
-        if (env->EnsureLocalCapacity(1) < 0) {
-            return NULL;
-        }
-
-        PDATA pData;
-        AwtCanvas* awtParent;
-        JNI_CHECK_PEER_GOTO(parent, done);
-
-        awtParent = (AwtCanvas*)pData;
-        JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
-
-        target = env->GetObjectField(peer, AwtObject::targetID);
-        JNI_CHECK_NULL_GOTO(target, "null target", done);
-
-        c = new AwtTextArea();
-
-        {
-            /* Adjust style for scrollbar visibility and word wrap  */
-          DWORD scroll_style;
-          jint scrollbarVisibility =
-              env->GetIntField(target, AwtTextArea::scrollbarVisibilityID);
-
-          switch (scrollbarVisibility) {
-            case java_awt_TextArea_SCROLLBARS_NONE:
-              scroll_style = ES_AUTOVSCROLL;
-              break;
-            case java_awt_TextArea_SCROLLBARS_VERTICAL_ONLY:
-              scroll_style = WS_VSCROLL | ES_AUTOVSCROLL;
-              break;
-            case java_awt_TextArea_SCROLLBARS_HORIZONTAL_ONLY:
-              scroll_style = WS_HSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL;
-              break;
-            case java_awt_TextArea_SCROLLBARS_BOTH:
-              scroll_style = WS_VSCROLL | WS_HSCROLL |
-                  ES_AUTOVSCROLL | ES_AUTOHSCROLL;
-              break;
-          }
-
-          /*
-           * Specify ES_DISABLENOSCROLL - RichEdit control style to disable
-           * scrollbars instead of hiding them when not needed.
-           */
-          DWORD style = WS_CHILD | WS_CLIPSIBLINGS | ES_LEFT | ES_MULTILINE |
-              ES_WANTRETURN | scroll_style | ES_DISABLENOSCROLL;
-          DWORD exStyle = WS_EX_CLIENTEDGE;
-          if (GetRTL()) {
-              exStyle |= WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR;
-              if (GetRTLReadingOrder())
-                  exStyle |= WS_EX_RTLREADING;
-          }
-
-          jint x = env->GetIntField(target, AwtComponent::xID);
-          jint y = env->GetIntField(target, AwtComponent::yID);
-          jint width = env->GetIntField(target, AwtComponent::widthID);
-          jint height = env->GetIntField(target, AwtComponent::heightID);
-
-          c->CreateHWnd(env, L"", style, exStyle,
-                        x, y, width, height,
-                        awtParent->GetHWnd(),
-                        reinterpret_cast<HMENU>(static_cast<INT_PTR>(
-                awtParent->CreateControlID())),
-                        ::GetSysColor(COLOR_WINDOWTEXT),
-                        ::GetSysColor(COLOR_WINDOW),
-                        peer);
-
-          // Fix for 4753116.
-          // If it is not win95 (we are using Richedit 2.0)
-          // we set plain text mode, in which the control is
-          // similar to a standard edit control:
-          //  - The text in a plain text control can have only
-          //    one format.
-          //  - The user cannot paste rich text formats, such as RTF
-          //    or embedded objects into a plain text control.
-          //  - Rich text mode controls always have a default
-          //    end-of-document marker or carriage return,
-          //    to format paragraphs.
-          // kdm@sparc.spb.su
-          c->SendMessage(EM_SETTEXTMODE, TM_PLAINTEXT, 0);
-
-          c->m_backgroundColorSet = TRUE;
-          /* suppress inheriting parent's color. */
-          c->UpdateBackground(env, target);
-          c->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN,
-                         MAKELPARAM(1, 1));
-          /*
-           * Fix for BugTraq Id 4260109.
-           * Set the text limit to the maximum.
-           * Use EM_EXLIMITTEXT for RichEdit controls.
-           * For some reason RichEdit 1.0 becomes read-only if the
-           * specified limit is greater than 0x7FFFFFFD.
-           */
-          c->SendMessage(EM_EXLIMITTEXT, 0, 0x7FFFFFFD);
-
-          /* Unregister RichEdit built-in drop target. */
-          VERIFY(::RevokeDragDrop(c->GetHWnd()) != DRAGDROP_E_INVALIDHWND);
-
-          /* To enforce CF_TEXT format for paste operations. */
-          VERIFY(c->SendMessage(EM_SETOLECALLBACK, 0,
-                                (LPARAM)&GetOleCallback()));
-
-          c->SendMessage(EM_SETEVENTMASK, 0, ENM_CHANGE);
-        }
-    } catch (...) {
-        env->DeleteLocalRef(target);
-        throw;
-    }
-
-done:
-    env->DeleteLocalRef(target);
-
-    return c;
+    return (AwtTextArea*) AwtTextComponent::Create(peer, parent, true);
 }
 
 void AwtTextArea::EditSetSel(CHARRANGE &cr) {
@@ -220,11 +95,6 @@
     SendMessage(EM_EXGETSEL, 0, reinterpret_cast<LPARAM>(&cr));
 }
 
-LONG AwtTextArea::EditGetCharFromPos(POINT& pt) {
-    return static_cast<LONG>(SendMessage(EM_CHARFROMPOS, 0,
-            reinterpret_cast<LPARAM>(&pt)));
-}
-
 /* Count how many '\n's are there in jStr */
 size_t AwtTextArea::CountNewLines(JNIEnv *env, jstring jStr, size_t maxlen)
 {
@@ -253,34 +123,6 @@
 
 BOOL AwtTextArea::InheritsNativeMouseWheelBehavior() {return true;}
 
-MsgRouting
-AwtTextArea::PreProcessMsg(MSG& msg)
-{
-    MsgRouting mr = mrPassAlong;
-    static BOOL bPassAlongWmLButtonUp = TRUE;
-
-    if (msg.message == WM_LBUTTONDBLCLK) {
-        bPassAlongWmLButtonUp = FALSE;
-    }
-
-    /*
-     * For some reason RichEdit 1.0 filters out WM_LBUTTONUP after
-     * WM_LBUTTONDBLCLK. To work around this "feature" we send WM_LBUTTONUP
-     * directly to the window procedure and consume instead of passing it
-     * to the next hook.
-     */
-    if (msg.message == WM_LBUTTONUP && bPassAlongWmLButtonUp == FALSE) {
-        SendMessage(WM_LBUTTONUP, msg.wParam, msg.lParam);
-        bPassAlongWmLButtonUp = TRUE;
-        mr = mrConsume;
-    }
-
-    if (mr == mrPassAlong) {
-        mr = AwtComponent::PreProcessMsg(msg);
-    }
-
-    return mr;
-}
 
 LRESULT
 AwtTextArea::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
@@ -800,54 +642,6 @@
     return returnVal;
 }
 
-/*
- * WM_CTLCOLOR is not sent by rich edit controls.
- * Use EM_SETCHARFORMAT and EM_SETBKGNDCOLOR to set
- * respectively foreground and background color.
- */
-void AwtTextArea::SetColor(COLORREF c) {
-    AwtComponent::SetColor(c);
-
-    CHARFORMAT cf;
-    memset(&cf, 0, sizeof(cf));
-    cf.cbSize = sizeof(cf);
-    cf.dwMask = CFM_COLOR;
-
-    cf.crTextColor = ::IsWindowEnabled(GetHWnd()) ? GetColor() : ::GetSysColor(COLOR_3DSHADOW);
-
-    /*
-     * The documentation for EM_GETCHARFORMAT is not exactly
-     * correct. It appears that wParam has the same meaning
-     * as for EM_SETCHARFORMAT. Our task is to secure that
-     * all the characters in the control have the required
-     * formatting. That's why we use SCF_ALL.
-     */
-    VERIFY(SendMessage(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf));
-    VERIFY(SendMessage(EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf));
-}
-
-/*
- * In responce to EM_SETBKGNDCOLOR rich edit changes
- * its bg color and repaints itself so we don't need
- * to force repaint.
- */
-void AwtTextArea::SetBackgroundColor(COLORREF c) {
-    AwtComponent::SetBackgroundColor(c);
-    SendMessage(EM_SETBKGNDCOLOR, (WPARAM)FALSE, (LPARAM)GetBackgroundColor());
-}
-
-/*
- * Disabled edit control has grayed foreground.
- * Disabled RichEdit 1.0 control has original foreground.
- * Thus we have to set grayed foreground manually.
- */
-void AwtTextArea::Enable(BOOL bEnable)
-{
-    AwtComponent::Enable(bEnable);
-
-    SetColor(GetColor());
-}
-
 
 /* Fix for 4776535, 4648702
  * If width is 0 or 1 Windows hides the horizontal scroll bar even
@@ -1048,133 +842,3 @@
 } /* extern "C" */
 
 
-AwtTextArea::OleCallback AwtTextArea::sm_oleCallback;
-
-/************************************************************************
- * Inner class OleCallback definition.
- */
-
-AwtTextArea::OleCallback::OleCallback() {
-    m_refs = 0;
-    AddRef();
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj) {
-
-    TRY;
-
-    if (::IsEqualIID(riid, IID_IUnknown)) {
-        *ppvObj = (void __RPC_FAR *__RPC_FAR)(IUnknown*)this;
-        AddRef();
-        return S_OK;
-    } else if (::IsEqualIID(riid, IID_IRichEditOleCallback)) {
-        *ppvObj = (void __RPC_FAR *__RPC_FAR)(IRichEditOleCallback*)this;
-        AddRef();
-        return S_OK;
-    } else {
-        *ppvObj = NULL;
-        return E_NOINTERFACE;
-    }
-
-    CATCH_BAD_ALLOC_RET(E_OUTOFMEMORY);
-}
-
-STDMETHODIMP_(ULONG)
-AwtTextArea::OleCallback::AddRef() {
-    return ++m_refs;
-}
-
-STDMETHODIMP_(ULONG)
-AwtTextArea::OleCallback::Release() {
-    int refs;
-
-    if ((refs = --m_refs) == 0) delete this;
-
-    return (ULONG)refs;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::GetNewStorage(LPSTORAGE FAR * ppstg) {
-    return E_NOTIMPL;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::GetInPlaceContext(LPOLEINPLACEFRAME FAR * ppipframe,
-                                                 LPOLEINPLACEUIWINDOW FAR* ppipuiDoc,
-                                                 LPOLEINPLACEFRAMEINFO pipfinfo)
-{
-    return E_NOTIMPL;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::ShowContainerUI(BOOL fShow) {
-    return E_NOTIMPL;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::QueryInsertObject(LPCLSID pclsid,
-                                                 LPSTORAGE pstg,
-                                                 LONG cp) {
-    return NOERROR;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::DeleteObject(LPOLEOBJECT poleobj) {
-    return NOERROR;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::QueryAcceptData(LPDATAOBJECT pdataobj,
-                                               CLIPFORMAT *pcfFormat,
-                                               DWORD reco,
-                                               BOOL fReally,
-                                               HGLOBAL hMetaPict) {
-    if (reco == RECO_PASTE) {
-        // If CF_TEXT format is available edit controls will select it,
-        // otherwise if it is CF_UNICODETEXT is available it will be
-        // selected, otherwise if CF_OEMTEXT is available it will be selected.
-        if (::IsClipboardFormatAvailable(CF_TEXT)) {
-            *pcfFormat = CF_TEXT;
-        } else if (::IsClipboardFormatAvailable(CF_UNICODETEXT)) {
-            *pcfFormat = CF_UNICODETEXT;
-        } else if (::IsClipboardFormatAvailable(CF_OEMTEXT)) {
-            *pcfFormat = CF_OEMTEXT;
-        } else {
-            // Don't allow rich edit to paste clipboard data
-            // in other formats.
-            *pcfFormat = CF_TEXT;
-        }
-    }
-
-    return NOERROR;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::ContextSensitiveHelp(BOOL fEnterMode) {
-    return NOERROR;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::GetClipboardData(CHARRANGE *pchrg,
-                                                DWORD reco,
-                                                LPDATAOBJECT *ppdataobj) {
-    return E_NOTIMPL;
-}
-
-STDMETHODIMP
-AwtTextArea::OleCallback::GetDragDropEffect(BOOL fDrag,
-                                                 DWORD grfKeyState,
-                                                 LPDWORD pdwEffect) {
-
-    return E_NOTIMPL;
-}
-
-
-STDMETHODIMP
-AwtTextArea::OleCallback::GetContextMenu(WORD seltype,
-                                              LPOLEOBJECT lpoleobj,
-                                              CHARRANGE FAR * lpchrg,
-                                              HMENU FAR * lphmenu) {
-    return E_NOTIMPL;
-}
--- a/src/windows/native/sun/windows/awt_TextArea.h	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/windows/native/sun/windows/awt_TextArea.h	Wed Jun 20 19:39:01 2012 +0100
@@ -51,15 +51,11 @@
 
     virtual void Dispose();
 
-    LPCTSTR GetClassName();
-
     static AwtTextArea* Create(jobject self, jobject parent);
 
     static size_t CountNewLines(JNIEnv *env, jstring jStr, size_t maxlen);
     static size_t GetALength(JNIEnv* env, jstring jStr, size_t maxlen);
 
-    MsgRouting PreProcessMsg(MSG& msg);
-
     LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
     static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
                                      WPARAM wParam, LPARAM lParam);
@@ -72,9 +68,6 @@
 
     INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
 
-    virtual void SetColor(COLORREF c);
-    virtual void SetBackgroundColor(COLORREF c);
-    virtual void Enable(BOOL bEnable);
     virtual BOOL InheritsNativeMouseWheelBehavior();
     virtual void Reshape(int x, int y, int w, int h);
 
@@ -87,40 +80,8 @@
 
 protected:
 
-    /*****************************************************************
-     * Inner class OleCallback declaration.
-     */
-    class OleCallback : public IRichEditOleCallback {
-    public:
-        OleCallback();
-
-        STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
-        STDMETHODIMP_(ULONG) AddRef();
-        STDMETHODIMP_(ULONG) Release();
-        STDMETHODIMP GetNewStorage(LPSTORAGE FAR * ppstg);
-        STDMETHODIMP GetInPlaceContext(LPOLEINPLACEFRAME FAR * ppipframe,
-                                       LPOLEINPLACEUIWINDOW FAR* ppipuiDoc,
-                                       LPOLEINPLACEFRAMEINFO pipfinfo);
-        STDMETHODIMP ShowContainerUI(BOOL fShow);
-        STDMETHODIMP QueryInsertObject(LPCLSID pclsid, LPSTORAGE pstg, LONG cp);
-        STDMETHODIMP DeleteObject(LPOLEOBJECT poleobj);
-        STDMETHODIMP QueryAcceptData(LPDATAOBJECT pdataobj, CLIPFORMAT *pcfFormat,
-                                     DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
-        STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
-        STDMETHODIMP GetClipboardData(CHARRANGE *pchrg, DWORD reco,
-                                      LPDATAOBJECT *ppdataobj);
-        STDMETHODIMP GetDragDropEffect(BOOL fDrag, DWORD grfKeyState,
-                                       LPDWORD pdwEffect);
-        STDMETHODIMP GetContextMenu(WORD seltype, LPOLEOBJECT poleobj,
-                                    CHARRANGE FAR * pchrg, HMENU FAR * phmenu);
-    private:
-        ULONG             m_refs; // Reference count
-    };//OleCallback class
-
-    INLINE static OleCallback& GetOleCallback() { return sm_oleCallback; }
     void EditSetSel(CHARRANGE &cr);
     void EditGetSel(CHARRANGE &cr);
-    LONG EditGetCharFromPos(POINT& pt);
   private:
     // RichEdit 1.0 control generates EN_CHANGE notifications not only
     // on text changes, but also on any character formatting change.
@@ -140,8 +101,6 @@
     LONG    m_lVDeltaAccum;
 
 
-    static OleCallback sm_oleCallback;
-
 };
 
 #endif /* AWT_TEXTAREA_H */
--- a/src/windows/native/sun/windows/awt_TextComponent.cpp	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/windows/native/sun/windows/awt_TextComponent.cpp	Wed Jun 20 19:39:01 2012 +0100
@@ -25,6 +25,8 @@
 
 #include "awt_Toolkit.h"
 #include "awt_TextComponent.h"
+#include "awt_TextArea.h"
+#include "awt_TextField.h"
 #include "awt_Canvas.h"
 
 #include "jni.h"
@@ -70,7 +72,152 @@
 }
 
 LPCTSTR AwtTextComponent::GetClassName() {
-    return TEXT("EDIT");  /* System provided edit control class */
+    static BOOL richedLibraryLoaded = FALSE;
+    if (!richedLibraryLoaded) {
+        JDK_LoadSystemLibrary("RICHED20.DLL");
+        richedLibraryLoaded = TRUE;
+    }
+    return RICHEDIT_CLASS;
+}
+
+/* Create a new AwtTextArea or AwtTextField object and window.   */
+AwtTextComponent* AwtTextComponent::Create(jobject peer, jobject parent, BOOL isMultiline)
+{
+    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+
+    jobject target = NULL;
+    AwtTextComponent* c = NULL;
+
+    try {
+        if (env->EnsureLocalCapacity(1) < 0) {
+            return NULL;
+        }
+
+        PDATA pData;
+        AwtCanvas* awtParent;
+        JNI_CHECK_PEER_GOTO(parent, done);
+
+        awtParent = (AwtCanvas*)pData;
+        JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
+
+        target = env->GetObjectField(peer, AwtObject::targetID);
+        JNI_CHECK_NULL_GOTO(target, "null target", done);
+
+        if(isMultiline){
+            c = new AwtTextArea();
+        }else{
+            c = new AwtTextField();
+        }
+
+        {
+            /* Adjust style for scrollbar visibility and word wrap  */
+            DWORD scroll_style;
+
+            if(isMultiline){
+
+                 jint scrollbarVisibility =
+                     env->GetIntField(target, AwtTextArea::scrollbarVisibilityID);
+
+                 switch (scrollbarVisibility) {
+                     case java_awt_TextArea_SCROLLBARS_NONE:
+                         scroll_style = ES_AUTOVSCROLL;
+                         break;
+                     case java_awt_TextArea_SCROLLBARS_VERTICAL_ONLY:
+                         scroll_style = WS_VSCROLL | ES_AUTOVSCROLL;
+                         break;
+                     case java_awt_TextArea_SCROLLBARS_HORIZONTAL_ONLY:
+                         scroll_style = WS_HSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL;
+                         break;
+                     case java_awt_TextArea_SCROLLBARS_BOTH:
+                         scroll_style = WS_VSCROLL | WS_HSCROLL |
+                             ES_AUTOVSCROLL | ES_AUTOHSCROLL;
+                         break;
+                }
+            }
+
+          DWORD style = WS_CHILD | WS_CLIPSIBLINGS | ES_LEFT;
+
+          /*
+           * Specify ES_DISABLENOSCROLL - RichEdit control style to disable
+           * scrollbars instead of hiding them when not needed.
+           */
+          style |= isMultiline ?  ES_MULTILINE | ES_WANTRETURN | scroll_style
+              | ES_DISABLENOSCROLL : ES_AUTOHSCROLL;
+
+
+          DWORD exStyle = WS_EX_CLIENTEDGE;
+          if (GetRTL()) {
+              exStyle |= WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR;
+              if (GetRTLReadingOrder())
+                  exStyle |= WS_EX_RTLREADING;
+          }
+
+
+          jint x = env->GetIntField(target, AwtComponent::xID);
+          jint y = env->GetIntField(target, AwtComponent::yID);
+          jint width = env->GetIntField(target, AwtComponent::widthID);
+          jint height = env->GetIntField(target, AwtComponent::heightID);
+
+          c->CreateHWnd(env, L"", style, exStyle,
+                        x, y, width, height,
+                        awtParent->GetHWnd(),
+                        reinterpret_cast<HMENU>(static_cast<INT_PTR>(
+                awtParent->CreateControlID())),
+                        ::GetSysColor(COLOR_WINDOWTEXT),
+                        ::GetSysColor(COLOR_WINDOW),
+                        peer);
+
+          // Fix for 4753116.
+          // If it is not win95 (we are using Richedit 2.0)
+          // we set plain text mode, in which the control is
+          // similar to a standard edit control:
+          //  - The text in a plain text control can have only
+          //    one format.
+          //  - The user cannot paste rich text formats, such as RTF
+          //    or embedded objects into a plain text control.
+          //  - Rich text mode controls always have a default
+          //    end-of-document marker or carriage return,
+          //    to format paragraphs.
+          // kdm@sparc.spb.su
+          c->SendMessage(EM_SETTEXTMODE, TM_PLAINTEXT, 0);
+
+          c->m_backgroundColorSet = TRUE;
+          /* suppress inheriting parent's color. */
+          c->UpdateBackground(env, target);
+          c->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN,
+                         MAKELPARAM(1, 1));
+          /*
+           * Fix for BugTraq Id 4260109.
+           * Set the text limit to the maximum.
+           * Use EM_EXLIMITTEXT for RichEdit controls.
+           * For some reason RichEdit 1.0 becomes read-only if the
+           * specified limit is greater than 0x7FFFFFFD.
+           */
+          c->SendMessage(EM_EXLIMITTEXT, 0, 0x7FFFFFFD);
+
+          /* Unregister RichEdit built-in drop target. */
+          VERIFY(::RevokeDragDrop(c->GetHWnd()) != DRAGDROP_E_INVALIDHWND);
+
+          /* To enforce CF_TEXT format for paste operations. */
+          VERIFY(c->SendMessage(EM_SETOLECALLBACK, 0,
+                                (LPARAM)&GetOleCallback()));
+
+          c->SendMessage(EM_SETEVENTMASK, 0, ENM_CHANGE);
+        }
+    } catch (...) {
+        env->DeleteLocalRef(target);
+        throw;
+    }
+
+done:
+    env->DeleteLocalRef(target);
+
+    return c;
+}
+
+LONG AwtTextComponent::EditGetCharFromPos(POINT& pt) {
+    return static_cast<LONG>(SendMessage(EM_CHARFROMPOS, 0,
+            reinterpret_cast<LPARAM>(&pt)));
 }
 
 /* Set a suitable font to IME against the component font. */
@@ -463,6 +610,54 @@
     delete ees;
 }
 
+/*
+ * Disabled edit control has grayed foreground.
+ * Disabled RichEdit 1.0 control has original foreground.
+ * Thus we have to set grayed foreground manually.
+ */
+void AwtTextComponent::Enable(BOOL bEnable)
+{
+    AwtComponent::Enable(bEnable);
+    SetColor(GetColor());
+}
+
+
+/*
+ * WM_CTLCOLOR is not sent by rich edit controls.
+ * Use EM_SETCHARFORMAT and EM_SETBKGNDCOLOR to set
+ * respectively foreground and background color.
+ */
+void AwtTextComponent::SetColor(COLORREF c) {
+    AwtComponent::SetColor(c);
+
+    CHARFORMAT cf;
+    memset(&cf, 0, sizeof(cf));
+    cf.cbSize = sizeof(cf);
+    cf.dwMask = CFM_COLOR;
+
+    cf.crTextColor = ::IsWindowEnabled(GetHWnd()) ? GetColor() : ::GetSysColor(COLOR_3DSHADOW);
+
+    /*
+     * The documentation for EM_GETCHARFORMAT is not exactly
+     * correct. It appears that wParam has the same meaning
+     * as for EM_SETCHARFORMAT. Our task is to secure that
+     * all the characters in the control have the required
+     * formatting. That's why we use SCF_ALL.
+     */
+    VERIFY(SendMessage(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf));
+    VERIFY(SendMessage(EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf));
+}
+
+/*
+ * In responce to EM_SETBKGNDCOLOR rich edit changes
+ * its bg color and repaints itself so we don't need
+ * to force repaint.
+ */
+void AwtTextComponent::SetBackgroundColor(COLORREF c) {
+    AwtComponent::SetBackgroundColor(c);
+    SendMessage(EM_SETBKGNDCOLOR, (WPARAM)FALSE, (LPARAM)GetBackgroundColor());
+}
+
 
 /************************************************************************
  * WTextComponentPeer native methods
@@ -623,6 +818,127 @@
     CATCH_BAD_ALLOC;
 }
 
+
+AwtTextComponent::OleCallback AwtTextComponent::sm_oleCallback;
+
+/************************************************************************
+ * Inner class OleCallback definition.
+ */
+
+AwtTextComponent::OleCallback::OleCallback() {
+    m_refs = 0;
+    AddRef();
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj) {
+     if (::IsEqualIID(riid, IID_IUnknown) ||::IsEqualIID(riid, IID_IRichEditOleCallback)  ) {
+         *ppvObj = static_cast<IRichEditOleCallback*>(this);
+         AddRef();
+         return S_OK;
+     }
+     *ppvObj = NULL;
+     return E_NOINTERFACE;
+}
+
+
+STDMETHODIMP_(ULONG)
+AwtTextComponent::OleCallback::AddRef() {
+    return ++m_refs;
+}
+
+STDMETHODIMP_(ULONG)
+AwtTextComponent::OleCallback::Release() {
+    return (ULONG)--m_refs;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::GetNewStorage(LPSTORAGE FAR * ppstg) {
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::GetInPlaceContext(LPOLEINPLACEFRAME FAR * ppipframe,
+                                                 LPOLEINPLACEUIWINDOW FAR* ppipuiDoc,
+                                                 LPOLEINPLACEFRAMEINFO pipfinfo)
+{
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::ShowContainerUI(BOOL fShow) {
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::QueryInsertObject(LPCLSID pclsid,
+                                                 LPSTORAGE pstg,
+                                                 LONG cp) {
+    return S_OK;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::DeleteObject(LPOLEOBJECT poleobj) {
+    return S_OK;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::QueryAcceptData(LPDATAOBJECT pdataobj,
+                                               CLIPFORMAT *pcfFormat,
+                                               DWORD reco,
+                                               BOOL fReally,
+                                               HGLOBAL hMetaPict) {
+    if (reco == RECO_PASTE) {
+        // If CF_TEXT format is available edit controls will select it,
+        // otherwise if it is CF_UNICODETEXT is available it will be
+        // selected, otherwise if CF_OEMTEXT is available it will be selected.
+        if (::IsClipboardFormatAvailable(CF_TEXT)) {
+            *pcfFormat = CF_TEXT;
+        } else if (::IsClipboardFormatAvailable(CF_UNICODETEXT)) {
+            *pcfFormat = CF_UNICODETEXT;
+        } else if (::IsClipboardFormatAvailable(CF_OEMTEXT)) {
+            *pcfFormat = CF_OEMTEXT;
+        } else {
+            // Don't allow rich edit to paste clipboard data
+            // in other formats.
+            *pcfFormat = CF_TEXT;
+        }
+    }
+
+    return S_OK;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::ContextSensitiveHelp(BOOL fEnterMode) {
+    return S_OK;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::GetClipboardData(CHARRANGE *pchrg,
+                                                DWORD reco,
+                                                LPDATAOBJECT *ppdataobj) {
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::GetDragDropEffect(BOOL fDrag,
+                                                 DWORD grfKeyState,
+                                                 LPDWORD pdwEffect) {
+
+    return E_NOTIMPL;
+}
+
+
+STDMETHODIMP
+AwtTextComponent::OleCallback::GetContextMenu(WORD seltype,
+                                              LPOLEOBJECT lpoleobj,
+                                              CHARRANGE FAR * lpchrg,
+                                              HMENU FAR * lphmenu) {
+    return E_NOTIMPL;
+}
+
+
+
 //
 // Accessibility support
 //
--- a/src/windows/native/sun/windows/awt_TextComponent.h	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/windows/native/sun/windows/awt_TextComponent.h	Wed Jun 20 19:39:01 2012 +0100
@@ -47,6 +47,8 @@
 
     AwtTextComponent();
 
+    static AwtTextComponent* Create(jobject self, jobject parent, BOOL isMultiline);
+
     virtual LPCTSTR GetClassName();
 
     int RemoveCR(WCHAR *pStr);
@@ -71,6 +73,10 @@
 
     void SetFont(AwtFont* font);
 
+    virtual void Enable(BOOL bEnable);
+    virtual void SetColor(COLORREF c);
+    virtual void SetBackgroundColor(COLORREF c);
+
     /*
      * Windows message handler functions
      */
@@ -113,7 +119,40 @@
     // Used to prevent untrusted code from synthesizing a WM_PASTE message
     // by posting a <CTRL>-V KeyEvent
     BOOL    m_synthetic;
-    virtual LONG EditGetCharFromPos(POINT& pt) = 0;
+    LONG EditGetCharFromPos(POINT& pt);
+
+    /*****************************************************************
+     * Inner class OleCallback declaration.
+     */
+    class OleCallback : public IRichEditOleCallback {
+    public:
+        OleCallback();
+
+        STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
+        STDMETHODIMP_(ULONG) AddRef();
+        STDMETHODIMP_(ULONG) Release();
+        STDMETHODIMP GetNewStorage(LPSTORAGE FAR * ppstg);
+        STDMETHODIMP GetInPlaceContext(LPOLEINPLACEFRAME FAR * ppipframe,
+                                       LPOLEINPLACEUIWINDOW FAR* ppipuiDoc,
+                                       LPOLEINPLACEFRAMEINFO pipfinfo);
+        STDMETHODIMP ShowContainerUI(BOOL fShow);
+        STDMETHODIMP QueryInsertObject(LPCLSID pclsid, LPSTORAGE pstg, LONG cp);
+        STDMETHODIMP DeleteObject(LPOLEOBJECT poleobj);
+        STDMETHODIMP QueryAcceptData(LPDATAOBJECT pdataobj, CLIPFORMAT *pcfFormat,
+                                     DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
+        STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
+        STDMETHODIMP GetClipboardData(CHARRANGE *pchrg, DWORD reco,
+                                      LPDATAOBJECT *ppdataobj);
+        STDMETHODIMP GetDragDropEffect(BOOL fDrag, DWORD grfKeyState,
+                                       LPDWORD pdwEffect);
+        STDMETHODIMP GetContextMenu(WORD seltype, LPOLEOBJECT poleobj,
+                                    CHARRANGE FAR * pchrg, HMENU FAR * phmenu);
+    private:
+        ULONG             m_refs; // Reference count
+    };//OleCallback class
+
+    INLINE static OleCallback& GetOleCallback() { return sm_oleCallback; }
+
 
 private:
 
@@ -126,6 +165,7 @@
     HFONT m_hFont;
     //im --- end
 
+    static OleCallback sm_oleCallback;
 
     //
     // Accessibility support
--- a/src/windows/native/sun/windows/awt_TextField.cpp	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/windows/native/sun/windows/awt_TextField.cpp	Wed Jun 20 19:39:01 2012 +0100
@@ -42,84 +42,23 @@
  */
 
 AwtTextField::AwtTextField()
-    : m_initialRescrollFlag( true )
 {
 }
 
 /* Create a new AwtTextField object and window.   */
 AwtTextField* AwtTextField::Create(jobject peer, jobject parent)
 {
-    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
-    jobject target = NULL;
-    AwtTextField* c = NULL;
-
-    try {
-        PDATA pData;
-        AwtCanvas* awtParent;
-        JNI_CHECK_PEER_GOTO(parent, done);
-        awtParent = (AwtCanvas*)pData;
-
-        JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
-
-        target = env->GetObjectField(peer, AwtObject::targetID);
-        JNI_CHECK_NULL_GOTO(target, "null target", done);
-
-        c = new AwtTextField();
-
-        {
-            DWORD style = WS_CHILD | WS_CLIPSIBLINGS |
-                ES_LEFT | ES_AUTOHSCROLL;
-            DWORD exStyle = WS_EX_CLIENTEDGE;
-            if (GetRTL()) {
-                exStyle |= WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR;
-                if (GetRTLReadingOrder())
-                    exStyle |= WS_EX_RTLREADING;
-            }
-
-            jint x = env->GetIntField(target, AwtComponent::xID);
-            jint y = env->GetIntField(target, AwtComponent::yID);
-            jint width = env->GetIntField(target, AwtComponent::widthID);
-            jint height = env->GetIntField(target, AwtComponent::heightID);
-
-            c->CreateHWnd(env, L"", style, exStyle,
-                          x, y, width, height,
-                          awtParent->GetHWnd(),
-                          reinterpret_cast<HMENU>(static_cast<INT_PTR>(
-                awtParent->CreateControlID())),
-                          ::GetSysColor(COLOR_WINDOWTEXT),
-                          ::GetSysColor(COLOR_WINDOW),
-                          peer);
-
-            c->m_backgroundColorSet = TRUE;
-            /* suppress inheriting parent's color. */
-            c->UpdateBackground(env, target);
-            c->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN,
-                           MAKELPARAM(1, 1));
-            /*
-             * Fix for BugTraq Id 4260109.
-             * Set the text limit to the maximum.
-             */
-            c->SendMessage(EM_SETLIMITTEXT);
-
-        }
-    } catch (...) {
-        env->DeleteLocalRef(target);
-        throw;
-    }
-
-done:
-    env->DeleteLocalRef(target);
-
-    return c;
+    return (AwtTextField*) AwtTextComponent::Create(peer, parent, false);
 }
 
 void AwtTextField::EditSetSel(CHARRANGE &cr) {
-    SendMessage(EM_SETSEL, cr.cpMin, cr.cpMax);
-}
+    SendMessage(EM_EXSETSEL, 0, reinterpret_cast<LPARAM>(&cr));
 
-LONG AwtTextField::EditGetCharFromPos(POINT& pt) {
-    return static_cast<LONG>(SendMessage(EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y)));
+    // 6417581: force expected drawing
+    if (IS_WINVISTA && cr.cpMin == cr.cpMax) {
+        ::InvalidateRect(GetHWnd(), NULL, TRUE);
+    }
+
 }
 
 LRESULT AwtTextField::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
@@ -162,10 +101,18 @@
          * to allow dnd of the current selection.
          */
         if (msg->message == WM_LBUTTONDBLCLK) {
-            SetStartSelectionPos(static_cast<LONG>(SendMessage(
-                EM_FINDWORDBREAK, WB_MOVEWORDLEFT, lCurPos)));
-            SetEndSelectionPos(static_cast<LONG>(SendMessage(
-                EM_FINDWORDBREAK, WB_MOVEWORDRIGHT, lCurPos)));
+            jchar echo = SendMessage(EM_GETPASSWORDCHAR);
+
+            if(echo == 0){
+              SetStartSelectionPos(static_cast<LONG>(SendMessage(
+                  EM_FINDWORDBREAK, WB_MOVEWORDLEFT, lCurPos)));
+              SetEndSelectionPos(static_cast<LONG>(SendMessage(
+                  EM_FINDWORDBREAK, WB_MOVEWORDRIGHT, lCurPos)));
+            }else{
+              SetStartSelectionPos(0);
+              SetEndSelectionPos(GetTextLength());
+            }
+
         } else {
             SetStartSelectionPos(lCurPos);
             SetEndSelectionPos(lCurPos);
@@ -307,46 +254,6 @@
     delete secs;
 }
 
-void AwtTextField::Reshape(int x, int y, int w, int h)
-{
-    AwtTextComponent::Reshape( x, y, w, h );
-
-    // Another option would be to call this
-    // after WM_SIZE notification is handled
-    initialRescroll();
-}
-
-
-// Windows' Edit control features:
-// (i) if text selection is set while control's width or height is 0,
-//   text is scrolled oddly.
-// (ii) if control's size is changed, text seems never be automatically
-//   rescrolled.
-//
-// This method is designed for the following scenario: AWT spawns Edit
-// control with 0x0 dimensions, then sets text selection, then resizes the
-// control (couple of times). This might cause text appear undesirably scrolled.
-// So we reset/set selection again to rescroll text. (see also CR 6480547)
-void AwtTextField::initialRescroll()
-{
-    if( ! m_initialRescrollFlag ) {
-        return;
-    }
-
-    ::RECT r;
-    BOOL ok = ::GetClientRect( GetHWnd(), &r );
-    if( ! ok || r.right==0 || r.bottom==0 ) {
-        return;
-    }
-
-    m_initialRescrollFlag = false;
-
-    DWORD start, end;
-    SendMessage( EM_GETSEL, (WPARAM)&start, (LPARAM)&end );
-    SendMessage( EM_SETSEL, (WPARAM)0, (LPARAM)0 );
-    SendMessage( EM_SETSEL, (WPARAM)start, (LPARAM)end );
-}
-
 
 /************************************************************************
  * WTextFieldPeer native methods
--- a/src/windows/native/sun/windows/awt_TextField.h	Wed Jun 20 19:35:47 2012 +0100
+++ b/src/windows/native/sun/windows/awt_TextField.h	Wed Jun 20 19:39:01 2012 +0100
@@ -54,15 +54,11 @@
     // invoked on Toolkit thread
     static void _SetEchoChar(void *param);
 
-  protected:
-    LONG EditGetCharFromPos(POINT& pt);
-    virtual void Reshape(int x, int y, int w, int h);
+protected:
 
 private:
     void EditSetSel(CHARRANGE &cr);
-    void initialRescroll();
 
-    bool m_initialRescrollFlag;
 };
 
 #endif /* AWT_TEXTFIELD_H */
--- a/test/Makefile	Wed Jun 20 19:35:47 2012 +0100
+++ b/test/Makefile	Wed Jun 20 19:39:01 2012 +0100
@@ -472,6 +472,16 @@
 jdk_io: $(call TestDirs, java/io)
 	$(call RunAgentvmBatch)
 
+# Stable othervm testruns (minus items from PROBLEM_LIST)
+#   Using agentvm has serious problems with these tests
+ifdef OPENJDK
+jdk_jfr:
+else
+JDK_ALL_TARGETS += jdk_jfr
+jdk_jfr: $(call TestDirs, com/oracle/jfr)
+	$(call RunOthervmBatch)
+endif
+
 # Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_lang
 jdk_lang: $(call TestDirs, java/lang)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java	Wed Jun 20 19:39:01 2012 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012, 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.Dialog;
+import java.awt.Frame;
+import java.util.Timer;
+import java.util.TimerTask;
+
+/*
+  @test
+  @bug 7080109
+  @summary Dialog.show() lacks doPrivileged() to access system event queue.
+  @author sergey.bylokhov@oracle.com: area=awt.dialog
+  @run main/othervm/policy=java.policy -Djava.security.manager ModalDialogPermission
+*/
+public final class ModalDialogPermission {
+
+    public static void main(final String[] args) {
+        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+            @Override
+            public void uncaughtException(final Thread t, final Throwable e) {
+                throw new RuntimeException(e);
+            }
+        });
+        final Frame frame = new Frame();
+        final Dialog dialog = new Dialog(frame, "ModalDialog", true);
+        final Timer t = new Timer();
+        t.schedule(new TimerTask() {
+
+            @Override
+            public void run() {
+                dialog.setVisible(false);
+                dialog.dispose();
+            }
+        }, 3000L);
+        dialog.show();
+        frame.dispose();
+        t.cancel();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Dialog/ModalDialogPermission/java.policy	Wed Jun 20 19:39:01 2012 +0100
@@ -0,0 +1,3 @@
+grant {
+    permission java.lang.RuntimePermission "setDefaultUncaughtExceptionHandler";
+};
--- a/test/java/util/Map/Collisions.java	Wed Jun 20 19:35:47 2012 +0100
+++ b/test/java/util/Map/Collisions.java	Wed Jun 20 19:39:01 2012 +0100
@@ -68,7 +68,7 @@
             return Integer.toString(value);
         }
     }
-    private static final int ITEMS = 10000;
+    private static final int ITEMS = 5000;
     private static final Object KEYS[][];
 
     static {
@@ -133,7 +133,7 @@
 
     private static void realMain(String[] args) throws Throwable {
         for (Object[] keys_desc : KEYS) {
-            Map<Object, Boolean>[] MAPS = (Map<Object, Boolean>[]) new Map[]{
+            Map<Object, Object>[] MAPS = (Map<Object, Object>[]) new Map[]{
                         new Hashtable<>(),
                         new HashMap<>(),
                         new IdentityHashMap<>(),
@@ -144,51 +144,69 @@
                         new ConcurrentSkipListMap<>()
                     };
 
-            for (Map<Object, Boolean> map : MAPS) {
+            for (Map<Object, Object> map : MAPS) {
                 String desc = (String) keys_desc[0];
                 Object[] keys = (Object[]) keys_desc[1];
+                try {
                 testMap(map, desc, keys);
+                } catch(Exception all) {
+                    unexpected("Failed for " + map.getClass().getName() + " with " + desc, all);
+                }
             }
         }
     }
 
-    private static <T> void testMap(Map<T, Boolean> map, String keys_desc, T[] keys) {
-        System.err.println(map.getClass() + " : " + keys_desc);
+    private static <T> void testMap(Map<T, T> map, String keys_desc, T[] keys) {
+        System.out.println(map.getClass() + " : " + keys_desc);
+        System.out.flush();
         testInsertion(map, keys_desc, keys);
 
         if (keys[0] instanceof HashableInteger) {
-            testIntegerIteration((Map<HashableInteger, Boolean>) map, (HashableInteger[]) keys);
+            testIntegerIteration((Map<HashableInteger, HashableInteger>) map, (HashableInteger[]) keys);
         } else {
-            testStringIteration((Map<String, Boolean>) map, (String[]) keys);
+            testStringIteration((Map<String, String>) map, (String[]) keys);
         }
 
         testContainsKey(map, keys_desc, keys);
 
         testRemove(map, keys_desc, keys);
 
+        map.clear();
+        testInsertion(map, keys_desc, keys);
+        testKeysIteratorRemove(map, keys_desc, keys);
+
+        map.clear();
+        testInsertion(map, keys_desc, keys);
+        testValuesIteratorRemove(map, keys_desc, keys);
+
+        map.clear();
+        testInsertion(map, keys_desc, keys);
+        testEntriesIteratorRemove(map, keys_desc, keys);
+
         check(map.isEmpty());
     }
 
-    private static <T> void testInsertion(Map<T, Boolean> map, String keys_desc, T[] keys) {
+    private static <T> void testInsertion(Map<T, T> map, String keys_desc, T[] keys) {
         check("map empty", (map.size() == 0) && map.isEmpty());
 
         for (int i = 0; i < keys.length; i++) {
             check(String.format("insertion: map expected size m%d != i%d", map.size(), i),
                     map.size() == i);
-            check(String.format("insertion: put(%s[%d])", keys_desc, i), null == map.put(keys[i], true));
+            check(String.format("insertion: put(%s[%d])", keys_desc, i), null == map.put(keys[i], keys[i]));
             check(String.format("insertion: containsKey(%s[%d])", keys_desc, i), map.containsKey(keys[i]));
+            check(String.format("insertion: containsValue(%s[%d])", keys_desc, i), map.containsValue(keys[i]));
         }
 
         check(String.format("map expected size m%d != k%d", map.size(), keys.length),
                 map.size() == keys.length);
     }
 
-    private static void testIntegerIteration(Map<HashableInteger, Boolean> map, HashableInteger[] keys) {
+    private static void testIntegerIteration(Map<HashableInteger, HashableInteger> map, HashableInteger[] keys) {
         check(String.format("map expected size m%d != k%d", map.size(), keys.length),
                 map.size() == keys.length);
 
         BitSet all = new BitSet(keys.length);
-        for (Map.Entry<HashableInteger, Boolean> each : map.entrySet()) {
+        for (Map.Entry<HashableInteger, HashableInteger> each : map.entrySet()) {
             check("Iteration: key already seen", !all.get(each.getKey().value));
             all.set(each.getKey().value);
         }
@@ -205,7 +223,7 @@
         check("Iteration: some keys not visited", all.isEmpty());
 
         int count = 0;
-        for (Boolean each : map.values()) {
+        for (HashableInteger each : map.values()) {
             count++;
         }
 
@@ -213,12 +231,12 @@
                 map.size() == count);
     }
 
-    private static void testStringIteration(Map<String, Boolean> map, String[] keys) {
+    private static void testStringIteration(Map<String, String> map, String[] keys) {
         check(String.format("map expected size m%d != k%d", map.size(), keys.length),
                 map.size() == keys.length);
 
         BitSet all = new BitSet(keys.length);
-        for (Map.Entry<String, Boolean> each : map.entrySet()) {
+        for (Map.Entry<String, String> each : map.entrySet()) {
             String key = each.getKey();
             boolean longKey = key.length() > 5;
             int index = key.hashCode() + (longKey ? keys.length / 2 : 0);
@@ -240,7 +258,7 @@
         check("some keys not visited", all.isEmpty());
 
         int count = 0;
-        for (Boolean each : map.values()) {
+        for (String each : map.values()) {
             count++;
         }
 
@@ -248,14 +266,14 @@
                 map.size() == keys.length);
     }
 
-    private static <T> void testContainsKey(Map<T, Boolean> map, String keys_desc, T[] keys) {
+    private static <T> void testContainsKey(Map<T, T> map, String keys_desc, T[] keys) {
         for (int i = 0; i < keys.length; i++) {
             T each = keys[i];
             check("containsKey: " + keys_desc + "[" + i + "]" + each, map.containsKey(each));
         }
     }
 
-    private static <T> void testRemove(Map<T, Boolean> map, String keys_desc, T[] keys) {
+    private static <T> void testRemove(Map<T, T> map, String keys_desc, T[] keys) {
         check(String.format("remove: map expected size m%d != k%d", map.size(), keys.length),
                 map.size() == keys.length);
 
@@ -267,6 +285,56 @@
         check(String.format("remove: map empty. size=%d", map.size()),
                 (map.size() == 0) && map.isEmpty());
     }
+
+    private static <T> void testKeysIteratorRemove(Map<T, T> map, String keys_desc, T[] keys) {
+        check(String.format("remove: map expected size m%d != k%d", map.size(), keys.length),
+                map.size() == keys.length);
+
+        Iterator<T> each = map.keySet().iterator();
+        while (each.hasNext()) {
+            T t = each.next();
+            each.remove();
+            check("not removed: " + each, !map.containsKey(t) );
+        }
+
+        check(String.format("remove: map empty. size=%d", map.size()),
+                (map.size() == 0) && map.isEmpty());
+    }
+
+    private static <T> void testValuesIteratorRemove(Map<T, T> map, String keys_desc, T[] keys) {
+        check(String.format("remove: map expected size m%d != k%d", map.size(), keys.length),
+                map.size() == keys.length);
+
+        Iterator<T> each = map.values().iterator();
+        while (each.hasNext()) {
+            T t = each.next();
+            each.remove();
+            check("not removed: " + each, !map.containsValue(t) );
+        }
+
+        check(String.format("remove: map empty. size=%d", map.size()),
+                (map.size() == 0) && map.isEmpty());
+    }
+
+    private static <T> void testEntriesIteratorRemove(Map<T, T> map, String keys_desc, T[] keys) {
+        check(String.format("remove: map expected size m%d != k%d", map.size(), keys.length),
+                map.size() == keys.length);
+
+        Iterator<Map.Entry<T,T>> each = map.entrySet().iterator();
+        while (each.hasNext()) {
+            Map.Entry<T,T> t = each.next();
+            T key = t.getKey();
+            T value = t.getValue();
+            each.remove();
+            check("not removed: " + each, (map instanceof IdentityHashMap) || !map.entrySet().contains(t) );
+            check("not removed: " + each, !map.containsKey(key) );
+            check("not removed: " + each, !map.containsValue(value));
+        }
+
+        check(String.format("remove: map empty. size=%d", map.size()),
+                (map.size() == 0) && map.isEmpty());
+    }
+
     //--------------------- Infrastructure ---------------------------
     static volatile int passed = 0, failed = 0;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java	Wed Jun 20 19:39:01 2012 +0100
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/* @test
+   @bug 7165725
+   @summary  Tests if HTML parser can handle successive script tags in a line
+             and it does not call false text callback after script tags.
+   @run main bug7165725
+*/
+
+import sun.awt.SunToolkit;
+
+import java.awt.BorderLayout;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.swing.*;
+import javax.swing.text.AbstractDocument.AbstractElement;
+import javax.swing.text.AbstractDocument;
+import javax.swing.text.Document;
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.text.html.parser.ParserDelegator;
+
+public class bug7165725 extends JFrame {
+    private static class GoldenElement {
+
+        private String goldenName;
+        private List<GoldenElement> goldenChildren;
+
+        GoldenElement(String goldenName, GoldenElement... goldenChildren){
+            this.goldenName = goldenName;
+            if (goldenChildren != null) {
+                this.goldenChildren = Arrays.asList(goldenChildren);
+            } else {
+                this.goldenChildren = new ArrayList<>();
+            }
+        }
+
+        // throws RuntimeException if not ok
+        public void checkStructureEquivalence(AbstractDocument.AbstractElement elem) {
+            String name = elem.getName();
+            if (!goldenName.equals(name)) {
+                throw new RuntimeException("Bad structure: expected element name is '" + goldenName + "' but the actual name was '" + name + "'.");
+            }
+            int goldenChildCount = goldenChildren.size();
+            int childCount = elem.getChildCount();
+            if (childCount != goldenChildCount) {
+                System.out.print("D: children: ");
+                for (int i = 0; i < childCount; i++) {
+                    System.out.print(" " + elem.getElement(i).getName());
+                }
+                System.out.println("");
+                System.out.print("D: goldenChildren: ");
+                for (GoldenElement ge : goldenChildren) {
+                    System.out.print(" " + ge.goldenName);
+                }
+                System.out.println("");
+
+                throw new RuntimeException("Bad structure: expected child count of element '" + goldenName + "' is '" + goldenChildCount + "' but the actual count was '" + childCount + "'.");
+            }
+            for (int i = 0; i < childCount; i++) {
+                AbstractDocument.AbstractElement nextElem = (AbstractDocument.AbstractElement) elem.getElement(i);
+                GoldenElement goldenElement = goldenChildren.get(i);
+                goldenElement.checkStructureEquivalence(nextElem);
+            }
+        }
+    }
+
+    private JEditorPane editorPane;
+    public void execute(final String urlStr, final GoldenElement goldenElement) throws Exception {
+        System.out.println();
+        System.out.println("***** TEST: " + urlStr + " *****");
+        System.out.println();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                try {
+                    editorPane = new JEditorPane();
+                    editorPane.setEditorKit(new HTMLEditorKit() {
+                        public Document createDefaultDocument() {
+                            AbstractDocument doc =
+                                    (AbstractDocument) super.createDefaultDocument();
+                            doc.setAsynchronousLoadPriority(-1);
+                            return doc;
+                        }
+                    });
+                    editorPane.setPage(new URL(urlStr));
+                } catch (IOException ex) {
+                    throw new RuntimeException("Test failed", ex);
+                }
+                editorPane.setEditable(false);
+                JScrollPane scroller = new JScrollPane();
+                JViewport vp = scroller.getViewport();
+                vp.add(editorPane);
+                add(scroller, BorderLayout.CENTER);
+                setDefaultCloseOperation(EXIT_ON_CLOSE);
+                setSize(400, 400);
+                setLocationRelativeTo(null);
+                setVisible(true);
+            }
+        });
+
+        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                HTMLDocument doc = (HTMLDocument) editorPane.getDocument();
+                doc.dump(System.out);
+                goldenElement.checkStructureEquivalence((AbstractElement) doc.getDefaultRootElement());
+                dispose();
+            }
+        });
+
+        System.out.println();
+        System.out.println("*********************************");
+        System.out.println();
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        String dirURL = getDirURL();
+
+        System.out.println("dirURL = " + dirURL);
+
+        new bug7165725().execute(dirURL + "successive-script-tag.html", createSuccessiveScriptTags());
+        new bug7165725().execute(dirURL + "false-text-after-script.html", createFalseTextAfterScript());
+
+        checkByCallbackForSuccessiveScript();
+        checkByCallbackForFalseTextAfterScript();
+
+        System.out.println();
+        System.out.println();
+        System.out.println("Test passed.");
+    }
+
+    static String getDirURL() {
+        return "file:///" +
+                new File(System.getProperty("test.src", ".")).getAbsolutePath() +
+                File.separator;
+    }
+
+    static String getParsedContentOneLine(String path) throws Exception {
+        File f = new File(path);
+        FileReader fr = new FileReader(f);
+        ParserDelegator pd = new ParserDelegator();
+        SBParserCallback sbcallback = new SBParserCallback();
+        pd.parse(fr, sbcallback, true);
+        fr.close();
+        return sbcallback.getStringOneLine();
+    }
+
+    static String getParsedContentOneLine(URL url) throws Exception {
+        return getParsedContentOneLine(url.getPath());
+    }
+
+    static void checkByCallbackForSuccessiveScript() throws Exception {
+        String content = getParsedContentOneLine(new URL(getDirURL() + "successive-script-tag.html"));
+        if (!content.matches(".*<script .*/js/js1\\.js.*<script .*/js/js2\\.js.*<script .*/js/js3\\.js.*"))
+            throw new RuntimeException("Failed to lookup script tags/attributes.");
+        if (!content.matches(".*<style .*stylesheets/base\\.css.*<style .*stylesheets/adv\\.css.*"))
+            throw new RuntimeException("Failed to lookup style tags.");
+    }
+
+    static void checkByCallbackForFalseTextAfterScript() throws Exception {
+        String content = getParsedContentOneLine(new URL(getDirURL() + "false-text-after-script.html"));
+        final int bodyIdx = content.indexOf("<body ");
+        if (bodyIdx > 0) {
+            String sbody = content.substring(bodyIdx);
+            // There should be no Text(...) in this html
+            if (sbody.indexOf("Text(") >= 0)
+                throw new RuntimeException("Unexpected text found.");
+        } else {
+            throw new RuntimeException("Failed to find body tag.");
+        }
+    }
+
+    private static GoldenElement createSuccessiveScriptTags() {
+        return new GoldenElement("html",
+                new GoldenElement("head",
+                        new GoldenElement("p-implied",
+                                new GoldenElement("title"),
+                                new GoldenElement("title"),
+                                new GoldenElement("script"),
+                                new GoldenElement("comment"),
+                                new GoldenElement("script"),
+                                new GoldenElement("script"),
+                                new GoldenElement("comment"),
+                                new GoldenElement("script"),
+                                new GoldenElement("script"),
+                                new GoldenElement("comment"),
+                                new GoldenElement("script"),
+                                new GoldenElement("content"))),
+                new GoldenElement("body",
+                        new GoldenElement("p-implied",
+                                new GoldenElement("content"))));
+    }
+
+    private static GoldenElement createFalseTextAfterScript() {
+        return new GoldenElement("html",
+                new GoldenElement("head",
+                        new GoldenElement("p-implied",
+                                new GoldenElement("title"),
+                                new GoldenElement("title"),
+                                new GoldenElement("content"))),
+                new GoldenElement("body",
+                        new GoldenElement("form",
+                                new GoldenElement("p-implied",
+                                        new GoldenElement("input"),
+                                        new GoldenElement("input"),
+                                        new GoldenElement("content"))),
+                        new GoldenElement("p-implied",
+                                new GoldenElement("script"),
+                                new GoldenElement("comment"),
+                                new GoldenElement("script"),
+                                new GoldenElement("script"),
+                                new GoldenElement("comment"),
+                                new GoldenElement("script"),
+                                new GoldenElement("content"))));
+    }
+
+    static class SBParserCallback extends HTMLEditorKit.ParserCallback
+    {
+        private int indentSize = 0;
+        private ArrayList<String> elist = new ArrayList<>();
+
+        public String getStringOneLine() {
+            StringBuilder sb = new StringBuilder();
+            for (String s : elist) sb.append(s);
+            return sb.toString();
+        }
+
+        public String toString() {
+            StringBuffer sb = new StringBuffer();
+            for (String s : elist) sb.append(s + "\n");
+            return sb.toString();
+        }
+
+        protected void indent() {
+            indentSize += 3;
+        }
+        protected void unIndent() {
+            indentSize -= 3; if (indentSize < 0) indentSize = 0;
+        }
+
+        protected String pIndent() {
+            StringBuilder sb = new StringBuilder();
+            for(int i = 0; i < indentSize; i++) sb.append(" ");
+            return sb.toString();
+        }
+
+        public void handleText(char[] data, int pos) {
+            elist.add(pIndent() + "Text(" + data.length + " chars) \"" + new String(data) + "\"");
+        }
+
+        public void handleComment(char[] data, int pos) {
+            elist.add(pIndent() + "Comment(" + data.length + " chars)");
+        }
+
+        public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {
+            elist.add(pIndent() + "Tag start(<" + t.toString() + " " + a + ">, " +
+                    a.getAttributeCount() + " attrs)");
+            indent();
+        }
+
+        public void handleEndTag(HTML.Tag t, int pos) {
+            unIndent();
+            elist.add(pIndent() + "Tag end(</" + t.toString() + ">)");
+        }
+
+        public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos) {
+            elist.add(pIndent() + "Tag(<" + t.toString() + ">, " +
+                    a.getAttributeCount() + " attrs)");
+        }
+
+        public void handleError(String errorMsg, int pos){
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/text/html/parser/Parser/7165725/false-text-after-script.html	Wed Jun 20 19:39:01 2012 +0100
@@ -0,0 +1,20 @@
+<html>
+<head> <title> Testing </title> </head>
+<body>
+<form>
+
+  <input type="text" name="text1" >
+  <input type="button" name="button1" value="button" onclick="test1(this.form)">
+
+</form>
+
+<SCRIPT LANGUAGE="JavaScript">
+  function test1(form) {
+  alert(form.text1.value);
+  }
+</SCRIPT>
+<SCRIPT>
+  history.forward();
+</SCRIPT>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/text/html/parser/Parser/7165725/successive-script-tag.html	Wed Jun 20 19:39:01 2012 +0100
@@ -0,0 +1,8 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head><title>my title</title>
+  <script src="../../js/js1.js" language="JavaScript"></script><script src="../../js/js2.js" language="JavaScript"></script><script src="../../js/js3.js" language="JavaScript"></script><style type="text/css" media="screen">@import "stylesheets/base.css";</style><style type="text/css" media="screen">@import "stylesheets/adv.css";</style>
+</head>
+<body>
+</body>
+</html>