changeset 5132:8e8cedfb1ee2 jdk7u6-b03

Merge
author lana
date Fri, 23 Mar 2012 09:55:13 -0700
parents 28190b68b0f3 9b4a7ae1d024
children 7bfc566a0e6d 5abe5fb2aeb3
files test/ProblemList.txt test/java/io/FileDescriptor/FileChannelFDTest.java
diffstat 50 files changed, 2119 insertions(+), 464 deletions(-) [+]
line wrap: on
line diff
--- a/make/javax/sound/jsoundalsa/Makefile	Tue Mar 20 10:27:31 2012 -0700
+++ b/make/javax/sound/jsoundalsa/Makefile	Fri Mar 23 09:55:13 2012 -0700
@@ -65,7 +65,7 @@
 	$(MIDIFILES_export) \
 	$(PORTFILES_export)
 
-LDFLAGS += -lasound
+OTHER_LDLIBS += -lasound
 
 CPPFLAGS += \
 	-DUSE_DAUDIO=TRUE \
--- a/make/tools/src/build/tools/javazic/Mappings.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/make/tools/src/build/tools/javazic/Mappings.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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,7 @@
 package build.tools.javazic;
 
 import  java.util.ArrayList;
+import  java.util.HashMap;
 import  java.util.LinkedList;
 import  java.util.List;
 import  java.util.Map;
@@ -162,6 +163,20 @@
         for (String key : toBeRemoved) {
             aliases.remove(key);
         }
+        // Eliminate any alias-to-alias mappings. For example, if
+        // there are A->B and B->C, A->B is changed to A->C.
+        Map<String, String> newMap = new HashMap<String, String>();
+        for (String key : aliases.keySet()) {
+            String realid = aliases.get(key);
+            String leaf = realid;
+            while (aliases.get(leaf) != null) {
+                leaf = aliases.get(leaf);
+            }
+            if (!realid.equals(leaf)) {
+                newMap.put(key, leaf);
+            }
+        }
+        aliases.putAll(newMap);
     }
 
     Map<String,String> getAliases() {
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java	Fri Mar 23 09:55:13 2012 -0700
@@ -522,11 +522,6 @@
         postEvent(targetToAppContext(event.getSource()), event);
     }
 
-    /*
-     * Returns true if the application (one of its windows) owns keyboard focus.
-     */
-    public abstract boolean isApplicationActive();
-
     // use peer's back buffer to implement non-opaque windows.
     @Override
     public boolean needUpdateWindow() {
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1072,11 +1072,7 @@
             return false;
         }
 
-        // Cross-app activation requests are not allowed.
-        if (cause != CausedFocusEvent.Cause.MOUSE_EVENT &&
-            !((LWToolkit)Toolkit.getDefaultToolkit()).isApplicationActive())
-        {
-            focusLog.fine("the app is inactive, so the request is rejected");
+        if (platformWindow.rejectFocusRequest(cause)) {
             return false;
         }
 
--- a/src/macosx/classes/sun/lwawt/PlatformWindow.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java	Fri Mar 23 09:55:13 2012 -0700
@@ -27,6 +27,7 @@
 
 import java.awt.*;
 
+import sun.awt.CausedFocusEvent;
 import sun.java2d.SurfaceData;
 
 // TODO Is it worth to generify this interface, like that:
@@ -117,6 +118,8 @@
 
     public void updateFocusableWindowState();
 
+    public boolean rejectFocusRequest(CausedFocusEvent.Cause cause);
+
     public boolean requestWindowFocus();
 
     /*
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Fri Mar 23 09:55:13 2012 -0700
@@ -38,6 +38,8 @@
 public class CEmbeddedFrame extends EmbeddedFrame {
 
     private CPlatformResponder responder;
+    private boolean focused = true;
+    private boolean parentWindowActive = true;
 
     public CEmbeddedFrame() {
         show();
@@ -94,4 +96,31 @@
     public void handleInputEvent(String text) {
         new RuntimeException("Not implemented");
     }
+
+    public void handleFocusEvent(boolean focused) {
+        this.focused = focused;
+        updateOverlayWindowActiveState();
+    }
+
+    public void handleWindowFocusEvent(boolean parentWindowActive) {
+        this.parentWindowActive = parentWindowActive;
+        updateOverlayWindowActiveState();
+    }
+
+    public boolean isParentWindowActive() {
+        return parentWindowActive;
+    }
+
+    /*
+     * May change appearance of contents of window, and generate a
+     * WINDOW_ACTIVATED event.
+     */
+    private void updateOverlayWindowActiveState() {
+        final boolean showAsFocused = parentWindowActive && focused;
+        dispatchEvent(
+            new FocusEvent(this, showAsFocused ?
+                                 FocusEvent.FOCUS_GAINED :
+                                 FocusEvent.FOCUS_LOST));
+     }
+
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Fri Mar 23 09:55:13 2012 -0700
@@ -33,17 +33,23 @@
 
 import sun.awt.CGraphicsConfig;
 import sun.awt.CGraphicsDevice;
+import sun.awt.CausedFocusEvent;
 
 import java.awt.*;
 import java.awt.BufferCapabilities.FlipContents;
 
+import sun.util.logging.PlatformLogger;
+
 /*
  * Provides a lightweight implementation of the EmbeddedFrame.
  */
 public class CPlatformEmbeddedFrame implements PlatformWindow {
 
+    private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformEmbeddedFrame");
+
     private CGLLayer windowLayer;
     private LWWindowPeer peer;
+    private CEmbeddedFrame target;
 
     private volatile int screenX = 0;
     private volatile int screenY = 0;
@@ -52,6 +58,7 @@
     public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
         this.peer = peer;
         this.windowLayer = new CGLLayer(peer);
+        this.target = (CEmbeddedFrame)target;
     }
 
     @Override
@@ -149,6 +156,18 @@
     public void updateFocusableWindowState() {}
 
     @Override
+    public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) {
+        // Cross-app activation requests are not allowed.
+        if (cause != CausedFocusEvent.Cause.MOUSE_EVENT &&
+            !target.isParentWindowActive())
+        {
+            focusLogger.fine("the embedder is inactive, so the request is rejected");
+            return true;
+        }
+        return false;
+    }
+
+    @Override
     public boolean requestWindowFocus() {
         return true;
     }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Mar 23 09:55:13 2012 -0700
@@ -65,6 +65,7 @@
 
     // Loger to report issues happened during execution but that do not affect functionality
     private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
+    private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformWindow");
 
     // for client properties
     public static final String WINDOW_BRUSH_METAL_LOOK = "apple.awt.brushMetalLook";
@@ -112,6 +113,7 @@
     static final int MINIMIZABLE = 1 << 8;
 
     static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
+    static final int NONACTIVATING = 1 << 24;
 
     static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
 
@@ -127,9 +129,6 @@
 
     static final int _METHOD_PROP_BITMASK = RESIZABLE | HAS_SHADOW | ZOOMABLE | ALWAYS_ON_TOP | HIDES_ON_DEACTIVATE | DRAGGABLE_BACKGROUND | DOCUMENT_MODIFIED | FULLSCREENABLE;
 
-    // not sure
-    static final int POPUP = 1 << 14;
-
     // corresponds to callback-based properties
     static final int SHOULD_BECOME_KEY = 1 << 12;
     static final int SHOULD_BECOME_MAIN = 1 << 13;
@@ -264,10 +263,6 @@
         // defaults style bits
         int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE;
 
-        if (target.getName() == "###overrideRedirect###") {
-            styleBits = SET(styleBits, POPUP, true);
-        }
-
         if (isNativelyFocusableWindow()) {
             styleBits = SET(styleBits, SHOULD_BECOME_KEY, true);
             styleBits = SET(styleBits, SHOULD_BECOME_MAIN, true);
@@ -275,6 +270,7 @@
 
         final boolean isFrame = (target instanceof Frame);
         final boolean isDialog = (target instanceof Dialog);
+        final boolean isPopup = (target.getType() == Window.Type.POPUP);
         if (isDialog) {
             styleBits = SET(styleBits, MINIMIZABLE, false);
         }
@@ -304,8 +300,10 @@
         }
 
         // If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look.
-        if (!isDialog && IS(styleBits, POPUP)) {
+        if (isPopup) {
             styleBits = SET(styleBits, TEXTURED, true);
+            // Popups in applets don't activate applet's process
+            styleBits = SET(styleBits, NONACTIVATING, true);
         }
 
         if (target instanceof javax.swing.RootPaneContainer) {
@@ -498,11 +496,18 @@
             // If it ain't blocked, or is being hidden, go regular way
             if (visible) {
                 CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView());
+
+                boolean isPopup = (target.getType() == Window.Type.POPUP);
+                if (isPopup) {
+                    // Popups in applets don't activate applet's process
+                    CWrapper.NSWindow.orderFrontRegardless(nsWindowPtr);
+                } else {
+                    CWrapper.NSWindow.orderFront(nsWindowPtr);
+                }
+
                 boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr);
                 if (!isKeyWindow) {
-                    CWrapper.NSWindow.makeKeyAndOrderFront(nsWindowPtr);
-                } else {
-                    CWrapper.NSWindow.orderFront(nsWindowPtr);
+                    CWrapper.NSWindow.makeKeyWindow(nsWindowPtr);
                 }
             } else {
                 CWrapper.NSWindow.orderOut(nsWindowPtr);
@@ -608,7 +613,20 @@
     }
 
     @Override
+    public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) {
+        // Cross-app activation requests are not allowed.
+        if (cause != CausedFocusEvent.Cause.MOUSE_EVENT &&
+            !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive())
+        {
+            focusLogger.fine("the app is inactive, so the request is rejected");
+            return true;
+        }
+        return false;
+    }
+
+    @Override
     public boolean requestWindowFocus() {
+
         long ptr = getNSWindowPtr();
         if (CWrapper.NSWindow.canBecomeMainWindow(ptr)) {
             CWrapper.NSWindow.makeMainWindow(ptr);
@@ -759,6 +777,11 @@
      * Callbacks from the AWTWindow and AWTView objc classes.
      *************************************************************/
     private void deliverWindowFocusEvent(boolean gained){
+        // Fix for 7150349: ingore "gained" notifications when the app is inactive.
+        if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) {
+            focusLogger.fine("the app is inactive, so the notification is ignored");
+            return;
+        }
         peer.notifyActivation(gained);
     }
 
--- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Fri Mar 23 09:55:13 2012 -0700
@@ -47,6 +47,7 @@
         public static native void setLevel(long window, int level);
 
         public static native void makeKeyAndOrderFront(long window);
+        public static native void makeKeyWindow(long window);
         public static native void makeMainWindow(long window);
         public static native boolean canBecomeMainWindow(long window);
         public static native boolean isKeyWindow(long window);
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Fri Mar 23 09:55:13 2012 -0700
@@ -686,7 +686,10 @@
         return sunAwtDisableCALayers.booleanValue();
     }
 
-    @Override
+
+    /*
+     * Returns true if the application (one of its windows) owns keyboard focus.
+     */
     public native boolean isApplicationActive();
 
     /************************
--- a/src/macosx/native/sun/awt/AWTWindow.m	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Fri Mar 23 09:55:13 2012 -0700
@@ -102,11 +102,12 @@
         type |= NSBorderlessWindowMask;
     }
 
-    if (IS(styleBits, TEXTURED))    type |= NSTexturedBackgroundWindowMask;
-    if (IS(styleBits, UNIFIED))     type |= NSUnifiedTitleAndToolbarWindowMask;
-    if (IS(styleBits, UTILITY))     type |= NSUtilityWindowMask;
-    if (IS(styleBits, HUD))         type |= NSHUDWindowMask;
-    if (IS(styleBits, SHEET))       type |= NSDocModalWindowMask;
+    if (IS(styleBits, TEXTURED))      type |= NSTexturedBackgroundWindowMask;
+    if (IS(styleBits, UNIFIED))       type |= NSUnifiedTitleAndToolbarWindowMask;
+    if (IS(styleBits, UTILITY))       type |= NSUtilityWindowMask;
+    if (IS(styleBits, HUD))           type |= NSHUDWindowMask;
+    if (IS(styleBits, SHEET))         type |= NSDocModalWindowMask;
+    if (IS(styleBits, NONACTIVATING)) type |= NSNonactivatingPanelMask;
 
     return type;
 }
--- a/src/macosx/native/sun/awt/CWrapper.m	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/native/sun/awt/CWrapper.m	Fri Mar 23 09:55:13 2012 -0700
@@ -76,6 +76,26 @@
 
 /*
  * Class:     sun_lwawt_macosx_CWrapper$NSWindow
+ * Method:    makeKeyWindow
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeKeyWindow
+(JNIEnv *env, jclass cls, jlong windowPtr)
+{
+JNF_COCOA_ENTER(env);
+
+    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
+    [JNFRunLoop performOnMainThread:@selector(makeKeyWindow)
+		                 on:window
+		         withObject:nil
+		      waitUntilDone:NO];
+
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class:     sun_lwawt_macosx_CWrapper$NSWindow
  * Method:    makeMainWindow
  * Signature: (J)V
  */
