Mercurial > hg > openjdk > bsd-port > jdk
changeset 6681:7c1d6fc3b6da jdk7u40-b34
Merge
author | lana |
---|---|
date | Tue, 16 Jul 2013 11:26:34 -0700 |
parents | ed809dc4f278 (current diff) 93ff09de1ad8 (diff) |
children | 3730baa74076 |
files | src/share/classes/com/sun/accessibility/internal/resources/accessibility_ja.properties src/share/classes/com/sun/accessibility/internal/resources/accessibility_ko.properties src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties |
diffstat | 70 files changed, 1905 insertions(+), 461 deletions(-) [+] |
line wrap: on
line diff
--- a/make/sun/security/pkcs11/mapfile-vers Wed Jul 10 13:49:00 2013 -0700 +++ b/make/sun/security/pkcs11/mapfile-vers Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -102,7 +102,7 @@ Java_sun_security_pkcs11_Secmod_nssGetLibraryHandle; Java_sun_security_pkcs11_Secmod_nssLoadLibrary; Java_sun_security_pkcs11_Secmod_nssVersionCheck; - Java_sun_security_pkcs11_Secmod_nssInit; + Java_sun_security_pkcs11_Secmod_nssInitialize; Java_sun_security_pkcs11_Secmod_nssGetModuleList; local:
--- a/src/macosx/classes/com/apple/eawt/FullScreenHandler.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/com/apple/eawt/FullScreenHandler.java Tue Jul 16 11:26:34 2013 -0700 @@ -32,6 +32,7 @@ import javax.swing.RootPaneContainer; import com.apple.eawt.AppEvent.FullScreenEvent; +import sun.awt.SunToolkit; final class FullScreenHandler { private static final String CLIENT_PROPERTY = "com.apple.eawt.event.internalFullScreenHandler"; @@ -73,7 +74,7 @@ static void handleFullScreenEventFromNative(final Window window, final int type) { if (!(window instanceof RootPaneContainer)) return; // handles null - EventQueue.invokeLater(new Runnable() { + SunToolkit.executeOnEventHandlerThread(window, new Runnable() { public void run() { final FullScreenHandler handler = getHandlerFor((RootPaneContainer)window); if (handler != null) handler.notifyListener(new FullScreenEvent(window), type);
--- a/src/macosx/classes/com/apple/eawt/_AppEventHandler.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/com/apple/eawt/_AppEventHandler.java Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ import java.net.*; import java.util.*; import java.util.List; +import sun.awt.AppContext; +import sun.awt.SunToolkit; import com.apple.eawt.AppEvent.*; @@ -269,11 +271,9 @@ } class _AppReOpenedDispatcher extends _AppEventMultiplexor<AppReOpenedListener> { - void performOnListeners(final List<AppReOpenedListener> listeners, final _NativeEvent event) { + void performOnListener(AppReOpenedListener listener, final _NativeEvent event) { final AppReOpenedEvent e = new AppReOpenedEvent(); - for (final AppReOpenedListener listener : listeners) { - listener.appReOpened(e); - } + listener.appReOpened(e); } } @@ -415,50 +415,67 @@ } abstract class _AppEventMultiplexor<L> { - final List<L> _listeners = new ArrayList<L>(0); + private final Map<L, AppContext> listenerToAppContext = + new IdentityHashMap<L, AppContext>(); boolean nativeListenerRegistered; // called from AppKit Thread-0 void dispatch(final _NativeEvent event, final Object... args) { - // grab a local ref to the listeners - final List<L> localListeners; + // grab a local ref to the listeners and its contexts as an array of the map's entries + final ArrayList<Map.Entry<L, AppContext>> localEntries; synchronized (this) { - if (_listeners.size() == 0) return; - localListeners = new ArrayList<L>(_listeners); + if (listenerToAppContext.size() == 0) { + return; + } + localEntries = new ArrayList<Map.Entry<L, AppContext>>(listenerToAppContext.size()); + localEntries.addAll(listenerToAppContext.entrySet()); } - EventQueue.invokeLater(new Runnable() { - public void run() { - performOnListeners(localListeners, event); - } - }); + for (final Map.Entry<L, AppContext> e : localEntries) { + final L listener = e.getKey(); + final AppContext listenerContext = e.getValue(); + SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() { + public void run() { + performOnListener(listener, event); + } + }); + } } synchronized void addListener(final L listener) { + setListenerContext(listener, AppContext.getAppContext()); + if (!nativeListenerRegistered) { registerNativeListener(); nativeListenerRegistered = true; } - _listeners.add(listener); } synchronized void removeListener(final L listener) { - _listeners.remove(listener); + listenerToAppContext.remove(listener); } - abstract void performOnListeners(final List<L> listeners, final _NativeEvent event); + abstract void performOnListener(L listener, final _NativeEvent event); void registerNativeListener() { } + + private void setListenerContext(L listener, AppContext listenerContext) { + if (listenerContext == null) { + throw new RuntimeException( + "Attempting to add a listener from a thread group without AppContext"); + } + listenerToAppContext.put(listener, AppContext.getAppContext()); + } } abstract class _BooleanAppEventMultiplexor<L, E> extends _AppEventMultiplexor<L> { @Override - void performOnListeners(final List<L> listeners, final _NativeEvent event) { + void performOnListener(L listener, final _NativeEvent event) { final boolean isTrue = Boolean.TRUE.equals(event.get(0)); final E e = createEvent(isTrue); if (isTrue) { - for (final L listener : listeners) performTrueEventOn(listener, e); + performTrueEventOn(listener, e); } else { - for (final L listener : listeners) performFalseEventOn(listener, e); + performFalseEventOn(listener, e); } } @@ -479,30 +496,34 @@ */ abstract class _AppEventDispatcher<H> { H _handler; + AppContext handlerContext; // called from AppKit Thread-0 void dispatch(final _NativeEvent event) { - EventQueue.invokeLater(new Runnable() { - public void run() { - // grab a local ref to the handler - final H localHandler; - synchronized (_AppEventDispatcher.this) { - localHandler = _handler; - } + // grab a local ref to the handler + final H localHandler; + final AppContext localHandlerContext; + synchronized (_AppEventDispatcher.this) { + localHandler = _handler; + localHandlerContext = handlerContext; + } - // invoke the handler outside of the synchronized block - if (localHandler == null) { - performDefaultAction(event); - } else { + if (localHandler == null) { + performDefaultAction(event); + } else { + SunToolkit.invokeLaterOnAppContext(localHandlerContext, new Runnable() { + public void run() { performUsing(localHandler, event); } - } - }); + }); + } } synchronized void setHandler(final H handler) { this._handler = handler; + setHandlerContext(AppContext.getAppContext()); + // if a new handler is installed, block addition of legacy ApplicationListeners if (handler == legacyHandler) return; legacyHandler.blockLegacyAPI(); @@ -510,6 +531,15 @@ void performDefaultAction(final _NativeEvent event) { } // by default, do nothing abstract void performUsing(final H handler, final _NativeEvent event); + + protected void setHandlerContext(AppContext ctx) { + if (ctx == null) { + throw new RuntimeException( + "Attempting to set a handler from a thread group without AppContext"); + } + + handlerContext = ctx; + } } abstract class _QueuingAppEventDispatcher<H> extends _AppEventDispatcher<H> { @@ -531,6 +561,8 @@ synchronized void setHandler(final H handler) { this._handler = handler; + setHandlerContext(AppContext.getAppContext()); + // dispatch any events in the queue if (queuedEvents != null) { // grab a local ref to the queue, so the real one can be nulled out
--- a/src/macosx/classes/com/apple/eawt/event/GestureHandler.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/com/apple/eawt/event/GestureHandler.java Tue Jul 16 11:26:34 2013 -0700 @@ -25,6 +25,8 @@ package com.apple.eawt.event; +import sun.awt.SunToolkit; + import java.awt.*; import java.util.*; import java.util.List; @@ -68,7 +70,7 @@ static void handleGestureFromNative(final Window window, final int type, final double x, final double y, final double a, final double b) { if (window == null) return; // should never happen... - EventQueue.invokeLater(new Runnable() { + SunToolkit.executeOnEventHandlerThread(window, new Runnable() { public void run() { final Component component = SwingUtilities.getDeepestComponentAt(window, (int)x, (int)y);
--- a/src/macosx/classes/com/apple/laf/ScreenMenu.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/com/apple/laf/ScreenMenu.java Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import javax.swing.*; +import sun.awt.SunToolkit; import sun.lwawt.LWToolkit; import sun.lwawt.macosx.*; @@ -139,7 +140,7 @@ updateItems(); fItemBounds = new Rectangle[invoker.getMenuComponentCount()]; } - }, null); + }, invoker); } catch (final Exception e) { System.err.println(e); e.printStackTrace(); @@ -167,7 +168,7 @@ fItemBounds = null; } - }, null); + }, invoker); } catch (final Exception e) { e.printStackTrace(); } @@ -195,7 +196,7 @@ if (kind == 0) return; if (fItemBounds == null) return; - SwingUtilities.invokeLater(new Runnable() { + SunToolkit.executeOnEventHandlerThread(fInvoker, new Runnable() { @Override public void run() { Component target = null;
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java Tue Jul 16 11:26:34 2013 -0700 @@ -328,7 +328,7 @@ return peerTreeLock; } - final T getTarget() { + public final T getTarget() { return target; }
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java Tue Jul 16 11:26:34 2013 -0700 @@ -787,7 +787,8 @@ Point lp = lastMouseEventPeer.windowToLocal(x, y, lastWindowPeer); Component target = lastMouseEventPeer.getTarget(); - postMouseEnteredExitedEvent(target, id, when, modifiers, lp, + postMouseEnteredExitedEvent(target, MouseEvent.MOUSE_EXITED, + when, modifiers, lp, screenX, screenY, clickCount, popupTrigger, button); } lastMouseEventPeer = null; @@ -805,12 +806,14 @@ oldp.x += r.x - lr.x; oldp.y += r.y - lr.y; Component target = lastMouseEventPeer.getTarget(); - postMouseEnteredExitedEvent(target, id, when, modifiers, oldp, + postMouseEnteredExitedEvent(target, MouseEvent.MOUSE_EXITED, + when, modifiers, oldp, screenX, screenY, clickCount, popupTrigger, button); } else { Point oldp = lastMouseEventPeer.windowToLocal(x, y, this); Component target = lastMouseEventPeer.getTarget(); - postMouseEnteredExitedEvent(target, id, when, modifiers, oldp, + postMouseEnteredExitedEvent(target, MouseEvent.MOUSE_EXITED, + when, modifiers, oldp, screenX, screenY, clickCount, popupTrigger, button); } } @@ -818,7 +821,8 @@ if (targetPeer != null && targetPeer.isEnabled() && id != MouseEvent.MOUSE_ENTERED) { Point newp = targetPeer.windowToLocal(x, y, curWindowPeer); Component target = targetPeer.getTarget(); - postMouseEnteredExitedEvent(target, id, when, modifiers, newp, + postMouseEnteredExitedEvent(target, MouseEvent.MOUSE_ENTERED, + when, modifiers, newp, screenX, screenY, clickCount, popupTrigger, button); } }
--- a/src/macosx/classes/sun/lwawt/macosx/CCheckboxMenuItem.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CCheckboxMenuItem.java Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ public void handleAction(final boolean state) { final CheckboxMenuItem target = (CheckboxMenuItem)getTarget(); - EventQueue.invokeLater(new Runnable() { + SunToolkit.executeOnEventHandlerThread(target, new Runnable() { public void run() { target.setState(state); }
--- a/src/macosx/classes/sun/lwawt/macosx/CCursorManager.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CCursorManager.java Tue Jul 16 11:26:34 2013 -0700 @@ -51,15 +51,6 @@ @Override protected Point getCursorPosition() { - synchronized(this) { - if (isDragging) { - // during the drag operation, the appkit thread is blocked, - // so nativeGetCursorPosition invocation may cause a deadlock. - // In order to avoid this, we returns last know cursor position. - return new Point(dragPos); - } - } - final Point2D nativePosition = nativeGetCursorPosition(); return new Point((int)nativePosition.getX(), (int)nativePosition.getY()); } @@ -101,31 +92,4 @@ // do something special throw new RuntimeException("Unimplemented"); } - - // package private methods to handle cursor change during drag-and-drop - private boolean isDragging = false; - private Point dragPos = null; - - synchronized void startDrag(int x, int y) { - if (isDragging) { - throw new RuntimeException("Invalid Drag state in CCursorManager!"); - } - isDragging = true; - dragPos = new Point(x, y); - } - - synchronized void updateDragPosition(int x, int y) { - if (!isDragging) { - throw new RuntimeException("Invalid Drag state in CCursorManager!"); - } - dragPos.move(x, y); - } - - synchronized void stopDrag() { - if (!isDragging) { - throw new RuntimeException("Invalid Drag state in CCursorManager!"); - } - isDragging = false; - dragPos = null; - } }
--- a/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Tue Jul 16 11:26:34 2013 -0700 @@ -38,8 +38,12 @@ import javax.accessibility.*; import java.util.Map; +import java.util.concurrent.Callable; + import sun.awt.dnd.*; import sun.lwawt.LWComponentPeer; +import sun.lwawt.LWWindowPeer; +import sun.lwawt.PlatformWindow; public final class CDragSourceContextPeer extends SunDragSourceContextPeer { @@ -104,13 +108,8 @@ } //It sure will be LWComponentPeer instance as rootComponent is a Window - LWComponentPeer peer = (LWComponentPeer)rootComponent.getPeer(); - //Get a pointer to a native window - CPlatformWindow platformWindow = (CPlatformWindow) peer.getPlatformWindow(); - long nativeWindowPtr = platformWindow.getNSWindowPtr(); - - // Get drag cursor: - Cursor cursor = this.getCursor(); + PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow(); + long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow); // If there isn't any drag image make one of default appearance: if (fDragImage == null) @@ -139,19 +138,15 @@ try { // Create native dragging source: - final long nativeDragSource = createNativeDragSource(component, peer, nativeWindowPtr, transferable, triggerEvent, + final long nativeDragSource = createNativeDragSource(component, nativeViewPtr, transferable, triggerEvent, (int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers, - clickCount, timestamp, cursor, fDragCImage, dragImageOffset.x, dragImageOffset.y, + clickCount, timestamp, fDragCImage, dragImageOffset.x, dragImageOffset.y, getDragSourceContext().getSourceActions(), formats, formatMap); if (nativeDragSource == 0) throw new InvalidDnDOperationException(""); setNativeContext(nativeDragSource); - - CCursorManager.getInstance().startDrag( - (int) (dragOrigin.getX()), - (int) (dragOrigin.getY())); } catch (Exception e) { @@ -160,6 +155,8 @@ SunDropTargetContextPeer.setCurrentJVMLocalSourceTransferable(transferable); + CCursorManager.getInstance().setCursor(getCursor()); + // Create a new thread to run the dragging operation since it's synchronous, only coming back // after dragging is finished. This leaves the AWT event thread free to handle AWT events which // are posted during dragging by native event handlers. @@ -173,8 +170,6 @@ } catch (Exception e) { e.printStackTrace(); } finally { - CCursorManager.getInstance().stopDrag(); - releaseNativeDragSource(nativeDragSource); fDragImage = null; if (fDragCImage != null) { @@ -189,8 +184,6 @@ } catch (Exception e) { - CCursorManager.getInstance().stopDrag(); - final long nativeDragSource = getNativeContext(); setNativeContext(0); releaseNativeDragSource(nativeDragSource); @@ -416,13 +409,24 @@ final int modifiers, final int x, final int y) { - CCursorManager.getInstance().updateDragPosition(x, y); + try { + Component componentAt = LWCToolkit.invokeAndWait( + new Callable<Component>() { + @Override + public Component call() { + LWWindowPeer mouseEventComponent = LWWindowPeer.getWindowUnderCursor(); + if (mouseEventComponent == null) { + return null; + } + Component root = SwingUtilities.getRoot(mouseEventComponent.getTarget()); + if (root == null) { + return null; + } + Point rootLocation = root.getLocationOnScreen(); + return getDropTargetAt(root, x - rootLocation.x, y - rootLocation.y); + } + }, getComponent()); - Component rootComponent = SwingUtilities.getRoot(getComponent()); - if(rootComponent != null) { - Point componentPoint = new Point(x, y); - SwingUtilities.convertPointFromScreen(componentPoint, rootComponent); - Component componentAt = SwingUtilities.getDeepestComponentAt(rootComponent, componentPoint.x, componentPoint.y); if(componentAt != hoveringComponent) { if(hoveringComponent != null) { dragExit(x, y); @@ -432,20 +436,36 @@ } hoveringComponent = componentAt; } + + postDragSourceDragEvent(targetActions, modifiers, x, y, + DISPATCH_MOUSE_MOVED); + } catch (Exception e) { + throw new InvalidDnDOperationException("Failed to handle DragMouseMoved event"); } - postDragSourceDragEvent(targetActions, modifiers, x, y, - DISPATCH_MOUSE_MOVED); } - /** - * upcall from native code - */ - private void dragEnter(final int targetActions, - final int modifiers, - final int x, final int y) { - CCursorManager.getInstance().updateDragPosition(x, y); + //Returns the first lightweight or heavyweight Component which has a dropTarget ready to accept the drag + //Should be called from the EventDispatchThread + private static Component getDropTargetAt(Component root, int x, int y) { + if (!root.contains(x, y) || !root.isEnabled() || !root.isVisible()) { + return null; + } + + if (root.getDropTarget() != null && root.getDropTarget().isActive()) { + return root; + } - postDragSourceDragEvent(targetActions, modifiers, x, y, DISPATCH_ENTER); + if (root instanceof Container) { + for (Component comp : ((Container) root).getComponents()) { + Point loc = comp.getLocation(); + Component dropTarget = getDropTargetAt(comp, x - loc.x, y - loc.y); + if (dropTarget != null) { + return dropTarget; + } + } + } + + return null; } /** @@ -455,19 +475,15 @@ hoveringComponent = null; } - public void setCursor(Cursor c) throws InvalidDnDOperationException { - // TODO : BG - //AWTLockAccess.awtLock(); - super.setCursor(c); - //AWTLockAccess.awtUnlock(); + @Override + protected void setNativeCursor(long nativeCtxt, Cursor c, int cType) { + CCursorManager.getInstance().setCursor(c); } - protected native void setNativeCursor(long nativeCtxt, Cursor c, int cType); - // Native support: - private native long createNativeDragSource(Component component, ComponentPeer peer, long nativePeer, Transferable transferable, + private native long createNativeDragSource(Component component, long nativePeer, Transferable transferable, InputEvent triggerEvent, int dragPosX, int dragPosY, int extModifiers, int clickCount, long timestamp, - Cursor cursor, CImage nsDragImage, int dragImageOffsetX, int dragImageOffsetY, + CImage nsDragImage, int dragImageOffsetX, int dragImageOffsetY, int sourceActions, long[] formats, Map formatMap); private native void doDragging(long nativeDragSource);
--- a/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java Tue Jul 16 11:26:34 2013 -0700 @@ -30,6 +30,7 @@ import java.awt.dnd.DropTarget; import sun.lwawt.LWComponentPeer; +import sun.lwawt.PlatformWindow; public final class CDropTarget { @@ -50,21 +51,11 @@ fComponent = component; fPeer = peer; - // Make sure the drop target is a ComponentModel: - if (!(peer instanceof LWComponentPeer)) - throw new IllegalArgumentException("CDropTarget's peer must be a LWComponentPeer."); - - // Get model pointer (CButton.m and such) and its native peer: - LWComponentPeer model = (LWComponentPeer) peer; - if (model.getPlatformWindow() instanceof CPlatformWindow) { - CPlatformWindow platformWindow = (CPlatformWindow) model.getPlatformWindow(); - long nativePeer = platformWindow.getNSWindowPtr(); - - // Create native dragging destination: - fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer); - if (fNativeDropTarget == 0) { - throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed."); - } + long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow()); + // Create native dragging destination: + fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer); + if (fNativeDropTarget == 0) { + throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed."); } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Jul 16 11:26:34 2013 -0700 @@ -923,6 +923,21 @@ } } + /** + * Helper method to get a pointer to the native view from the PlatformWindow. + */ + static long getNativeViewPtr(PlatformWindow platformWindow) { + long nativePeer = 0L; + if (platformWindow instanceof CPlatformWindow) { + nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView(); + } else if (platformWindow instanceof CViewPlatformEmbeddedFrame){ + nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr(); + } else { + throw new IllegalArgumentException("Unsupported platformWindow implementation"); + } + return nativePeer; + } + /************************************************************* * Callbacks from the AWTWindow and AWTView objc classes. *************************************************************/ @@ -949,25 +964,19 @@ final Rectangle oldB = nativeBounds; nativeBounds = new Rectangle(x, y, width, height); - final GraphicsConfiguration oldGC = contentView.getGraphicsConfiguration(); - - if (peer!= null) { + if (peer != null) { peer.notifyReshape(x, y, width, height); - } - - final GraphicsConfiguration newGC = contentView.getGraphicsConfiguration(); - // System-dependent appearance optimization. - if ((byUser && !oldB.getSize().equals(nativeBounds.getSize())) - || isFullScreenAnimationOn || !Objects.equals(newGC, oldGC)) { - flushBuffers(); + // System-dependent appearance optimization. + if ((byUser && !oldB.getSize().equals(nativeBounds.getSize())) + || isFullScreenAnimationOn) { + flushBuffers(); + } } } private void deliverWindowClosingEvent() { - if (peer != null) { - if (peer.getBlocker() == null) { - peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING)); - } + if (peer != null && peer.getBlocker() == null) { + peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING)); } }
--- a/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,7 +96,7 @@ validate(); setVisible(true); } - }, null); + }, this); } catch (InterruptedException | InvocationTargetException ex) {} } }
--- a/src/macosx/native/sun/awt/CDragSource.h Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/native/sun/awt/CDragSource.h Tue Jul 16 11:26:34 2013 -0700 @@ -33,7 +33,6 @@ @private NSView* fView; jobject fComponent; - jobject fComponentPeer; jobject fDragSourceContextPeer; jobject fTransferable; @@ -43,8 +42,6 @@ jint fClickCount; jint fModifiers; - jobject fCursor; - NSImage* fDragImage; NSPoint fDragImageOffset; @@ -59,12 +56,22 @@ + (CDragSource *) currentDragSource; // Common methods: -- (id)init:(jobject)jdragsourcecontextpeer component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control - transferable:(jobject)jtransferable triggerEvent:(jobject)jtrigger - dragPosX:(jint)dragPosX dragPosY:(jint)dragPosY modifiers:(jint)extModifiers clickCount:(jint)clickCount timeStamp:(jlong)timeStamp - cursor:(jobject)jcursor - dragImage:(jobject)jnsdragimage dragImageOffsetX:(jint)jdragimageoffsetx dragImageOffsetY:(jint)jdragimageoffsety - sourceActions:(jint)jsourceactions formats:(jlongArray)jformats formatMap:(jobject)jformatmap; +- (id) init:(jobject)jDragSourceContextPeer + component:(jobject)jComponent + control:(id)control + transferable:(jobject)jTransferable + triggerEvent:(jobject)jTrigger + dragPosX:(jint)dragPosX + dragPosY:(jint)dragPosY + modifiers:(jint)extModifiers + clickCount:(jint)clickCount + timeStamp:(jlong)timeStamp + dragImage:(jobject)jDragImage + dragImageOffsetX:(jint)jDragImageOffsetX + dragImageOffsetY:(jint)jDragImageOffsetY + sourceActions:(jint)jSourceActions + formats:(jlongArray)jFormats + formatMap:(jobject)jFormatMap; - (void)removeFromView:(JNIEnv *)env;
--- a/src/macosx/native/sun/awt/CDragSource.m Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/native/sun/awt/CDragSource.m Tue Jul 16 11:26:34 2013 -0700 @@ -84,12 +84,22 @@ return sCurrentDragSource; } -- (id)init:(jobject)jdragsourcecontextpeer component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control - transferable:(jobject)jtransferable triggerEvent:(jobject)jtrigger - dragPosX:(jint)dragPosX dragPosY:(jint)dragPosY modifiers:(jint)extModifiers clickCount:(jint)clickCount - timeStamp:(jlong)timeStamp cursor:(jobject)jcursor - dragImage:(jobject)jnsdragimage dragImageOffsetX:(jint)jdragimageoffsetx dragImageOffsetY:(jint)jdragimageoffsety - sourceActions:(jint)jsourceactions formats:(jlongArray)jformats formatMap:(jobject)jformatmap +- (id) init:(jobject)jDragSourceContextPeer + component:(jobject)jComponent + control:(id)control + transferable:(jobject)jTransferable + triggerEvent:(jobject)jTrigger + dragPosX:(jint)dragPosX + dragPosY:(jint)dragPosY + modifiers:(jint)extModifiers + clickCount:(jint)clickCount + timeStamp:(jlong)timeStamp + dragImage:(jobject)jDragImage + dragImageOffsetX:(jint)jDragImageOffsetX + dragImageOffsetY:(jint)jDragImageOffsetY + sourceActions:(jint)jSourceActions + formats:(jlongArray)jFormats + formatMap:(jobject)jFormatMap { self = [super init]; DLog2(@"[CDragSource init]: %@\n", self); @@ -100,27 +110,25 @@ // Construct the object if we have a valid model for it: if (control != nil) { JNIEnv *env = [ThreadUtilities getJNIEnv]; - fComponent = JNFNewGlobalRef(env, jcomponent); - fComponentPeer = JNFNewGlobalRef(env, jpeer); - fDragSourceContextPeer = JNFNewGlobalRef(env, jdragsourcecontextpeer); + fComponent = JNFNewGlobalRef(env, jComponent); + fDragSourceContextPeer = JNFNewGlobalRef(env, jDragSourceContextPeer); - fTransferable = JNFNewGlobalRef(env, jtransferable); - fTriggerEvent = JNFNewGlobalRef(env, jtrigger); - fCursor = JNFNewGlobalRef(env, jcursor); + fTransferable = JNFNewGlobalRef(env, jTransferable); + fTriggerEvent = JNFNewGlobalRef(env, jTrigger); - if (jnsdragimage) { + if (jDragImage) { JNF_MEMBER_CACHE(nsImagePtr, CImageClass, "ptr", "J"); - jlong imgPtr = JNFGetLongField(env, jnsdragimage, nsImagePtr); + jlong imgPtr = JNFGetLongField(env, jDragImage, nsImagePtr); fDragImage = (NSImage*) jlong_to_ptr(imgPtr); // Double-casting prevents compiler 'd$|// [fDragImage retain]; } - fDragImageOffset = NSMakePoint(jdragimageoffsetx, jdragimageoffsety); + fDragImageOffset = NSMakePoint(jDragImageOffsetX, jDragImageOffsetY); - fSourceActions = jsourceactions; - fFormats = JNFNewGlobalRef(env, jformats); - fFormatMap = JNFNewGlobalRef(env, jformatmap); + fSourceActions = jSourceActions; + fFormats = JNFNewGlobalRef(env, jFormats); + fFormatMap = JNFNewGlobalRef(env, jFormatMap); fTriggerEventTimeStamp = timeStamp; fDragPos = NSMakePoint(dragPosX, dragPosY); @@ -129,9 +137,8 @@ // Set this object as a dragging source: - AWTView *awtView = [((NSWindow *) control) contentView]; - fView = [awtView retain]; - [awtView setDragSource:self]; + fView = [(AWTView *) control retain]; + [fView setDragSource:self]; // Let AWTEvent know Java drag is getting underway: [NSEvent javaDraggingBegin]; @@ -158,11 +165,6 @@ fComponent = NULL; } - if (fComponentPeer != NULL) { - JNFDeleteGlobalRef(env, fComponentPeer); - fComponentPeer = NULL; - } - if (fDragSourceContextPeer != NULL) { JNFDeleteGlobalRef(env, fDragSourceContextPeer); fDragSourceContextPeer = NULL; @@ -178,11 +180,6 @@ fTriggerEvent = NULL; } - if (fCursor != NULL) { - JNFDeleteGlobalRef(env, fCursor); - fCursor = NULL; - } - if (fFormats != NULL) { JNFDeleteGlobalRef(env, fFormats); fFormats = NULL; @@ -586,11 +583,6 @@ { AWT_ASSERT_NOT_APPKIT_THREAD; - // Set the drag cursor (or not 3839999) - //JNIEnv *env = [ThreadUtilities getJNIEnv]; - //jobject gCursor = JNFNewGlobalRef(env, fCursor); - //[EventFactory setJavaCursor:gCursor withEnv:env]; - [self performSelectorOnMainThread:@selector(doDrag) withObject:nil waitUntilDone:YES]; // AWT_THREADING Safe (called from unique asynchronous thread) }
--- a/src/macosx/native/sun/awt/CDragSourceContextPeer.m Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/native/sun/awt/CDragSourceContextPeer.m Tue Jul 16 11:26:34 2013 -0700 @@ -34,12 +34,13 @@ /* * Class: sun_lwawt_macosx_CDragSourceContextPeer * Method: createNativeDragSource - * Signature: (Ljava/awt/Component;Ljava/awt/peer/ComponentPeer;JLjava/awt/datatransfer/Transferable;Ljava/awt/event/InputEvent;IIIIJLjava/awt/Cursor;IJIII[JLjava/util/Map;)J + * Signature: (Ljava/awt/Component;JLjava/awt/datatransfer/Transferable; + Ljava/awt/event/InputEvent;IIIIJIJIII[JLjava/util/Map;)J */ JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource - (JNIEnv *env, jobject jthis, jobject jcomponent, jobject jpeer, jlong jnativepeer, jobject jtransferable, + (JNIEnv *env, jobject jthis, jobject jcomponent, jlong jnativepeer, jobject jtransferable, jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp, - jobject jcursor, jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety, + jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety, jint jsourceactions, jlongArray jformats, jobject jformatmap) { id controlObj = (id) jlong_to_ptr(jnativepeer); @@ -47,12 +48,22 @@ JNF_COCOA_ENTER(env); [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - dragSource = [[CDragSource alloc] init:jthis component:jcomponent peer:jpeer control:controlObj - transferable:jtransferable triggerEvent:jtrigger dragPosX:jdragposx - dragPosY:jdragposy modifiers:jextmodifiers clickCount:jclickcount timeStamp:jtimestamp - cursor:jcursor dragImage:jnsdragimage dragImageOffsetX:jdragimageoffsetx - dragImageOffsetY:jdragimageoffsety sourceActions:jsourceactions - formats:jformats formatMap:jformatmap]; + dragSource = [[CDragSource alloc] init:jthis + component:jcomponent + control:controlObj + transferable:jtransferable + triggerEvent:jtrigger + dragPosX:jdragposx + dragPosY:jdragposy + modifiers:jextmodifiers + clickCount:jclickcount + timeStamp:jtimestamp + dragImage:jnsdragimage + dragImageOffsetX:jdragimageoffsetx + dragImageOffsetY:jdragimageoffsety + sourceActions:jsourceactions + formats:jformats + formatMap:jformatmap]; }]; JNF_COCOA_EXIT(env); @@ -94,19 +105,3 @@ [dragSource removeFromView:env]; JNF_COCOA_EXIT(env); } - -/* - * Class: sun_lwawt_macosx_CDragSourceContextPeer - * Method: setNativeCursor - * Signature: (JLjava/awt/Cursor;I)V - */ -JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_setNativeCursor - (JNIEnv *env, jobject jthis, jlong nativeDragSourceVal, jobject jcursor, jint jcursortype) -{ - //AWT_ASSERT_NOT_APPKIT_THREAD; - -//JNF_COCOA_ENTER(env); -// jobject gCursor = JNFNewGlobalRef(env, jcursor); -// [EventFactory setJavaCursor:gCursor withEnv:env]; -//JNF_COCOA_EXIT(env); -}
--- a/src/macosx/native/sun/awt/CDropTarget.m Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/native/sun/awt/CDropTarget.m Tue Jul 16 11:26:34 2013 -0700 @@ -81,9 +81,8 @@ fComponent = JNFNewGlobalRef(env, jcomponent); fDropTarget = JNFNewGlobalRef(env, jdropTarget); - AWTView *awtView = [((NSWindow *) control) contentView]; - fView = [awtView retain]; - [awtView setDropTarget:self]; + fView = [((AWTView *) control) retain]; + [fView setDropTarget:self]; } else { @@ -177,6 +176,10 @@ { DLog2(@"[CDropTarget dealloc]: %@\n", self); + if(sCurrentDropTarget == self) { + sCurrentDropTarget = nil; + } + [fView release]; fView = nil; @@ -490,7 +493,10 @@ JNF_MEMBER_CACHE(handleEnterMessageMethod, jc_CDropTargetContextPeer, "handleEnterMessage", "(Ljava/awt/Component;IIII[JJ)I"); if (sDraggingError == FALSE) { // Double-casting self gets rid of 'different size' compiler warning: - actions = JNFCallIntMethod(env, fDropTargetContextPeer, handleEnterMessageMethod, fComponent, (jint) javaLocation.x, (jint) javaLocation.y, dropAction, actions, formats, ptr_to_jlong(self)); // AWT_THREADING Safe (CToolkitThreadBlockedHandler) + // AWT_THREADING Safe (CToolkitThreadBlockedHandler) + actions = JNFCallIntMethod(env, fDropTargetContextPeer, handleEnterMessageMethod, + fComponent, (jint) javaLocation.x, (jint) javaLocation.y, + dropAction, actions, formats, ptr_to_jlong(self)); } if (sDraggingError == FALSE) { @@ -510,11 +516,6 @@ // Remember the dragOp for no-op'd update messages: sUpdateOperation = dragOp; } - - // If we are in the same process as the sender, make the sender post the appropriate message - if (sender) { - [[CDragSource currentDragSource] postDragEnter]; - } } // 9-11-02 Note: the native event thread would not handle an exception gracefully: @@ -608,11 +609,9 @@ JNF_MEMBER_CACHE(handleExitMessageMethod, jc_CDropTargetContextPeer, "handleExitMessage", "(Ljava/awt/Component;J)V"); if (sDraggingError == FALSE) { DLog3(@" - dragExit: loc native %f, %f\n", sDraggingLocation.x, sDraggingLocation.y); - JNFCallVoidMethod(env, fDropTargetContextPeer, handleExitMessageMethod, fComponent, ptr_to_jlong(self)); // AWT_THREADING Safe (CToolkitThreadBlockedHandler) - // If we are in the same process as the sender, make the sender post the appropriate message - if (sender) { - [[CDragSource currentDragSource] postDragExit]; - } + // AWT_THREADING Safe (CToolkitThreadBlockedHandler) + JNFCallVoidMethod(env, fDropTargetContextPeer, + handleExitMessageMethod, fComponent, ptr_to_jlong(self)); } // 5-27-03 Note: [Radar 3270455]
--- a/src/macosx/native/sun/awt/CMenuItem.m Wed Jul 10 13:49:00 2013 -0700 +++ b/src/macosx/native/sun/awt/CMenuItem.m Tue Jul 16 11:26:34 2013 -0700 @@ -82,8 +82,13 @@ // keys, so we need to do the same translation here that we do // for the regular key down events if ([eventKey length] == 1) { - unichar ch = NsCharToJavaChar([eventKey characterAtIndex:0], 0); - eventKey = [NSString stringWithCharacters: &ch length: 1]; + unichar origChar = [eventKey characterAtIndex:0]; + unichar newChar = NsCharToJavaChar(origChar, 0); + if (newChar == java_awt_event_KeyEvent_CHAR_UNDEFINED) { + newChar = origChar; + } + + eventKey = [NSString stringWithCharacters: &newChar length: 1]; } if ([menuKey isEqualToString:eventKey]) {
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=toggle expand +toggleexpand=toggle expand # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_de.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_de.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=ein-/ausblenden +toggleexpand=ein-/ausblenden # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_es.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_es.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=activar/desactivar ampliaci\u00F3n +toggleexpand=activar/desactivar ampliaci\u00F3n # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_fr.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_fr.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=basculer le d\u00E9veloppement +toggleexpand=basculer le d\u00E9veloppement # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_it.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_it.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=abilita/disabilita espansione +toggleexpand=abilita/disabilita espansione # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_ja.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_ja.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=\u5C55\u958B\u306E\u30C8\u30B0\u30EB +toggleexpand=\u5C55\u958B\u306E\u30C8\u30B0\u30EB # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_ko.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_ko.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=\uD1A0\uAE00 \uD655\uC7A5 +toggleexpand=\uD1A0\uAE00 \uD655\uC7A5 # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=alternar expans\u00E3o +toggleexpand=alternar expans\u00E3o # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_sv.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=v\u00E4xla ut\u00F6ka +toggleexpand=v\u00E4xla ut\u00F6ka # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_zh_CN.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_zh_CN.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=\u5207\u6362\u5C55\u5F00 +toggleexpand=\u5207\u6362\u5C55\u5F00 # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/accessibility/internal/resources/accessibility_zh_TW.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/accessibility/internal/resources/accessibility_zh_TW.properties Tue Jul 16 11:26:34 2013 -0700 @@ -102,7 +102,7 @@ # # accessible actions # -toggle expand=\u5207\u63DB\u64F4\u5C55 +toggleexpand=\u5207\u63DB\u64F4\u5C55 # new relations, roles and states for J2SE 1.5.0
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java Tue Jul 16 11:26:34 2013 -0700 @@ -160,7 +160,7 @@ ); algorithmsMap.put( XMLCipher.RSA_OAEP, - new Algorithm("RSA", "RSA/ECB/OAEPPadding", "KeyTransport") + new Algorithm("RSA", "RSA/ECB/OAEPWithSHA1AndMGF1Padding", "KeyTransport") ); algorithmsMap.put( XMLCipher.DIFFIE_HELLMAN,
--- a/src/share/classes/java/awt/GraphicsDevice.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/java/awt/GraphicsDevice.java Tue Jul 16 11:26:34 2013 -0700 @@ -296,6 +296,12 @@ bgColor.getBlue(), 255); w.setBackground(bgColor); } + // Check if this window is in fullscreen mode on another device. + final GraphicsConfiguration gc = w.getGraphicsConfiguration(); + if (gc != null && gc.getDevice() != this + && gc.getDevice().getFullScreenWindow() == w) { + gc.getDevice().setFullScreenWindow(null); + } } if (fullScreenWindow != null && windowedModeBounds != null) { // if the window went into fs mode before it was realized it may
--- a/src/share/classes/java/util/logging/LogManager.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/java/util/logging/LogManager.java Tue Jul 16 11:26:34 2013 -0700 @@ -194,13 +194,22 @@ // Create and retain Logger for the root of the namespace. manager.rootLogger = manager.new RootLogger(); + // since by design the global manager's userContext and + // systemContext don't have their requiresDefaultLoggers + // flag set - we make sure to add the root logger to + // the global manager's default contexts here. manager.addLogger(manager.rootLogger); - manager.systemContext.addLocalLogger(manager.rootLogger); + manager.systemContext.addLocalLogger(manager.rootLogger, false); + manager.userContext.addLocalLogger(manager.rootLogger, false); // Adding the global Logger. Doing so in the Logger.<clinit> // would deadlock with the LogManager.<clinit>. Logger.global.setLogManager(manager); + // Make sure the global logger will be registered in the + // global manager's default contexts. manager.addLogger(Logger.global); + manager.systemContext.addLocalLogger(Logger.global, false); + manager.userContext.addLocalLogger(Logger.global, false); // We don't call readConfiguration() here, as we may be running // very early in the JVM startup sequence. Instead readConfiguration @@ -360,7 +369,11 @@ if (javaAwtAccess.isMainAppContext()) { context = userContext; } else { - context = new LoggerContext(); + // Create a new LoggerContext for the applet. + // The new logger context has its requiresDefaultLoggers + // flag set to true - so that these loggers will be + // lazily added when the context is firt accessed. + context = new LoggerContext(true); } javaAwtAccess.put(ecx, LoggerContext.class, context); } @@ -467,9 +480,13 @@ private final Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>(); // Tree of named Loggers private final LogNode root; - + private final boolean requiresDefaultLoggers; private LoggerContext() { + this(false); + } + private LoggerContext(boolean requiresDefaultLoggers) { this.root = new LogNode(null, this); + this.requiresDefaultLoggers = requiresDefaultLoggers; } Logger demandLogger(String name, String resourceBundleName) { @@ -478,7 +495,27 @@ return manager.demandLogger(name, resourceBundleName, null); } + + // Due to subtle deadlock issues getUserContext() no longer + // calls addLocalLogger(rootLogger); + // Therefore - we need to add the default loggers later on. + // Checks that the context is properly initialized + // This is necessary before calling e.g. find(name) + // or getLoggerNames() + // + private void ensureInitialized() { + if (requiresDefaultLoggers) { + // Ensure that the root and global loggers are set. + ensureDefaultLogger(manager.rootLogger); + ensureDefaultLogger(Logger.global); + } + } + + synchronized Logger findLogger(String name) { + // ensure that this context is properly initialized before + // looking for loggers. + ensureInitialized(); LoggerWeakRef ref = namedLoggers.get(name); if (ref == null) { return null; @@ -492,21 +529,76 @@ return logger; } - synchronized void ensureRootLogger(Logger logger) { - if (logger.getName().isEmpty()) - return; + // This method is called before adding a logger to the + // context. + // 'logger' is the context that will be added. + // This method will ensure that the defaults loggers are added + // before adding 'logger'. + // + private void ensureAllDefaultLoggers(Logger logger) { + if (requiresDefaultLoggers) { + final String name = logger.getName(); + if (!name.isEmpty()) { + ensureDefaultLogger(manager.rootLogger); + } + if (!Logger.GLOBAL_LOGGER_NAME.equals(name)) { + ensureDefaultLogger(Logger.global); + } + } + } + + private void ensureDefaultLogger(Logger logger) { + // Used for lazy addition of root logger and global logger + // to a LoggerContext. - // during initialization, rootLogger is null when - // instantiating itself RootLogger - if (findLogger("") == null && manager.rootLogger != null) { - addLocalLogger(manager.rootLogger); + // This check is simple sanity: we do not want that this + // method be called for anything else than Logger.global + // or owner.rootLogger. + if (!requiresDefaultLoggers || logger == null + || logger != Logger.global && logger != manager.rootLogger) { + + // the case where we have a non null logger which is neither + // Logger.global nor manager.rootLogger indicates a serious + // issue - as ensureDefaultLogger should never be called + // with any other loggers than one of these two (or null - if + // e.g manager.rootLogger is not yet initialized)... + assert logger == null; + + return; } + + // Adds the logger if it's not already there. + if (!namedLoggers.containsKey(logger.getName())) { + // It is important to prevent addLocalLogger to + // call ensureAllDefaultLoggers when we're in the process + // off adding one of those default loggers - as this would + // immediately cause a stack overflow. + // Therefore we must pass addDefaultLoggersIfNeeded=false, + // even if requiresDefaultLoggers is true. + addLocalLogger(logger, false); + } + } + + boolean addLocalLogger(Logger logger) { + // no need to add default loggers if it's not required + return addLocalLogger(logger, requiresDefaultLoggers); } // Add a logger to this context. This method will only set its level // and process parent loggers. It doesn't set its handlers. - synchronized boolean addLocalLogger(Logger logger) { - ensureRootLogger(logger); + synchronized boolean addLocalLogger(Logger logger, boolean addDefaultLoggersIfNeeded) { + // addDefaultLoggersIfNeeded serves to break recursion when adding + // default loggers. If we're adding one of the default loggers + // (we're being called from ensureDefaultLogger()) then + // addDefaultLoggersIfNeeded will be false: we don't want to + // call ensureAllDefaultLoggers again. + // + // Note: addDefaultLoggersIfNeeded can also be false when + // requiresDefaultLoggers is false - since calling + // ensureAllDefaultLoggers would have no effect in this case. + if (addDefaultLoggersIfNeeded) { + ensureAllDefaultLoggers(logger); + } final String name = logger.getName(); if (name == null) { @@ -572,6 +664,9 @@ } synchronized Enumeration<String> getLoggerNames() { + // ensure that this context is properly initialized before + // returning logger names. + ensureInitialized(); return namedLoggers.keys(); }
--- a/src/share/classes/javax/accessibility/AccessibleAction.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/javax/accessibility/AccessibleAction.java Tue Jul 16 11:26:34 2013 -0700 @@ -54,7 +54,7 @@ * @since 1.5 */ public static final String TOGGLE_EXPAND = - new String ("toggle expand"); + new String ("toggleexpand"); /** * An action which increments a value.
--- a/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java Tue Jul 16 11:26:34 2013 -0700 @@ -274,7 +274,7 @@ * upcall from native code */ - private void dragEnter(final int targetActions, + protected void dragEnter(final int targetActions, final int modifiers, final int x, final int y) { postDragSourceDragEvent(targetActions, modifiers, x, y, DISPATCH_ENTER); @@ -352,10 +352,6 @@ public static void setDragDropInProgress(boolean b) throws InvalidDnDOperationException { - if (dragDropInProgress == b) { - throw new InvalidDnDOperationException(getExceptionMessage(b)); - } - synchronized (SunDragSourceContextPeer.class) { if (dragDropInProgress == b) { throw new InvalidDnDOperationException(getExceptionMessage(b));
--- a/src/share/classes/sun/java2d/SunGraphics2D.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/java2d/SunGraphics2D.java Tue Jul 16 11:26:34 2013 -0700 @@ -1770,20 +1770,10 @@ } public Rectangle getClipBounds() { - Rectangle r; if (clipState == CLIP_DEVICE) { - r = null; - } else if (transformState <= TRANSFORM_INT_TRANSLATE) { - if (usrClip instanceof Rectangle) { - r = new Rectangle((Rectangle) usrClip); - } else { - r = usrClip.getBounds(); - } - r.translate(-transX, -transY); - } else { - r = getClip().getBounds(); + return null; } - return r; + return getClipBounds(new Rectangle()); } public Rectangle getClipBounds(Rectangle r) { @@ -1792,11 +1782,11 @@ if (usrClip instanceof Rectangle) { r.setBounds((Rectangle) usrClip); } else { - r.setBounds(usrClip.getBounds()); + r.setFrame(usrClip.getBounds2D()); } r.translate(-transX, -transY); } else { - r.setBounds(getClip().getBounds()); + r.setFrame(getClip().getBounds2D()); } } else if (r == null) { throw new NullPointerException("null rectangle parameter"); @@ -1971,10 +1961,10 @@ matrix[2] = matrix[0] + rect.getWidth(); matrix[3] = matrix[1] + rect.getHeight(); tx.transform(matrix, 0, matrix, 0, 2); - rect = new Rectangle2D.Float(); - rect.setFrameFromDiagonal(matrix[0], matrix[1], - matrix[2], matrix[3]); - return rect; + fixRectangleOrientation(matrix, rect); + return new Rectangle2D.Double(matrix[0], matrix[1], + matrix[2] - matrix[0], + matrix[3] - matrix[1]); } if (tx.isIdentity()) { @@ -1984,6 +1974,22 @@ return tx.createTransformedShape(clip); } + /** + * Sets orientation of the rectangle according to the clip. + */ + private static void fixRectangleOrientation(double[] m, Rectangle2D clip) { + if (clip.getWidth() > 0 != (m[2] - m[0] > 0)) { + double t = m[0]; + m[0] = m[2]; + m[2] = t; + } + if (clip.getHeight() > 0 != (m[3] - m[1] > 0)) { + double t = m[1]; + m[1] = m[3]; + m[3] = t; + } + } + public void clipRect(int x, int y, int w, int h) { clip(new Rectangle(x, y, w, h)); }
--- a/src/share/classes/sun/security/pkcs11/Config.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/security/pkcs11/Config.java Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -197,6 +197,10 @@ // (false). private boolean useEcX963Encoding = false; + // Flag to indicate whether NSS should favour performance (false) or + // memory footprint (true). + private boolean nssOptimizeSpace = false; + private Config(String filename, InputStream in) throws IOException { if (in == null) { if (filename.startsWith("--")) { @@ -329,6 +333,10 @@ return useEcX963Encoding; } + boolean getNssOptimizeSpace() { + return nssOptimizeSpace; + } + private static String expand(final String s) throws IOException { try { return PropertyExpander.expand(s); @@ -451,6 +459,8 @@ nssUseSecmodTrust = parseBooleanEntry(word); } else if (word.equals("useEcX963Encoding")) { useEcX963Encoding = parseBooleanEntry(word); + } else if (word.equals("nssOptimizeSpace")) { + nssOptimizeSpace = parseBooleanEntry(word); } else { throw new ConfigurationException ("Unknown keyword '" + word + "', line " + st.lineno());
--- a/src/share/classes/sun/security/pkcs11/Secmod.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/security/pkcs11/Secmod.java Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -157,11 +157,17 @@ */ public void initialize(String configDir, String nssLibDir) throws IOException { - initialize(DbMode.READ_WRITE, configDir, nssLibDir); + initialize(DbMode.READ_WRITE, configDir, nssLibDir, false); } - public synchronized void initialize(DbMode dbMode, String configDir, String nssLibDir) + public void initialize(DbMode dbMode, String configDir, String nssLibDir) throws IOException { + initialize(dbMode, configDir, nssLibDir, false); + } + + public synchronized void initialize(DbMode dbMode, String configDir, + String nssLibDir, boolean nssOptimizeSpace) throws IOException { + if (isInitialized()) { throw new IOException("NSS is already initialized"); } @@ -210,7 +216,8 @@ } if (DEBUG) System.out.println("dir: " + configDir); - boolean initok = nssInit(dbMode.functionName, nssHandle, configDir); + boolean initok = nssInitialize(dbMode.functionName, nssHandle, + configDir, nssOptimizeSpace); if (DEBUG) System.out.println("init: " + initok); if (initok == false) { throw new IOException("NSS initialization failed"); @@ -753,7 +760,7 @@ private static native boolean nssVersionCheck(long handle, String minVersion); - private static native boolean nssInit(String functionName, long handle, String configDir); + private static native boolean nssInitialize(String functionName, long handle, String configDir, boolean nssOptimizeSpace); private static native Object nssGetModuleList(long handle, String libDir);
--- a/src/share/classes/sun/security/pkcs11/SunPKCS11.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/security/pkcs11/SunPKCS11.java Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -167,6 +167,7 @@ try { String nssLibraryDirectory = config.getNssLibraryDirectory(); String nssSecmodDirectory = config.getNssSecmodDirectory(); + boolean nssOptimizeSpace = config.getNssOptimizeSpace(); if (secmod.isInitialized()) { if (nssSecmodDirectory != null) { @@ -204,7 +205,7 @@ } } secmod.initialize(nssDbMode, nssSecmodDirectory, - nssLibraryDirectory); + nssLibraryDirectory, nssOptimizeSpace); } } catch (IOException e) { // XXX which exception to throw
--- a/src/share/classes/sun/security/x509/X509CertImpl.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/security/x509/X509CertImpl.java Tue Jul 16 11:26:34 2013 -0700 @@ -174,12 +174,6 @@ */ private boolean verificationResult; - // Cached SKID - private byte[] subjectKeyId = null; - - // Cached AKID - private byte[] issuerKeyId = null; - /** * Default constructor. */ @@ -1068,25 +1062,25 @@ */ public byte[] getIssuerKeyIdentifier() { - if (issuerKeyId == null) { - AuthorityKeyIdentifierExtension aki = - getAuthorityKeyIdentifierExtension(); - if (aki != null) { + byte[] issuerKeyId = null; + AuthorityKeyIdentifierExtension aki = + getAuthorityKeyIdentifierExtension(); + + if (aki != null) { - try { - issuerKeyId = ((KeyIdentifier) - aki.get(AuthorityKeyIdentifierExtension.KEY_ID)) - .getIdentifier(); - } catch (IOException e) { - // should never happen (because KEY_ID attr is supported) + try { + KeyIdentifier ki = + ((KeyIdentifier) aki.get( + AuthorityKeyIdentifierExtension.KEY_ID)); + if (ki != null) { + issuerKeyId = ki.getIdentifier(); } - - } else { - issuerKeyId = new byte[0]; // no AKID present + } catch (IOException e) { + // should never happen (because KEY_ID attr is supported) } } - return issuerKeyId.length != 0 ? issuerKeyId : null; + return issuerKeyId; } /** @@ -1193,25 +1187,24 @@ */ public byte[] getSubjectKeyIdentifier() { - if (subjectKeyId == null) { - SubjectKeyIdentifierExtension ski = - getSubjectKeyIdentifierExtension(); - if (ski != null) { + byte[] subjectKeyId = null; + SubjectKeyIdentifierExtension ski = getSubjectKeyIdentifierExtension(); + + if (ski != null) { - try { - subjectKeyId = ((KeyIdentifier) - ski.get(SubjectKeyIdentifierExtension.KEY_ID)) - .getIdentifier(); - } catch (IOException e) { - // should never happen (because KEY_ID attr is supported) + try { + KeyIdentifier ki = + ((KeyIdentifier) ski.get( + SubjectKeyIdentifierExtension.KEY_ID)); + if (ki != null) { + subjectKeyId = ki.getIdentifier(); } - - } else { - subjectKeyId = new byte[0]; // no SKID present + } catch (IOException e) { + // should never happen (because KEY_ID attr is supported) } } - return subjectKeyId.length != 0 ? subjectKeyId : null; + return subjectKeyId; } /**
--- a/src/share/classes/sun/util/logging/resources/logging_de.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_de.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=ALL +ALL=Alle # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=Schwerwiegend # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=Warnung # The following ALL CAPS words should be translated. -INFO=INFO +INFO=Information # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= Konfiguration # The following ALL CAPS words should be translated. -FINE=FINE +FINE=Fein # The following ALL CAPS words should be translated. -FINER=FINER +FINER=Feiner # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=Am feinsten # The following ALL CAPS words should be translated. -OFF=OFF +OFF=Deaktiviert
--- a/src/share/classes/sun/util/logging/resources/logging_es.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_es.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=ALL +ALL=Todo # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=Grave # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=Advertencia # The following ALL CAPS words should be translated. -INFO=INFO +INFO=Informaci\u00F3n # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= Configurar # The following ALL CAPS words should be translated. -FINE=FINE +FINE=Detallado # The following ALL CAPS words should be translated. -FINER=FINER +FINER=Muy Detallado # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=M\u00E1s Detallado # The following ALL CAPS words should be translated. -OFF=OFF +OFF=Desactivado
--- a/src/share/classes/sun/util/logging/resources/logging_fr.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_fr.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=ALL +ALL=Tout # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=Grave # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=Avertissement # The following ALL CAPS words should be translated. -INFO=INFO +INFO=Infos # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= Config # The following ALL CAPS words should be translated. -FINE=FINE +FINE=Pr\u00E9cis # The following ALL CAPS words should be translated. -FINER=FINER +FINER=Plus pr\u00E9cis # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=Le plus pr\u00E9cis # The following ALL CAPS words should be translated. -OFF=OFF +OFF=D\u00E9sactiv\u00E9
--- a/src/share/classes/sun/util/logging/resources/logging_it.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_it.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=ALL +ALL=Tutto # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=Grave # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=Avvertenza # The following ALL CAPS words should be translated. -INFO=INFO +INFO=Informazioni # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= Configurazione # The following ALL CAPS words should be translated. -FINE=FINE +FINE=Buono # The following ALL CAPS words should be translated. -FINER=FINER +FINER=Migliore # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=Ottimale # The following ALL CAPS words should be translated. -OFF=OFF +OFF=Non attivo
--- a/src/share/classes/sun/util/logging/resources/logging_ja.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_ja.properties Tue Jul 16 11:26:34 2013 -0700 @@ -29,18 +29,18 @@ # The following ALL CAPS words should be translated. ALL=\u3059\u3079\u3066 # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=\u91CD\u5927 # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=\u8B66\u544A # The following ALL CAPS words should be translated. INFO=\u60C5\u5831 # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= \u69CB\u6210 # The following ALL CAPS words should be translated. -FINE=\u8A73\u7D30\u30EC\u30D9\u30EB(\u4F4E) +FINE=\u666E\u901A # The following ALL CAPS words should be translated. -FINER=FINER +FINER=\u8A73\u7D30 # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=\u6700\u3082\u8A73\u7D30 # The following ALL CAPS words should be translated. OFF=\u30AA\u30D5
--- a/src/share/classes/sun/util/logging/resources/logging_ko.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_ko.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=ALL +ALL=\uBAA8\uB450 # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=\uC2EC\uAC01 # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=\uACBD\uACE0 # The following ALL CAPS words should be translated. -INFO=INFO +INFO=\uC815\uBCF4 # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= \uAD6C\uC131 # The following ALL CAPS words should be translated. -FINE=FINE +FINE=\uBBF8\uC138 # The following ALL CAPS words should be translated. -FINER=FINER +FINER=\uBCF4\uB2E4 \uBBF8\uC138 # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=\uAC00\uC7A5 \uBBF8\uC138 # The following ALL CAPS words should be translated. -OFF=OFF +OFF=\uD574\uC81C
--- a/src/share/classes/sun/util/logging/resources/logging_pt_BR.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_pt_BR.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=ALL +ALL=Tudo # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=Grave # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=Advert\u00EAncia # The following ALL CAPS words should be translated. -INFO=INFO +INFO=Informa\u00E7\u00F5es # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= Configura\u00E7\u00E3o # The following ALL CAPS words should be translated. -FINE=FINE +FINE=Detalhado # The following ALL CAPS words should be translated. -FINER=FINER +FINER=Mais Detalhado # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=O Mais Detalhado # The following ALL CAPS words should be translated. -OFF=OFF +OFF=Desativado
--- a/src/share/classes/sun/util/logging/resources/logging_sv.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_sv.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=ALLA +ALL=Alla # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=Allvarlig # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=Varning # The following ALL CAPS words should be translated. -INFO=INFO +INFO=Info # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= Konfig # The following ALL CAPS words should be translated. -FINE=FINE +FINE=Fin # The following ALL CAPS words should be translated. -FINER=FINER +FINER=Finare # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=Finaste # The following ALL CAPS words should be translated. -OFF=OFF +OFF=Av
--- a/src/share/classes/sun/util/logging/resources/logging_zh_CN.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_zh_CN.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=ALL +ALL=\u5168\u90E8 # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=\u4E25\u91CD # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=\u8B66\u544A # The following ALL CAPS words should be translated. -INFO=INFO +INFO=\u4FE1\u606F # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= \u914D\u7F6E # The following ALL CAPS words should be translated. -FINE=FINE +FINE=\u8BE6\u7EC6 # The following ALL CAPS words should be translated. -FINER=FINER +FINER=\u8F83\u8BE6\u7EC6 # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=\u975E\u5E38\u8BE6\u7EC6 # The following ALL CAPS words should be translated. -OFF=OFF +OFF=\u7981\u7528
--- a/src/share/classes/sun/util/logging/resources/logging_zh_TW.properties Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/classes/sun/util/logging/resources/logging_zh_TW.properties Tue Jul 16 11:26:34 2013 -0700 @@ -27,20 +27,20 @@ # these are the same as the non-localized level name. # The following ALL CAPS words should be translated. -ALL=\u6240\u6709 +ALL=\u5168\u90E8 # The following ALL CAPS words should be translated. -SEVERE=SEVERE +SEVERE=\u56B4\u91CD # The following ALL CAPS words should be translated. -WARNING=WARNING +WARNING=\u8B66\u544A # The following ALL CAPS words should be translated. INFO=\u8CC7\u8A0A # The following ALL CAPS words should be translated. -CONFIG= CONFIG +CONFIG= \u7D44\u614B # The following ALL CAPS words should be translated. FINE=\u8A73\u7D30 # The following ALL CAPS words should be translated. -FINER=FINER +FINER=\u8F03\u8A73\u7D30 # The following ALL CAPS words should be translated. -FINEST=FINEST +FINEST=\u6700\u8A73\u7D30 # The following ALL CAPS words should be translated. OFF=\u95DC\u9589
--- a/src/share/lib/security/java.security-linux Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/lib/security/java.security-linux Tue Jul 16 11:26:34 2013 -0700 @@ -124,7 +124,6 @@ # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. package.access=sun.,\ - com.sun.corba.se.impl.,\ com.sun.xml.internal.,\ com.sun.imageio.,\ com.sun.istack.internal.,\ @@ -162,7 +161,6 @@ # checkPackageDefinition. # package.definition=sun.,\ - com.sun.corba.se.impl.,\ com.sun.xml.internal.,\ com.sun.imageio.,\ com.sun.istack.internal.,\
--- a/src/share/lib/security/java.security-macosx Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/lib/security/java.security-macosx Tue Jul 16 11:26:34 2013 -0700 @@ -125,7 +125,6 @@ # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. package.access=sun.,\ - com.sun.corba.se.impl.,\ com.sun.xml.internal.,\ com.sun.imageio.,\ com.sun.istack.internal.,\ @@ -165,7 +164,6 @@ # checkPackageDefinition. # package.definition=sun.,\ - com.sun.corba.se.impl.,\ com.sun.xml.internal.,\ com.sun.imageio.,\ com.sun.istack.internal.,\
--- a/src/share/lib/security/java.security-solaris Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/lib/security/java.security-solaris Tue Jul 16 11:26:34 2013 -0700 @@ -126,7 +126,6 @@ # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. package.access=sun.,\ - com.sun.corba.se.impl.,\ com.sun.xml.internal.,\ com.sun.imageio.,\ com.sun.istack.internal.,\ @@ -165,7 +164,6 @@ # checkPackageDefinition. # package.definition=sun.,\ - com.sun.corba.se.impl.,\ com.sun.xml.internal.,\ com.sun.imageio.,\ com.sun.istack.internal.,\
--- a/src/share/lib/security/java.security-windows Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/lib/security/java.security-windows Tue Jul 16 11:26:34 2013 -0700 @@ -125,7 +125,6 @@ # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. package.access=sun.,\ - com.sun.corba.se.impl.,\ com.sun.xml.internal.,\ com.sun.imageio.,\ com.sun.istack.internal.,\ @@ -165,7 +164,6 @@ # checkPackageDefinition. # package.definition=sun.,\ - com.sun.corba.se.impl.,\ com.sun.xml.internal.,\ com.sun.imageio.,\ com.sun.istack.internal.,\
--- a/src/share/native/sun/security/pkcs11/j2secmod.c Wed Jul 10 13:49:00 2013 -0700 +++ b/src/share/native/sun/security/pkcs11/j2secmod.c Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,20 +51,63 @@ return (res == 0) ? JNI_FALSE : JNI_TRUE; } -JNIEXPORT jboolean JNICALL Java_sun_security_pkcs11_Secmod_nssInit - (JNIEnv *env, jclass thisClass, jstring jFunctionName, jlong jHandle, jstring jConfigDir) +/* + * Initializes NSS. + * The NSS_INIT_OPTIMIZESPACE flag is supplied by the caller. + * The NSS_Init* functions are mapped to the NSS_Initialize function. + */ +JNIEXPORT jboolean JNICALL Java_sun_security_pkcs11_Secmod_nssInitialize + (JNIEnv *env, jclass thisClass, jstring jFunctionName, jlong jHandle, jstring jConfigDir, jboolean jNssOptimizeSpace) { - const char *functionName = (*env)->GetStringUTFChars(env, jFunctionName, NULL); - const char *configDir = (jConfigDir == NULL) ? NULL : (*env)->GetStringUTFChars(env, jConfigDir, NULL); - FPTR_Init init = (FPTR_Init)findFunction(env, jHandle, functionName); - int res; + const char *functionName = + (*env)->GetStringUTFChars(env, jFunctionName, NULL); + const char *configDir = (jConfigDir == NULL) + ? NULL : (*env)->GetStringUTFChars(env, jConfigDir, NULL); + FPTR_Initialize initialize = + (FPTR_Initialize)findFunction(env, jHandle, "NSS_Initialize"); + int res = 0; + unsigned int flags = 0x00; - (*env)->ReleaseStringUTFChars(env, jFunctionName, functionName); - if (init == NULL) { - return JNI_FALSE; + if (jNssOptimizeSpace == JNI_TRUE) { + flags = 0x20; // NSS_INIT_OPTIMIZESPACE flag } - res = init(configDir); + if (initialize != NULL) { + /* + * If the NSS_Init function is requested then call NSS_Initialize to + * open the Cert, Key and Security Module databases, read only. + */ + if (strcmp("NSS_Init", functionName) == 0) { + flags = flags | 0x01; // NSS_INIT_READONLY flag + res = initialize(configDir, "", "", "secmod.db", flags); + + /* + * If the NSS_InitReadWrite function is requested then call + * NSS_Initialize to open the Cert, Key and Security Module databases, + * read/write. + */ + } else if (strcmp("NSS_InitReadWrite", functionName) == 0) { + res = initialize(configDir, "", "", "secmod.db", flags); + + /* + * If the NSS_NoDB_Init function is requested then call + * NSS_Initialize without creating Cert, Key or Security Module + * databases. + */ + } else if (strcmp("NSS_NoDB_Init", functionName) == 0) { + flags = flags | 0x02 // NSS_INIT_NOCERTDB flag + | 0x04 // NSS_INIT_NOMODDB flag + | 0x08 // NSS_INIT_FORCEOPEN flag + | 0x10; // NSS_INIT_NOROOTINIT flag + res = initialize("", "", "", "", flags); + + } else { + res = 2; + } + } else { + res = 1; + } + (*env)->ReleaseStringUTFChars(env, jFunctionName, functionName); if (configDir != NULL) { (*env)->ReleaseStringUTFChars(env, jConfigDir, configDir); }
--- a/src/solaris/classes/sun/print/IPPPrintService.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/solaris/classes/sun/print/IPPPrintService.java Tue Jul 16 11:26:34 2013 -0700 @@ -1029,7 +1029,16 @@ // now supports collation and that most OS has a way // of setting it, it is a safe assumption to just always // include SheetCollate as supported attribute. - catList.add(SheetCollate.class); + + /* + In Linux, we use Postscript for rendering but Linux still + has issues in propagating Postscript-embedded setpagedevice + setting like collation. Therefore, we temporarily exclude + Linux. + */ + if (!UnixPrintServiceLookup.isLinux()) { + catList.add(SheetCollate.class); + } } // With the assumption that Chromaticity is equivalent to
--- a/src/solaris/classes/sun/print/UnixPrintServiceLookup.java Wed Jul 10 13:49:00 2013 -0700 +++ b/src/solaris/classes/sun/print/UnixPrintServiceLookup.java Tue Jul 16 11:26:34 2013 -0700 @@ -123,6 +123,10 @@ return osname.equals("SunOS"); } + static boolean isLinux() { + return (osname.equals("Linux")); + } + static boolean isBSD() { return (osname.equals("Linux") || osname.contains("OS X"));
--- a/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c Wed Jul 10 13:49:00 2013 -0700 +++ b/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c Tue Jul 16 11:26:34 2013 -0700 @@ -372,7 +372,7 @@ size_t fds_size; kres = pid_for_task(mach_task_self(), &my_pid); - if (res != KERN_SUCCESS) { + if (kres != KERN_SUCCESS) { throw_internal_error(env, "pid_for_task failed"); return -1; }
--- a/src/solaris/native/sun/security/pkcs11/j2secmod_md.h Wed Jul 10 13:49:00 2013 -0700 +++ b/src/solaris/native/sun/security/pkcs11/j2secmod_md.h Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,14 @@ // in nss.h: // extern PRBool NSS_VersionCheck(const char *importedVersion); -// extern SECStatus NSS_Init(const char *configdir); +// extern SECStatus NSS_Initialize(const char *configdir, +// const char *certPrefix, const char *keyPrefix, +// const char *secmodName, PRUint32 flags); + typedef int (*FPTR_VersionCheck)(const char *importedVersion); -typedef int (*FPTR_Init)(const char *configdir); +typedef int (*FPTR_Initialize)(const char *configdir, + const char *certPrefix, const char *keyPrefix, + const char *secmodName, unsigned int flags); // in secmod.h //extern SECMODModule *SECMOD_LoadModule(char *moduleSpec,SECMODModule *parent,
--- a/src/windows/native/sun/security/pkcs11/j2secmod_md.h Wed Jul 10 13:49:00 2013 -0700 +++ b/src/windows/native/sun/security/pkcs11/j2secmod_md.h Tue Jul 16 11:26:34 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,9 +27,14 @@ // in nss.h: // extern PRBool NSS_VersionCheck(const char *importedVersion); -// extern SECStatus NSS_Init(const char *configdir); +// extern SECStatus NSS_Initialize(const char *configdir, +// const char *certPrefix, const char *keyPrefix, +// const char *secmodName, PRUint32 flags); + typedef int __declspec(dllimport) (*FPTR_VersionCheck)(const char *importedVersion); -typedef int __declspec(dllimport) (*FPTR_Init)(const char *configdir); +typedef int __declspec(dllimport) (*FPTR_Initialize)(const char *configdir, + const char *certPrefix, const char *keyPrefix, + const char *secmodName, unsigned int flags); // in secmod.h //extern SECMODModule *SECMOD_LoadModule(char *moduleSpec,SECMODModule *parent,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/org/apache/xml/internal/security/encryption/XMLCipher/GetInstance.java Tue Jul 16 11:26:34 2013 -0700 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8017173 + * @summary Check that an XMLCipher with RSA_OAEP Key Transport algorithm can + * be instantiated + * @compile -XDignore.symbol.file GetInstance.java + * @run main GetInstance + */ +import com.sun.org.apache.xml.internal.security.Init; +import com.sun.org.apache.xml.internal.security.encryption.XMLCipher; + +public class GetInstance { + + private static final String RSA_OAEP = + "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"; + + public static void main(String[] args) throws Exception { + Init.init(); + XMLCipher.getInstance(RSA_OAEP); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Graphics2D/Test8004859/Test8004859.java Tue Jul 16 11:26:34 2013 -0700 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.geom.NoninvertibleTransformException; +import java.awt.image.BufferedImage; + +import sun.java2d.SunGraphics2D; + +/** + * @test + * @bug 8004859 + * @summary getClipBounds/getClip should return equivalent bounds. + * @author Sergey Bylokhov + */ +public final class Test8004859 { + + private static Shape[] clips = {new Rectangle(0, 0, -1, -1), new Rectangle( + 100, 100, -100, -100)}; + + private static boolean status = true; + + public static void main(final String[] args) + throws NoninvertibleTransformException { + final BufferedImage bi = new BufferedImage(300, 300, + BufferedImage.TYPE_INT_RGB); + final Graphics2D g = (Graphics2D) bi.getGraphics(); + test(g); + g.translate(2.0, 2.0); + test(g); + g.translate(-4.0, -4.0); + test(g); + g.scale(2.0, 2.0); + test(g); + g.scale(-4.0, -4.0); + test(g); + g.rotate(Math.toRadians(90)); + test(g); + g.rotate(Math.toRadians(90)); + test(g); + g.rotate(Math.toRadians(90)); + test(g); + g.rotate(Math.toRadians(90)); + test(g); + g.dispose(); + if (!status) { + throw new RuntimeException("Test failed"); + } + } + + private static void test(final Graphics2D g) { + for (final Shape clip : clips) { + g.setClip(clip); + if (!g.getClip().equals(clip)) { + System.err.println("Expected clip: " + clip); + System.err.println("Actual clip: " + g.getClip()); + System.err.println("bounds="+g.getClip().getBounds2D()); + System.err.println("bounds="+g.getClip().getBounds()); + status = false; + } + final Rectangle bounds = g.getClipBounds(); + if (!clip.equals(bounds)) { + System.err.println("Expected getClipBounds(): " + clip); + System.err.println("Actual getClipBounds(): " + bounds); + status = false; + } + g.getClipBounds(bounds); + if (!clip.equals(bounds)) { + System.err.println("Expected getClipBounds(r): " + clip); + System.err.println("Actual getClipBounds(r): " + bounds); + status = false; + } + if (!clip.getBounds2D().isEmpty() && ((SunGraphics2D) g).clipRegion + .isEmpty()) { + System.err.println("clipRegion should not be empty"); + status = false; + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java Tue Jul 16 11:26:34 2013 -0700 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.Color; +import java.awt.DisplayMode; +import java.awt.Frame; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Toolkit; + +import sun.awt.SunToolkit; + +/** + * @test + * @bug 8019587 + * @author Sergey Bylokhov + */ +public class IncorrectDisplayModeExitFullscreen { + + public static void main(final String[] args) { + + final GraphicsDevice[] devices = + GraphicsEnvironment.getLocalGraphicsEnvironment() + .getScreenDevices(); + if (devices.length < 2 || devices[0].getDisplayModes().length < 2 + || !devices[0].isFullScreenSupported() + || !devices[1].isFullScreenSupported()) { + System.err.println("Testcase is not applicable"); + return; + } + final DisplayMode defaultDM = devices[0].getDisplayMode(); + final DisplayMode[] dms = devices[0].getDisplayModes(); + DisplayMode nonDefaultDM = null; + + for (final DisplayMode dm : dms) { + if (!dm.equals(defaultDM)) { + nonDefaultDM = dm; + break; + } + } + if (nonDefaultDM == null) { + System.err.println("Testcase is not applicable"); + return; + } + + final Frame frame = new Frame(); + frame.setBackground(Color.GREEN); + frame.setUndecorated(true); + try { + devices[0].setFullScreenWindow(frame); + sleep(); + devices[0].setDisplayMode(nonDefaultDM); + sleep(); + devices[1].setFullScreenWindow(frame); + sleep(); + if (!defaultDM.equals(devices[0].getDisplayMode())) { + throw new RuntimeException("DisplayMode is not restored"); + } + } finally { + // cleaning up + devices[0].setFullScreenWindow(null); + devices[1].setFullScreenWindow(null); + frame.dispose(); + } + } + private static void sleep() { + ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + try { + Thread.sleep(1500); + } catch (InterruptedException ignored) { + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java Tue Jul 16 11:26:34 2013 -0700 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test @summary JVM crash if the frame is disposed in DropTargetListener + * @author Petr Pchelko + * @library ../../regtesthelpers + * @build Util + * @compile DisposeFrameOnDragTest.java + * @run main/othervm DisposeFrameOnDragTest + */ +import java.awt.AWTException; +import java.awt.Point; +import java.awt.Robot; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.event.InputEvent; +import java.lang.reflect.InvocationTargetException; +import java.util.TooManyListenersException; +import javax.swing.JFrame; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import test.java.awt.regtesthelpers.Util; + +public class DisposeFrameOnDragTest { + + private static JTextArea textArea; + + public static void main(String[] args) throws Throwable { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + constructTestUI(); + } + }); + + Util.waitForIdle(null); + try { + Point loc = textArea.getLocationOnScreen(); + Util.drag(new Robot(), + new Point((int) loc.x + 3, (int) loc.y + 3), + new Point((int) loc.x + 40, (int) loc.y + 40), + InputEvent.BUTTON1_MASK); + } catch (AWTException ex) { + throw new RuntimeException("Could not initiate a drag operation"); + } + Util.waitForIdle(null); + } + + private static void constructTestUI() { + final JFrame frame = new JFrame("Test frame"); + textArea = new JTextArea("Drag Me!"); + try { + textArea.getDropTarget().addDropTargetListener(new DropTargetAdapter() { + @Override + public void drop(DropTargetDropEvent dtde) { + //IGNORE + } + + @Override + public void dragOver(DropTargetDragEvent dtde) { + frame.dispose(); + } + }); + } catch (TooManyListenersException ex) { + throw new RuntimeException(ex); + } + textArea.setSize(100, 100); + textArea.setDragEnabled(true); + textArea.select(0, textArea.getText().length()); + frame.add(textArea); + frame.setBounds(100, 100, 100, 100); + frame.setVisible(true); + } +}
--- a/test/java/lang/SecurityManager/CheckPackageAccess.java Wed Jul 10 13:49:00 2013 -0700 +++ b/test/java/lang/SecurityManager/CheckPackageAccess.java Tue Jul 16 11:26:34 2013 -0700 @@ -22,31 +22,127 @@ */ /* - * @test - * @bug 7146431 8000450 - * @summary Test that internal packages cannot be accessed + * @test + * @bug 6741606 7146431 8000450 + * @summary Make sure all restricted packages listed in the package.access + * property in the java.security file are blocked + * @run main/othervm CheckPackageAccess */ +import java.security.Security; +import java.util.Collections; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +/* + * The main benefit of this test is to catch merge errors or other types + * of issues where one or more of the packages are accidentally + * removed. This is why the packages that are known to be restricted have to + * be explicitly listed below. + */ public class CheckPackageAccess { + /* + * This array should be updated whenever new packages are added to the + * package.access property in the java.security file + */ + private static final String[] packages = { + "sun.", + "com.sun.xml.internal.", + "com.sun.imageio.", + "com.sun.istack.internal.", + "com.sun.jmx.", + "com.sun.proxy.", + "com.sun.org.apache.bcel.internal.", + "com.sun.org.apache.regexp.internal.", + "com.sun.org.apache.xerces.internal.", + "com.sun.org.apache.xpath.internal.", + "com.sun.org.apache.xalan.internal.extensions.", + "com.sun.org.apache.xalan.internal.lib.", + "com.sun.org.apache.xalan.internal.res.", + "com.sun.org.apache.xalan.internal.templates.", + "com.sun.org.apache.xalan.internal.utils.", + "com.sun.org.apache.xalan.internal.xslt.", + "com.sun.org.apache.xalan.internal.xsltc.cmdline.", + "com.sun.org.apache.xalan.internal.xsltc.compiler.", + "com.sun.org.apache.xalan.internal.xsltc.trax.", + "com.sun.org.apache.xalan.internal.xsltc.util.", + "com.sun.org.apache.xml.internal.res.", + "com.sun.org.apache.xml.internal.security.", + "com.sun.org.apache.xml.internal.serializer.utils.", + "com.sun.org.apache.xml.internal.utils.", + "com.sun.org.glassfish.", + "oracle.jrockit.jfr.", + "org.jcp.xml.dsig.internal.", + }; + public static void main(String[] args) throws Exception { + List<String> pkgs = new ArrayList<>(Arrays.asList(packages)); + String osName = System.getProperty("os.name"); + if (osName.contains("OS X")) { + pkgs.add("apple."); // add apple package for OS X + } else if (osName.startsWith("Windows")) { + pkgs.add("com.sun.java.accessibility."); + } - String[] pkgs = new String[] { - "com.sun.corba.se.impl.", - "com.sun.org.apache.xerces.internal.utils.", - "com.sun.org.apache.xalan.internal.utils." }; - SecurityManager sm = new SecurityManager(); - System.setSecurityManager(sm); - for (String pkg : pkgs) { - System.out.println("Checking package access for " + pkg); + List<String> jspkgs = + getPackages(Security.getProperty("package.access")); + + // Sort to ensure lists are comparable + Collections.sort(pkgs); + Collections.sort(jspkgs); + + if (!pkgs.equals(jspkgs)) { + for (String p : pkgs) + if (!jspkgs.contains(p)) + System.out.println("In golden set, but not in j.s file: " + p); + for (String p : jspkgs) + if (!pkgs.contains(p)) + System.out.println("In j.s file, but not in golden set: " + p); + + + throw new RuntimeException("restricted packages are not " + + "consistent with java.security file"); + } + System.setSecurityManager(new SecurityManager()); + SecurityManager sm = System.getSecurityManager(); + for (String pkg : packages) { + String subpkg = pkg + "foo"; try { sm.checkPackageAccess(pkg); - throw new Exception("Expected PackageAccess SecurityException not thrown"); + throw new RuntimeException("Able to access " + pkg + + " package"); + } catch (SecurityException se) { } + try { + sm.checkPackageAccess(subpkg); + throw new RuntimeException("Able to access " + subpkg + + " package"); } catch (SecurityException se) { } try { sm.checkPackageDefinition(pkg); - throw new Exception("Expected PackageDefinition SecurityException not thrown"); + throw new RuntimeException("Able to define class in " + pkg + + " package"); + } catch (SecurityException se) { } + try { + sm.checkPackageDefinition(subpkg); + throw new RuntimeException("Able to define class in " + subpkg + + " package"); } catch (SecurityException se) { } } + System.out.println("Test passed"); + } + + private static List<String> getPackages(String p) { + List<String> packages = new ArrayList<>(); + if (p != null && !p.equals("")) { + StringTokenizer tok = new StringTokenizer(p, ","); + while (tok.hasMoreElements()) { + String s = tok.nextToken().trim(); + packages.add(s); + } + } + return packages; } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/LevelResourceBundle.java Tue Jul 16 11:26:34 2013 -0700 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.util.*; +import java.util.logging.*; + +/* + * @test + * @bug 8020228 + * @summary test logging.properties localized + * @run main LevelResourceBundle + */ + +public class LevelResourceBundle { + public static void main(String args[]) throws Exception { + final String name = "SEVERE"; + String en = getLocalizedMessage(Locale.getDefault(), name); + String fr = getLocalizedMessage(Locale.FRANCE, name); + if (!name.equals(en)) { + throw new RuntimeException("Expect " + name + " equals " + en); + } + if (name.equals(fr)) { + throw new RuntimeException("Expect " + name + " not equals " + fr); + } + } + + private static final String RBNAME = "sun.util.logging.resources.logging"; + private static String getLocalizedMessage(Locale locale, String key) { + ResourceBundle rb = ResourceBundle.getBundle(RBNAME, locale); + return rb.getString(key); + } +}
--- a/test/java/util/logging/LogManagerInstanceTest.java Wed Jul 10 13:49:00 2013 -0700 +++ b/test/java/util/logging/LogManagerInstanceTest.java Tue Jul 16 11:26:34 2013 -0700 @@ -63,7 +63,7 @@ if (!super.addLogger(root)) throw new RuntimeException("Fail to addLogger " + root); } else { - System.out.println("Root logger already exists"); + throw new RuntimeException("Root logger already exists"); } this.base = root; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/logging/TestAppletLoggerContext.java Tue Jul 16 11:26:34 2013 -0700 @@ -0,0 +1,610 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.LogManager; +import java.util.logging.Logger; +import java.util.logging.LoggingPermission; +import sun.misc.JavaAWTAccess; +import sun.misc.SharedSecrets; + +/* + * @test + * @bug 8017174 8010727 + * @summary NPE when using Logger.getAnonymousLogger or + * LogManager.getLogManager().getLogger + * + * @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingApplet + * @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingApplet + * @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingMain + * @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingMain + * @run main/othervm -Dtest.security=off TestAppletLoggerContext One + * @run main/othervm -Dtest.security=on TestAppletLoggerContext One + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Two + * @run main/othervm -Dtest.security=on TestAppletLoggerContext Two + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Three + * @run main/othervm -Dtest.security=on TestAppletLoggerContext Three + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Four + * @run main/othervm -Dtest.security=on TestAppletLoggerContext Four + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Five + * @run main/othervm -Dtest.security=on TestAppletLoggerContext Five + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Six + * @run main/othervm -Dtest.security=on TestAppletLoggerContext Six + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Seven + * @run main/othervm -Dtest.security=on TestAppletLoggerContext Seven + * @run main/othervm -Dtest.security=off TestAppletLoggerContext + * @run main/othervm -Dtest.security=on TestAppletLoggerContext + */ + +// NOTE: We run in other VM in order to 1. switch security manager and 2. cause +// LogManager class to be loaded anew. +public class TestAppletLoggerContext { + + // Avoids the hassle of dealing with files and system props... + static class SimplePolicy extends Policy { + private final Permissions perms; + public SimplePolicy(Permission... permissions) { + perms = new Permissions(); + for (Permission permission : permissions) { + perms.add(permission); + } + } + @Override + public PermissionCollection getPermissions(CodeSource cs) { + return perms; + } + @Override + public PermissionCollection getPermissions(ProtectionDomain pd) { + return perms; + } + @Override + public boolean implies(ProtectionDomain pd, Permission p) { + return perms.implies(p); + } + } + + // The bridge class initializes the logging system. + // It stubs the applet context in order to simulate context changes. + // + public static class Bridge { + + private static class JavaAWTAccessStub implements JavaAWTAccess { + boolean active = true; + + private static class TestExc { + private final Map<Object, Object> map = new HashMap<>(); + void put(Object key, Object v) { map.put(key, v); } + Object get(Object key) { return map.get(key); } + void remove(Object o) { map.remove(o); } + public static TestExc exc(Object o) { + return TestExc.class.cast(o); + } + } + + TestExc exc; + TestExc global = new TestExc(); + + @Override + public Object getContext() { return active ? global : null; } + @Override + public Object getExecutionContext() { return active ? exc : null; } + @Override + public Object get(Object o, Object o1) { return TestExc.exc(o).get(o1); } + @Override + public void put(Object o, Object o1, Object o2) { TestExc.exc(o).put(o1, o2); } + @Override + public void remove(Object o, Object o1) { TestExc.exc(o).remove(o1); } + @Override + public Object get(Object o) { return global.get(o); } + @Override + public void put(Object o, Object o1) { global.put(o, o1); } + @Override + public void remove(Object o) { global.remove(o); } + @Override + public boolean isDisposed() { return false; } + @Override + public boolean isMainAppContext() { return exc == null; } + } + + final static JavaAWTAccessStub javaAwtAccess = new JavaAWTAccessStub(); + public static void init() { + SharedSecrets.setJavaAWTAccess(javaAwtAccess); + if (System.getProperty("test.security", "on").equals("on")) { + Policy p = new SimplePolicy(new LoggingPermission("control", null), + new RuntimePermission("setContextClassLoader"), + new RuntimePermission("shutdownHooks")); + Policy.setPolicy(p); + System.setSecurityManager(new SecurityManager()); + } + } + + public static void changeContext() { + System.out.println("... Switching to a new applet context ..."); + javaAwtAccess.active = true; + javaAwtAccess.exc = new JavaAWTAccessStub.TestExc(); + } + + public static void desactivate() { + System.out.println("... Running with no applet context ..."); + javaAwtAccess.exc = null; + javaAwtAccess.active = false; + } + + public static class CustomAnonymousLogger extends Logger { + public CustomAnonymousLogger() { + this(""); + } + public CustomAnonymousLogger(String name) { + super(null, null); + System.out.println( " LogManager: " +LogManager.getLogManager()); + System.out.println( " getLogger: " +LogManager.getLogManager().getLogger(name)); + setParent(LogManager.getLogManager().getLogger(name)); + } + } + + public static class CustomLogger extends Logger { + CustomLogger(String name) { + super(name, null); + } + } + } + + public static enum TestCase { + LoadingApplet, LoadingMain, One, Two, Three, Four, Five, Six, Seven; + public void test() { + switch(this) { + // When run - each of these two tests must be + // run before any other tests and before each other. + case LoadingApplet: testLoadingApplet(); break; + case LoadingMain: testLoadingMain(); break; + case One: testOne(); break; + case Two: testTwo(); break; + case Three: testThree(); break; + case Four: testFour(); break; + case Five: testFive(); break; + case Six: testSix(); break; + case Seven: testSeven(); break; + } + } + public String describe() { + switch(this) { + case LoadingApplet: + return "Test that when the LogManager class is" + + " loaded in an applet thread first," + + "\n all LoggerContexts are correctly initialized"; + case LoadingMain: + return "Test that when the LogManager class is" + + " loaded in the main thread first," + + "\n all LoggerContexts are correctly initialized"; + case One: + return "Test that Logger.getAnonymousLogger()" + + " and new CustomAnonymousLogger() don't throw NPE"; + case Two: + return "Test that Logger.getLogger(\"\")" + + " does not return null nor throws NPE"; + case Three: + return "Test that LogManager.getLogManager().getLogger(\"\")" + + " does not return null nor throws NPE"; + case Four: + return "Test that Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)" + + " does not return null,\n and that" + + " new CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME)" + + " does not throw NPE"; + case Five: + return "Test that LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME)" + + "\n does not return null nor throws NPE"; + case Six: + return "Test that manager.getLogger(Logger.GLOBAL_LOGGER_NAME)" + + " returns null\n when manager is not the default" + + " LogManager instance.\n" + + "Test adding a new logger named \"global\" in that" + + " non default instance."; + case Seven: return "Test that manager.getLogger(\"\")" + + " returns null\n when manager is not the default" + + " LogManager instance.\n" + + "Test adding a new logger named \"\" in that" + + " non default instance."; + default: return "Undefined"; + } + } + }; + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + Bridge.init(); + EnumSet<TestCase> tests = EnumSet.noneOf(TestCase.class); + for (String arg : args) { + tests.add(TestCase.valueOf(arg)); + } + if (args.length == 0) { + tests = EnumSet.complementOf(EnumSet.of(TestCase.LoadingMain)); + } + final EnumSet<TestCase> loadingTests = + EnumSet.of(TestCase.LoadingApplet, TestCase.LoadingMain); + int testrun = 0; + for (TestCase test : tests) { + if (loadingTests.contains(test)) { + if (testrun > 0) { + throw new UnsupportedOperationException("Test case " + + test + " must be executed first!"); + } + } + System.out.println("Testing "+ test+": "); + System.out.println(test.describe()); + try { + test.test(); + } catch (Exception x) { + throw new Error(String.valueOf(test) + + (System.getSecurityManager() == null ? " without " : " with ") + + "security failed: "+x+"\n "+"FAILED: "+test.describe()+"\n", x); + } finally { + testrun++; + } + Bridge.changeContext(); + System.out.println("PASSED: "+ test); + } + } + + public static void testLoadingApplet() { + Bridge.changeContext(); + + Logger bar = new Bridge.CustomLogger("com.foo.Bar"); + LogManager.getLogManager().addLogger(bar); + assertNotNull(bar.getParent()); + testParent(bar); + testParent(LogManager.getLogManager().getLogger("global")); + testParent(LogManager.getLogManager().getLogger(bar.getName())); + + Bridge.desactivate(); + + Logger foo = new Bridge.CustomLogger("com.foo.Foo"); + boolean b = LogManager.getLogManager().addLogger(foo); + assertEquals(Boolean.TRUE, Boolean.valueOf(b)); + assertNotNull(foo.getParent()); + testParent(foo); + testParent(LogManager.getLogManager().getLogger("global")); + testParent(LogManager.getLogManager().getLogger(foo.getName())); + } + + public static void testLoadingMain() { + Bridge.desactivate(); + + Logger bar = new Bridge.CustomLogger("com.foo.Bar"); + LogManager.getLogManager().addLogger(bar); + assertNotNull(bar.getParent()); + testParent(bar); + testParent(LogManager.getLogManager().getLogger("global")); + testParent(LogManager.getLogManager().getLogger(bar.getName())); + + Bridge.changeContext(); + + Logger foo = new Bridge.CustomLogger("com.foo.Foo"); + boolean b = LogManager.getLogManager().addLogger(foo); + assertEquals(Boolean.TRUE, Boolean.valueOf(b)); + assertNotNull(foo.getParent()); + testParent(foo); + testParent(LogManager.getLogManager().getLogger("global")); + testParent(LogManager.getLogManager().getLogger(foo.getName())); + + } + + public static void testOne() { + for (int i=0; i<3 ; i++) { + Logger logger1 = Logger.getAnonymousLogger(); + Logger logger1b = Logger.getAnonymousLogger(); + Bridge.changeContext(); + Logger logger2 = Logger.getAnonymousLogger(); + Logger logger2b = Logger.getAnonymousLogger(); + Bridge.changeContext(); + Logger logger3 = new Bridge.CustomAnonymousLogger(); + Logger logger3b = new Bridge.CustomAnonymousLogger(); + Bridge.changeContext(); + Logger logger4 = new Bridge.CustomAnonymousLogger(); + Logger logger4b = new Bridge.CustomAnonymousLogger(); + } + } + + + public static void testTwo() { + for (int i=0; i<3 ; i++) { + Logger logger1 = Logger.getLogger(""); + Logger logger1b = Logger.getLogger(""); + assertNotNull(logger1); + assertNotNull(logger1b); + assertEquals(logger1, logger1b); + Bridge.changeContext(); + Logger logger2 = Logger.getLogger(""); + Logger logger2b = Logger.getLogger(""); + assertNotNull(logger2); + assertNotNull(logger2b); + assertEquals(logger2, logger2b); + assertEquals(logger1, logger2); + } + } + + public static void testThree() { + for (int i=0; i<3 ; i++) { + Logger logger1 = LogManager.getLogManager().getLogger(""); + Logger logger1b = LogManager.getLogManager().getLogger(""); + assertNotNull(logger1); + assertNotNull(logger1b); + assertEquals(logger1, logger1b); + Bridge.changeContext(); + Logger logger2 = LogManager.getLogManager().getLogger(""); + Logger logger2b = LogManager.getLogManager().getLogger(""); + assertNotNull(logger2); + assertNotNull(logger2b); + assertEquals(logger2, logger2b); + assertEquals(logger1, logger2); + } + } + + public static void testFour() { + for (int i=0; i<3 ; i++) { + Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNotNull(logger1); + assertNotNull(logger1b); + assertEquals(logger1, logger1b); + Bridge.changeContext(); + + Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNotNull(logger2); + assertNotNull(logger2b); + assertEquals(logger2, logger2b); + + assertEquals(logger1, logger2); + + Bridge.changeContext(); + Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME); + Bridge.changeContext(); + Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME); + } + } + + public static void testFive() { + for (int i=0; i<3 ; i++) { + Logger logger1 = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger1b = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNotNull(logger1); + assertNotNull(logger1b); + assertEquals(logger1, logger1b); + + Bridge.changeContext(); + + Logger logger2 = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger2b = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNotNull(logger2); + assertNotNull(logger2b); + assertEquals(logger2, logger2b); + + assertEquals(logger1, logger2); + } + } + + /** + * This test is designed to test the behavior of additional LogManager instances. + * It must be noted that if the security manager is off, then calling + * Bridge.changeContext() has actually no effect - which explains why we have + * some differences between the cases security manager on & security manager + * off. + **/ + public static void testSix() { + for (int i=0; i<3 ; i++) { + Bridge.desactivate(); + LogManager manager = new LogManager() {}; + Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNull(logger1); + assertNull(logger1b); + Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME); + manager.addLogger(global); + Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNotNull(logger2); + assertNotNull(logger2b); + assertEquals(logger2, global); + assertEquals(logger2b, global); + assertNull(manager.getLogger("")); + assertNull(manager.getLogger("")); + + Bridge.changeContext(); + + // this is not a supported configuration: + // We are in an applet context with several log managers. + // We however need to check our assumptions... + + // Applet context => root logger and global logger are not null. + // root == LogManager.getLogManager().rootLogger + // global == Logger.global + + Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNotNull(logger3); + assertNotNull(logger3b); + Logger expected = (System.getSecurityManager() != null + ? Logger.getGlobal() + : global); + assertEquals(logger3, expected); // in applet context, we will not see + // the LogManager's custom global logger added above... + assertEquals(logger3b, expected); // in applet context, we will not see + // the LogManager's custom global logger added above... + Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME); + manager.addLogger(global2); // adding a global logger will not work in applet context + // we will always get back the global logger. + // this could be considered as a bug... + Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNotNull(logger4); + assertNotNull(logger4b); + assertEquals(logger4, expected); // adding a global logger will not work in applet context + assertEquals(logger4b, expected); // adding a global logger will not work in applet context + + Logger logger5 = manager.getLogger(""); + Logger logger5b = manager.getLogger(""); + Logger expectedRoot = (System.getSecurityManager() != null + ? LogManager.getLogManager().getLogger("") + : null); + assertEquals(logger5, expectedRoot); + assertEquals(logger5b, expectedRoot); + + } + } + + /** + * This test is designed to test the behavior of additional LogManager instances. + * It must be noted that if the security manager is off, then calling + * Bridge.changeContext() has actually no effect - which explains why we have + * some differences between the cases security manager on & security manager + * off. + **/ + public static void testSeven() { + for (int i=0; i<3 ; i++) { + Bridge.desactivate(); + LogManager manager = new LogManager() {}; + Logger logger1 = manager.getLogger(""); + Logger logger1b = manager.getLogger(""); + assertNull(logger1); + assertNull(logger1b); + Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME); + manager.addLogger(global); + Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + assertNotNull(logger2); + assertNotNull(logger2b); + assertEquals(logger2, global); + assertEquals(logger2b, global); + Logger logger3 = manager.getLogger(""); + Logger logger3b = manager.getLogger(""); + assertNull(logger3); + assertNull(logger3b); + Logger root = new Bridge.CustomLogger(""); + manager.addLogger(root); + Logger logger4 = manager.getLogger(""); + Logger logger4b = manager.getLogger(""); + assertNotNull(logger4); + assertNotNull(logger4b); + assertEquals(logger4, root); + assertEquals(logger4b, root); + + Bridge.changeContext(); + + // this is not a supported configuration: + // We are in an applet context with several log managers. + // We haowever need to check our assumptions... + + // Applet context => root logger and global logger are not null. + // root == LogManager.getLogManager().rootLogger + // global == Logger.global + + Logger logger5 = manager.getLogger(""); + Logger logger5b = manager.getLogger(""); + Logger expectedRoot = (System.getSecurityManager() != null + ? LogManager.getLogManager().getLogger("") + : root); + + assertNotNull(logger5); + assertNotNull(logger5b); + assertEquals(logger5, expectedRoot); + assertEquals(logger5b, expectedRoot); + if (System.getSecurityManager() != null) { + assertNotEquals(logger5, root); + assertNotEquals(logger5b, root); + } + + Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME); + manager.addLogger(global2); // adding a global logger will not work in applet context + // we will always get back the global logger. + // this could be considered as a bug... + Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME); + Logger expectedGlobal = (System.getSecurityManager() != null + ? Logger.getGlobal() + : global); + assertNotNull(logger6); + assertNotNull(logger6b); + assertEquals(logger6, expectedGlobal); // adding a global logger will not work in applet context + assertEquals(logger6b, expectedGlobal); // adding a global logger will not work in applet context + + Logger root2 = new Bridge.CustomLogger(""); + manager.addLogger(root2); // adding a root logger will not work in applet context + // we will always get back the default manager's root logger. + // this could be considered as a bug... + Logger logger7 = manager.getLogger(""); + Logger logger7b = manager.getLogger(""); + assertNotNull(logger7); + assertNotNull(logger7b); + assertEquals(logger7, expectedRoot); // adding a global logger will not work in applet context + assertEquals(logger7b, expectedRoot); // adding a global logger will not work in applet context + assertNotEquals(logger7, root2); + assertNotEquals(logger7b, root2); + } + } + + public static void testParent(Logger logger) { + Logger l = logger; + while (l.getParent() != null) { + l = l.getParent(); + } + assertEquals("", l.getName()); + } + + public static class TestError extends RuntimeException { + public TestError(String msg) { + super(msg); + } + } + + public static void assertNotNull(Object obj) { + if (obj == null) throw new NullPointerException(); + } + + public static void assertNull(Object obj) { + if (obj != null) throw new TestError("Null expected, got "+obj); + } + + public static void assertEquals(Object o1, Object o2) { + if (o1 != o2) { + throw new TestError(o1 + " != " + o2); + } + } + + public static void assertNotEquals(Object o1, Object o2) { + if (o1 == o2) { + throw new TestError(o1 + " == " + o2); + } + } +}
--- a/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java Wed Jul 10 13:49:00 2013 -0700 +++ b/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java Tue Jul 16 11:26:34 2013 -0700 @@ -35,10 +35,11 @@ import javax.swing.*; public class ActionListenerCalledTwiceTest { - static String menuItems[] = { "Item1", "Item2" }; + static String menuItems[] = { "Item1", "Item2", "Item3" }; static KeyStroke keyStrokes[] = { KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK), - KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0) + KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), + KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK), }; static volatile int listenerCallCounter = 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/xml/jaxp/common/8020430/JAXP15RegTest.java Tue Jul 16 11:26:34 2013 -0700 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8020430 + * @summary test that setProperty for XMLOutputFactory works properly + * @run main/othervm JAXP15RegTest + */ +import java.security.Policy; +import javax.xml.stream.XMLOutputFactory; + +/** + * @author huizhe.wang@oracle.com + */ +public class JAXP15RegTest extends TestBase { + + public JAXP15RegTest(String name) { + super(name); + } + + private boolean hasSM; + private Policy _orig; + + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + JAXP15RegTest test = new JAXP15RegTest("JAXP 1.5 regression"); + test.setUp(); + test.testXMLOutputFactory(); + test.tearDown(); + } + + + public void testXMLOutputFactory() { + XMLOutputFactory factory = XMLOutputFactory.newInstance(); + factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true); + success("testXMLOutputFactory passed"); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/xml/jaxp/common/8020430/TestBase.java Tue Jul 16 11:26:34 2013 -0700 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.security.Policy; + +/** + * + * + * @author huizhe.wang@oracle.com + */ +public class TestBase { + String filePath; + boolean hasSM; + String curDir; + Policy origPolicy; + + String testName; + static String errMessage; + + int passed = 0, failed = 0; + + /** + * Creates a new instance of StreamReader + */ + public TestBase(String name) { + testName = name; + } + + //junit @Override + protected void setUp() { + if (System.getSecurityManager() != null) { + hasSM = true; + System.setSecurityManager(null); + } + + filePath = System.getProperty("test.src"); + if (filePath == null) { + //current directory + filePath = System.getProperty("user.dir"); + } + origPolicy = Policy.getPolicy(); + + } + + //junit @Override + public void tearDown() { + // turn off security manager and restore policy + System.setSecurityManager(null); + Policy.setPolicy(origPolicy); + if (hasSM) { + System.setSecurityManager(new SecurityManager()); + } + System.out.println("\nNumber of tests passed: " + passed); + System.out.println("Number of tests failed: " + failed + "\n"); + + if (errMessage != null ) { + throw new RuntimeException(errMessage); + } + } + + void fail(String errMsg) { + if (errMessage == null) { + errMessage = errMsg; + } else { + errMessage = errMessage + "\n" + errMsg; + } + failed++; + } + + void success(String msg) { + passed++; + System.out.println(msg); + } + +}