--- a/src/macosx/native/sun/awt/LWCToolkit.m	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/macosx/native/sun/awt/LWCToolkit.m	Fri Mar 23 09:55:13 2012 -0700
@@ -401,18 +401,21 @@
 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
 (JNIEnv *env, jclass clazz)
 {
-        __block jboolean active = JNI_FALSE;
+    __block jboolean active = JNI_FALSE;
 
-AWT_ASSERT_NOT_APPKIT_THREAD;
 JNF_COCOA_ENTER(env);
 
+    if ([NSThread isMainThread]) {
+        active = (jboolean)[NSRunningApplication currentApplication].active;
+    } else {
         [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() {
-                active = (jboolean)[NSRunningApplication currentApplication].active;
+            active = (jboolean)[NSRunningApplication currentApplication].active;
         }];
+    }
 
 JNF_COCOA_EXIT(env);
 
-        return active;
+    return active;
 }
 
 
--- a/src/share/bin/java.c	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/bin/java.c	Fri Mar 23 09:55:13 2012 -0700
@@ -362,6 +362,11 @@
         exit(1);
     }
 
+    if (showSettings != NULL) {
+        ShowSettings(env, showSettings);
+        CHECK_EXCEPTION_LEAVE(1);
+    }
+
     if (printVersion || showVersion) {
         PrintJavaVersion(env, showVersion);
         CHECK_EXCEPTION_LEAVE(0);
@@ -370,10 +375,6 @@
         }
     }
 
-    if (showSettings != NULL) {
-        ShowSettings(env, showSettings);
-        CHECK_EXCEPTION_LEAVE(1);
-    }
     /* If the user specified neither a class name nor a JAR file */
     if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) {
         PrintUsage(env, printXUsage);
--- a/src/share/classes/com/sun/jndi/toolkit/url/UrlUtil.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/com/sun/jndi/toolkit/url/UrlUtil.java	Fri Mar 23 09:55:13 2012 -0700
@@ -27,6 +27,7 @@
 
 import java.net.MalformedURLException;
 import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 
 /**
  * Utilities for dealing with URLs.
@@ -61,29 +62,14 @@
      * The string is subsequently converted using the specified encoding
      */
     public static final String decode(String s, String enc)
-        throws MalformedURLException, UnsupportedEncodingException {
-
-        int length = s.length();
-        byte[] bytes = new byte[length];
-        int j = 0;
-
-        for (int i = 0; i < length; i++) {
-            if (s.charAt(i) == '%') {
-                i++;  // skip %
-                try {
-                    bytes[j++] = (byte)
-                        Integer.parseInt(s.substring(i, i + 2), 16);
-
-                } catch (Exception e) {
-                    throw new MalformedURLException("Invalid URI encoding: " + s);
-                }
-                i++;  // skip first hex char; for loop will skip second one
-            } else {
-                bytes[j++] = (byte) s.charAt(i);
-            }
+            throws MalformedURLException, UnsupportedEncodingException {
+        try {
+            return URLDecoder.decode(s, enc);
+        } catch (IllegalArgumentException iae) {
+            MalformedURLException mue = new MalformedURLException("Invalid URI encoding: " + s);
+            mue.initCause(iae);
+            throw mue;
         }
-
-        return new String(bytes, 0, j, enc);
     }
 
     /**
--- a/src/share/classes/java/beans/ChangeListenerMap.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/java/beans/ChangeListenerMap.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -237,11 +237,5 @@
      *
      * @return a real listener
      */
-    public final L extract(L listener) {
-        while (listener instanceof EventListenerProxy) {
-            EventListenerProxy<L> proxy = (EventListenerProxy<L>) listener;
-            listener = proxy.getListener();
-        }
-        return listener;
-    }
+    public abstract L extract(L listener);
 }
--- a/src/share/classes/java/beans/PropertyChangeSupport.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/java/beans/PropertyChangeSupport.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -532,5 +532,15 @@
         protected PropertyChangeListener newProxy(String name, PropertyChangeListener listener) {
             return new PropertyChangeListenerProxy(name, listener);
         }
+
+        /**
+         * {@inheritDoc}
+         */
+        public final PropertyChangeListener extract(PropertyChangeListener listener) {
+            while (listener instanceof PropertyChangeListenerProxy) {
+                listener = ((PropertyChangeListenerProxy) listener).getListener();
+            }
+            return listener;
+        }
     }
 }
--- a/src/share/classes/java/beans/VetoableChangeSupport.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/java/beans/VetoableChangeSupport.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -521,5 +521,15 @@
         protected VetoableChangeListener newProxy(String name, VetoableChangeListener listener) {
             return new VetoableChangeListenerProxy(name, listener);
         }
+
+        /**
+         * {@inheritDoc}
+         */
+        public final VetoableChangeListener extract(VetoableChangeListener listener) {
+            while (listener instanceof VetoableChangeListenerProxy) {
+                listener = ((VetoableChangeListenerProxy) listener).getListener();
+            }
+            return listener;
+        }
     }
 }
--- a/src/share/classes/java/io/FileInputStream.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/java/io/FileInputStream.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -56,16 +56,6 @@
     private final Object closeLock = new Object();
     private volatile boolean closed = false;
 
-    private static final ThreadLocal<Boolean> runningFinalize =
-        new ThreadLocal<>();
-
-    private static boolean isRunningFinalize() {
-        Boolean val;
-        if ((val = runningFinalize.get()) != null)
-            return val.booleanValue();
-        return false;
-    }
-
     /**
      * Creates a <code>FileInputStream</code> by
      * opening a connection to an actual file,
@@ -134,7 +124,7 @@
             throw new NullPointerException();
         }
         fd = new FileDescriptor();
-        fd.incrementAndGetUseCount();
+        fd.attach(this);
         open(name);
     }
 
@@ -174,10 +164,9 @@
 
         /*
          * FileDescriptor is being shared by streams.
-         * Ensure that it's GC'ed only when all the streams/channels are done
-         * using it.
+         * Register this stream with FileDescriptor tracker.
          */
-        fd.incrementAndGetUseCount();
+        fd.attach(this);
     }
 
     /**
@@ -304,27 +293,13 @@
             closed = true;
         }
         if (channel != null) {
-            /*
-             * Decrement the FD use count associated with the channel
-             * The use count is incremented whenever a new channel
-             * is obtained from this stream.
-             */
-           fd.decrementAndGetUseCount();
            channel.close();
         }
-
-        /*
-         * Decrement the FD use count associated with this stream
-         */
-        int useCount = fd.decrementAndGetUseCount();
-
-        /*
-         * If FileDescriptor is still in use by another stream, the finalizer
-         * will not close it.
-         */
-        if ((useCount <= 0) || !isRunningFinalize()) {
-            close0();
-        }
+        fd.closeAll(new Closeable() {
+            public void close() throws IOException {
+               close0();
+           }
+        });
     }
 
     /**
@@ -338,7 +313,9 @@
      * @see        java.io.FileDescriptor
      */
     public final FileDescriptor getFD() throws IOException {
-        if (fd != null) return fd;
+        if (fd != null) {
+            return fd;
+        }
         throw new IOException();
     }
 
@@ -362,13 +339,6 @@
         synchronized (this) {
             if (channel == null) {
                 channel = FileChannelImpl.open(fd, true, false, this);
-
-                /*
-                 * Increment fd's use count. Invoking the channel's close()
-                 * method will result in decrementing the use count set for
-                 * the channel.
-                 */
-                fd.incrementAndGetUseCount();
             }
             return channel;
         }
@@ -391,18 +361,12 @@
      */
     protected void finalize() throws IOException {
         if ((fd != null) &&  (fd != FileDescriptor.in)) {
-
-            /*
-             * Finalizer should not release the FileDescriptor if another
-             * stream is still using it. If the user directly invokes
-             * close() then the FileDescriptor is also released.
+            /* if fd is shared, the references in FileDescriptor
+             * will ensure that finalizer is only called when
+             * safe to do so. All references using the fd have
+             * become unreachable. We can call close()
              */
-            runningFinalize.set(Boolean.TRUE);
-            try {
-                close();
-            } finally {
-                runningFinalize.set(Boolean.FALSE);
-            }
+            close();
         }
     }
 }
--- a/src/share/classes/java/io/FileOutputStream.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/java/io/FileOutputStream.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -69,15 +69,6 @@
 
     private final Object closeLock = new Object();
     private volatile boolean closed = false;
-    private static final ThreadLocal<Boolean> runningFinalize =
-        new ThreadLocal<>();
-
-    private static boolean isRunningFinalize() {
-        Boolean val;
-        if ((val = runningFinalize.get()) != null)
-            return val.booleanValue();
-        return false;
-    }
 
     /**
      * Creates a file output stream to write to the file with the
@@ -208,7 +199,7 @@
         this.fd = new FileDescriptor();
         this.append = append;
 
-        fd.incrementAndGetUseCount();
+        fd.attach(this);
         open(name, append);
     }
 
@@ -245,13 +236,7 @@
         }
         this.fd = fdObj;
         this.append = false;
-
-        /*
-         * FileDescriptor is being shared by streams.
-         * Ensure that it's GC'ed only when all the streams/channels are done
-         * using it.
-         */
-        fd.incrementAndGetUseCount();
+        fd.attach(this);
     }
 
     /**
@@ -340,27 +325,13 @@
         }
 
         if (channel != null) {
-            /*
-             * Decrement FD use count associated with the channel
-             * The use count is incremented whenever a new channel
-             * is obtained from this stream.
-             */
-            fd.decrementAndGetUseCount();
             channel.close();
         }
-
-        /*
-         * Decrement FD use count associated with this stream
-         */
-        int useCount = fd.decrementAndGetUseCount();
-
-        /*
-         * If FileDescriptor is still in use by another stream, the finalizer
-         * will not close it.
-         */
-        if ((useCount <= 0) || !isRunningFinalize()) {
-            close0();
-        }
+        fd.closeAll(new Closeable() {
+            public void close() throws IOException {
+               close0();
+           }
+        });
     }
 
     /**
@@ -374,7 +345,9 @@
      * @see        java.io.FileDescriptor
      */
      public final FileDescriptor getFD()  throws IOException {
-        if (fd != null) return fd;
+        if (fd != null) {
+            return fd;
+        }
         throw new IOException();
      }
 
@@ -399,13 +372,6 @@
         synchronized (this) {
             if (channel == null) {
                 channel = FileChannelImpl.open(fd, false, true, append, this);
-
-                /*
-                 * Increment fd's use count. Invoking the channel's close()
-                 * method will result in decrementing the use count set for
-                 * the channel.
-                 */
-                fd.incrementAndGetUseCount();
             }
             return channel;
         }
@@ -424,18 +390,12 @@
             if (fd == FileDescriptor.out || fd == FileDescriptor.err) {
                 flush();
             } else {
-
-                /*
-                 * Finalizer should not release the FileDescriptor if another
-                 * stream is still using it. If the user directly invokes
-                 * close() then the FileDescriptor is also released.
+                /* if fd is shared, the references in FileDescriptor
+                 * will ensure that finalizer is only called when
+                 * safe to do so. All references using the fd have
+                 * become unreachable. We can call close()
                  */
-                runningFinalize.set(Boolean.TRUE);
-                try {
-                    close();
-                } finally {
-                    runningFinalize.set(Boolean.FALSE);
-                }
+                close();
             }
         }
     }
--- a/src/share/classes/java/io/RandomAccessFile.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/java/io/RandomAccessFile.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -229,7 +229,7 @@
             throw new NullPointerException();
         }
         fd = new FileDescriptor();
-        fd.incrementAndGetUseCount();
+        fd.attach(this);
         open(name, imode);
     }
 
@@ -242,7 +242,9 @@
      * @see        java.io.FileDescriptor
      */
     public final FileDescriptor getFD() throws IOException {
-        if (fd != null) return fd;
+        if (fd != null) {
+            return fd;
+        }
         throw new IOException();
     }
 
@@ -268,17 +270,6 @@
         synchronized (this) {
             if (channel == null) {
                 channel = FileChannelImpl.open(fd, true, rw, this);
-
-                /*
-                 * FileDescriptor could be shared by FileInputStream or
-                 * FileOutputStream.
-                 * Ensure that FD is GC'ed only when all the streams/channels
-                 * are done using it.
-                 * Increment fd's use count. Invoking the channel's close()
-                 * method will result in decrementing the use count set for
-                 * the channel.
-                 */
-                fd.incrementAndGetUseCount();
             }
             return channel;
         }
@@ -577,21 +568,13 @@
             closed = true;
         }
         if (channel != null) {
-            /*
-             * Decrement FD use count associated with the channel. The FD use
-             * count is incremented whenever a new channel is obtained from
-             * this stream.
-             */
-            fd.decrementAndGetUseCount();
             channel.close();
         }
-
-        /*
-         * Decrement FD use count associated with this stream.
-         * The count got incremented by FileDescriptor during its construction.
-         */
-        fd.decrementAndGetUseCount();
-        close0();
+        fd.closeAll(new Closeable() {
+            public void close() throws IOException {
+               close0();
+           }
+        });
     }
 
     //
--- a/src/share/classes/java/util/Collections.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/java/util/Collections.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1489,6 +1489,8 @@
                 }
                 public int hashCode()    {return e.hashCode();}
                 public boolean equals(Object o) {
+                    if (this == o)
+                        return true;
                     if (!(o instanceof Map.Entry))
                         return false;
                     Map.Entry t = (Map.Entry)o;
@@ -1709,6 +1711,8 @@
         }
 
         public boolean equals(Object o) {
+            if (this == o)
+                return true;
             synchronized (mutex) {return c.equals(o);}
         }
         public int hashCode() {
@@ -1863,6 +1867,8 @@
         }
 
         public boolean equals(Object o) {
+            if (this == o)
+                return true;
             synchronized (mutex) {return list.equals(o);}
         }
         public int hashCode() {
@@ -2073,6 +2079,8 @@
         }
 
         public boolean equals(Object o) {
+            if (this == o)
+                return true;
             synchronized (mutex) {return m.equals(o);}
         }
         public int hashCode() {
--- a/src/share/classes/java/util/jar/Manifest.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/java/util/jar/Manifest.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -400,6 +400,8 @@
         public byte peek() throws IOException {
             if (pos == count)
                 fill();
+            if (pos == count)
+                return -1; // nothing left in buffer
             return buf[pos];
         }
 
--- a/src/share/classes/javax/script/ScriptEngineManager.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/javax/script/ScriptEngineManager.java	Fri Mar 23 09:55:13 2012 -0700
@@ -39,7 +39,7 @@
  * collection of key/value pairs storing state shared by all engines created
  * by the Manager. This class uses the <a href="../../../technotes/guides/jar/jar.html#Service%20Provider">service provider</a> mechanism to enumerate all the
  * implementations of <code>ScriptEngineFactory</code>. <br><br>
- * The <code>ScriptEngineManager</code> provides a method to return an array of all these factories
+ * The <code>ScriptEngineManager</code> provides a method to return a list of all these factories
  * as well as utility methods which look up factories on the basis of language name, file extension
  * and mime type.
  * <p>
@@ -202,7 +202,7 @@
      * The algorithm first searches for a <code>ScriptEngineFactory</code> that has been
      * registered as a handler for the specified name using the <code>registerEngineName</code>
      * method.
-     * <br><br> If one is not found, it searches the array of <code>ScriptEngineFactory</code> instances
+     * <br><br> If one is not found, it searches the set of <code>ScriptEngineFactory</code> instances
      * stored by the constructor for one with the specified name.  If a <code>ScriptEngineFactory</code>
      * is found by either method, it is used to create instance of <code>ScriptEngine</code>.
      * @param shortName The short name of the <code>ScriptEngine</code> implementation.
@@ -351,7 +351,7 @@
     }
 
     /**
-     * Returns an array whose elements are instances of all the <code>ScriptEngineFactory</code> classes
+     * Returns a list whose elements are instances of all the <code>ScriptEngineFactory</code> classes
      * found by the discovery mechanism.
      * @return List of all discovered <code>ScriptEngineFactory</code>s.
      */
--- a/src/share/classes/javax/swing/DefaultListSelectionModel.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/javax/swing/DefaultListSelectionModel.java	Fri Mar 23 09:55:13 2012 -0700
@@ -252,6 +252,10 @@
 
     // Updates first and last change indices
     private void markAsDirty(int r) {
+        if (r == -1) {
+            return;
+        }
+
         firstAdjustedIndex = Math.min(firstAdjustedIndex, r);
         lastAdjustedIndex =  Math.max(lastAdjustedIndex, r);
     }
@@ -358,16 +362,12 @@
     private void updateLeadAnchorIndices(int anchorIndex, int leadIndex) {
         if (leadAnchorNotificationEnabled) {
             if (this.anchorIndex != anchorIndex) {
-                if (this.anchorIndex != -1) { // The unassigned state.
-                    markAsDirty(this.anchorIndex);
-                }
+                markAsDirty(this.anchorIndex);
                 markAsDirty(anchorIndex);
             }
 
             if (this.leadIndex != leadIndex) {
-                if (this.leadIndex != -1) { // The unassigned state.
-                    markAsDirty(this.leadIndex);
-                }
+                markAsDirty(this.leadIndex);
                 markAsDirty(leadIndex);
             }
         }
--- a/src/share/classes/sun/java2d/loops/Blit.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/sun/java2d/loops/Blit.java	Fri Mar 23 09:55:13 2012 -0700
@@ -172,11 +172,11 @@
             while (si.nextSpan(span)) {
                 int w = span[2] - span[0];
                 int h = span[3] - span[1];
-                srcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
-                                            w, h, 0, 0, null);
-                dstRas = dstRas.createWritableChild(span[0], span[1],
-                                                    w, h, 0, 0, null);
-                ctx.compose(srcRas, dstRas, dstRas);
+                Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
+                                                      w, h, 0, 0, null);
+                WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
+                                                                      w, h, 0, 0, null);
+                ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
             }
             ctx.dispose();
         }
--- a/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	Fri Mar 23 09:55:13 2012 -0700
@@ -141,7 +141,7 @@
         if (s == null) {
             return getInstance();
         } else {
-            return getInstance0(s);
+            return getInstance0(parse(s));
         }
     }
 
--- a/src/share/classes/sun/util/calendar/ZoneInfo.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/sun/util/calendar/ZoneInfo.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -80,13 +80,18 @@
     private static final int TRANSITION_NSHIFT = 12;
 
     // Flag for supporting JDK backward compatible IDs, such as "EST".
-    private static final boolean USE_OLDMAPPING;
+    static final boolean USE_OLDMAPPING;
     static {
       String oldmapping = AccessController.doPrivileged(
           new sun.security.action.GetPropertyAction("sun.timezone.ids.oldmapping", "false")).toLowerCase(Locale.ROOT);
       USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true"));
     }
 
+    // IDs having conflicting data between Olson and JDK 1.1
+    static final String[] conflictingIDs = {
+        "EST", "MST", "HST"
+    };
+
     private static final CalendarSystem gcal = CalendarSystem.getGregorianCalendar();
 
     /**
@@ -807,7 +812,17 @@
         return (checksum == ((ZoneInfo)other).checksum);
     }
 
-    private static SoftReference<Map> aliasTable;
+    private static SoftReference<Map<String, String>> aliasTable;
+
+    static Map<String, String> getCachedAliasTable() {
+        Map<String, String> aliases = null;
+
+        SoftReference<Map<String, String>> cache = aliasTable;
+        if (cache != null) {
+            aliases = cache.get();
+        }
+        return aliases;
+    }
 
     /**
      * Returns a Map from alias time zone IDs to their standard
@@ -818,20 +833,19 @@
      *    <code>ZoneInfoMappings</code> file is not available.
      */
     public synchronized static Map<String, String> getAliasTable() {
-        Map<String, String> aliases = null;
-
-        SoftReference<Map> cache = aliasTable;
-        if (cache != null) {
-            aliases = cache.get();
+        Map<String, String> aliases = getCachedAliasTable();
+        if (aliases == null) {
+            aliases = ZoneInfoFile.getZoneAliases();
             if (aliases != null) {
-                return aliases;
+                if (!USE_OLDMAPPING) {
+                    // Remove the conflicting IDs from the alias table.
+                    for (String key : conflictingIDs) {
+                        aliases.remove(key);
+                    }
+                }
+                aliasTable = new SoftReference<Map<String, String>>(aliases);
             }
         }
-
-        aliases = ZoneInfoFile.getZoneAliases();
-        if (aliases != null) {
-            aliasTable = new SoftReference<Map>(aliases);
-        }
         return aliases;
     }
 
--- a/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -472,6 +472,7 @@
     public static final byte    TAG_ExcludedZones = 69;
 
     private static Map<String, ZoneInfo> zoneInfoObjects = null;
+    private static final ZoneInfo GMT = new ZoneInfo("GMT", 0);
 
     private static final String ziDir = AccessController.doPrivileged(
         new PrivilegedAction<String>() {
@@ -553,8 +554,15 @@
      * id.
      */
     public static ZoneInfo getZoneInfo(String id) {
+        //treat GMT zone as special
+        if ("GMT".equals(id))
+            return (ZoneInfo) GMT.clone();
         ZoneInfo zi = getFromCache(id);
         if (zi == null) {
+            Map<String, String> aliases = ZoneInfo.getCachedAliasTable();
+            if (aliases != null && aliases.get(id) != null) {
+                return null;
+            }
             zi = createZoneInfo(id);
             if (zi == null) {
                 return null;
@@ -1031,30 +1039,26 @@
      * @return the buffer, or null if any I/O error occurred.
      */
     private static byte[] readZoneInfoFile(final String fileName) {
+        if (fileName.indexOf("..") >= 0) {
+            return null;
+        }
         byte[] buffer = null;
 
         try {
             buffer = (byte[]) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                 public Object run() throws IOException {
                     File file = new File(ziDir, fileName);
-                    if (!file.exists() || !file.isFile()) {
-                        return null;
-                    }
-                    file = file.getCanonicalFile();
-                    String path = file.getCanonicalPath();
                     byte[] buf = null;
-                    if (path != null && path.startsWith(ziDir)) {
-                        int filesize = (int)file.length();
-                        if (filesize > 0) {
-                            FileInputStream fis = new FileInputStream(file);
-                            buf = new byte[filesize];
-                            try {
-                                if (fis.read(buf) != filesize) {
-                                    throw new IOException("read error on " + fileName);
-                                }
-                            } finally {
-                                fis.close();
+                    int filesize = (int)file.length();
+                    if (filesize > 0) {
+                        FileInputStream fis = new FileInputStream(file);
+                        buf = new byte[filesize];
+                        try {
+                            if (fis.read(buf) != filesize) {
+                                throw new IOException("read error on " + fileName);
                             }
+                        } finally {
+                            fis.close();
                         }
                     }
                     return buf;
--- a/src/solaris/classes/java/io/FileDescriptor.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/solaris/classes/java/io/FileDescriptor.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -24,8 +24,8 @@
  */
 
 package java.io;
-
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Instances of the file descriptor class serve as an opaque handle
@@ -45,13 +45,9 @@
 public final class FileDescriptor {
 
     private int fd;
-
-    /**
-     * A counter for tracking the FIS/FOS/RAF instances that
-     * use this FileDescriptor. The FIS/FOS.finalize() will not release
-     * the FileDescriptor if it is still under user by a stream.
-     */
-    private AtomicInteger useCount;
+    private Closeable parent;
+    private List<Closeable> otherParents;
+    private boolean closed;
 
     /**
      * Constructs an (invalid) FileDescriptor
@@ -59,12 +55,10 @@
      */
     public /**/ FileDescriptor() {
         fd = -1;
-        useCount = new AtomicInteger();
     }
 
     private /* */ FileDescriptor(int fd) {
         this.fd = fd;
-        useCount = new AtomicInteger();
     }
 
     /**
@@ -164,13 +158,67 @@
         );
     }
 
-    // package private methods used by FIS, FOS and RAF
+    /*
+     * Package private methods to track referents.
+     * If multiple streams point to the same FileDescriptor, we cycle
+     * through the list of all referents and call close()
+     */
 
-    int incrementAndGetUseCount() {
-        return useCount.incrementAndGet();
+    /**
+     * Attach a Closeable to this FD for tracking.
+     * parent reference is added to otherParents when
+     * needed to make closeAll simpler.
+     */
+    synchronized void attach(Closeable c) {
+        if (parent == null) {
+            // first caller gets to do this
+            parent = c;
+        } else if (otherParents == null) {
+            otherParents = new ArrayList<>();
+            otherParents.add(parent);
+            otherParents.add(c);
+        } else {
+            otherParents.add(c);
+        }
     }
 
-    int decrementAndGetUseCount() {
-        return useCount.decrementAndGet();
+    /**
+     * Cycle through all Closeables sharing this FD and call
+     * close() on each one.
+     *
+     * The caller closeable gets to call close0().
+     */
+    @SuppressWarnings("try")
+    synchronized void closeAll(Closeable releaser) throws IOException {
+        if (!closed) {
+            closed = true;
+            IOException ioe = null;
+            try (Closeable c = releaser) {
+                if (otherParents != null) {
+                    for (Closeable referent : otherParents) {
+                        try {
+                            referent.close();
+                        } catch(IOException x) {
+                            if (ioe == null) {
+                                ioe = x;
+                            } else {
+                                ioe.addSuppressed(x);
+                            }
+                        }
+                    }
+                }
+            } catch(IOException ex) {
+                /*
+                 * If releaser close() throws IOException
+                 * add other exceptions as suppressed.
+                 */
+                if (ioe != null)
+                    ex.addSuppressed(ioe);
+                ioe = ex;
+            } finally {
+                if (ioe != null)
+                    throw ioe;
+            }
+        }
     }
 }
--- a/src/windows/classes/java/io/FileDescriptor.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/src/windows/classes/java/io/FileDescriptor.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,8 +24,8 @@
  */
 
 package java.io;
-
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Instances of the file descriptor class serve as an opaque handle
@@ -42,16 +42,10 @@
 public final class FileDescriptor {
 
     private int fd;
-
     private long handle;
-
-    /**
-     * A use counter for tracking the FIS/FOS/RAF instances that
-     * use this FileDescriptor. The FIS/FOS.finalize() will not release
-     * the FileDescriptor if it is still under use by any stream.
-     */
-    private AtomicInteger useCount;
-
+    private Closeable parent;
+    private List<Closeable> otherParents;
+    private boolean closed;
 
     /**
      * Constructs an (invalid) FileDescriptor
@@ -60,7 +54,6 @@
     public /**/ FileDescriptor() {
         fd = -1;
         handle = -1;
-        useCount = new AtomicInteger();
     }
 
     static {
@@ -168,13 +161,67 @@
         return desc;
     }
 
-    // package private methods used by FIS, FOS and RAF.
+    /*
+     * Package private methods to track referents.
+     * If multiple streams point to the same FileDescriptor, we cycle
+     * through the list of all referents and call close()
+     */
 
-    int incrementAndGetUseCount() {
-        return useCount.incrementAndGet();
+    /**
+     * Attach a Closeable to this FD for tracking.
+     * parent reference is added to otherParents when
+     * needed to make closeAll simpler.
+     */
+    synchronized void attach(Closeable c) {
+        if (parent == null) {
+            // first caller gets to do this
+            parent = c;
+        } else if (otherParents == null) {
+            otherParents = new ArrayList<>();
+            otherParents.add(parent);
+            otherParents.add(c);
+        } else {
+            otherParents.add(c);
+        }
     }
 
-    int decrementAndGetUseCount() {
-        return useCount.decrementAndGet();
+    /**
+     * Cycle through all Closeables sharing this FD and call
+     * close() on each one.
+     *
+     * The caller closeable gets to call close0().
+     */
+    @SuppressWarnings("try")
+    synchronized void closeAll(Closeable releaser) throws IOException {
+        if (!closed) {
+            closed = true;
+            IOException ioe = null;
+            try (Closeable c = releaser) {
+                if (otherParents != null) {
+                    for (Closeable referent : otherParents) {
+                        try {
+                            referent.close();
+                        } catch(IOException x) {
+                            if (ioe == null) {
+                                ioe = x;
+                            } else {
+                                ioe.addSuppressed(x);
+                            }
+                        }
+                    }
+                }
+            } catch(IOException ex) {
+                /*
+                 * If releaser close() throws IOException
+                 * add other exceptions as suppressed.
+                 */
+                if (ioe != null)
+                    ex.addSuppressed(ioe);
+                ioe = ex;
+            } finally {
+                if (ioe != null)
+                    throw ioe;
+            }
+        }
     }
 }
--- a/test/ProblemList.txt	Tue Mar 20 10:27:31 2012 -0700
+++ b/test/ProblemList.txt	Fri Mar 23 09:55:13 2012 -0700
@@ -210,6 +210,9 @@
 # Windows X64, RuntimeException: MyThread expected to have RUNNABLE but got WAITING
 java/lang/Thread/ThreadStateTest.java                           generic-all
 
+# 7148492
+java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	generic-all
+
 ############################################################################
 
 # jdk_management
@@ -382,6 +385,10 @@
 #7143960
 java/net/DatagramSocket/SendDatagramToBadAddress.java            macosx-all
 
+# 7148829
+sun/net/InetAddress/nameservice/simple/CacheTest.java		generic-all
+sun/net/InetAddress/nameservice/simple/DefaultCaching.java	generic-all
+
 ############################################################################
 
 # jdk_io
@@ -431,6 +438,9 @@
 # Fails on Linux 32 and 64bit -server?, impl not garbage collected???
 java/rmi/transport/pinLastArguments/PinLastArguments.java       generic-all
 
+# 7146541
+java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java	linux-all
+
 # Times out on solaris sparc
 java/rmi/server/RemoteServer/AddrInUse.java                     generic-all
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/jndi/ldap/LdapUnicodeURL.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,41 @@
+/*
+ * 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 6961765
+ * @summary Double byte characters corrupted in DN for LDAP referrals
+ */
+
+import com.sun.jndi.ldap.LdapURL;
+
+public class LdapUnicodeURL {
+    public static void main(String[] args) throws Exception {
+        // First 3 characters of the CJK Unified Ideographs
+        String uid = "uid=\u4e00\u4e01\u4e02";
+        LdapURL ldURL = new LdapURL("ldap://www.example.com/" + uid);
+        if (!ldURL.getDN().equals(uid)) {
+            throw new Exception("uid changed to " + ldURL.getDN());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/beans/PropertyChangeSupport/Test7148143.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,58 @@
+/*
+ * 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 7148143
+ * @summary Tests ClassCastException for the PropertyChangeSupport class
+ * @author Sergey Malenkov
+ */
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.EventListener;
+import java.util.EventListenerProxy;
+
+public class Test7148143 {
+
+    private static class CustomProxy
+            extends EventListenerProxy<EventListener>
+            implements PropertyChangeListener {
+
+        public CustomProxy() {
+            super(new EventListener() {
+            });
+        }
+
+        public void propertyChange(PropertyChangeEvent event) {
+        }
+    }
+
+    public static void main(String[] args) {
+        PropertyChangeListener listener = new CustomProxy();
+        PropertyChangeSupport support = new PropertyChangeSupport(listener);
+        support.addPropertyChangeListener(listener);
+        support.addPropertyChangeListener("foo", listener); // cast class exception
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/beans/VetoableChangeSupport/Test7148143.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,58 @@
+/*
+ * 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 7148143
+ * @summary Tests ClassCastException for the VetoableChangeSupport class
+ * @author Sergey Malenkov
+ */
+
+import java.beans.PropertyChangeEvent;
+import java.beans.VetoableChangeListener;
+import java.beans.VetoableChangeSupport;
+import java.util.EventListener;
+import java.util.EventListenerProxy;
+
+public class Test7148143 {
+
+    private static class CustomProxy
+            extends EventListenerProxy<EventListener>
+            implements VetoableChangeListener {
+
+        public CustomProxy() {
+            super(new EventListener() {
+            });
+        }
+
+        public void vetoableChange(PropertyChangeEvent event) {
+        }
+    }
+
+    public static void main(String[] args) {
+        VetoableChangeListener listener = new CustomProxy();
+        VetoableChangeSupport support = new VetoableChangeSupport(listener);
+        support.addVetoableChangeListener(listener);
+        support.addVetoableChangeListener("foo", listener); // cast class exception
+    }
+}
--- a/test/java/io/FileDescriptor/FileChannelFDTest.java	Tue Mar 20 10:27:31 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2006, 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 6322678
- * @summary Test for making sure that fd is closed during
- *          finalization of a stream, when an associated
- *          file channel is not available
- */
-
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-
-public class FileChannelFDTest {
-
-    static byte data[] = new byte[] {48, 49, 50, 51, 52, 53, 54, 55, 56, 57,};
-    static String inFileName = "fd-in-test.txt";
-    static String outFileName = "fd-out-test.txt";
-    static File inFile;
-    static File outFile;
-
-    private static void writeToInFile() throws IOException {
-        FileOutputStream out = new FileOutputStream(inFile);
-        out.write(data);
-        out.close();
-    }
-
-    public static void main(String[] args)
-                throws Exception {
-
-        inFile= new File(System.getProperty("test.dir", "."),
-                        inFileName);
-        inFile.createNewFile();
-        inFile.deleteOnExit();
-        writeToInFile();
-
-        outFile  = new File(System.getProperty("test.dir", "."),
-                        outFileName);
-        outFile.createNewFile();
-        outFile.deleteOnExit();
-
-        doFileChannel();
-    }
-
-     private static void doFileChannel() throws Exception {
-
-        FileInputStream fis = new FileInputStream(inFile);
-        FileDescriptor fd = fis.getFD();
-        FileChannel fc = fis.getChannel();
-        System.out.println("Created fis:" + fis);
-
-        /**
-         * Encourage the GC
-         */
-        fis = null;
-        fc = null;
-        System.gc();
-        Thread.sleep(500);
-
-        if (fd.valid()) {
-            throw new Exception("Finalizer either didn't run --" +
-                "try increasing the Thread's sleep time after System.gc();" +
-                "or the finalizer didn't close the file");
-        }
-
-        System.out.println("File Closed successfully");
-        System.out.println();
-  }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/io/FileDescriptor/Sharing.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,408 @@
+/*
+ * 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 7105952 6322678 7082769
+ * @summary Improve finalisation for FileInputStream/FileOutputStream/RandomAccessFile
+ * @run main/othervm Sharing
+ */
+
+import java.io.*;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.util.concurrent.CountDownLatch;
+
+public class Sharing {
+
+    final static int numFiles = 10;
+    volatile static boolean fail;
+
+    public static void main(String[] args) throws Exception {
+        TestFinalizer();
+        TestMultipleFD();
+        TestIsValid();
+        MultiThreadedFD();
+        TestCloseAll();
+    }
+
+    /**
+     * Finalizer shouldn't discard a file descriptor until all streams have
+     * finished with it.
+     */
+    private static void TestFinalizer() throws Exception {
+        FileDescriptor fd = null;
+        File tempFile = new File("TestFinalizer1.txt");
+        tempFile.deleteOnExit();
+        try (Writer writer = new FileWriter(tempFile)) {
+            for (int i=0; i<5; i++) {
+                writer.write("test file content test file content");
+            }
+        }
+
+        FileInputStream fis1 = new FileInputStream(tempFile);
+        fd = fis1.getFD();
+        // Create a new FIS based on the existing FD (so the two FIS's share the same native fd)
+        try (FileInputStream fis2 = new FileInputStream(fd)) {
+            // allow fis1 to be gc'ed
+            fis1 = null;
+            int ret = 0;
+            while(ret >= 0) {
+                // encourage gc
+                System.gc();
+                // read from fis2 - when fis1 is gc'ed and finalizer is run, read will fail
+                System.out.print(".");
+                ret = fis2.read();
+            }
+        }
+
+        // variation of above. Use RandomAccessFile to obtain a filedescriptor
+        File testFinalizerFile = new File("TestFinalizer");
+        RandomAccessFile raf = new RandomAccessFile(testFinalizerFile, "rw");
+        raf.writeBytes("test file content test file content");
+        raf.seek(0L);
+        fd = raf.getFD();
+        try (FileInputStream fis3 = new FileInputStream(fd)) {
+            // allow raf to be gc'ed
+            raf = null;
+            int ret = 0;
+            while (ret >= 0) {
+                // encourage gc
+                System.gc();
+                /*
+                 * read from fis3 - when raf is gc'ed and finalizer is run,
+                 * fd should still be valid.
+                 */
+                System.out.print(".");
+                ret = fis3.read();
+            }
+        } finally {
+            testFinalizerFile.delete();
+        }
+    }
+
+    /**
+     * Exercise FileDispatcher close()/preClose()
+     */
+    private static void TestMultipleFD() throws Exception {
+        RandomAccessFile raf = null;
+        FileOutputStream fos = null;
+        FileInputStream fis = null;
+        FileChannel fc = null;
+        FileLock fileLock = null;
+
+        File test1 = new File("test1");
+        try {
+            raf = new RandomAccessFile(test1, "rw");
+            fos = new FileOutputStream(raf.getFD());
+            fis = new FileInputStream(raf.getFD());
+            fc = raf.getChannel();
+            fileLock = fc.lock();
+            raf.setLength(0L);
+            fos.flush();
+            fos.write("TEST".getBytes());
+        } finally {
+            if (fileLock != null) fileLock.release();
+            if (fis != null) fis.close();
+            if (fos != null) fos.close();
+            if (raf != null) raf.close();
+            test1.delete();
+        }
+
+        /*
+         * Close out in different order to ensure FD is not
+         * closed out too early
+         */
+        File test2 = new File("test2");
+        try {
+            raf = new RandomAccessFile(test2, "rw");
+            fos = new FileOutputStream(raf.getFD());
+            fis = new FileInputStream(raf.getFD());
+            fc = raf.getChannel();
+            fileLock = fc.lock();
+            raf.setLength(0L);
+            fos.flush();
+            fos.write("TEST".getBytes());
+        } finally {
+            if (fileLock != null) fileLock.release();
+            if (raf != null) raf.close();
+            if (fos != null) fos.close();
+            if (fis != null) fis.close();
+            test2.delete();
+        }
+
+        // one more time, fos first this time
+        File test3 = new File("test3");
+        try {
+            raf = new RandomAccessFile(test3, "rw");
+            fos = new FileOutputStream(raf.getFD());
+            fis = new FileInputStream(raf.getFD());
+            fc = raf.getChannel();
+            fileLock = fc.lock();
+            raf.setLength(0L);
+            fos.flush();
+            fos.write("TEST".getBytes());
+        } finally {
+            if (fileLock != null) fileLock.release();
+            if (fos != null) fos.close();
+            if (raf != null) raf.close();
+            if (fis != null) fis.close();
+            test3.delete();
+        }
+    }
+
+    /**
+     * Similar to TestMultipleFD() but this time we
+     * just get and use FileDescriptor.valid() for testing.
+     */
+    private static void TestIsValid() throws Exception {
+        FileDescriptor fd = null;
+        RandomAccessFile raf = null;
+        FileOutputStream fos = null;
+        FileInputStream fis = null;
+        FileChannel fc = null;
+
+        File test1 = new File("test1");
+        try {
+            raf = new RandomAccessFile(test1, "rw");
+            fd = raf.getFD();
+            fos = new FileOutputStream(fd);
+            fis = new FileInputStream(fd);
+        } finally {
+            try {
+                if (fis != null) fis.close();
+                if (fd.valid()) {
+                    throw new RuntimeException("[FIS close()] FileDescriptor shouldn't be valid");
+                }
+                if (fos != null) fos.close();
+                if (raf != null) raf.close();
+            } finally {
+                test1.delete();
+            }
+        }
+
+        /*
+         * Close out in different order to ensure FD is
+         * closed correctly.
+         */
+        File test2 = new File("test2");
+        try {
+            raf = new RandomAccessFile(test2, "rw");
+            fd = raf.getFD();
+            fos = new FileOutputStream(fd);
+            fis = new FileInputStream(fd);
+        } finally {
+            try {
+                if (raf != null) raf.close();
+                if (fd.valid()) {
+                    throw new RuntimeException("[RAF close()] FileDescriptor shouldn't be valid");
+                }
+                if (fos != null) fos.close();
+                if (fis != null) fis.close();
+            } finally {
+                test2.delete();
+            }
+        }
+
+        // one more time, fos first this time
+        File test3 = new File("test3");
+        try {
+            raf = new RandomAccessFile(test3, "rw");
+            fd = raf.getFD();
+            fos = new FileOutputStream(fd);
+            fis = new FileInputStream(fd);
+        } finally {
+            try {
+                if (fos != null) fos.close();
+                if (fd.valid()) {
+                    throw new RuntimeException("[FOS close()] FileDescriptor shouldn't be valid");
+                }
+                if (raf != null) raf.close();
+                if (fis != null) fis.close();
+            } finally {
+                test3.delete();
+            }
+        }
+    }
+
+    /**
+     * Test concurrent access to the same FileDescriptor
+     */
+    private static void MultiThreadedFD() throws Exception {
+        RandomAccessFile raf = null;
+        FileDescriptor fd = null;
+        int numThreads = 2;
+        CountDownLatch done = new CountDownLatch(numThreads);
+        OpenClose[] fileOpenClose = new OpenClose[numThreads];
+        File MultipleThreadedFD = new File("MultipleThreadedFD");
+        try {
+            raf = new RandomAccessFile(MultipleThreadedFD, "rw");
+            fd = raf.getFD();
+            for(int count=0;count<numThreads;count++) {
+                fileOpenClose[count] = new OpenClose(fd, done);
+                fileOpenClose[count].start();
+            }
+            done.await();
+        } finally {
+            try {
+                if(raf != null) raf.close();
+                // fd should now no longer be valid
+                if(fd.valid()) {
+                    throw new RuntimeException("FileDescriptor should not be valid");
+                }
+                // OpenClose thread tests failed
+                if(fail) {
+                    throw new RuntimeException("OpenClose thread tests failed.");
+                }
+            } finally {
+                MultipleThreadedFD.delete();
+            }
+        }
+    }
+
+    /**
+     * Test closeAll handling in FileDescriptor
+     */
+    private static void TestCloseAll() throws Exception {
+        File testFile = new File("test");
+        testFile.deleteOnExit();
+        RandomAccessFile raf = new RandomAccessFile(testFile, "rw");
+        FileInputStream fis = new FileInputStream(raf.getFD());
+        fis.close();
+        if (raf.getFD().valid()) {
+             throw new RuntimeException("FD should not be valid.");
+        }
+
+        // Test the suppressed exception handling - FileInputStream
+
+        raf = new RandomAccessFile(testFile, "rw");
+        fis = new FileInputStream(raf.getFD());
+        BadFileInputStream bfis1 = new BadFileInputStream(raf.getFD());
+        BadFileInputStream bfis2 = new BadFileInputStream(raf.getFD());
+        BadFileInputStream bfis3 = new BadFileInputStream(raf.getFD());
+        // extra test - set bfis3 to null
+        bfis3 = null;
+        try {
+            fis.close();
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+            if (ioe.getSuppressed().length != 2) {
+                throw new RuntimeException("[FIS]Incorrect number of suppressed " +
+                          "exceptions received : " + ioe.getSuppressed().length);
+            }
+        }
+        if (raf.getFD().valid()) {
+            // we should still have closed the FD
+            // even with the exception.
+            throw new RuntimeException("[FIS]TestCloseAll : FD still valid.");
+        }
+
+        // Now test with FileOutputStream
+
+        raf = new RandomAccessFile(testFile, "rw");
+        FileOutputStream fos = new FileOutputStream(raf.getFD());
+        BadFileOutputStream bfos1 = new BadFileOutputStream(raf.getFD());
+        BadFileOutputStream bfos2 = new BadFileOutputStream(raf.getFD());
+        BadFileOutputStream bfos3 = new BadFileOutputStream(raf.getFD());
+        // extra test - set bfos3 to null
+        bfos3 = null;
+        try {
+            fos.close();
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+            if (ioe.getSuppressed().length != 2) {
+                throw new RuntimeException("[FOS]Incorrect number of suppressed " +
+                          "exceptions received : " + ioe.getSuppressed().length);
+            }
+        }
+        if (raf.getFD().valid()) {
+            // we should still have closed the FD
+            // even with the exception.
+            throw new RuntimeException("[FOS]TestCloseAll : FD still valid.");
+        }
+    }
+
+    /**
+     * A thread which will open and close a number of FileInputStreams and
+     * FileOutputStreams referencing the same native file descriptor.
+     */
+    private static class OpenClose extends Thread {
+        private FileDescriptor fd = null;
+        private CountDownLatch done;
+        FileInputStream[] fisArray = new FileInputStream[numFiles];
+        FileOutputStream[] fosArray = new FileOutputStream[numFiles];
+
+        OpenClose(FileDescriptor filedescriptor, CountDownLatch done) {
+            this.fd = filedescriptor;
+            this.done = done;
+        }
+
+        public void run() {
+             try {
+                 for(int i=0;i<numFiles;i++) {
+                     fisArray[i] = new FileInputStream(fd);
+                     fosArray[i] = new FileOutputStream(fd);
+                 }
+
+                 // Now close out
+                 for(int i=0;i<numFiles;i++) {
+                     if(fisArray[i] != null) fisArray[i].close();
+                     if(fosArray[i] != null) fosArray[i].close();
+                 }
+
+             } catch(IOException ioe) {
+                 System.out.println("OpenClose encountered IO issue :" + ioe);
+                 fail = true;
+             } finally {
+                 if (fd.valid()) { // fd should not be valid after first close() call
+                     System.out.println("OpenClose: FileDescriptor shouldn't be valid");
+                     fail = true;
+                 }
+                 done.countDown();
+             }
+         }
+    }
+
+    private static class BadFileInputStream extends FileInputStream {
+
+        BadFileInputStream(FileDescriptor fd) {
+            super(fd);
+        }
+
+        public void close() throws IOException {
+            throw new IOException("Bad close operation");
+        }
+    }
+
+    private static class BadFileOutputStream extends FileOutputStream {
+
+        BadFileOutputStream(FileDescriptor fd) {
+            super(fd);
+        }
+
+        public void close() throws IOException {
+            throw new IOException("Bad close operation");
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Collections/EqualsTest.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,66 @@
+/*
+ * 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 7144488
+ * @summary Infinite recursion for some equals tests in Collections
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class EqualsTest {
+    public static void main(String[] args) {
+        boolean test;
+
+        /* synchronizedList test */
+        List list = Collections.synchronizedList(new ArrayList());
+        list.add(list);
+        test = list.equals(list);
+        assertTrue(test);
+        list.remove(list);
+
+        /* synchronizedSet test */
+        Set s = Collections.synchronizedSet(new HashSet());
+        s.add(s);
+        test = s.equals(s);
+        assertTrue(test);
+
+        /* synchronizedMap test */
+        Map m =  Collections.synchronizedMap(new HashMap());
+        test = m.equals(m);
+        assertTrue(test);
+
+    }
+
+    private static void assertTrue(boolean b) {
+        if (!b)
+            throw new RuntimeException("assertion failed");
+    }
+}
--- a/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Fri Mar 23 09:55:13 2012 -0700
@@ -28,6 +28,8 @@
  * @author Martin Buchholz
  */
 
+// Note: this file is now out of sync with the jsr166 CVS repository due to the fix for 7092140
+
 import java.util.*;
 import java.util.regex.*;
 import java.util.concurrent.*;
@@ -148,7 +150,7 @@
             String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
 
         final String[] jobCmd = {
-            java, "-Xmx8m",
+            java, "-Xmx8m", "-XX:+UsePerfData",
             "-classpath", System.getProperty("test.classes", "."),
             childClassName, uniqueID
         };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/jar/Manifest/CreateManifest.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,301 @@
+/*
+ * 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 7148584
+ * @summary Jar tools fails to generate manifest correctly when boundary condition hit
+ * @compile -XDignore.symbol.file=true CreateManifest.java
+ * @run main CreateManifest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.jar.*;
+
+public class CreateManifest {
+
+public static void main(String arg[]) throws Exception {
+
+    String jarFileName = "test.jar";
+    String ManifestName = "MANIFEST.MF";
+
+    // create the MANIFEST.MF file
+    Files.write(Paths.get(ManifestName), FILE_CONTENTS.getBytes());
+
+    String [] args = new String [] { "cvfm", jarFileName, ManifestName};
+    sun.tools.jar.Main jartool =
+            new sun.tools.jar.Main(System.out, System.err, "jar");
+    jartool.run(args);
+
+    try (JarFile jf = new JarFile(jarFileName)) {
+        Manifest m = jf.getManifest();
+        String result = m.getMainAttributes().getValue("Class-path");
+        if (result == null)
+            throw new RuntimeException("Failed to add Class-path attribute to manifest");
+    } finally {
+        Files.deleteIfExists(Paths.get(jarFileName));
+        Files.deleteIfExists(Paths.get(ManifestName));
+    }
+
+}
+
+private static final String FILE_CONTENTS =
+ "Class-path: \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-host-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-host-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-security-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-security-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-event-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-event-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-event-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-event-console-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-event-console-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-event-rules-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-event-rules-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-swlib-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-installmediacomponent-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-host-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-event-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-security-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ohagent-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ohcoherence-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ohjrockit-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-extensibility-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mpcustom-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-selfmonitor-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ocheck-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-udmmig-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-multioms-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ocheck-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-services-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-services-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-services-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-eventmobile-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwkmobile-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-logmgmt-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-omsproperties-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-ohel-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-agentupgrade-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-regiontest-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-uielements-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-uielements-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-sandbox-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-sandbox-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-adfext-bc-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-aslm-services-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-avail-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-charge-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-config-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-connect-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-db-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-public-entity.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-console-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-rules-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-extens-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-filebrowser-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-filebrowser-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ip-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-job-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-me-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-metric-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-paf-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-security-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-templ-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-entity.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agent-patching-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agent-patching-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-uimodel.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-adfext-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agentpatching-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-avail-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-charge-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-config-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-connect-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-db-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-extens-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ip-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-job-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-me-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-metric-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-paf-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-security-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-templ-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-groups-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-groups-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-resources-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-patching-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-patching-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ohinv-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ohinv-test.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ppc-public-pojo.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ppc-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agentpush-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwkmobile-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-public-model.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-public-ui.jar \n" +
+ " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-test.jar \n";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JMenuItem/6209975/bug6209975.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,172 @@
+/*
+ * 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 6209975
+ * @summary regression: JMenuItem icons overimposed on JMenuItem labels under Metal LAF
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author Alexander Zuev
+ * @run main bug6209975
+ */
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import sun.awt.SunToolkit;
+
+public class bug6209975 {
+
+    private static final ReturnObject RO1 = new ReturnObject();
+    private static final ReturnObject RO2 = new ReturnObject();
+
+    private static JMenu menu;
+    private static JButton button;
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(500);
+
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        Point clickPoint = getButtonClickPoint();
+        robot.mouseMove(clickPoint.x, clickPoint.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        toolkit.realSync();
+
+        clickPoint = getMenuClickPoint();
+        robot.mouseMove(clickPoint.x, clickPoint.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        toolkit.realSync();
+
+        if (RO1.itsValue <= RO2.itsValue) {
+            throw new RuntimeException("Offset if the second icon is invalid.");
+        }
+    }
+
+    private static Point getButtonClickPoint() throws Exception {
+        final Point[] result = new Point[1];
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                Point p = button.getLocationOnScreen();
+                Dimension size = button.getSize();
+                result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2);
+            }
+        });
+        return result[0];
+    }
+
+    private static Point getMenuClickPoint() throws Exception {
+        final Point[] result = new Point[1];
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                Point p = menu.getLocationOnScreen();
+                Dimension size = menu.getSize();
+                result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2);
+            }
+        });
+        return result[0];
+    }
+
+    private static void createAndShowGUI() {
+        JFrame frame = new JFrame("Test6209975");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        frame.setLayout(new BorderLayout());
+        button = new JButton("Focus holder");
+        frame.add(button);
+
+        JMenuBar mb = new JMenuBar();
+        menu = new JMenu("File");
+
+        JMenuItem item;
+
+        item = new JMenuItem("Just a menu item");
+        item.setIcon(new MyIcon(RO1));
+        item.setHorizontalTextPosition(SwingConstants.LEADING);
+        menu.add(item);
+
+        item = new JMenuItem("Menu Item with another icon");
+        item.setIcon(new MyIcon(RO2));
+        item.setHorizontalTextPosition(SwingConstants.TRAILING);
+        menu.add(item);
+
+        mb.add(menu);
+
+        frame.setJMenuBar(mb);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.pack();
+        frame.setLocation(400, 300);
+        frame.setVisible(true);
+    }
+
+    public static class ReturnObject {
+
+        public volatile int itsValue;
+    }
+
+    public static class MyIcon implements Icon {
+
+        ReturnObject thisObject = null;
+
+        public MyIcon(ReturnObject ro) {
+            super();
+            thisObject = ro;
+        }
+
+        public void paintIcon(Component c, Graphics g, int x, int y) {
+            Color color = g.getColor();
+            g.setColor(Color.BLACK);
+            g.fillRect(x, y, 10, 10);
+            g.setColor(color);
+            thisObject.itsValue = x;
+        }
+
+        public int getIconWidth() {
+            return 10;
+        }
+
+        public int getIconHeight() {
+            return 10;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JTable/7027139/bug7027139.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,66 @@
+/*
+ * 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 7027139
+   @summary getFirstIndex() does not return the first index that has changed
+   @author Pavel Porvatov
+*/
+
+import javax.swing.*;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+public class bug7027139 {
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JTable orderTable = new JTable(new String[][]{
+                        {"Item 1 1", "Item 1 2"},
+                        {"Item 2 1", "Item 2 2"},
+                        {"Item 3 1", "Item 3 2"},
+                        {"Item 4 1", "Item 4 2"},
+                },
+                        new String[]{"Col 1", "Col 2"});
+
+                ListSelectionModel selectionModel = orderTable.getSelectionModel();
+                selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+                selectionModel.addListSelectionListener(new ListSelectionListener() {
+                    public void valueChanged(ListSelectionEvent e) {
+                        if (e.getValueIsAdjusting()) {
+                            return;
+                        }
+
+                        if (e.getFirstIndex() < 0) {
+                            throw new RuntimeException("Test bug7027139 failed");
+                        }
+                    }
+                });
+
+                orderTable.selectAll();
+            }
+        });
+
+        System.out.println("Test bug7027139 passed");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JToolBar/4247996/bug4247996.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,115 @@
+/*
+ * 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 4247996 4260485
+ * @summary Test that rollover toolbar doesn't corrupt buttons
+ * @author Peter Zhelezniakov
+ * @run main bug4247996
+ */
+import java.awt.*;
+import javax.swing.*;
+import sun.awt.SunToolkit;
+
+public class bug4247996 {
+
+    private static JButton button;
+    private static JToggleButton toogleButton;
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+
+        javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        Point point = getButtonCenter();
+        robot.mouseMove(point.x, point.y);
+        toolkit.realSync();
+
+        checkButtonsSize();
+
+    }
+
+    private static void checkButtonsSize() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                if (!button.getSize().equals(toogleButton.getSize())) {
+                    throw new RuntimeException("Button sizes are different!");
+                }
+            }
+        });
+    }
+
+    private static Point getButtonCenter() throws Exception {
+        final Point[] result = new Point[1];
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                Point p = button.getLocationOnScreen();
+                Dimension size = button.getSize();
+                result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2);
+            }
+        });
+        return result[0];
+    }
+
+    private static void createAndShowGUI() {
+        JFrame frame = new JFrame("Test");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(200, 200);
+
+        JButton rButton = new JButton("Rollover");
+        rButton.setRolloverEnabled(true);
+        JToolBar nrToolbar = new JToolBar();
+        nrToolbar.add(rButton);
+        nrToolbar.remove(rButton);
+
+        if (!rButton.isRolloverEnabled()) {
+            throw new Error("Failed (bug 4260485): "
+                    + "toolbar overrode button's rollover property");
+        }
+
+        JToolBar rToolbar = new JToolBar();
+        rToolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
+        rToolbar.add(button = new JButton("Test"));
+        rToolbar.add(toogleButton = new JToggleButton("Test"));
+
+        frame.getContentPane().add(rToolbar, BorderLayout.NORTH);
+        frame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/java2d/loops/Bug7049339.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2011 Red Hat, Inc.  All Rights Reserved.
+ * Copyright (c) 2011, 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 7049339
+  @summary Copying images with a non-rectangular clip and a custom composite
+           fails
+  @author Denis Lila <dlila@redhat.com>
+  @run main Bug7049339
+ */
+
+import java.awt.Composite;
+import java.awt.CompositeContext;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.geom.Ellipse2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+
+public class Bug7049339 {
+    public static void main(String[] argv) {
+        int x = 100, y = 100;
+        BufferedImage src = new BufferedImage(x, y, BufferedImage.TYPE_INT_ARGB);
+        BufferedImage dst = new BufferedImage(x, y, BufferedImage.TYPE_3BYTE_BGR);
+
+        Graphics2D dstg2d = dst.createGraphics();
+        dstg2d.setComposite(new Composite() {
+            @Override
+            public CompositeContext createContext(
+                    ColorModel srcColorModel,
+                    ColorModel dstColorModel,
+                    RenderingHints hints)
+            {
+                return new CompositeContext() {
+                    @Override
+                    public void compose(Raster src, Raster dstIn,
+                            WritableRaster dstOut)
+                    {
+                        // do nothing
+                    }
+                    @Override
+                    public void dispose() {
+                    }
+                };
+            }
+        });
+        Shape clip = new Ellipse2D.Double(x/4, y/4, x/2, y/2);
+        dstg2d.setClip(clip);
+        // This will throw a RasterFormatException if the bug is present.
+        dstg2d.drawImage(src, 0, 0, null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/krb5/ktab/FileKeyTab.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,58 @@
+/*
+ * 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 7144530
+ * @summary KeyTab.getInstance(String) no longer handles keyTabNames with "file:" prefix
+ */
+import java.io.File;
+import sun.security.krb5.PrincipalName;
+import sun.security.krb5.internal.ktab.KeyTab;
+
+public class FileKeyTab {
+    public static void main(String[] args) throws Exception {
+        String name = "ktab";
+        KeyTab kt = KeyTab.create(name);
+        kt.addEntry(new PrincipalName("a@A"), "x".toCharArray(), 1, true);
+        kt.save();
+        check(name);
+        check("FILE:" + name);
+
+        name = new File(name).getAbsolutePath().toString();
+
+        check(name);
+        check("FILE:" + name);
+
+        // The bug reporter uses this style, should only work for
+        // absolute path
+        check("FILE:/" + name);
+    }
+
+    static void check(String file) throws Exception {
+        System.out.println("Checking for " + file + "...");
+        KeyTab kt2 = KeyTab.getInstance(file);
+        if (kt2.isMissing()) {
+            throw new Exception("FILE:ktab cannot be loaded");
+        }
+    }
+}
--- a/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh	Tue Mar 20 10:27:31 2012 -0700
+++ b/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 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
@@ -95,7 +95,6 @@
     ;;
 esac
 
-TOKENS="nss solaris"
 CP="cp -f"
 RM="rm -rf"
 MKDIR="mkdir -p"
--- a/test/tools/launcher/Arrrghs.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/test/tools/launcher/Arrrghs.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,9 +24,9 @@
 /**
  * @test
  * @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938
- *      6894719 6968053 7067922
+ *      6894719 6968053
  * @summary Argument parsing validation.
- * @compile -XDignore.symbol.file Arrrghs.java TestHelper.java
+ * @compile -XDignore.symbol.file Arrrghs.java
  * @run main Arrrghs
  */
 
@@ -38,7 +38,7 @@
 import java.io.InputStreamReader;
 import java.util.Map;
 
-public class Arrrghs {
+public class Arrrghs extends TestHelper {
     private Arrrghs(){}
     /**
      * This class provides various tests for arguments processing.
@@ -62,7 +62,7 @@
      * SIGH, On Windows all strings are quoted, we need to unwrap it
      */
     private static String removeExtraQuotes(String in) {
-        if (TestHelper.isWindows) {
+        if (isWindows) {
             // Trim the string and remove the enclosed quotes if any.
             in = in.trim();
             if (in.startsWith("\"") && in.endsWith("\"")) {
@@ -82,7 +82,7 @@
 
         String in = rd.readLine();
         while (in != null) {
-            if (TestHelper.debug) System.out.println(in);
+            if (debug) System.out.println(in);
             if (in.startsWith(Cookie)) {
                 String detectedArgument = removeExtraQuotes(in.substring(Cookie.length()));
                 if (expectedArguments.equals(detectedArgument)) {
@@ -94,7 +94,7 @@
                             detectedArgument + "'");
                 }
                 // Return the value asap if not in debug mode.
-                if (!TestHelper.debug) {
+                if (!debug) {
                     rd.close();
                     istream.close();
                     return retval;
@@ -125,7 +125,7 @@
      * Quoting could cause dissimilar testArguments and expected arguments.
      */
     static int doTest(String testArguments, String expectedPattern) {
-        ProcessBuilder pb = new ProcessBuilder(TestHelper.javaCmd,
+        ProcessBuilder pb = new ProcessBuilder(javaCmd,
                 VersionStr, testArguments);
 
         Map<String, String> env = pb.environment();
@@ -146,47 +146,47 @@
          * These tests require that a JVM (any JVM) be installed in the system registry.
          * If none is installed, skip this test.
          */
-        TestHelper.TestResult tr =
-                TestHelper.doExec(TestHelper.javaCmd, VersionStr, "-version");
+        TestResult tr = doExec(javaCmd, VersionStr, "-version");
         if (!tr.isOK()) {
             System.err.println("Warning:Argument Passing Tests were skipped, " +
                     "no java found in system registry.");
             return;
         }
 
+
         // Basic test
-        TestHelper.testExitValue += doTest("-a -b -c -d");
+        testExitValue += doTest("-a -b -c -d");
 
         // Basic test with many spaces
-        TestHelper.testExitValue += doTest("-a    -b      -c       -d");
+        testExitValue += doTest("-a    -b      -c       -d");
 
         // Quoted whitespace does matter ?
-        TestHelper.testExitValue += doTest("-a \"\"-b      -c\"\" -d");
+        testExitValue += doTest("-a \"\"-b      -c\"\" -d");
 
 
         // Escaped quotes outside of quotes as literals
-        TestHelper.testExitValue += doTest("-a \\\"-b -c\\\" -d");
+        testExitValue += doTest("-a \\\"-b -c\\\" -d");
 
         // Check for escaped quotes inside of quotes as literal
-        TestHelper.testExitValue += doTest("-a \"-b \\\"stuff\\\"\" -c -d");
+        testExitValue += doTest("-a \"-b \\\"stuff\\\"\" -c -d");
 
         // A quote preceeded by an odd number of slashes is a literal quote
-        TestHelper.testExitValue += doTest("-a -b\\\\\\\" -c -d");
+        testExitValue += doTest("-a -b\\\\\\\" -c -d");
 
         // A quote preceeded by an even number of slashes is a literal quote
         // see 6214916.
-        TestHelper.testExitValue += doTest("-a -b\\\\\\\\\" -c -d");
+        testExitValue += doTest("-a -b\\\\\\\\\" -c -d");
 
         // Make sure that whitespace doesn't interfere with the removal of the
         // appropriate tokens. (space-tab-space preceeds -jre-restict-search).
-        TestHelper.testExitValue += doTest("-a -b  \t -jre-restrict-search -c -d","-a -b -c -d");
+        testExitValue += doTest("-a -b  \t -jre-restrict-search -c -d","-a -b -c -d");
 
         // Make sure that the mJRE tokens being stripped, aren't stripped if
         // they happen to appear as arguments to the main class.
-        TestHelper.testExitValue += doTest("foo -version:1.1+");
+        testExitValue += doTest("foo -version:1.1+");
 
         System.out.println("Completed arguments quoting tests with " +
-                TestHelper.testExitValue + " errors");
+                testExitValue + " errors");
     }
 
     /*
@@ -194,156 +194,167 @@
      */
     static void runBasicErrorMessageTests() {
         // Tests for 5030233
-        TestHelper.TestResult tr = TestHelper.doExec(TestHelper.javaCmd, "-cp");
+        TestResult tr = doExec(javaCmd, "-cp");
         tr.checkNegative();
         tr.isNotZeroOutput();
         System.out.println(tr);
 
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-classpath");
+        tr = doExec(javaCmd, "-classpath");
         tr.checkNegative();
         tr.isNotZeroOutput();
         System.out.println(tr);
 
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar");
+        tr = doExec(javaCmd, "-jar");
         tr.checkNegative();
         tr.isNotZeroOutput();
         System.out.println(tr);
 
-        tr = TestHelper.doExec(TestHelper.javacCmd, "-cp");
+        tr = doExec(javacCmd, "-cp");
         tr.checkNegative();
         tr.isNotZeroOutput();
         System.out.println(tr);
 
         // Test for 6356475 "REGRESSION:"java -X" from cmdline fails"
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-X");
+        tr = doExec(javaCmd, "-X");
         tr.checkPositive();
         tr.isNotZeroOutput();
         System.out.println(tr);
 
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-help");
+        tr = doExec(javaCmd, "-help");
         tr.checkPositive();
         tr.isNotZeroOutput();
         System.out.println(tr);
 
         // 6753938, test for non-negative exit value for an incorrectly formed
         // command line,  '% java'
-        tr = TestHelper.doExec(TestHelper.javaCmd);
+        tr = doExec(javaCmd);
         tr.checkNegative();
         tr.isNotZeroOutput();
         System.out.println(tr);
 
         // 6753938, test for non-negative exit value for an incorrectly formed
         // command line,  '% java -Xcomp'
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-Xcomp");
+        tr = doExec(javaCmd, "-Xcomp");
         tr.checkNegative();
         tr.isNotZeroOutput();
         System.out.println(tr);
     }
 
     /*
-     * A set of tests which tests various dispositions of the main method.
+     * Tests various dispositions of the main method, these tests are limited
+     * to English locales as they check for error messages that are localized.
      */
     static void runMainMethodTests() throws FileNotFoundException {
-        TestHelper.TestResult tr = null;
+        if (!isEnglishLocale()) {
+            return;
+        }
+
+        TestResult tr = null;
 
         // a missing class
-        TestHelper.createJar("MIA", new File("some.jar"), new File("Foo"),
+        createJar("MIA", new File("some.jar"), new File("Foo"),
                 (String[])null);
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar");
+        tr = doExec(javaCmd, "-jar", "some.jar");
         tr.contains("Error: Could not find or load main class MIA");
         System.out.println(tr);
         // use classpath to check
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "MIA");
+        tr = doExec(javaCmd, "-cp", "some.jar", "MIA");
         tr.contains("Error: Could not find or load main class MIA");
         System.out.println(tr);
 
         // incorrect method access
-        TestHelper.createJar(new File("some.jar"), new File("Foo"),
+        createJar(new File("some.jar"), new File("Foo"),
                 "private static void main(String[] args){}");
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar");
+        tr = doExec(javaCmd, "-jar", "some.jar");
         tr.contains("Error: Main method not found in class Foo");
         System.out.println(tr);
         // use classpath to check
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo");
+        tr = doExec(javaCmd, "-cp", "some.jar", "Foo");
         tr.contains("Error: Main method not found in class Foo");
         System.out.println(tr);
 
         // incorrect return type
-        TestHelper.createJar(new File("some.jar"), new File("Foo"),
+        createJar(new File("some.jar"), new File("Foo"),
                 "public static int main(String[] args){return 1;}");
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar");
+        tr = doExec(javaCmd, "-jar", "some.jar");
         tr.contains("Error: Main method must return a value of type void in class Foo");
         System.out.println(tr);
         // use classpath to check
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo");
+        tr = doExec(javaCmd, "-cp", "some.jar", "Foo");
         tr.contains("Error: Main method must return a value of type void in class Foo");
         System.out.println(tr);
 
         // incorrect parameter type
-        TestHelper.createJar(new File("some.jar"), new File("Foo"),
+        createJar(new File("some.jar"), new File("Foo"),
                 "public static void main(Object[] args){}");
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar");
+        tr = doExec(javaCmd, "-jar", "some.jar");
         tr.contains("Error: Main method not found in class Foo");
         System.out.println(tr);
         // use classpath to check
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo");
+        tr = doExec(javaCmd, "-cp", "some.jar", "Foo");
         tr.contains("Error: Main method not found in class Foo");
         System.out.println(tr);
 
         // incorrect method type - non-static
-         TestHelper.createJar(new File("some.jar"), new File("Foo"),
+         createJar(new File("some.jar"), new File("Foo"),
                 "public void main(String[] args){}");
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar");
+        tr = doExec(javaCmd, "-jar", "some.jar");
         tr.contains("Error: Main method is not static in class Foo");
         System.out.println(tr);
         // use classpath to check
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo");
+        tr = doExec(javaCmd, "-cp", "some.jar", "Foo");
         tr.contains("Error: Main method is not static in class Foo");
         System.out.println(tr);
 
         // amongst a potpourri of kindred main methods, is the right one chosen ?
-        TestHelper.createJar(new File("some.jar"), new File("Foo"),
+        createJar(new File("some.jar"), new File("Foo"),
             "void main(Object[] args){}",
             "int  main(Float[] args){return 1;}",
             "private void main() {}",
             "private static void main(int x) {}",
             "public int main(int argc, String[] argv) {return 1;}",
             "public static void main(String[] args) {System.out.println(\"THE_CHOSEN_ONE\");}");
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar");
+        tr = doExec(javaCmd, "-jar", "some.jar");
         tr.contains("THE_CHOSEN_ONE");
         System.out.println(tr);
         // use classpath to check
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo");
+        tr = doExec(javaCmd, "-cp", "some.jar", "Foo");
         tr.contains("THE_CHOSEN_ONE");
         System.out.println(tr);
 
         // test for extraneous whitespace in the Main-Class attribute
-        TestHelper.createJar(" Foo ", new File("some.jar"), new File("Foo"),
+        createJar(" Foo ", new File("some.jar"), new File("Foo"),
                 "public static void main(String... args){}");
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar");
+        tr = doExec(javaCmd, "-jar", "some.jar");
         tr.checkPositive();
         System.out.println(tr);
     }
-    // tests 6968053, ie. we turn on the -Xdiag (for now) flag and check if
-    // the suppressed stack traces are exposed.
+    /*
+     * tests 6968053, ie. we turn on the -Xdiag (for now) flag and check if
+     * the suppressed stack traces are exposed, ignore these tests for localized
+     * locales, limiting to English only.
+     */
     static void runDiagOptionTests() throws FileNotFoundException {
-        TestHelper.TestResult tr = null;
+        if (!isEnglishLocale()) { // only english version
+            return;
+        }
+        TestResult tr = null;
         // a missing class
-        TestHelper.createJar("MIA", new File("some.jar"), new File("Foo"),
+        createJar("MIA", new File("some.jar"), new File("Foo"),
                 (String[])null);
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-Xdiag", "-jar", "some.jar");
+        tr = doExec(javaCmd, "-Xdiag", "-jar", "some.jar");
         tr.contains("Error: Could not find or load main class MIA");
         tr.contains("java.lang.ClassNotFoundException: MIA");
         System.out.println(tr);
 
         // use classpath to check
-        tr = TestHelper.doExec(TestHelper.javaCmd,  "-Xdiag", "-cp", "some.jar", "MIA");
+        tr = doExec(javaCmd,  "-Xdiag", "-cp", "some.jar", "MIA");
         tr.contains("Error: Could not find or load main class MIA");
         tr.contains("java.lang.ClassNotFoundException: MIA");
         System.out.println(tr);
 
         // a missing class on the classpath
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-Xdiag", "NonExistentClass");
+        tr = doExec(javaCmd, "-Xdiag", "NonExistentClass");
         tr.contains("Error: Could not find or load main class NonExistentClass");
         tr.contains("java.lang.ClassNotFoundException: NonExistentClass");
         System.out.println(tr);
@@ -351,43 +362,33 @@
 
     static void test6894719() {
         // test both arguments to ensure they exist
-        TestHelper.TestResult tr = null;
-        tr = TestHelper.doExec(TestHelper.javaCmd,
+        TestResult tr = null;
+        tr = doExec(javaCmd,
                 "-no-jre-restrict-search", "-version");
         tr.checkPositive();
         System.out.println(tr);
 
-        tr = TestHelper.doExec(TestHelper.javaCmd,
+        tr = doExec(javaCmd,
                 "-jre-restrict-search", "-version");
         tr.checkPositive();
         System.out.println(tr);
     }
 
-    static void test7067922() {
-        // a missing manifest entry 7067922
-        TestHelper.TestResult tr = null;
-        TestHelper.createJar("cvf", "missingmainentry.jar", ".");
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "missingmainentry.jar");
-        tr.contains("no main manifest attribute");
-        System.out.println(tr);
-    }
-
     /**
      * @param args the command line arguments
      * @throws java.io.FileNotFoundException
      */
     public static void main(String[] args) throws FileNotFoundException {
-        if (TestHelper.debug) {
+        if (debug) {
             System.out.println("Starting Arrrghs tests");
         }
         quoteParsingTests();
         runBasicErrorMessageTests();
         runMainMethodTests();
         test6894719();
-        test7067922();
         runDiagOptionTests();
-        if (TestHelper.testExitValue > 0) {
-            System.out.println("Total of " + TestHelper.testExitValue + " failed");
+        if (testExitValue > 0) {
+            System.out.println("Total of " + testExitValue + " failed");
             System.exit(1);
         } else {
             System.out.println("All tests pass");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/launcher/MainClassAttributeTest.java	Fri Mar 23 09:55:13 2012 -0700
@@ -0,0 +1,104 @@
+/*
+ * 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 7067922
+ * @author sogoel
+ * @summary Test negative scenarios for main class attribute
+ * @compile -XDignore.symbol.file MainClassAttributeTest.java
+ * @run main MainClassAttributeTest
+ */
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * This class tests negative scenarios for Main class entry in jar file
+ * An error should be thrown for each of the test cases when such a jar
+ * is executed. These tests can only run on non-localized locales, thus
+ * only English is seleced and will pass vacuosly for other locales.
+ *
+ */
+
+public class MainClassAttributeTest extends TestHelper {
+
+    static void runTest(File jarFile, String expectedErrorMessage) {
+        TestResult tr = doExec(TestHelper.javaCmd,
+                "-jar", jarFile.getAbsolutePath());
+        if (isEnglishLocale() && !tr.contains(expectedErrorMessage)) {
+            System.out.println(tr);
+            throw new RuntimeException("expected string not found");
+        }
+        if (tr.isOK()) {
+            System.out.println(tr);
+            throw new RuntimeException("test exit with status 0");
+        }
+    }
+
+    // Missing manifest entry
+    static void test1() throws Exception {
+        File jarFile = new File("missingmainentry.jar");
+        createJar("cvf", jarFile.getName(), ".");
+        runTest(jarFile, "no main manifest attribute");
+    }
+
+    // Entry point in manifest file has .class extension
+    static void test2() throws FileNotFoundException {
+        File jarFile = new File("extensionmainentry.jar");
+        createJar("Foo.class", jarFile, new File("Foo"), (String[])null);
+        runTest(jarFile, "Error: Could not find or load main class");
+    }
+
+    // Entry point in manifest file is misspelled
+    static void test3() throws FileNotFoundException {
+        File jarFile = new File("misspelledmainentry.jar");
+        createJar("FooMIS", jarFile, new File("Foo"), (String[])null);
+        runTest(jarFile, "Error: Could not find or load main class");
+    }
+
+    // Main-Class attribute is misspelled in manifest file
+    static void test4() throws Exception {
+        File jarFile = new File("misspelledMainAttribute.jar");
+        File manifestFile = new File("manifest.txt");
+        try {
+            List<String> contents = new ArrayList<>();
+            contents.add("MainClassName: Foo");
+            createFile(manifestFile, contents);
+        } catch (IOException e) {
+            throw new Exception("Creation of manifest file for test3 failed");
+        }
+        createJar("-cmf", manifestFile.getName(), jarFile.getName());
+        runTest(jarFile, "no main manifest attribute");
+    }
+
+    public static void main(String[] args) throws Throwable {
+        test1();
+        test2();
+        test3();
+        test4();
+    }
+}
--- a/test/tools/launcher/Settings.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/test/tools/launcher/Settings.java	Fri Mar 23 09:55:13 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 6994753
+ * @bug 6994753 7123582
  * @summary tests -XshowSettings options
  * @compile -XDignore.symbol.file Settings.java TestHelper.java
  * @run main Settings
@@ -75,14 +75,14 @@
     static void runTestOptionDefault() throws IOException {
         TestHelper.TestResult tr = null;
         tr = TestHelper.doExec(TestHelper.javaCmd, "-Xms64m", "-Xmx512m",
-                "-Xss128k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
+                "-Xss256k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
         containsAllOptions(tr);
         if (!tr.isOK()) {
             System.out.println(tr.status);
             throw new RuntimeException("test fails");
         }
         tr = TestHelper.doExec(TestHelper.javaCmd, "-Xms65536k", "-Xmx712m",
-                "-Xss122880", "-XshowSettings", "-jar", testJar.getAbsolutePath());
+                "-Xss256000", "-XshowSettings", "-jar", testJar.getAbsolutePath());
         containsAllOptions(tr);
         if (!tr.isOK()) {
             System.out.println(tr.status);
@@ -129,6 +129,17 @@
         checkNoContains(tr, LOCALE_SETTINGS);
         checkContains(tr, "Unrecognized option: -XshowSettingsBadOption");
     }
+
+    static void runTest7123582() throws IOException {
+        TestHelper.TestResult tr = null;
+        tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettings", "-version");
+        if (!tr.isOK()) {
+            System.out.println(tr.status);
+            throw new RuntimeException("test fails");
+        }
+        containsAllOptions(tr);
+    }
+
     public static void main(String... args) {
         try {
             runTestOptionAll();
@@ -137,6 +148,7 @@
             runTestOptionProperty();
             runTestOptionLocale();
             runTestBadOptions();
+            runTest7123582();
         } catch (IOException ioe) {
             throw new RuntimeException(ioe);
         }
--- a/test/tools/launcher/TestHelper.java	Tue Mar 20 10:27:31 2012 -0700
+++ b/test/tools/launcher/TestHelper.java	Fri Mar 23 09:55:13 2012 -0700
@@ -29,6 +29,7 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
+import java.nio.charset.Charset;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.nio.file.Files;
 import java.nio.file.FileVisitResult;
@@ -36,20 +37,26 @@
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import javax.tools.JavaCompiler;
 import javax.tools.ToolProvider;
 
 import static java.nio.file.StandardCopyOption.*;
+import static java.nio.file.StandardOpenOption.*;
 
 /**
  * This class provides some common utilities for the launcher tests.
  */
-public enum TestHelper {
-    INSTANCE;
+public class TestHelper {
+    // commonly used jtreg constants
+    static final File TEST_CLASSES_DIR;
+    static final File TEST_SOURCES_DIR;
+
     static final String JAVAHOME = System.getProperty("java.home");
     static final boolean isSDK = JAVAHOME.endsWith("jre");
     static final String javaCmd;
+    static final String javawCmd;
     static final String java64Cmd;
     static final String javacCmd;
     static final JavaCompiler compiler;
@@ -70,13 +77,30 @@
     static final boolean isDualMode = isSolaris;
     static final boolean isSparc = System.getProperty("os.arch").startsWith("sparc");
 
+    // make a note of the golden default locale
+    static final Locale DefaultLocale = Locale.getDefault();
+
     static final String JAVA_FILE_EXT  = ".java";
     static final String CLASS_FILE_EXT = ".class";
     static final String JAR_FILE_EXT   = ".jar";
+    static final String JLDEBUG_KEY     = "_JAVA_LAUNCHER_DEBUG";
+    static final String EXPECTED_MARKER = "TRACER_MARKER:About to EXEC";
 
     static int testExitValue = 0;
 
     static {
+        String tmp = System.getProperty("test.classes", null);
+        if (tmp == null) {
+            throw new Error("property test.classes not defined ??");
+        }
+        TEST_CLASSES_DIR = new File(tmp).getAbsoluteFile();
+
+        tmp = System.getProperty("test.src", null);
+        if (tmp == null) {
+            throw new Error("property test.src not defined ??");
+        }
+        TEST_SOURCES_DIR = new File(tmp).getAbsoluteFile();
+
         if (is64Bit && is32Bit) {
             throw new RuntimeException("arch model cannot be both 32 and 64 bit");
         }
@@ -91,15 +115,29 @@
                 : new File(binDir, "java");
         javaCmd = javaCmdFile.getAbsolutePath();
         if (!javaCmdFile.canExecute()) {
-            throw new RuntimeException("java <" + TestHelper.javaCmd + "> must exist");
+            throw new RuntimeException("java <" + TestHelper.javaCmd +
+                    "> must exist and should be executable");
         }
 
         File javacCmdFile = (isWindows)
                 ? new File(binDir, "javac.exe")
                 : new File(binDir, "javac");
         javacCmd = javacCmdFile.getAbsolutePath();
+
+        if (isWindows) {
+            File javawCmdFile = new File(binDir, "javaw.exe");
+            javawCmd = javawCmdFile.getAbsolutePath();
+            if (!javawCmdFile.canExecute()) {
+                throw new RuntimeException("java <" + javawCmd +
+                        "> must exist and should be executable");
+            }
+        } else {
+            javawCmd = null;
+        }
+
         if (!javacCmdFile.canExecute()) {
-            throw new RuntimeException("java <" + javacCmd + "> must exist");
+            throw new RuntimeException("java <" + javacCmd +
+                    "> must exist and should be executable");
         }
         if (isSolaris) {
             File sparc64BinDir = new File(binDir,isSparc ? "sparcv9" : "amd64");
@@ -168,6 +206,19 @@
     }
 
     /*
+     * A convenience method to compile java files.
+     */
+    static void compile(String... compilerArgs) {
+        if (compiler.run(null, null, null, compilerArgs) != 0) {
+            String sarg = "";
+            for (String x : compilerArgs) {
+                sarg.concat(x + " ");
+            }
+            throw new Error("compilation failed: " + sarg);
+        }
+    }
+
+    /*
      * A generic jar file creator to create a java file, compile it
      * and jar it up, a specific Main-Class entry name in the
      * manifest can be specified or a null to use the sole class file name
@@ -226,6 +277,11 @@
         Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING);
     }
 
+    static void createFile(File outFile, List<String> content) throws IOException {
+        Files.write(outFile.getAbsoluteFile().toPath(), content,
+                Charset.defaultCharset(), CREATE_NEW);
+    }
+
     static void recursiveDelete(File target) throws IOException {
         if (!target.exists()) {
             return;
@@ -308,6 +364,10 @@
         };
     }
 
+    static boolean isEnglishLocale() {
+        return Locale.getDefault().getLanguage().equals("en");
+    }
+
     /*
      * A class to encapsulate the test results and stuff, with some ease
      * of use methods to check the test results.