Mercurial > hg > icedtea7-forest-aarch64 > jdk
changeset 5848:b5449e3dcf1f jdk7u12-b06
Merge
author | lana |
---|---|
date | Wed, 12 Dec 2012 13:09:55 -0800 |
parents | 196eaca56e27 (current diff) c6d441f47bae (diff) |
children | cb81ee79a72d 0072a14db232 |
files | make/sun/rmi/rmi/mapfile-vers src/share/lib/security/java.security src/share/native/sun/rmi/server/MarshalInputStream.c test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java |
diffstat | 73 files changed, 2361 insertions(+), 1005 deletions(-) [+] |
line wrap: on
line diff
--- a/make/java/java/mapfile-vers Wed Dec 12 12:16:30 2012 -0800 +++ b/make/java/java/mapfile-vers Wed Dec 12 13:09:55 2012 -0800 @@ -90,7 +90,6 @@ Java_java_io_FileSystem_getFileSystem; Java_java_io_ObjectInputStream_bytesToDoubles; Java_java_io_ObjectInputStream_bytesToFloats; - Java_java_io_ObjectInputStream_latestUserDefinedLoader; Java_java_io_ObjectOutputStream_doublesToBytes; Java_java_io_ObjectOutputStream_floatsToBytes; Java_java_io_ObjectStreamClass_hasStaticInitializer; @@ -275,6 +274,7 @@ Java_sun_misc_Version_getJvmVersionInfo; Java_sun_misc_Version_getJvmSpecialVersion; Java_sun_misc_VM_getThreadStateValues; + Java_sun_misc_VM_latestUserDefinedLoader; Java_sun_misc_VM_initialize; Java_sun_misc_VMSupport_initAgentProperties;
--- a/make/java/net/Makefile Wed Dec 12 12:16:30 2012 -0800 +++ b/make/java/net/Makefile Wed Dec 12 13:09:55 2012 -0800 @@ -74,6 +74,7 @@ FILES_export += java/net/DualStackPlainSocketImpl.java FILES_export += java/net/TwoStacksPlainDatagramSocketImpl.java FILES_export += java/net/DualStackPlainDatagramSocketImpl.java + FILES_export += sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java else FILES_export += java/net/PlainDatagramSocketImpl.java endif
--- a/make/java/security/Makefile Wed Dec 12 12:16:30 2012 -0800 +++ b/make/java/security/Makefile Wed Dec 12 13:09:55 2012 -0800 @@ -37,7 +37,8 @@ # Directories # -PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security +# The default security properties file is for linux +PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-linux ifeq ($(PLATFORM), solaris) PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris
--- a/make/jprt.properties Wed Dec 12 12:16:30 2012 -0800 +++ b/make/jprt.properties Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -77,20 +77,17 @@ ${jprt.my.test.target.set:TESTNAME=jdk_util}, \ ${jprt.my.test.target.set:TESTNAME=jdk_io}, \ ${jprt.my.test.target.set:TESTNAME=jdk_net}, \ - ${jprt.my.test.target.set:TESTNAME=jdk_nio1}, \ - ${jprt.my.test.target.set:TESTNAME=jdk_nio2}, \ - ${jprt.my.test.target.set:TESTNAME=jdk_nio3}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_nio}, \ ${jprt.my.test.target.set:TESTNAME=jdk_security1}, \ ${jprt.my.test.target.set:TESTNAME=jdk_security2}, \ ${jprt.my.test.target.set:TESTNAME=jdk_security3}, \ ${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \ - ${jprt.my.test.target.set:TESTNAME=jdk_management1}, \ - ${jprt.my.test.target.set:TESTNAME=jdk_management2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_management}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_jmx}, \ ${jprt.my.test.target.set:TESTNAME=jdk_text}, \ - ${jprt.my.test.target.set:TESTNAME=jdk_tools1}, \ - ${jprt.my.test.target.set:TESTNAME=jdk_tools2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_tools}, \ ${jprt.my.test.target.set:TESTNAME=jdk_jfr}, \ - ${jprt.my.test.target.set:TESTNAME=jdk_misc} + ${jprt.my.test.target.set:TESTNAME=jdk_other} # All vm test targets (testset=all) jprt.vm.all.test.targets= \ @@ -105,6 +102,7 @@ ${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \ ${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \ ${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_jdi}, \ ${jprt.my.test.target.set:TESTNAME=jdk_sound}, \ ${jprt.my.test.target.set:TESTNAME=jdk_swing}
--- a/make/sun/rmi/rmi/Makefile Wed Dec 12 12:16:30 2012 -0800 +++ b/make/sun/rmi/rmi/Makefile Wed Dec 12 13:09:55 2012 -0800 @@ -30,16 +30,9 @@ BUILDDIR = ../../.. PACKAGE = sun.rmi PRODUCT = sun -LIBRARY = rmi include $(BUILDDIR)/common/Defs.gmk # -# Add use of a mapfile -# -FILES_m = mapfile-vers -include $(BUILDDIR)/common/Mapfile-vers.gmk - -# # Java files to compile. # AUTO_FILES_JAVA_DIRS = \ @@ -52,31 +45,9 @@ com/sun/rmi # -# Native files to compile. -# -FILES_c = \ - sun/rmi/server/MarshalInputStream.c - -# -# Add ambient vpath to pick up files not part of sun.rmi package -# -vpath %.c $(SHARE_SRC)/native/sun/rmi/server - -# -# Exported files that require generated .h -# -FILES_export = \ - sun/rmi/server/MarshalInputStream.java - -# -# Link to JVM for JVM_LatestUserDefinedLoader -# -OTHER_LDLIBS = $(JVMLIB) - -# # Rules # -include $(BUILDDIR)/common/Library.gmk +include $(BUILDDIR)/common/Rules.gmk # # Full package names of implementations requiring stubs
--- a/make/sun/rmi/rmi/mapfile-vers Wed Dec 12 12:16:30 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -# -# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - Java_sun_rmi_server_MarshalInputStream_latestUserDefinedLoader; - local: - *; -};
--- a/src/share/back/debugInit.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/back/debugInit.c Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,7 @@ #include "debugLoop.h" #include "bag.h" #include "invoker.h" +#include "sys.h" /* How the options get to OnLoad: */ #define XDEBUG "-Xdebug" @@ -201,6 +202,8 @@ jint jvmtiCompileTimeMajorVersion; jint jvmtiCompileTimeMinorVersion; jint jvmtiCompileTimeMicroVersion; + char *boot_path = NULL; + char npt_lib[MAXPATHLEN]; /* See if it's already loaded */ if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) { @@ -227,18 +230,6 @@ vmInitialized = JNI_FALSE; gdata->vmDead = JNI_FALSE; - /* Npt and Utf function init */ - NPT_INITIALIZE(&(gdata->npt), NPT_VERSION, NULL); - if (gdata->npt == NULL) { - ERROR_MESSAGE(("JDWP: unable to initialize NPT library")); - return JNI_ERR; - } - gdata->npt->utf = (gdata->npt->utfInitialize)(NULL); - if (gdata->npt->utf == NULL) { - ERROR_MESSAGE(("JDWP: UTF function initialization failed")); - return JNI_ERR; - } - /* Get the JVMTI Env, IMPORTANT: Do this first! For jvmtiAllocate(). */ error = JVM_FUNC_PTR(vm,GetEnv) (vm, (void **)&(gdata->jvmti), JVMTI_VERSION_1); @@ -277,6 +268,24 @@ forceExit(1); /* Kill entire process, no core dump wanted */ } + JVMTI_FUNC_PTR(gdata->jvmti, GetSystemProperty) + (gdata->jvmti, (const char *)"sun.boot.library.path", + &boot_path); + + dbgsysBuildLibName(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME); + /* Npt and Utf function init */ + NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL); + jvmtiDeallocate(boot_path); + if (gdata->npt == NULL) { + ERROR_MESSAGE(("JDWP: unable to initialize NPT library")); + return JNI_ERR; + } + gdata->npt->utf = (gdata->npt->utfInitialize)(NULL); + if (gdata->npt->utf == NULL) { + ERROR_MESSAGE(("JDWP: UTF function initialization failed")); + return JNI_ERR; + } + /* Parse input options */ if (!parseOptions(options)) { /* No message necessary, should have been printed out already */
--- a/src/share/back/error_messages.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/back/error_messages.c Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -70,8 +70,13 @@ len = (int)strlen((char*)utf8buf); /* Convert to platform encoding (ignore errors, dangerous area) */ - (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf, - utf8buf, len, pbuf, MAX_MESSAGE_LEN); + if (gdata->npt != NULL) { + (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf, + utf8buf, len, pbuf, MAX_MESSAGE_LEN); + } else { + /* May be called before NPT is initialized so don't fault */ + strncpy(pbuf, (char*)utf8buf, len); + } (void)fprintf(fp, "%s%s%s", prefix, pbuf, suffix); }
--- a/src/share/back/transport.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/back/transport.c Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -144,7 +144,9 @@ /* First, look in sun.boot.library.path. This should find the standard * dt_socket and dt_shmem transport libraries, or any library * that was delivered with the J2SE. - * Note: Java property sun.boot.library.path contains a single directory. + * Note: Since 6819213 fixed, Java property sun.boot.library.path can + * contain multiple paths. Dll_dir is the first entry and + * -Dsun.boot.library.path entries are appended. */ libdir = gdata->property_sun_boot_library_path; if (libdir == NULL) {
--- a/src/share/classes/java/io/ObjectInputStream.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/java/io/ObjectInputStream.java Wed Dec 12 13:09:55 2012 -0800 @@ -2025,8 +2025,9 @@ * This method should not be removed or its signature changed without * corresponding modifications to the above class. */ - // REMIND: change name to something more accurate? - private static native ClassLoader latestUserDefinedLoader(); + private static ClassLoader latestUserDefinedLoader() { + return sun.misc.VM.latestUserDefinedLoader(); + } /** * Default GetField implementation.
--- a/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java Wed Dec 12 13:09:55 2012 -0800 @@ -90,27 +90,26 @@ // -- Utility methods for the key set -- private void addKey(SelectionKey k) { - synchronized (keyLock) { - int i = 0; - if ((keys != null) && (keyCount < keys.length)) { - // Find empty element of key array - for (i = 0; i < keys.length; i++) - if (keys[i] == null) - break; - } else if (keys == null) { - keys = new SelectionKey[3]; - } else { - // Grow key array - int n = keys.length * 2; - SelectionKey[] ks = new SelectionKey[n]; - for (i = 0; i < keys.length; i++) - ks[i] = keys[i]; - keys = ks; - i = keyCount; - } - keys[i] = k; - keyCount++; + assert Thread.holdsLock(keyLock); + int i = 0; + if ((keys != null) && (keyCount < keys.length)) { + // Find empty element of key array + for (i = 0; i < keys.length; i++) + if (keys[i] == null) + break; + } else if (keys == null) { + keys = new SelectionKey[3]; + } else { + // Grow key array + int n = keys.length * 2; + SelectionKey[] ks = new SelectionKey[n]; + for (i = 0; i < keys.length; i++) + ks[i] = keys[i]; + keys = ks; + i = keyCount; } + keys[i] = k; + keyCount++; } private SelectionKey findKey(Selector sel) { @@ -190,11 +189,11 @@ Object att) throws ClosedChannelException { - if (!isOpen()) - throw new ClosedChannelException(); - if ((ops & ~validOps()) != 0) - throw new IllegalArgumentException(); synchronized (regLock) { + if (!isOpen()) + throw new ClosedChannelException(); + if ((ops & ~validOps()) != 0) + throw new IllegalArgumentException(); if (blocking) throw new IllegalBlockingModeException(); SelectionKey k = findKey(sel); @@ -204,8 +203,12 @@ } if (k == null) { // New registration - k = ((AbstractSelector)sel).register(this, ops, att); - addKey(k); + synchronized (keyLock) { + if (!isOpen()) + throw new ClosedChannelException(); + k = ((AbstractSelector)sel).register(this, ops, att); + addKey(k); + } } return k; } @@ -275,9 +278,9 @@ public final SelectableChannel configureBlocking(boolean block) throws IOException { - if (!isOpen()) - throw new ClosedChannelException(); synchronized (regLock) { + if (!isOpen()) + throw new ClosedChannelException(); if (blocking == block) return this; if (block && haveValidKeys())
--- a/src/share/classes/java/text/DateFormatSymbols.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/java/text/DateFormatSymbols.java Wed Dec 12 13:09:55 2012 -0800 @@ -647,6 +647,8 @@ private static final ConcurrentMap<Locale, SoftReference<DateFormatSymbols>> cachedInstances = new ConcurrentHashMap<Locale, SoftReference<DateFormatSymbols>>(3); + private transient int lastZoneIndex = 0; + private void initializeData(Locale desiredLocale) { locale = desiredLocale; @@ -692,12 +694,24 @@ * the given time zone ID can't be located in the DateFormatSymbols object. * @see java.util.SimpleTimeZone */ - final int getZoneIndex(String ID) - { + final int getZoneIndex(String ID) { String[][] zoneStrings = getZoneStringsWrapper(); - for (int index=0; index<zoneStrings.length; index++) - { - if (ID.equals(zoneStrings[index][0])) return index; + + /* + * getZoneIndex has been re-written for performance reasons. instead of + * traversing the zoneStrings array every time, we cache the last used zone + * index + */ + if (lastZoneIndex < zoneStrings.length && ID.equals(zoneStrings[lastZoneIndex][0])) { + return lastZoneIndex; + } + + /* slow path, search entire list */ + for (int index = 0; index < zoneStrings.length; index++) { + if (ID.equals(zoneStrings[index][0])) { + lastZoneIndex = index; + return index; + } } return -1;
--- a/src/share/classes/javax/swing/colorchooser/DefaultSwatchChooserPanel.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/javax/swing/colorchooser/DefaultSwatchChooserPanel.java Wed Dec 12 13:09:55 2012 -0800 @@ -57,6 +57,8 @@ RecentSwatchPanel recentSwatchPanel; MouseListener mainSwatchListener; MouseListener recentSwatchListener; + private KeyListener mainSwatchKeyListener; + private KeyListener recentSwatchKeyListener; public DefaultSwatchChooserPanel() { super(); @@ -151,10 +153,14 @@ recentSwatchPanel.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, recentStr); + mainSwatchKeyListener = new MainSwatchKeyListener(); mainSwatchListener = new MainSwatchListener(); swatchPanel.addMouseListener(mainSwatchListener); + swatchPanel.addKeyListener(mainSwatchKeyListener); recentSwatchListener = new RecentSwatchListener(); + recentSwatchKeyListener = new RecentSwatchKeyListener(); recentSwatchPanel.addMouseListener(recentSwatchListener); + recentSwatchPanel.addKeyListener(recentSwatchKeyListener); JPanel mainHolder = new JPanel(new BorderLayout()); Border border = new CompoundBorder( new LineBorder(Color.black), @@ -196,11 +202,17 @@ public void uninstallChooserPanel(JColorChooser enclosingChooser) { super.uninstallChooserPanel(enclosingChooser); swatchPanel.removeMouseListener(mainSwatchListener); + swatchPanel.removeKeyListener(mainSwatchKeyListener); recentSwatchPanel.removeMouseListener(recentSwatchListener); + recentSwatchPanel.removeKeyListener(recentSwatchKeyListener); + swatchPanel = null; recentSwatchPanel = null; mainSwatchListener = null; + mainSwatchKeyListener = null; recentSwatchListener = null; + recentSwatchKeyListener = null; + removeAll(); // strip out all the sub-components } @@ -209,11 +221,32 @@ } + private class RecentSwatchKeyListener extends KeyAdapter { + public void keyPressed(KeyEvent e) { + if (KeyEvent.VK_SPACE == e.getKeyCode()) { + Color color = recentSwatchPanel.getSelectedColor(); + setSelectedColor(color); + } + } + } + + private class MainSwatchKeyListener extends KeyAdapter { + public void keyPressed(KeyEvent e) { + if (KeyEvent.VK_SPACE == e.getKeyCode()) { + Color color = swatchPanel.getSelectedColor(); + setSelectedColor(color); + recentSwatchPanel.setMostRecentColor(color); + } + } + } + class RecentSwatchListener extends MouseAdapter implements Serializable { public void mousePressed(MouseEvent e) { if (isEnabled()) { Color color = recentSwatchPanel.getColorForLocation(e.getX(), e.getY()); + recentSwatchPanel.setSelectedColorFromLocation(e.getX(), e.getY()); setSelectedColor(color); + recentSwatchPanel.requestFocusInWindow(); } } } @@ -223,7 +256,9 @@ if (isEnabled()) { Color color = swatchPanel.getColorForLocation(e.getX(), e.getY()); setSelectedColor(color); + swatchPanel.setSelectedColorFromLocation(e.getX(), e.getY()); recentSwatchPanel.setMostRecentColor(color); + swatchPanel.requestFocusInWindow(); } } } @@ -239,18 +274,81 @@ protected Dimension numSwatches; protected Dimension gap; + private int selRow; + private int selCol; + public SwatchPanel() { initValues(); initColors(); setToolTipText(""); // register for events setOpaque(true); setBackground(Color.white); - setRequestFocusEnabled(false); + setFocusable(true); setInheritsPopupMenu(true); + + addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + repaint(); + } + + public void focusLost(FocusEvent e) { + repaint(); + } + }); + + addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + int typed = e.getKeyCode(); + switch (typed) { + case KeyEvent.VK_UP: + if (selRow > 0) { + selRow--; + repaint(); + } + break; + case KeyEvent.VK_DOWN: + if (selRow < numSwatches.height - 1) { + selRow++; + repaint(); + } + break; + case KeyEvent.VK_LEFT: + if (selCol > 0 && SwatchPanel.this.getComponentOrientation().isLeftToRight()) { + selCol--; + repaint(); + } else if (selCol < numSwatches.width - 1 + && !SwatchPanel.this.getComponentOrientation().isLeftToRight()) { + selCol++; + repaint(); + } + break; + case KeyEvent.VK_RIGHT: + if (selCol < numSwatches.width - 1 + && SwatchPanel.this.getComponentOrientation().isLeftToRight()) { + selCol++; + repaint(); + } else if (selCol > 0 && !SwatchPanel.this.getComponentOrientation().isLeftToRight()) { + selCol--; + repaint(); + } + break; + case KeyEvent.VK_HOME: + selCol = 0; + selRow = 0; + repaint(); + break; + case KeyEvent.VK_END: + selCol = numSwatches.width - 1; + selRow = numSwatches.height - 1; + repaint(); + break; + } + } + }); } - public boolean isFocusTraversable() { - return false; + public Color getSelectedColor() { + return getColorForCell(selCol, selRow); } protected void initValues() { @@ -263,11 +361,10 @@ for (int row = 0; row < numSwatches.height; row++) { int y = row * (swatchSize.height + gap.height); for (int column = 0; column < numSwatches.width; column++) { - - g.setColor( getColorForCell(column, row) ); + Color c = getColorForCell(column, row); + g.setColor(c); int x; - if ((!this.getComponentOrientation().isLeftToRight()) && - (this instanceof RecentSwatchPanel)) { + if (!this.getComponentOrientation().isLeftToRight()) { x = (numSwatches.width - column - 1) * (swatchSize.width + gap.width); } else { x = column * (swatchSize.width + gap.width); @@ -276,6 +373,20 @@ g.setColor(Color.black); g.drawLine( x+swatchSize.width-1, y, x+swatchSize.width-1, y+swatchSize.height-1); g.drawLine( x, y+swatchSize.height-1, x+swatchSize.width-1, y+swatchSize.height-1); + + if (selRow == row && selCol == column && this.isFocusOwner()) { + Color c2 = new Color(c.getRed() < 125 ? 255 : 0, + c.getGreen() < 125 ? 255 : 0, + c.getBlue() < 125 ? 255 : 0); + g.setColor(c2); + + g.drawLine(x, y, x + swatchSize.width - 1, y); + g.drawLine(x, y, x, y + swatchSize.height - 1); + g.drawLine(x + swatchSize.width - 1, y, x + swatchSize.width - 1, y + swatchSize.height - 1); + g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1, y + swatchSize.height - 1); + g.drawLine(x, y, x + swatchSize.width - 1, y + swatchSize.height - 1); + g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1, y); + } } } } @@ -296,10 +407,19 @@ return color.getRed()+", "+ color.getGreen() + ", " + color.getBlue(); } + public void setSelectedColorFromLocation(int x, int y) { + if (!this.getComponentOrientation().isLeftToRight()) { + selCol = numSwatches.width - x / (swatchSize.width + gap.width) - 1; + } else { + selCol = x / (swatchSize.width + gap.width); + } + selRow = y / (swatchSize.height + gap.height); + repaint(); + } + public Color getColorForLocation( int x, int y ) { int column; - if ((!this.getComponentOrientation().isLeftToRight()) && - (this instanceof RecentSwatchPanel)) { + if (!this.getComponentOrientation().isLeftToRight()) { column = numSwatches.width - x / (swatchSize.width + gap.width) - 1; } else { column = x / (swatchSize.width + gap.width);
--- a/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Wed Dec 12 13:09:55 2012 -0800 @@ -1941,6 +1941,9 @@ for(int counter = beginRow + 1; counter <= endRow; counter++) { testRect = getPathBounds(tree, getPathForRow(tree, counter)); + if (testRect == null) { + return; + } if((testRect.y + testRect.height) > maxY) counter = endRow; } @@ -2069,7 +2072,7 @@ treeState.invalidatePathBounds(oldPath); updateSize(); } - else { + else if (editingBounds != null) { editingBounds.x = 0; editingBounds.width = tree.getSize().width; tree.repaint(editingBounds); @@ -2114,6 +2117,9 @@ tree.isPathSelected(path), tree.isExpanded(path), treeModel.isLeaf(path.getLastPathComponent()), row); Rectangle nodeBounds = getPathBounds(tree, path); + if (nodeBounds == null) { + return false; + } editingRow = row; @@ -2134,6 +2140,9 @@ // To make sure x/y are updated correctly, fetch // the bounds again. nodeBounds = getPathBounds(tree, path); + if (nodeBounds == null) { + return false; + } } else editorHasDifferentSize = false; @@ -3570,7 +3579,7 @@ if(pressedPath != null) { Rectangle bounds = getPathBounds(tree, pressedPath); - if(e.getY() >= (bounds.y + bounds.height)) { + if (bounds == null || e.getY() >= (bounds.y + bounds.height)) { return; } @@ -3832,6 +3841,10 @@ // And repaint Rectangle newMinBounds = getPathBounds(tree, minPath); + if (minBounds == null || newMinBounds == null) { + return; + } + if (indices.length == 1 && newMinBounds.height == minBounds.height) { tree.repaint(0, minBounds.y, tree.getWidth(), @@ -4466,27 +4479,28 @@ } } Rectangle newRect = ui.getPathBounds(tree, newPath); - - newRect.x = visRect.x; - newRect.width = visRect.width; - if(direction == -1) { - newRect.height = visRect.height; - } - else { - newRect.y -= (visRect.height - newRect.height); - newRect.height = visRect.height; + if (newRect != null) { + newRect.x = visRect.x; + newRect.width = visRect.width; + if(direction == -1) { + newRect.height = visRect.height; + } + else { + newRect.y -= (visRect.height - newRect.height); + newRect.height = visRect.height; + } + + if(addToSelection) { + ui.extendSelection(newPath); + } + else if(changeSelection) { + tree.setSelectionPath(newPath); + } + else { + ui.setLeadSelectionPath(newPath, true); + } + tree.scrollRectToVisible(newRect); } - - if(addToSelection) { - ui.extendSelection(newPath); - } - else if(changeSelection) { - tree.setSelectionPath(newPath); - } - else { - ui.setLeadSelectionPath(newPath, true); - } - tree.scrollRectToVisible(newRect); } }
--- a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java Wed Dec 12 13:09:55 2012 -0800 @@ -25,6 +25,7 @@ package sun.java2d.opengl; +import java.awt.AlphaComposite; import java.awt.Composite; import java.awt.Transparency; import java.awt.geom.AffineTransform; @@ -96,6 +97,8 @@ CompositeType.AnyAlpha, blitIntArgbPreToSurface), + new OGLAnyCompositeBlit(OGLSurfaceData.OpenGLSurface), + new OGLSwToSurfaceScale(SurfaceType.IntRgb, OGLSurfaceData.PF_INT_RGB), new OGLSwToSurfaceScale(SurfaceType.IntRgbx, @@ -172,6 +175,9 @@ new OGLGeneralBlit(OGLSurfaceData.OpenGLTexture, CompositeType.SrcNoEa, blitIntArgbPreToTexture), + + new OGLAnyCompositeBlit(OGLSurfaceData.OpenGLTexture), + }; GraphicsPrimitiveMgr.register(primitives); } @@ -760,3 +766,49 @@ } } } + +class OGLAnyCompositeBlit extends Blit { + private WeakReference<SurfaceData> dstTmp; + + public OGLAnyCompositeBlit(SurfaceType dstType) { + super(SurfaceType.Any, CompositeType.Any, dstType); + } + public synchronized void Blit(SurfaceData src, SurfaceData dst, + Composite comp, Region clip, + int sx, int sy, int dx, int dy, + int w, int h) + { + Blit convertdst = Blit.getFromCache(dst.getSurfaceType(), + CompositeType.SrcNoEa, + SurfaceType.IntArgbPre); + + SurfaceData cachedDst = null; + + if (dstTmp != null) { + // use cached intermediate surface, if available + cachedDst = dstTmp.get(); + } + + // convert source to IntArgbPre + SurfaceData dstBuffer = convertFrom(convertdst, dst, dx, dy, w, h, + cachedDst, BufferedImage.TYPE_INT_ARGB_PRE); + + Blit performop = Blit.getFromCache(src.getSurfaceType(), + CompositeType.Any, dstBuffer.getSurfaceType()); + + performop.Blit(src, dstBuffer, comp, clip, + sx, sy, 0, 0, w, h); + + if (dstBuffer != cachedDst) { + // cache the intermediate surface + dstTmp = new WeakReference(dstBuffer); + } + + // now blit the buffer back to the destination + convertdst = Blit.getFromCache(dstBuffer.getSurfaceType(), + CompositeType.SrcNoEa, + dst.getSurfaceType()); + convertdst.Blit(dstBuffer, dst, AlphaComposite.Src, + clip, 0, 0, dx, dy, w, h); + } +}
--- a/src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/java2d/opengl/OGLSurfaceDataProxy.java Wed Dec 12 13:09:55 2012 -0800 @@ -76,6 +76,7 @@ CompositeType comp, Color bgColor) { - return (bgColor == null || transparency == Transparency.OPAQUE); + return comp.isDerivedFrom(CompositeType.AnyAlpha) && + (bgColor == null || transparency == Transparency.OPAQUE); } }
--- a/src/share/classes/sun/management/Agent.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/management/Agent.java Wed Dec 12 13:09:55 2012 -0800 @@ -168,7 +168,10 @@ // management properties can be overridden by system properties // which take precedence - configProps.putAll(System.getProperties()); + Properties sysProps = System.getProperties(); + synchronized(sysProps){ + configProps.putAll(sysProps); + } // if user specifies config file into command line for either // jcmd utilities or attach command it overrides properties set in @@ -264,7 +267,10 @@ // management properties can be overridden by system properties // which take precedence - props.putAll(System.getProperties()); + Properties sysProps = System.getProperties(); + synchronized(sysProps){ + props.putAll(sysProps); + } return props; }
--- a/src/share/classes/sun/misc/VM.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/misc/VM.java Wed Dec 12 13:09:55 2012 -0800 @@ -371,6 +371,12 @@ private final static int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010; private final static int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020; + /* + * Returns the first non-null class loader up the execution stack, + * or null if only code from the null class loader is on the stack. + */ + public static native ClassLoader latestUserDefinedLoader(); + static { initialize(); }
--- a/src/share/classes/sun/net/www/MessageHeader.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/net/www/MessageHeader.java Wed Dec 12 13:09:55 2012 -0800 @@ -138,6 +138,43 @@ return null; } + /** + * Removes bare Negotiate and Kerberos headers when an "NTLM ..." + * appears. All Performed on headers with key being k. + * @return true if there is a change + */ + public boolean filterNTLMResponses(String k) { + boolean found = false; + for (int i=0; i<nkeys; i++) { + if (k.equalsIgnoreCase(keys[i]) + && values[i] != null && values[i].length() > 5 + && values[i].regionMatches(true, 0, "NTLM ", 0, 5)) { + found = true; + break; + } + } + if (found) { + int j = 0; + for (int i=0; i<nkeys; i++) { + if (k.equalsIgnoreCase(keys[i]) && ( + "Negotiate".equalsIgnoreCase(values[i]) || + "Kerberos".equalsIgnoreCase(values[i]))) { + continue; + } + if (i != j) { + keys[j] = keys[i]; + values[j] = values[i]; + } + j++; + } + if (j != nkeys) { + nkeys = j; + return true; + } + } + return false; + } + class HeaderIterator implements Iterator<String> { int index = 0; int next = -1;
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Wed Dec 12 13:09:55 2012 -0800 @@ -1324,6 +1324,16 @@ if (logger.isLoggable(PlatformLogger.FINE)) { logger.fine(responses.toString()); } + + boolean b1 = responses.filterNTLMResponses("WWW-Authenticate"); + boolean b2 = responses.filterNTLMResponses("Proxy-Authenticate"); + if (b1 || b2) { + if (logger.isLoggable(PlatformLogger.FINE)) { + logger.fine(">>>> Headers are filtered"); + logger.fine(responses.toString()); + } + } + inputStream = http.getInputStream(); respCode = getResponseCode(); @@ -1783,6 +1793,13 @@ logger.fine(responses.toString()); } + if (responses.filterNTLMResponses("Proxy-Authenticate")) { + if (logger.isLoggable(PlatformLogger.FINE)) { + logger.fine(">>>> Headers are filtered"); + logger.fine(responses.toString()); + } + } + statusLine = responses.getValue(0); StringTokenizer st = new StringTokenizer(statusLine); st.nextToken();
--- a/src/share/classes/sun/rmi/server/MarshalInputStream.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/rmi/server/MarshalInputStream.java Wed Dec 12 13:09:55 2012 -0800 @@ -110,14 +110,6 @@ } /** - * Load the "rmi" native library. - */ - static { - java.security.AccessController.doPrivileged( - new sun.security.action.LoadLibraryAction("rmi")); - } - - /** * Create a new MarshalInputStream object. */ public MarshalInputStream(InputStream in) @@ -262,7 +254,9 @@ * Returns the first non-null class loader up the execution stack, or null * if only code from the null class loader is on the stack. */ - private static native ClassLoader latestUserDefinedLoader(); + private static ClassLoader latestUserDefinedLoader() { + return sun.misc.VM.latestUserDefinedLoader(); + } /** * Fix for 4179055: Need to assist resolving sun stubs; resolve
--- a/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUI.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUI.java Wed Dec 12 13:09:55 2012 -0800 @@ -256,6 +256,7 @@ if (getFileChooser().getControlButtonsAreShown()) { approveButton.setText(getApproveButtonText(getFileChooser())); approveButton.setToolTipText(getApproveButtonToolTipText(getFileChooser())); + approveButton.setMnemonic(getApproveButtonMnemonic(getFileChooser())); } }
--- a/src/share/classes/sun/text/resources/FormatData_sl.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/text/resources/FormatData_sl.java Wed Dec 12 13:09:55 2012 -0800 @@ -131,8 +131,8 @@ "H:mm:ss z", // long time pattern "H:mm:ss", // medium time pattern "H:mm", // short time pattern - "EEEE, d MMMM yyyy", // full date pattern - "EEEE, d MMMM yyyy", // long date pattern + "EEEE, dd. MMMM y", // full date pattern + "dd. MMMM y", // long date pattern "d.M.yyyy", // medium date pattern "d.M.y", // short date pattern "{1} {0}" // date-time pattern
--- a/src/share/classes/sun/tools/java/ClassPath.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/classes/sun/tools/java/ClassPath.java Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -141,7 +141,7 @@ } else { StringBuilder sb = new StringBuilder(patharray[0]); for (int i = 1; i < patharray.length; i++) { - sb.append(File.separator); + sb.append(File.pathSeparatorChar); sb.append(patharray[i]); } this.pathstr = sb.toString();
--- a/src/share/demo/jvmti/hprof/hprof.h Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/demo/jvmti/hprof/hprof.h Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -65,6 +65,7 @@ #include "jni.h" #include "jvmti.h" #include "classfile_constants.h" +#include "jvm_md.h" #ifndef SKIP_NPT #include "npt.h" /* To get NptEnv for doing character conversions */
--- a/src/share/demo/jvmti/hprof/hprof_init.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/demo/jvmti/hprof/hprof_init.c Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1899,6 +1899,7 @@ */ getSystemProperty("sun.boot.library.path", &boot_path); md_build_library_name(lname, FILENAME_MAX, boot_path, name); + jvmtiDeallocate(boot_path); handle = md_load_library(lname, err_buf, (int)sizeof(err_buf)); if ( handle == NULL ) { /* This may be necessary on Windows. */ @@ -1941,6 +1942,9 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { + char *boot_path = NULL; + char npt_lib[JVM_MAXPATHLEN]; + /* See if it's already loaded */ if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) { HPROF_ERROR(JNI_TRUE, "Cannot load this JVM TI agent twice, check your java command line for duplicate hprof options."); @@ -1957,9 +1961,15 @@ gdata->jvm = vm; + /* Get the JVMTI environment */ + getJvmti(); + #ifndef SKIP_NPT + getSystemProperty("sun.boot.library.path", &boot_path); /* Load in NPT library for character conversions */ - NPT_INITIALIZE(&(gdata->npt), NPT_VERSION, NULL); + md_build_library_name(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME); + jvmtiDeallocate(boot_path); + NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL); if ( gdata->npt == NULL ) { HPROF_ERROR(JNI_TRUE, "Cannot load npt library"); } @@ -1969,9 +1979,6 @@ } #endif - /* Get the JVMTI environment */ - getJvmti(); - /* Lock needed to protect debug_malloc() code, which is not MT safe */ #ifdef DEBUG gdata->debug_malloc_lock = createRawMonitor("HPROF debug_malloc lock");
--- a/src/share/lib/security/java.security Wed Dec 12 12:16:30 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,376 +0,0 @@ -# -# This is the "master security properties file". -# -# In this file, various security properties are set for use by -# java.security classes. This is where users can statically register -# Cryptography Package Providers ("providers" for short). The term -# "provider" refers to a package or set of packages that supply a -# concrete implementation of a subset of the cryptography aspects of -# the Java Security API. A provider may, for example, implement one or -# more digital signature algorithms or message digest algorithms. -# -# Each provider must implement a subclass of the Provider class. -# To register a provider in this master security properties file, -# specify the Provider subclass name and priority in the format -# -# security.provider.<n>=<className> -# -# This declares a provider, and specifies its preference -# order n. The preference order is the order in which providers are -# searched for requested algorithms (when no specific provider is -# requested). The order is 1-based; 1 is the most preferred, followed -# by 2, and so on. -# -# <className> must specify the subclass of the Provider class whose -# constructor sets the values of various properties that are required -# for the Java Security API to look up the algorithms or other -# facilities implemented by the provider. -# -# There must be at least one provider specification in java.security. -# There is a default provider that comes standard with the JDK. It -# is called the "SUN" provider, and its Provider subclass -# named Sun appears in the sun.security.provider package. Thus, the -# "SUN" provider is registered via the following: -# -# security.provider.1=sun.security.provider.Sun -# -# (The number 1 is used for the default provider.) -# -# Note: Providers can be dynamically registered instead by calls to -# either the addProvider or insertProviderAt method in the Security -# class. - -# -# List of providers and their preference orders (see above): -# -security.provider.1=sun.security.provider.Sun -security.provider.2=sun.security.rsa.SunRsaSign -security.provider.3=sun.security.ec.SunEC -security.provider.4=com.sun.net.ssl.internal.ssl.Provider -security.provider.5=com.sun.crypto.provider.SunJCE -security.provider.6=sun.security.jgss.SunProvider -security.provider.7=com.sun.security.sasl.Provider -security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI -security.provider.9=sun.security.smartcardio.SunPCSC - -# -# Select the source of seed data for SecureRandom. By default an -# attempt is made to use the entropy gathering device specified by -# the securerandom.source property. If an exception occurs when -# accessing the URL then the traditional system/thread activity -# algorithm is used. -# -# On Solaris and Linux systems, if file:/dev/urandom is specified and it -# exists, a special SecureRandom implementation is activated by default. -# This "NativePRNG" reads random bytes directly from /dev/urandom. -# -# On Windows systems, the URLs file:/dev/random and file:/dev/urandom -# enables use of the Microsoft CryptoAPI seed functionality. -# -securerandom.source=file:/dev/urandom -# -# The entropy gathering device is described as a URL and can also -# be specified with the system property "java.security.egd". For example, -# -Djava.security.egd=file:/dev/urandom -# Specifying this system property will override the securerandom.source -# setting. - -# -# Class to instantiate as the javax.security.auth.login.Configuration -# provider. -# -login.configuration.provider=com.sun.security.auth.login.ConfigFile - -# -# Default login configuration file -# -#login.config.url.1=file:${user.home}/.java.login.config - -# -# Class to instantiate as the system Policy. This is the name of the class -# that will be used as the Policy object. -# -policy.provider=sun.security.provider.PolicyFile - -# The default is to have a single system-wide policy file, -# and a policy file in the user's home directory. -policy.url.1=file:${java.home}/lib/security/java.policy -policy.url.2=file:${user.home}/.java.policy - -# whether or not we expand properties in the policy file -# if this is set to false, properties (${...}) will not be expanded in policy -# files. -policy.expandProperties=true - -# whether or not we allow an extra policy to be passed on the command line -# with -Djava.security.policy=somefile. Comment out this line to disable -# this feature. -policy.allowSystemProperty=true - -# whether or not we look into the IdentityScope for trusted Identities -# when encountering a 1.1 signed JAR file. If the identity is found -# and is trusted, we grant it AllPermission. -policy.ignoreIdentityScope=false - -# -# Default keystore type. -# -keystore.type=jks - -# -# List of comma-separated packages that start with or equal this string -# will cause a security exception to be thrown when -# passed to checkPackageAccess unless the -# corresponding RuntimePermission ("accessClassInPackage."+package) has -# been granted. -package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal. - -# -# List of comma-separated packages that start with or equal this string -# will cause a security exception to be thrown when -# passed to checkPackageDefinition unless the -# corresponding RuntimePermission ("defineClassInPackage."+package) has -# been granted. -# -# by default, none of the class loaders supplied with the JDK call -# checkPackageDefinition. -# -package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal. - -# -# Determines whether this properties file can be appended to -# or overridden on the command line via -Djava.security.properties -# -security.overridePropertiesFile=true - -# -# Determines the default key and trust manager factory algorithms for -# the javax.net.ssl package. -# -ssl.KeyManagerFactory.algorithm=SunX509 -ssl.TrustManagerFactory.algorithm=PKIX - -# -# The Java-level namelookup cache policy for successful lookups: -# -# any negative value: caching forever -# any positive value: the number of seconds to cache an address for -# zero: do not cache -# -# default value is forever (FOREVER). For security reasons, this -# caching is made forever when a security manager is set. When a security -# manager is not set, the default behavior in this implementation -# is to cache for 30 seconds. -# -# NOTE: setting this to anything other than the default value can have -# serious security implications. Do not set it unless -# you are sure you are not exposed to DNS spoofing attack. -# -#networkaddress.cache.ttl=-1 - -# The Java-level namelookup cache policy for failed lookups: -# -# any negative value: cache forever -# any positive value: the number of seconds to cache negative lookup results -# zero: do not cache -# -# In some Microsoft Windows networking environments that employ -# the WINS name service in addition to DNS, name service lookups -# that fail may take a noticeably long time to return (approx. 5 seconds). -# For this reason the default caching policy is to maintain these -# results for 10 seconds. -# -# -networkaddress.cache.negative.ttl=10 - -# -# Properties to configure OCSP for certificate revocation checking -# - -# Enable OCSP -# -# By default, OCSP is not used for certificate revocation checking. -# This property enables the use of OCSP when set to the value "true". -# -# NOTE: SocketPermission is required to connect to an OCSP responder. -# -# Example, -# ocsp.enable=true - -# -# Location of the OCSP responder -# -# By default, the location of the OCSP responder is determined implicitly -# from the certificate being validated. This property explicitly specifies -# the location of the OCSP responder. The property is used when the -# Authority Information Access extension (defined in RFC 3280) is absent -# from the certificate or when it requires overriding. -# -# Example, -# ocsp.responderURL=http://ocsp.example.net:80 - -# -# Subject name of the OCSP responder's certificate -# -# By default, the certificate of the OCSP responder is that of the issuer -# of the certificate being validated. This property identifies the certificate -# of the OCSP responder when the default does not apply. Its value is a string -# distinguished name (defined in RFC 2253) which identifies a certificate in -# the set of certificates supplied during cert path validation. In cases where -# the subject name alone is not sufficient to uniquely identify the certificate -# then both the "ocsp.responderCertIssuerName" and -# "ocsp.responderCertSerialNumber" properties must be used instead. When this -# property is set then those two properties are ignored. -# -# Example, -# ocsp.responderCertSubjectName="CN=OCSP Responder, O=XYZ Corp" - -# -# Issuer name of the OCSP responder's certificate -# -# By default, the certificate of the OCSP responder is that of the issuer -# of the certificate being validated. This property identifies the certificate -# of the OCSP responder when the default does not apply. Its value is a string -# distinguished name (defined in RFC 2253) which identifies a certificate in -# the set of certificates supplied during cert path validation. When this -# property is set then the "ocsp.responderCertSerialNumber" property must also -# be set. When the "ocsp.responderCertSubjectName" property is set then this -# property is ignored. -# -# Example, -# ocsp.responderCertIssuerName="CN=Enterprise CA, O=XYZ Corp" - -# -# Serial number of the OCSP responder's certificate -# -# By default, the certificate of the OCSP responder is that of the issuer -# of the certificate being validated. This property identifies the certificate -# of the OCSP responder when the default does not apply. Its value is a string -# of hexadecimal digits (colon or space separators may be present) which -# identifies a certificate in the set of certificates supplied during cert path -# validation. When this property is set then the "ocsp.responderCertIssuerName" -# property must also be set. When the "ocsp.responderCertSubjectName" property -# is set then this property is ignored. -# -# Example, -# ocsp.responderCertSerialNumber=2A:FF:00 - -# -# Policy for failed Kerberos KDC lookups: -# -# When a KDC is unavailable (network error, service failure, etc), it is -# put inside a blacklist and accessed less often for future requests. The -# value (case-insensitive) for this policy can be: -# -# tryLast -# KDCs in the blacklist are always tried after those not on the list. -# -# tryLess[:max_retries,timeout] -# KDCs in the blacklist are still tried by their order in the configuration, -# but with smaller max_retries and timeout values. max_retries and timeout -# are optional numerical parameters (default 1 and 5000, which means once -# and 5 seconds). Please notes that if any of the values defined here is -# more than what is defined in krb5.conf, it will be ignored. -# -# Whenever a KDC is detected as available, it is removed from the blacklist. -# The blacklist is reset when krb5.conf is reloaded. You can add -# refreshKrb5Config=true to a JAAS configuration file so that krb5.conf is -# reloaded whenever a JAAS authentication is attempted. -# -# Example, -# krb5.kdc.bad.policy = tryLast -# krb5.kdc.bad.policy = tryLess:2,2000 -krb5.kdc.bad.policy = tryLast - -# Algorithm restrictions for certification path (CertPath) processing -# -# In some environments, certain algorithms or key lengths may be undesirable -# for certification path building and validation. For example, "MD2" is -# generally no longer considered to be a secure hash algorithm. This section -# describes the mechanism for disabling algorithms based on algorithm name -# and/or key length. This includes algorithms used in certificates, as well -# as revocation information such as CRLs and signed OCSP Responses. -# -# The syntax of the disabled algorithm string is described as this Java -# BNF-style: -# DisabledAlgorithms: -# " DisabledAlgorithm { , DisabledAlgorithm } " -# -# DisabledAlgorithm: -# AlgorithmName [Constraint] -# -# AlgorithmName: -# (see below) -# -# Constraint: -# KeySizeConstraint -# -# KeySizeConstraint: -# keySize Operator DecimalInteger -# -# Operator: -# <= | < | == | != | >= | > -# -# DecimalInteger: -# DecimalDigits -# -# DecimalDigits: -# DecimalDigit {DecimalDigit} -# -# DecimalDigit: one of -# 1 2 3 4 5 6 7 8 9 0 -# -# The "AlgorithmName" is the standard algorithm name of the disabled -# algorithm. See "Java Cryptography Architecture Standard Algorithm Name -# Documentation" for information about Standard Algorithm Names. Matching -# is performed using a case-insensitive sub-element matching rule. (For -# example, in "SHA1withECDSA" the sub-elements are "SHA1" for hashing and -# "ECDSA" for signatures.) If the assertion "AlgorithmName" is a -# sub-element of the certificate algorithm name, the algorithm will be -# rejected during certification path building and validation. For example, -# the assertion algorithm name "DSA" will disable all certificate algorithms -# that rely on DSA, such as NONEwithDSA, SHA1withDSA. However, the assertion -# will not disable algorithms related to "ECDSA". -# -# A "Constraint" provides further guidance for the algorithm being specified. -# The "KeySizeConstraint" requires a key of a valid size range if the -# "AlgorithmName" is of a key algorithm. The "DecimalInteger" indicates the -# key size specified in number of bits. For example, "RSA keySize <= 1024" -# indicates that any RSA key with key size less than or equal to 1024 bits -# should be disabled, and "RSA keySize < 1024, RSA keySize > 2048" indicates -# that any RSA key with key size less than 1024 or greater than 2048 should -# be disabled. Note that the "KeySizeConstraint" only makes sense to key -# algorithms. -# -# Note: This property is currently used by Oracle's PKIX implementation. It -# is not guaranteed to be examined and used by other implementations. -# -# Example: -# jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048 -# -# -jdk.certpath.disabledAlgorithms=MD2 - -# Algorithm restrictions for Secure Socket Layer/Transport Layer Security -# (SSL/TLS) processing -# -# In some environments, certain algorithms or key lengths may be undesirable -# when using SSL/TLS. This section describes the mechanism for disabling -# algorithms during SSL/TLS security parameters negotiation, including cipher -# suites selection, peer authentication and key exchange mechanisms. -# -# For PKI-based peer authentication and key exchange mechanisms, this list -# of disabled algorithms will also be checked during certification path -# building and validation, including algorithms used in certificates, as -# well as revocation information such as CRLs and signed OCSP Responses. -# This is in addition to the jdk.certpath.disabledAlgorithms property above. -# -# See the specification of "jdk.certpath.disabledAlgorithms" for the -# syntax of the disabled algorithm string. -# -# Note: This property is currently used by Oracle's JSSE implementation. -# It is not guaranteed to be examined and used by other implementations. -# -# Example: -# jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048 -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/lib/security/java.security-linux Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,376 @@ +# +# This is the "master security properties file". +# +# In this file, various security properties are set for use by +# java.security classes. This is where users can statically register +# Cryptography Package Providers ("providers" for short). The term +# "provider" refers to a package or set of packages that supply a +# concrete implementation of a subset of the cryptography aspects of +# the Java Security API. A provider may, for example, implement one or +# more digital signature algorithms or message digest algorithms. +# +# Each provider must implement a subclass of the Provider class. +# To register a provider in this master security properties file, +# specify the Provider subclass name and priority in the format +# +# security.provider.<n>=<className> +# +# This declares a provider, and specifies its preference +# order n. The preference order is the order in which providers are +# searched for requested algorithms (when no specific provider is +# requested). The order is 1-based; 1 is the most preferred, followed +# by 2, and so on. +# +# <className> must specify the subclass of the Provider class whose +# constructor sets the values of various properties that are required +# for the Java Security API to look up the algorithms or other +# facilities implemented by the provider. +# +# There must be at least one provider specification in java.security. +# There is a default provider that comes standard with the JDK. It +# is called the "SUN" provider, and its Provider subclass +# named Sun appears in the sun.security.provider package. Thus, the +# "SUN" provider is registered via the following: +# +# security.provider.1=sun.security.provider.Sun +# +# (The number 1 is used for the default provider.) +# +# Note: Providers can be dynamically registered instead by calls to +# either the addProvider or insertProviderAt method in the Security +# class. + +# +# List of providers and their preference orders (see above): +# +security.provider.1=sun.security.provider.Sun +security.provider.2=sun.security.rsa.SunRsaSign +security.provider.3=sun.security.ec.SunEC +security.provider.4=com.sun.net.ssl.internal.ssl.Provider +security.provider.5=com.sun.crypto.provider.SunJCE +security.provider.6=sun.security.jgss.SunProvider +security.provider.7=com.sun.security.sasl.Provider +security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI +security.provider.9=sun.security.smartcardio.SunPCSC + +# +# Select the source of seed data for SecureRandom. By default an +# attempt is made to use the entropy gathering device specified by +# the securerandom.source property. If an exception occurs when +# accessing the URL then the traditional system/thread activity +# algorithm is used. +# +# On Solaris and Linux systems, if file:/dev/urandom is specified and it +# exists, a special SecureRandom implementation is activated by default. +# This "NativePRNG" reads random bytes directly from /dev/urandom. +# +# On Windows systems, the URLs file:/dev/random and file:/dev/urandom +# enables use of the Microsoft CryptoAPI seed functionality. +# +securerandom.source=file:/dev/urandom +# +# The entropy gathering device is described as a URL and can also +# be specified with the system property "java.security.egd". For example, +# -Djava.security.egd=file:/dev/urandom +# Specifying this system property will override the securerandom.source +# setting. + +# +# Class to instantiate as the javax.security.auth.login.Configuration +# provider. +# +login.configuration.provider=com.sun.security.auth.login.ConfigFile + +# +# Default login configuration file +# +#login.config.url.1=file:${user.home}/.java.login.config + +# +# Class to instantiate as the system Policy. This is the name of the class +# that will be used as the Policy object. +# +policy.provider=sun.security.provider.PolicyFile + +# The default is to have a single system-wide policy file, +# and a policy file in the user's home directory. +policy.url.1=file:${java.home}/lib/security/java.policy +policy.url.2=file:${user.home}/.java.policy + +# whether or not we expand properties in the policy file +# if this is set to false, properties (${...}) will not be expanded in policy +# files. +policy.expandProperties=true + +# whether or not we allow an extra policy to be passed on the command line +# with -Djava.security.policy=somefile. Comment out this line to disable +# this feature. +policy.allowSystemProperty=true + +# whether or not we look into the IdentityScope for trusted Identities +# when encountering a 1.1 signed JAR file. If the identity is found +# and is trusted, we grant it AllPermission. +policy.ignoreIdentityScope=false + +# +# Default keystore type. +# +keystore.type=jks + +# +# List of comma-separated packages that start with or equal this string +# will cause a security exception to be thrown when +# passed to checkPackageAccess unless the +# corresponding RuntimePermission ("accessClassInPackage."+package) has +# been granted. +package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal. + +# +# List of comma-separated packages that start with or equal this string +# will cause a security exception to be thrown when +# passed to checkPackageDefinition unless the +# corresponding RuntimePermission ("defineClassInPackage."+package) has +# been granted. +# +# by default, none of the class loaders supplied with the JDK call +# checkPackageDefinition. +# +package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal. + +# +# Determines whether this properties file can be appended to +# or overridden on the command line via -Djava.security.properties +# +security.overridePropertiesFile=true + +# +# Determines the default key and trust manager factory algorithms for +# the javax.net.ssl package. +# +ssl.KeyManagerFactory.algorithm=SunX509 +ssl.TrustManagerFactory.algorithm=PKIX + +# +# The Java-level namelookup cache policy for successful lookups: +# +# any negative value: caching forever +# any positive value: the number of seconds to cache an address for +# zero: do not cache +# +# default value is forever (FOREVER). For security reasons, this +# caching is made forever when a security manager is set. When a security +# manager is not set, the default behavior in this implementation +# is to cache for 30 seconds. +# +# NOTE: setting this to anything other than the default value can have +# serious security implications. Do not set it unless +# you are sure you are not exposed to DNS spoofing attack. +# +#networkaddress.cache.ttl=-1 + +# The Java-level namelookup cache policy for failed lookups: +# +# any negative value: cache forever +# any positive value: the number of seconds to cache negative lookup results +# zero: do not cache +# +# In some Microsoft Windows networking environments that employ +# the WINS name service in addition to DNS, name service lookups +# that fail may take a noticeably long time to return (approx. 5 seconds). +# For this reason the default caching policy is to maintain these +# results for 10 seconds. +# +# +networkaddress.cache.negative.ttl=10 + +# +# Properties to configure OCSP for certificate revocation checking +# + +# Enable OCSP +# +# By default, OCSP is not used for certificate revocation checking. +# This property enables the use of OCSP when set to the value "true". +# +# NOTE: SocketPermission is required to connect to an OCSP responder. +# +# Example, +# ocsp.enable=true + +# +# Location of the OCSP responder +# +# By default, the location of the OCSP responder is determined implicitly +# from the certificate being validated. This property explicitly specifies +# the location of the OCSP responder. The property is used when the +# Authority Information Access extension (defined in RFC 3280) is absent +# from the certificate or when it requires overriding. +# +# Example, +# ocsp.responderURL=http://ocsp.example.net:80 + +# +# Subject name of the OCSP responder's certificate +# +# By default, the certificate of the OCSP responder is that of the issuer +# of the certificate being validated. This property identifies the certificate +# of the OCSP responder when the default does not apply. Its value is a string +# distinguished name (defined in RFC 2253) which identifies a certificate in +# the set of certificates supplied during cert path validation. In cases where +# the subject name alone is not sufficient to uniquely identify the certificate +# then both the "ocsp.responderCertIssuerName" and +# "ocsp.responderCertSerialNumber" properties must be used instead. When this +# property is set then those two properties are ignored. +# +# Example, +# ocsp.responderCertSubjectName="CN=OCSP Responder, O=XYZ Corp" + +# +# Issuer name of the OCSP responder's certificate +# +# By default, the certificate of the OCSP responder is that of the issuer +# of the certificate being validated. This property identifies the certificate +# of the OCSP responder when the default does not apply. Its value is a string +# distinguished name (defined in RFC 2253) which identifies a certificate in +# the set of certificates supplied during cert path validation. When this +# property is set then the "ocsp.responderCertSerialNumber" property must also +# be set. When the "ocsp.responderCertSubjectName" property is set then this +# property is ignored. +# +# Example, +# ocsp.responderCertIssuerName="CN=Enterprise CA, O=XYZ Corp" + +# +# Serial number of the OCSP responder's certificate +# +# By default, the certificate of the OCSP responder is that of the issuer +# of the certificate being validated. This property identifies the certificate +# of the OCSP responder when the default does not apply. Its value is a string +# of hexadecimal digits (colon or space separators may be present) which +# identifies a certificate in the set of certificates supplied during cert path +# validation. When this property is set then the "ocsp.responderCertIssuerName" +# property must also be set. When the "ocsp.responderCertSubjectName" property +# is set then this property is ignored. +# +# Example, +# ocsp.responderCertSerialNumber=2A:FF:00 + +# +# Policy for failed Kerberos KDC lookups: +# +# When a KDC is unavailable (network error, service failure, etc), it is +# put inside a blacklist and accessed less often for future requests. The +# value (case-insensitive) for this policy can be: +# +# tryLast +# KDCs in the blacklist are always tried after those not on the list. +# +# tryLess[:max_retries,timeout] +# KDCs in the blacklist are still tried by their order in the configuration, +# but with smaller max_retries and timeout values. max_retries and timeout +# are optional numerical parameters (default 1 and 5000, which means once +# and 5 seconds). Please notes that if any of the values defined here is +# more than what is defined in krb5.conf, it will be ignored. +# +# Whenever a KDC is detected as available, it is removed from the blacklist. +# The blacklist is reset when krb5.conf is reloaded. You can add +# refreshKrb5Config=true to a JAAS configuration file so that krb5.conf is +# reloaded whenever a JAAS authentication is attempted. +# +# Example, +# krb5.kdc.bad.policy = tryLast +# krb5.kdc.bad.policy = tryLess:2,2000 +krb5.kdc.bad.policy = tryLast + +# Algorithm restrictions for certification path (CertPath) processing +# +# In some environments, certain algorithms or key lengths may be undesirable +# for certification path building and validation. For example, "MD2" is +# generally no longer considered to be a secure hash algorithm. This section +# describes the mechanism for disabling algorithms based on algorithm name +# and/or key length. This includes algorithms used in certificates, as well +# as revocation information such as CRLs and signed OCSP Responses. +# +# The syntax of the disabled algorithm string is described as this Java +# BNF-style: +# DisabledAlgorithms: +# " DisabledAlgorithm { , DisabledAlgorithm } " +# +# DisabledAlgorithm: +# AlgorithmName [Constraint] +# +# AlgorithmName: +# (see below) +# +# Constraint: +# KeySizeConstraint +# +# KeySizeConstraint: +# keySize Operator DecimalInteger +# +# Operator: +# <= | < | == | != | >= | > +# +# DecimalInteger: +# DecimalDigits +# +# DecimalDigits: +# DecimalDigit {DecimalDigit} +# +# DecimalDigit: one of +# 1 2 3 4 5 6 7 8 9 0 +# +# The "AlgorithmName" is the standard algorithm name of the disabled +# algorithm. See "Java Cryptography Architecture Standard Algorithm Name +# Documentation" for information about Standard Algorithm Names. Matching +# is performed using a case-insensitive sub-element matching rule. (For +# example, in "SHA1withECDSA" the sub-elements are "SHA1" for hashing and +# "ECDSA" for signatures.) If the assertion "AlgorithmName" is a +# sub-element of the certificate algorithm name, the algorithm will be +# rejected during certification path building and validation. For example, +# the assertion algorithm name "DSA" will disable all certificate algorithms +# that rely on DSA, such as NONEwithDSA, SHA1withDSA. However, the assertion +# will not disable algorithms related to "ECDSA". +# +# A "Constraint" provides further guidance for the algorithm being specified. +# The "KeySizeConstraint" requires a key of a valid size range if the +# "AlgorithmName" is of a key algorithm. The "DecimalInteger" indicates the +# key size specified in number of bits. For example, "RSA keySize <= 1024" +# indicates that any RSA key with key size less than or equal to 1024 bits +# should be disabled, and "RSA keySize < 1024, RSA keySize > 2048" indicates +# that any RSA key with key size less than 1024 or greater than 2048 should +# be disabled. Note that the "KeySizeConstraint" only makes sense to key +# algorithms. +# +# Note: This property is currently used by Oracle's PKIX implementation. It +# is not guaranteed to be examined and used by other implementations. +# +# Example: +# jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048 +# +# +jdk.certpath.disabledAlgorithms=MD2 + +# Algorithm restrictions for Secure Socket Layer/Transport Layer Security +# (SSL/TLS) processing +# +# In some environments, certain algorithms or key lengths may be undesirable +# when using SSL/TLS. This section describes the mechanism for disabling +# algorithms during SSL/TLS security parameters negotiation, including cipher +# suites selection, peer authentication and key exchange mechanisms. +# +# For PKI-based peer authentication and key exchange mechanisms, this list +# of disabled algorithms will also be checked during certification path +# building and validation, including algorithms used in certificates, as +# well as revocation information such as CRLs and signed OCSP Responses. +# This is in addition to the jdk.certpath.disabledAlgorithms property above. +# +# See the specification of "jdk.certpath.disabledAlgorithms" for the +# syntax of the disabled algorithm string. +# +# Note: This property is currently used by Oracle's JSSE implementation. +# It is not guaranteed to be examined and used by other implementations. +# +# Example: +# jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048 +
--- a/src/share/native/com/sun/java/util/jar/pack/jni.cpp Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/native/com/sun/java/util/jar/pack/jni.cpp Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,7 +82,11 @@ static unpacker* get_unpacker() { //fprintf(stderr, "get_unpacker()\n"); JavaVM* vm = null; - JNI_GetCreatedJavaVMs(&vm, 1, null); + jsize nVM = 0; + jint retval = JNI_GetCreatedJavaVMs(&vm, 1, &nVM); + // other VM implements may differ, thus for correctness, we need these checks + if (retval != JNI_OK || nVM != 1) + return null; void* envRaw = null; vm->GetEnv(&envRaw, JNI_VERSION_1_1); JNIEnv* env = (JNIEnv*) envRaw;
--- a/src/share/native/java/io/ObjectInputStream.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/native/java/io/ObjectInputStream.c Wed Dec 12 13:09:55 2012 -0800 @@ -173,16 +173,3 @@ (*env)->ReleasePrimitiveArrayCritical(env, dst, doubles, 0); } -/* - * Class: java_io_ObjectInputStream - * Method: latestUserDefinedLoader - * Signature: ()Ljava/lang/ClassLoader; - * - * Returns the first non-null class loader up the execution stack, or null - * if only code from the null class loader is on the stack. - */ -JNIEXPORT jobject JNICALL -Java_java_io_ObjectInputStream_latestUserDefinedLoader(JNIEnv *env, jclass cls) -{ - return JVM_LatestUserDefinedLoader(env); -}
--- a/src/share/native/java/net/net_util.h Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/native/java/net/net_util.h Wed Dec 12 13:09:55 2012 -0800 @@ -140,6 +140,9 @@ int NET_IsEqual(jbyte* caddr1, jbyte* caddr2); +int +NET_IsZeroAddr(jbyte* caddr); + /* Socket operations * * These work just like the JVM_* procedures, except that they may do some
--- a/src/share/native/sun/misc/VM.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/share/native/sun/misc/VM.c Wed Dec 12 13:09:55 2012 -0800 @@ -111,6 +111,11 @@ get_thread_state_info(env, JAVA_THREAD_STATE_TERMINATED, values, names); } +JNIEXPORT jobject JNICALL +Java_sun_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) { + return JVM_LatestUserDefinedLoader(env); +} + typedef void (JNICALL *GetJvmVersionInfo_fp)(JNIEnv*, jvm_version_info*, size_t); JNIEXPORT void JNICALL
--- a/src/share/native/sun/rmi/server/MarshalInputStream.c Wed Dec 12 12:16:30 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include "jni.h" -#include "jvm.h" -#include "jni_util.h" - -#include "sun_rmi_server_MarshalInputStream.h" - -/* - * Class: sun_rmi_server_MarshalInputStream - * Method: latestUserDefinedLoader - * Signature: ()Ljava/lang/ClassLoader; - * - * Returns the first non-null class loader up the execution stack, or null - * if only code from the null class loader is on the stack. - */ -JNIEXPORT jobject JNICALL -Java_sun_rmi_server_MarshalInputStream_latestUserDefinedLoader(JNIEnv *env, jclass cls) -{ - return JVM_LatestUserDefinedLoader(env); -}
--- a/src/solaris/back/linker_md.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/back/linker_md.c Wed Dec 12 13:09:55 2012 -0800 @@ -54,6 +54,32 @@ #define LIB_SUFFIX "so" #endif +static void dll_build_name(char* buffer, size_t buflen, + const char* pname, const char* fname) { + // Based on os_solaris.cpp + + char *path_sep = PATH_SEPARATOR; + char *pathname = (char *)pname; + while (strlen(pathname) > 0) { + char *p = strchr(pathname, *path_sep); + if (p == NULL) { + p = pathname + strlen(pathname); + } + /* check for NULL path */ + if (p == pathname) { + continue; + } + (void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (p - pathname), + pathname, fname); + + if (access(buffer, F_OK) == 0) { + break; + } + pathname = p + 1; + *buffer = '\0'; + } +} + /* * create a string for the JNI native function name by adding the * appropriate decorations. @@ -76,16 +102,16 @@ { const int pnamelen = pname ? strlen(pname) : 0; + *holder = '\0'; /* Quietly truncate on buffer overflow. Should be an error. */ if (pnamelen + (int)strlen(fname) + 10 > holderlen) { - *holder = '\0'; return; } if (pnamelen == 0) { (void)snprintf(holder, holderlen, "lib%s." LIB_SUFFIX, fname); } else { - (void)snprintf(holder, holderlen, "%s/lib%s." LIB_SUFFIX, pname, fname); + dll_build_name(holder, holderlen, pname, fname); } }
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/classes/sun/awt/X11/XToolkit.java Wed Dec 12 13:09:55 2012 -0800 @@ -1298,6 +1298,15 @@ return new XInputMethodDescriptor(); } + /** + * Returns whether enableInputMethods should be set to true for peered + * TextComponent instances on this platform. True by default. + */ + @Override + public boolean enableInputMethodsForTextComponent() { + return true; + } + static int getMultiClickTime() { if (awt_multiclick_time == 0) { initializeMultiClickTime();
--- a/src/solaris/demo/jvmti/hprof/hprof_md.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/demo/jvmti/hprof/hprof_md.c Wed Dec 12 13:09:55 2012 -0800 @@ -375,6 +375,31 @@ return ntohl(l); } +static void dll_build_name(char* buffer, size_t buflen, + const char* pname, const char* fname) { + // Loosely based on os_solaris.cpp + + char *pathname = (char *)pname; + while (strlen(pathname) > 0) { + char *p = strchr(pathname, ':'); + if (p == NULL) { + p = pathname + strlen(pathname); + } + /* check for NULL path */ + if (p == pathname) { + continue; + } + (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX, + (p - pathname), pathname, fname); + + if (access(buffer, F_OK) == 0) { + break; + } + pathname = p + 1; + *buffer = '\0'; + } +} + /* Create the actual fill filename for a dynamic library. */ void md_build_library_name(char *holder, int holderlen, char *pname, char *fname) @@ -384,9 +409,9 @@ /* Length of options directory location. */ pnamelen = pname ? strlen(pname) : 0; + *holder = '\0'; /* Quietly truncate on buffer overflow. Should be an error. */ if (pnamelen + (int)strlen(fname) + 10 > holderlen) { - *holder = '\0'; return; } @@ -394,7 +419,7 @@ if (pnamelen == 0) { (void)snprintf(holder, holderlen, "lib%s" JNI_LIB_SUFFIX, fname); } else { - (void)snprintf(holder, holderlen, "%s/lib%s" JNI_LIB_SUFFIX, pname, fname); + dll_build_name(holder, holderlen, pname, fname); } }
--- a/src/solaris/lib/content-types.properties Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/lib/content-types.properties Wed Dec 12 13:09:55 2012 -0800 @@ -225,6 +225,10 @@ icon=png;\ action=browser +image/bmp: \ + description=Bitmap Image;\ + file_extensions=.bmp; + text/html: \ description=HTML Document;\ file_extensions=.htm,.html;\
--- a/src/solaris/native/java/net/Inet4AddressImpl.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/native/java/net/Inet4AddressImpl.c Wed Dec 12 13:09:55 2012 -0800 @@ -695,12 +695,19 @@ * We did receive something, but is it what we were expecting? * I.E.: A ICMP_ECHOREPLY packet with the proper PID. */ - if (icmplen >= 8 && icmp->icmp_type == ICMP_ECHOREPLY && - (ntohs(icmp->icmp_id) == pid) && - (him->sin_addr.s_addr == sa_recv.sin_addr.s_addr)) { - close(fd); - return JNI_TRUE; - } + if (icmplen >= 8 && icmp->icmp_type == ICMP_ECHOREPLY + && (ntohs(icmp->icmp_id) == pid)) { + if ((him->sin_addr.s_addr == sa_recv.sin_addr.s_addr)) { + close(fd); + return JNI_TRUE; + } + + if (him->sin_addr.s_addr == 0) { + close(fd); + return JNI_TRUE; + } + } + } } while (tmout2 > 0); timeout -= 1000;
--- a/src/solaris/native/java/net/Inet6AddressImpl.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/native/java/net/Inet6AddressImpl.c Wed Dec 12 13:09:55 2012 -0800 @@ -539,10 +539,15 @@ * from the host that we are trying to determine is reachable. */ if (n >= 8 && icmp6->icmp6_type == ICMP6_ECHO_REPLY && - (ntohs(icmp6->icmp6_id) == pid) && - NET_IsEqual(caddr, recv_caddr)) { - close(fd); - return JNI_TRUE; + (ntohs(icmp6->icmp6_id) == pid)) { + if (NET_IsEqual(caddr, recv_caddr)) { + close(fd); + return JNI_TRUE; + } + if (NET_IsZeroAddr(caddr)) { + close(fd); + return JNI_TRUE; + } } } } while (tmout2 > 0);
--- a/src/solaris/native/java/net/NetworkInterface.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/native/java/net/NetworkInterface.c Wed Dec 12 13:09:55 2012 -0800 @@ -147,7 +147,7 @@ static short getSubnet(JNIEnv *env, int sock, const char *ifname); static int getIndex(int sock, const char *ifname); -static int getFlags(int sock, const char *ifname); +static int getFlags(int sock, const char *ifname, int *flags); static int getMacAddress(JNIEnv *env, int sock, const char* ifname, const struct in_addr* addr, unsigned char *buf); static int getMTU(JNIEnv *env, int sock, const char *ifname); @@ -561,6 +561,7 @@ jboolean isCopy; int ret, sock; const char* name_utf; + int flags = 0; name_utf = (*env)->GetStringUTFChars(env, name, &isCopy); @@ -571,7 +572,7 @@ name_utf = (*env)->GetStringUTFChars(env, name, &isCopy); - ret = getFlags(sock, name_utf); + ret = getFlags(sock, name_utf, &flags); close(sock); (*env)->ReleaseStringUTFChars(env, name, name_utf); @@ -581,7 +582,7 @@ return -1; } - return ret; + return flags; } @@ -852,6 +853,7 @@ int mask; int isVirtual = 0; int addr_size; + int flags = 0; /* * If the interface name is a logical interface then we @@ -906,7 +908,7 @@ * the 'parent' interface with the new records. */ *name_colonP = 0; - if (getFlags(sock, name) < 0) { + if (getFlags(sock, name, &flags) < 0 || flags < 0) { // failed to access parent interface do not create parent. // We are a virtual interface with no parent. isVirtual = 1; @@ -1278,9 +1280,8 @@ return if2.ifr_mtu; } -static int getFlags(int sock, const char *ifname) { +static int getFlags(int sock, const char *ifname, int *flags) { struct ifreq if2; - int ret = -1; memset((char *) &if2, 0, sizeof(if2)); strcpy(if2.ifr_name, ifname); @@ -1289,7 +1290,12 @@ return -1; } - return if2.ifr_flags; + if (sizeof(if2.ifr_flags) == sizeof(short)) { + *flags = (if2.ifr_flags & 0xffff); + } else { + *flags = if2.ifr_flags; + } + return 0; } #endif @@ -1663,7 +1669,7 @@ } -static int getFlags(int sock, const char *ifname) { +static int getFlags(int sock, const char *ifname, int *flags) { struct lifreq lifr; memset((caddr_t)&lifr, 0, sizeof(lifr)); strcpy((caddr_t)&(lifr.lifr_name), ifname); @@ -1672,7 +1678,8 @@ return -1; } - return lifr.lifr_flags; + *flags = lifr.lifr_flags; + return 0; } @@ -1968,7 +1975,7 @@ return if2.ifr_mtu; } -static int getFlags(int sock, const char *ifname) { +static int getFlags(int sock, const char *ifname, int *flags) { struct ifreq if2; int ret = -1; @@ -1979,7 +1986,12 @@ return -1; } - return (((int) if2.ifr_flags) & 0xffff); + if (sizeof(if2.ifr_flags) == sizeof(short)) { + *flags = (if2.ifr_flags & 0xffff); + } else { + *flags = if2.ifr_flags; + } + return 0; } #endif
--- a/src/solaris/native/java/net/net_util_md.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/native/java/net/net_util_md.c Wed Dec 12 13:09:55 2012 -0800 @@ -1010,6 +1010,16 @@ return (jboolean)(getaddrinfo_ptr != NULL); } +int NET_IsZeroAddr(jbyte* caddr) { + int i; + for (i = 0; i < 16; i++) { + if (caddr[i] != 0) { + return 0; + } + } + return 1; +} + /* * Map the Java level socket option to the platform specific * level and option name.
--- a/src/solaris/npt/npt_md.h Wed Dec 12 12:16:30 2012 -0800 +++ b/src/solaris/npt/npt_md.h Wed Dec 12 13:09:55 2012 -0800 @@ -36,14 +36,14 @@ #define NPT_LIBNAME "npt" -#define NPT_INITIALIZE(pnpt,version,options) \ +#define NPT_INITIALIZE(path,pnpt,version,options) \ { \ void *_handle; \ void *_sym; \ \ if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ *(pnpt) = NULL; \ - _handle = dlopen(JNI_LIB_NAME(NPT_LIBNAME), RTLD_LAZY); \ + _handle = dlopen(path, RTLD_LAZY); \ if ( _handle == NULL ) NPT_ERROR("Cannot open library"); \ _sym = dlsym(_handle, "nptInitialize"); \ if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize"); \
--- a/src/windows/back/linker_md.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/windows/back/linker_md.c Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,11 +32,42 @@ #include <stdio.h> #include <string.h> #include <errno.h> +#include <io.h> #include "sys.h" #include "path_md.h" +static void dll_build_name(char* buffer, size_t buflen, + const char* pname, const char* fname) { + // Based on os_windows.cpp + + char *path_sep = PATH_SEPARATOR; + char *pathname = (char *)pname; + while (strlen(pathname) > 0) { + char *p = strchr(pathname, *path_sep); + if (p == NULL) { + p = pathname + strlen(pathname); + } + /* check for NULL path */ + if (p == pathname) { + continue; + } + if (*(p-1) == ':' || *(p-1) == '\\') { + (void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname), + pathname, fname); + } else { + (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname), + pathname, fname); + } + if (_access(buffer, 0) == 0) { + break; + } + pathname = p + 1; + *buffer = '\0'; + } +} + /* * From system_md.c v1.54 */ @@ -80,20 +111,17 @@ dbgsysBuildLibName(char *holder, int holderlen, char *pname, char *fname) { const int pnamelen = pname ? (int)strlen(pname) : 0; - const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0; + *holder = '\0'; /* Quietly truncates on buffer overflow. Should be an error. */ if (pnamelen + (int)strlen(fname) + 10 > holderlen) { - *holder = '\0'; return; } if (pnamelen == 0) { sprintf(holder, "%s.dll", fname); - } else if (c == ':' || c == '\\') { - sprintf(holder, "%s%s.dll", pname, fname); } else { - sprintf(holder, "%s\\%s.dll", pname, fname); + dll_build_name(holder, holderlen, pname, fname); } }
--- a/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java Wed Dec 12 13:09:55 2012 -0800 @@ -45,15 +45,25 @@ private long ctxHandle; static { - initFirst(); + initFirst(Status.class); } + // Used by native code to indicate when a particular protocol sequence is completed + // and must not be re-used. + + class Status { + boolean sequenceComplete; + } + + Status status; + NTLMAuthSequence (String username, String password, String ntdomain) throws IOException { this.username = username; this.password = password; this.ntdomain = ntdomain; + this.status = new Status(); state = 0; crdHandle = getCredentialsHandle (username, ntdomain, password); if (crdHandle == 0) { @@ -63,19 +73,26 @@ public String getAuthHeader (String token) throws IOException { byte[] input = null; + + assert !status.sequenceComplete; + if (token != null) input = (new BASE64Decoder()).decodeBuffer(token); - byte[] b = getNextToken (crdHandle, input); + byte[] b = getNextToken (crdHandle, input, status); if (b == null) throw new IOException ("Internal authentication error"); return (new B64Encoder()).encode (b); } - private native static void initFirst (); + public boolean isComplete() { + return status.sequenceComplete; + } + + private native static void initFirst (Class<NTLMAuthSequence.Status> clazz); private native long getCredentialsHandle (String user, String domain, String password); - private native byte[] getNextToken (long crdHandle, byte[] lastToken); + private native byte[] getNextToken (long crdHandle, byte[] lastToken, Status returned); } class B64Encoder extends BASE64Encoder {
--- a/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Wed Dec 12 12:16:30 2012 -0800 +++ b/src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -186,6 +186,7 @@ public synchronized boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { try { + NTLMAuthSequence seq = (NTLMAuthSequence)conn.authObj(); if (seq == null) { seq = new NTLMAuthSequence (username, password, ntdomain); @@ -193,8 +194,12 @@ } String response = "NTLM " + seq.getAuthHeader (raw.length()>6?raw.substring(5):null); conn.setAuthenticationProperty(getHeaderName(), response); + if (seq.isComplete()) { + conn.authObj(null); + } return true; } catch (IOException e) { + conn.authObj(null); return false; } }
--- a/src/windows/demo/jvmti/hprof/hprof_md.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/windows/demo/jvmti/hprof/hprof_md.c Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -367,28 +367,53 @@ return 0; } +static void dll_build_name(char* buffer, size_t buflen, + const char* pname, const char* fname) { + // Loosley based on os_windows.cpp + + char *pathname = (char *)pname; + while (strlen(pathname) > 0) { + char *p = strchr(pathname, ';'); + if (p == NULL) { + p = pathname + strlen(pathname); + } + /* check for NULL path */ + if (p == pathname) { + continue; + } + if (*(p-1) == ':' || *(p-1) == '\\') { + (void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname), + pathname, fname); + } else { + (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname), + pathname, fname); + } + if (_access(buffer, 0) == 0) { + break; + } + pathname = p + 1; + *buffer = '\0'; + } +} + /* Build a machine dependent library name out of a path and file name. */ void md_build_library_name(char *holder, int holderlen, char *pname, char *fname) { int pnamelen; - char c; pnamelen = pname ? (int)strlen(pname) : 0; - c = (pnamelen > 0) ? pname[pnamelen-1] : 0; + *holder = '\0'; /* Quietly truncates on buffer overflow. Should be an error. */ if (pnamelen + strlen(fname) + 10 > (unsigned int)holderlen) { - *holder = '\0'; return; } if (pnamelen == 0) { sprintf(holder, "%s.dll", fname); - } else if (c == ':' || c == '\\') { - sprintf(holder, "%s%s.dll", pname, fname); } else { - sprintf(holder, "%s\\%s.dll", pname, fname); + dll_build_name(holder, holderlen, pname, fname); } }
--- a/src/windows/lib/content-types.properties Wed Dec 12 12:16:30 2012 -0800 +++ b/src/windows/lib/content-types.properties Wed Dec 12 13:09:55 2012 -0800 @@ -222,6 +222,10 @@ icon=png;\ action=browser +image/bmp: \ + description=Bitmap Image;\ + file_extensions=.bmp; + text/html: \ description=HTML Document;\ file_extensions=.htm,.html;\
--- a/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c Wed Dec 12 12:16:30 2012 -0800 +++ b/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c Wed Dec 12 13:09:55 2012 -0800 @@ -41,18 +41,20 @@ #define SECURITY_WIN32 #include "sspi.h" -static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle); +static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle, JNIEnv *env, jobject status); static jfieldID ntlm_ctxHandleID; static jfieldID ntlm_crdHandleID; +static jfieldID status_seqCompleteID; static HINSTANCE lib = NULL; JNIEXPORT void JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_initFirst -(JNIEnv *env, jclass clazz) +(JNIEnv *env, jclass authseq_clazz, jclass status_clazz) { - ntlm_ctxHandleID = (*env)->GetFieldID(env, clazz, "ctxHandle", "J"); - ntlm_crdHandleID = (*env)->GetFieldID(env, clazz, "crdHandle", "J"); + ntlm_ctxHandleID = (*env)->GetFieldID(env, authseq_clazz, "ctxHandle", "J"); + ntlm_crdHandleID = (*env)->GetFieldID(env, authseq_clazz, "crdHandle", "J"); + status_seqCompleteID = (*env)->GetFieldID(env, status_clazz, "sequenceComplete", "Z"); } /* @@ -145,8 +147,14 @@ } } + +/* + * Class: sun_net_www_protocol_http_ntlm_NTLMAuthSequence + * Method: getNextToken + * Signature: (J[BLsun/net/www/protocol/http/ntlm/NTLMAuthSequence/Status;)[B + */ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_getNextToken -(JNIEnv *env, jobject this, jlong crdHandle, jbyteArray lastToken) +(JNIEnv *env, jobject this, jlong crdHandle, jbyteArray lastToken, jobject status) { VOID *pInput = 0; @@ -217,7 +225,7 @@ } if (ss < 0) { - endSequence (pCred, pCtx); + endSequence (pCred, pCtx, env, status); return 0; } @@ -225,7 +233,7 @@ ss = CompleteAuthToken( pCtx, &OutBuffDesc ); if (ss < 0) { - endSequence (pCred, pCtx); + endSequence (pCred, pCtx, env, status); return 0; } } @@ -235,18 +243,18 @@ (*env)->SetByteArrayRegion(env, ret, 0, OutSecBuff.cbBuffer, OutSecBuff.pvBuffer); if (lastToken != 0) // 2nd stage - endSequence (pCred, pCtx); + endSequence (pCred, pCtx, env, status); result = ret; } if ((ss != SEC_I_CONTINUE_NEEDED) && (ss == SEC_I_COMPLETE_AND_CONTINUE)) { - endSequence (pCred, pCtx); + endSequence (pCred, pCtx, env, status); } return result; } -static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle) { +static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle, JNIEnv *env, jobject status) { if (credHand != 0) { FreeCredentialsHandle(credHand); free(credHand); @@ -256,4 +264,7 @@ DeleteSecurityContext(ctxHandle); free(ctxHandle); } + + /* Sequence is complete so set flag */ + (*env)->SetBooleanField(env, status, status_seqCompleteID, JNI_TRUE); }
--- a/src/windows/native/sun/windows/awt_InputMethod.cpp Wed Dec 12 12:16:30 2012 -0800 +++ b/src/windows/native/sun/windows/awt_InputMethod.cpp Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -517,10 +517,10 @@ jstring infojStr = NULL; if ((buffSize = ::ImmGetDescription(hkl, szImmDescription, 0)) > 0) { - szImmDescription = (LPTSTR) safe_Malloc(buffSize * sizeof(TCHAR)); + szImmDescription = (LPTSTR) safe_Malloc((buffSize+1) * sizeof(TCHAR)); if (szImmDescription != NULL) { - ImmGetDescription(hkl, szImmDescription, buffSize); + ImmGetDescription(hkl, szImmDescription, (buffSize+1)); infojStr = JNU_NewStringPlatform(env, szImmDescription);
--- a/src/windows/npt/npt_md.h Wed Dec 12 12:16:30 2012 -0800 +++ b/src/windows/npt/npt_md.h Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,30 +33,16 @@ #include <string.h> #include <errno.h> -#define NPT_LIBNAME "npt.dll" +#define NPT_LIBNAME "npt" -#define NPT_INITIALIZE(pnpt,version,options) \ +#define NPT_INITIALIZE(path,pnpt,version,options) \ { \ - HINSTANCE jvm; \ void *_handle; \ void *_sym; \ - char buf[FILENAME_MAX+32]; \ - char *lastSlash; \ \ if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ - _handle = NULL; \ *(pnpt) = NULL; \ - buf[0] = 0; \ - jvm = GetModuleHandle("jvm.dll"); \ - if ( jvm == NULL ) NPT_ERROR("Cannot find jvm.dll"); \ - GetModuleFileName(jvm, buf, FILENAME_MAX); \ - lastSlash = strrchr(buf, '\\'); \ - if ( lastSlash != NULL ) { \ - *lastSlash = '\0'; \ - (void)strcat(buf, "\\..\\"); \ - (void)strcat(buf, NPT_LIBNAME); \ - _handle = LoadLibrary(buf); \ - } \ + _handle = LoadLibrary(path); \ if ( _handle == NULL ) NPT_ERROR("Cannot open library"); \ _sym = GetProcAddress(_handle, "nptInitialize"); \ if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize"); \
--- a/test/Makefile Wed Dec 12 12:16:30 2012 -0800 +++ b/test/Makefile Wed Dec 12 13:09:55 2012 -0800 @@ -484,72 +484,61 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_lang -jdk_lang: $(call TestDirs, java/lang) +jdk_lang: $(call TestDirs, java/lang sun/invoke sun/misc vm) $(call RunAgentvmBatch) # Stable othervm testruns (minus items from PROBLEM_LIST) # Using agentvm has serious problems with these tests -JDK_ALL_TARGETS += jdk_management1 -jdk_management1: $(call TestDirs, javax/management) +JDK_ALL_TARGETS += jdk_jmx +jdk_jmx: $(call TestDirs, javax/management com/sun/jmx) $(call RunOthervmBatch) # Stable othervm testruns (minus items from PROBLEM_LIST) # Using agentvm has serious problems with these tests -JDK_ALL_TARGETS += jdk_management2 -jdk_management2: $(call TestDirs, com/sun/jmx com/sun/management sun/management) +JDK_ALL_TARGETS += jdk_management +jdk_management: $(call TestDirs, com/sun/management sun/management) $(call RunOthervmBatch) -# All management tests -jdk_management: jdk_management1 jdk_management2 - @$(SummaryInfo) - # Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_math jdk_math: $(call TestDirs, java/math) $(call RunAgentvmBatch) # Stable samevm testruns (minus items from PROBLEM_LIST) -JDK_ALL_TARGETS += jdk_misc -jdk_misc: $(call TestDirs, \ - demo/jvmti demo/zipfs javax/naming javax/script \ - javax/smartcardio com/sun/jndi com/sun/xml \ - com/sun/corba sun/misc) +JDK_ALL_TARGETS += jdk_other +jdk_other: $(call TestDirs, \ + demo/jvmti demo/zipfs \ + javax/naming com/sun/jndi \ + javax/script \ + javax/sql \ + javax/smartcardio \ + com/sun/xml \ + javax/xml/ws com/sun/internal/ws \ + com/sun/org/apache/xerces \ + com/sun/corba \ + com/sun/servicetag \ + com/sun/tracing \ + sun/usagetracker) $(call RunAgentvmBatch) # Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_net -jdk_net: $(call TestDirs, com/sun/net java/net sun/net) - $(call RunAgentvmBatch) - -# Stable samevm testruns (minus items from PROBLEM_LIST) -JDK_ALL_TARGETS += jdk_nio1 -jdk_nio1: $(call TestDirs, java/nio/file) +jdk_net: $(call TestDirs, com/sun/net java/net sun/net com/oracle/net) $(call RunAgentvmBatch) # Stable samevm testruns (minus items from PROBLEM_LIST) -JDK_ALL_TARGETS += jdk_nio2 -jdk_nio2: $(call TestDirs, java/nio/Buffer java/nio/ByteOrder \ - java/nio/channels java/nio/MappedByteBuffer) +jdk_nio: $(call TestDirs, java/nio sun/nio com/oracle/nio) $(call SharedLibraryPermissions,java/nio/channels) $(call RunAgentvmBatch) # Stable samevm testruns (minus items from PROBLEM_LIST) -JDK_ALL_TARGETS += jdk_nio3 -jdk_nio3: $(call TestDirs, sun/nio) - $(call RunAgentvmBatch) - -# All nio tests -jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3 - @$(SummaryInfo) - -# Stable samevm testruns (minus items from PROBLEM_LIST) jdk_sctp: $(call TestDirs, com/sun/nio/sctp) $(call RunAgentvmBatch) # Stable othervm testruns (minus items from PROBLEM_LIST) # Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_rmi -jdk_rmi: $(call TestDirs, java/rmi javax/rmi sun/rmi) +jdk_rmi: $(call TestDirs, java/rmi sun/rmi javax/rmi/ssl) $(call RunOthervmBatch) # Stable samevm testruns (minus items from PROBLEM_LIST) @@ -567,9 +556,9 @@ # Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_security3 jdk_security3: $(call TestDirs, com/sun/security lib/security \ - javax/security sun/security \ - com/sun/org/apache/xml/internal/security \ - com/oracle/security/ucrypto) + javax/security sun/security \ + com/sun/org/apache/xml/internal/security \ + com/oracle/security) $(call SharedLibraryPermissions,sun/security) $(call RunAgentvmBatch) @@ -595,23 +584,19 @@ $(call RunAgentvmBatch) # Stable samevm testruns (minus items from PROBLEM_LIST) -JDK_ALL_TARGETS += jdk_tools1 -jdk_tools1: $(call TestDirs, com/sun/jdi) +JDK_ALL_TARGETS += jdk_jdi +jdk_jdi: $(call TestDirs, com/sun/jdi) $(call RunAgentvmBatch) # Stable othervm testruns (minus items from PROBLEM_LIST) # Using samevm has serious problems with these tests -JDK_ALL_TARGETS += jdk_tools2 -jdk_tools2: $(call TestDirs, \ - com/sun/tools sun/jvmstat sun/tools tools vm \ - com/sun/servicetag com/sun/tracing) +JDK_ALL_TARGETS += jdk_tools +jdk_tools: $(call TestDirs, \ + com/sun/tools sun/jvmstat sun/tools tools \ + com/sun/servicetag com/sun/tracing) $(call SharedLibraryPermissions,tools/launcher) $(call RunAgentvmBatch) -# All tools tests -jdk_tools: jdk_tools1 jdk_tools2 - @$(SummaryInfo) - # Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_util jdk_util: $(call TestDirs, java/util sun/util)
--- a/test/ProblemList.txt Wed Dec 12 12:16:30 2012 -0800 +++ b/test/ProblemList.txt Wed Dec 12 13:09:55 2012 -0800 @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -144,18 +144,44 @@ # jdk_management -# Failing, bug was filed: 6959636 -javax/management/loading/LibraryLoader/LibraryLoaderTest.java generic-all - # Access denied messages on windows/mks, filed 6954450 sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh windows-all +# Port conflict? Fails with communication error +sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh generic-all + +# Fails with port already in use +sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh generic-all + +# Fails with port already in use +sun/management/jmxremote/bootstrap/RmiRegistrySslTest.sh generic-all + +# Windows run seems to have triggered a hotspot gc error (see 6801625) +com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.sh generic-all + +# Port already in use +sun/management/jmxremote/bootstrap/LocalManagementTest.sh generic-all + +# Failed to initialize connector (also overflowing jtreg io buffers) +sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh generic-all +sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh generic-all + +# Windows X64, java.lang.IllegalStateException +javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all + +# 7149181 +sun/management/jmxremote/startstop/JMXStartStopTest.sh generic-all + +############################################################################ + +# jdk_jmx + +# Failing, bug was filed: 6959636 +javax/management/loading/LibraryLoader/LibraryLoaderTest.java generic-all + # Fails on linux: KO: StringMonitor notification missed or not emitted javax/management/monitor/NonComparableAttributeValueTest.java generic-all -# Port conflict? Fails with communication error -sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh generic-all - # Fails on Windows 2000, Test failed for iiop java.lang.NullPointerException # at org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(Unknown Source) # at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:653) @@ -170,21 +196,12 @@ # Problems with rmi connection, othervm javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java generic-all -# Fails with port already in use -sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh generic-all - -# Fails with port already in use -sun/management/jmxremote/bootstrap/RmiRegistrySslTest.sh generic-all - # Windows, connection can't last that long javax/management/eventService/LeaseTest.java generic-all # Linux othervm, X64, java.lang.Exception: Failed: ratio=102.4027795593753 javax/management/remote/mandatory/notif/ListenerScaleTest.java generic-all -# Windows run seems to have triggered a hotspot gc error (see 6801625) -com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.sh generic-all - # rmi problem? othervm, java.lang.reflect.UndeclaredThrowableException javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java generic-all @@ -207,26 +224,13 @@ # Windows i586 failure, callback did not complete javax/management/eventService/LeaseManagerDeadlockTest.java windows-all -# Port already in use -sun/management/jmxremote/bootstrap/LocalManagementTest.sh generic-all - -# Failed to initialize connector (also overflowing jtreg io buffers) -sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh generic-all -sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh generic-all - -# Windows X64, java.lang.IllegalStateException -javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all - -# 7149181 -sun/management/jmxremote/startstop/JMXStartStopTest.sh generic-all - ############################################################################ # jdk_math ############################################################################ -# jdk_misc +# jdk_other # 6988950 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all @@ -466,12 +470,6 @@ # 6461635 com/sun/tools/attach/BasicTests.sh generic-all -# Filed 6952105 -com/sun/jdi/SuspendThreadTest.java generic-all - -# Filed 6987312 -com/sun/jdi/DoubleAgentTest.java generic-all - # Filed 6986875 sun/tools/jps/jps-Vvml.sh generic-all @@ -498,6 +496,16 @@ ############################################################################ +# jdk_jdi + +# Filed 6952105 +com/sun/jdi/SuspendThreadTest.java generic-all + +# Filed 6987312 +com/sun/jdi/DoubleAgentTest.java generic-all + +############################################################################ + # jdk_util # Need 7094995 back-ported from jdk8
--- a/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh Wed Dec 12 12:16:30 2012 -0800 +++ b/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh Wed Dec 12 13:09:55 2012 -0800 @@ -1,7 +1,7 @@ #!/bin/ksh -p # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ #Call this from anywhere to fail the test with an error message # usage: fail "reason why the test failed" -fail() +fail() { echo "The test failed :-(" echo "$*" 1>&2 echo "exit status was $status" @@ -48,7 +48,7 @@ #Call this from anywhere to pass the test with a message # usage: pass "reason why the test passed if applicable" -pass() +pass() { echo "The test passed!!!" echo "$*" 1>&2 exit 0 @@ -64,20 +64,42 @@ case "$OS" in SunOS ) VAR="One value for Sun" - DEFAULT_JDK=/usr/local/java/jdk1.2/solaris + DEFAULT_JDK=/ FILESEP="/" + PATHSEP=":" + TMP="/tmp" ;; Linux ) VAR="A different value for Linux" - DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386 + DEFAULT_JDK=/ FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + + Darwin ) + VAR="A different value for MacOSX" + DEFAULT_JDK=/usr + FILESEP="/" + PATHSEP=":" + TMP="/tmp" ;; - Windows_95 | Windows_98 | Windows_NT | Windows_ME ) + Windows* ) VAR="A different value for Win32" - DEFAULT_JDK=/usr/local/java/jdk1.2/win32 + DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" FILESEP="\\" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` + ;; + + CYGWIN* ) + VAR="A different value for Cygwin" + DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0" + FILESEP="/" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` ;; # catch all other OSs @@ -88,8 +110,8 @@ esac -# Want this test to run standalone as well as in the harness, so do the -# following to copy the test's directory into the harness's scratch directory +# Want this test to run standalone as well as in the harness, so do the +# following to copy the test's directory into the harness's scratch directory # and set all appropriate variables: if [ -z "${TESTJAVA}" ] ; then @@ -104,7 +126,7 @@ if [ -n "$1" ] ; then TESTJAVA=$1 else echo "no JDK specified on command line so using default!" - TESTJAVA=$DEFAULT_JDK + TESTJAVA=$DEFAULT_JDK fi TESTSRC=. TESTCLASSES=. @@ -113,25 +135,25 @@ echo "JDK under test is: $TESTJAVA" #Deal with .class files: -if [ -n "${STANDALONE}" ] ; - then +if [ -n "${STANDALONE}" ] ; + then #if standalone, remind user to cd to dir. containing test before running it echo "Just a reminder: cd to the dir containing this test when running it" # then compile all .java files (if there are any) into .class files - if [ -a *.java ] ; + if [ -a *.java ] ; then echo "Reminder, this test should be in its own directory with all" echo "supporting files it needs in the directory with it." - ${TESTJAVA}/bin/javac ./*.java ; + ${TESTJAVA}/bin/javac ./*.java ; fi # else in harness so copy all the class files from where jtreg put them - # over to the scratch directory this test is running in. + # over to the scratch directory this test is running in. else cp ${TESTCLASSES}/*.class . ; fi -#if in test harness, then copy the entire directory that the test is in over +#if in test harness, then copy the entire directory that the test is in over # to the scratch directory. This catches any support files needed by the test. -if [ -z "${STANDALONE}" ] ; - then cp ${TESTSRC}/* . +if [ -z "${STANDALONE}" ] ; + then cp ${TESTSRC}/* . fi #Just before executing anything, make sure it has executable permission!
--- a/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh Wed Dec 12 12:16:30 2012 -0800 +++ b/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ #Call this from anywhere to fail the test with an error message # usage: fail "reason why the test failed" -fail() +fail() { echo "The test failed :-(" echo "$*" 1>&2 echo "exit status was $status" @@ -47,7 +47,7 @@ #Call this from anywhere to pass the test with a message # usage: pass "reason why the test passed if applicable" -pass() +pass() { echo "The test passed!!!" echo "$*" 1>&2 exit 0 @@ -99,20 +99,42 @@ case "$OS" in SunOS ) VAR="One value for Sun" - DEFAULT_JDK=/usr/local/java/jdk1.2.1/solaris + DEFAULT_JDK=/ FILESEP="/" + PATHSEP=":" + TMP="/tmp" ;; Linux ) VAR="A different value for Linux" - DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386 + DEFAULT_JDK=/ FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + + Darwin ) + VAR="A different value for MacOSX" + DEFAULT_JDK=/usr + FILESEP="/" + PATHSEP=":" + TMP="/tmp" ;; - Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN_NT-5.1) + Windows* ) VAR="A different value for Win32" - DEFAULT_JDK=/usr/local/java/jdk1.2.1/win32 + DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" FILESEP="\\" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` + ;; + + CYGWIN* ) + VAR="A different value for Cygwin" + DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0" + FILESEP="/" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` ;; # catch all other OSs @@ -132,12 +154,12 @@ # note that the name of the executable is in the fail string as well. # this is how to check for presence of the compiler, etc. #RESOURCE=`whence SomeProgramOrFileNeeded` -#if [ "${RESOURCE}" = "" ] ; -# then fail "Need SomeProgramOrFileNeeded to perform the test" ; +#if [ "${RESOURCE}" = "" ] ; +# then fail "Need SomeProgramOrFileNeeded to perform the test" ; #fi -# Want this test to run standalone as well as in the harness, so do the -# following to copy the test's directory into the harness's scratch directory +# Want this test to run standalone as well as in the harness, so do the +# following to copy the test's directory into the harness's scratch directory # and set all appropriate variables: if [ -z "${TESTJAVA}" ] ; then @@ -152,7 +174,7 @@ if [ -n "$1" ] ; then TESTJAVA=$1 else echo "no JDK specified on command line so using default!" - TESTJAVA=$DEFAULT_JDK + TESTJAVA=$DEFAULT_JDK fi TESTSRC=. TESTCLASSES=. @@ -161,25 +183,25 @@ echo "JDK under test is: $TESTJAVA" #Deal with .class files: -if [ -n "${STANDALONE}" ] ; - then +if [ -n "${STANDALONE}" ] ; + then #if standalone, remind user to cd to dir. containing test before running it echo "Just a reminder: cd to the dir containing this test when running it" # then compile all .java files (if there are any) into .class files - if [ -a *.java ] ; + if [ -a *.java ] ; then echo "Reminder, this test should be in its own directory with all" echo "supporting files it needs in the directory with it." - ${TESTJAVA}/bin/javac ./*.java ; + ${TESTJAVA}/bin/javac ./*.java ; fi # else in harness so copy all the class files from where jtreg put them - # over to the scratch directory this test is running in. + # over to the scratch directory this test is running in. else cp ${TESTCLASSES}/*.class . ; fi -#if in test harness, then copy the entire directory that the test is in over +#if in test harness, then copy the entire directory that the test is in over # to the scratch directory. This catches any support files needed by the test. -#if [ -z "${STANDALONE}" ] ; -# then cp ${TESTSRC}/* . +#if [ -z "${STANDALONE}" ] ; +# then cp ${TESTSRC}/* . #fi #Just before executing anything, make sure it has executable permission! @@ -198,7 +220,7 @@ # this shell test as appropriate ( 0 status is considered a pass here ) # The test verifies that appletviewer correctly works with the different -# names of the files, including relative and absolute paths +# names of the files, including relative and absolute paths # 6619458: exclude left brace from the name of the files managed by the VCS NAME='test.html'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/net/Inet4Address/PingThis.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2012 IBM Corporation + */ + +/* @test + * @bug 7163874 + * @summary InetAddress.isReachable is returning false + * for InetAdress 0.0.0.0 and ::0 + * @run main PingThis + * @run main/othervm -Djava.net.preferIPv4Stack=true PingThis + */ + +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +public class PingThis { + private static boolean hasIPv6() throws Exception { + List<NetworkInterface> nics = Collections.list(NetworkInterface + .getNetworkInterfaces()); + for (NetworkInterface nic : nics) { + List<InetAddress> addrs = Collections.list(nic.getInetAddresses()); + for (InetAddress addr : addrs) { + if (addr instanceof Inet6Address) + return true; + } + } + + return false; + } + + public static void main(String args[]) throws Exception { + if (System.getProperty("os.name").startsWith("Windows")) { + return; + } + + boolean preferIPv4Stack = "true".equals(System + .getProperty("java.net.preferIPv4Stack")); + List<String> addrs = new ArrayList<String>(); + InetAddress inetAddress = null; + + addrs.add("0.0.0.0"); + if (!preferIPv4Stack) { + if (hasIPv6()) { + addrs.add("::0"); + } + } + + for (String addr : addrs) { + inetAddress = InetAddress.getByName(addr); + System.out.println("The target ip is " + + inetAddress.getHostAddress()); + boolean isReachable = inetAddress.isReachable(3000); + System.out.println("the target is reachable: " + isReachable); + if (isReachable) { + System.out.println("Test passed "); + } else { + System.out.println("Test failed "); + throw new Exception("address " + inetAddress.getHostAddress() + + " can not be reachable!"); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/net/ResponseCache/Test.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @summary Fixed a potential NullPointerException when setting a ResponseCache that returns a null CacheRequest + * @bug 4837267 + * @author Michael McMahon + */ + +import com.sun.net.httpserver.*; +import java.net.*; +import java.io.*; +import java.util.*; + +public class Test +{ + + static class MyHandler implements HttpHandler { + public void handle(HttpExchange t) throws IOException { + byte[] b = new byte[1024]; + int r = 0; + InputStream is = t.getRequestBody(); + while (is.read(b) != -1) ; + String response = "This is the response"; + t.sendResponseHeaders(200, response.length()); + OutputStream os = t.getResponseBody(); + os.write(response.getBytes()); + os.close(); + } + } + + public static void main(String args[]) throws Exception { + HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); + server.createContext("/", new MyHandler()); + server.start(); + ResponseCache bak = ResponseCache.getDefault(); + + try { + ResponseCache.setDefault (new ResponseCache() { + public CacheResponse get (URI uri, String rqstMethod, Map<String,List<String>> rqstHeaders) + throws IOException { + return null; + } + public CacheRequest put(URI uri, URLConnection conn) throws IOException + { + return null; + } + }); + + URL url = new URL ("http://localhost:" + server.getAddress().getPort() + "/"); + URLConnection urlc = url.openConnection (); + InputStream is = urlc.getInputStream(); + while (is.read() != -1) ; + is.close(); + } finally { + ResponseCache.setDefault(bak); + server.stop(0); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/net/Socket/B6210227.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 6210227 + * @summary REGRESSION: Socket.getLocalAddress() returns address of 0.0.0.0 on outbound TCP + */ + +import java.util.*; +import java.net.*; + +public class B6210227 { + public static void main(String[] args) throws Exception + { + ServerSocket ss = new ServerSocket(0); + int port = ss.getLocalPort(); + + byte[] bad = {0,0,0,0}; + try { + InetSocketAddress isa = new InetSocketAddress(InetAddress.getLocalHost(), port); + Socket s = new Socket(); + s.connect( isa, 1000 ); + InetAddress iaLocal = s.getLocalAddress(); // if this comes back as 0.0. 0.0 this would demonstrate issue + String sLocalHostname = iaLocal.getHostName(); + if (Arrays.equals (iaLocal.getAddress(), bad)) { + throw new RuntimeException ("0.0.0.0 returned"); + } + System.out.println("local hostname is "+sLocalHostname ); + } catch(Exception e) { + System.out.println("Exception happened"); + throw e; + } finally { + ss.close(); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/nio/channels/SelectionKey/RacyRegister.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 7132889 + * @summary Test that register does not return a valid SelectionKey when + * invoked at around the time that the channel is closed + */ + +import java.nio.channels.*; +import java.util.concurrent.*; +import java.util.Random; +import java.io.IOException; + +public class RacyRegister { + + public static void main(String[] args) throws Exception { + ExecutorService pool = Executors.newFixedThreadPool(1); + try (Selector sel = Selector.open()) { + int count = 100; + while (count-- > 0) { + final SocketChannel sc = SocketChannel.open(); + sc.configureBlocking(false); + + // close channel asynchronously + Future<Void> result = pool.submit(new Callable<Void>() { + public Void call() throws IOException { + sc.close(); + return null; + } + }); + + // attempt to register channel with Selector + SelectionKey key = null; + try { + key = sc.register(sel, SelectionKey.OP_READ); + } catch (ClosedChannelException ignore) { + } + + // ensure close is done + result.get(); + + // if we have a key then it should be invalid + if (key != null && key.isValid()) + throw new RuntimeException("Key is valid"); + } + } finally { + pool.shutdown(); + } + } +}
--- a/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh Wed Dec 12 12:16:30 2012 -0800 +++ b/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh Wed Dec 12 13:09:55 2012 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -31,8 +31,22 @@ # @build ExtLoadedImplTest ExtLoadedImpl ExtLoadedImpl_Stub CheckLoader # @run shell ext.sh +OS=`uname -s` +case "$OS" in + SunOS | Linux | Darwin ) + PS=":" + ;; + Windows* | CYGWIN* ) + PS=";" + ;; + * ) + echo "Unrecognized system!" + exit 1; + ;; +esac + mkdir -p classes -cp $TESTCLASSES/*.class classes +for dir in `echo ${TESTCLASSPATH:-$TESTCLASSES} | sed -e "s/$PS/ /"` ; do cp $dir/*.class classes ; done rm classes/ExtLoadedImpl.class classes/ExtLoadedImpl_Stub.class classes/CheckLoader.class mkdir -p ext $TESTJAVA/bin/jar cf ext/ext.jar -C $TESTCLASSES ExtLoadedImpl.class -C $TESTCLASSES ExtLoadedImpl_Stub.class -C $TESTCLASSES CheckLoader.class
--- a/test/java/rmi/registry/readTest/readTest.sh Wed Dec 12 12:16:30 2012 -0800 +++ b/test/java/rmi/registry/readTest/readTest.sh Wed Dec 12 13:09:55 2012 -0800 @@ -51,7 +51,7 @@ ;; esac -TEST_CLASSPATH=.$PS$TESTCLASSES +TEST_CLASSPATH=.$PS${TESTCLASSPATH:-$TESTCLASSES} cp -r ${TESTSRC}${FS}* . ${TESTJAVA}${FS}bin${FS}javac testPkg${FS}*java ${TESTJAVA}${FS}bin${FS}javac -cp $TEST_CLASSPATH readTest.java
--- a/test/java/util/TimeZone/Bug6912560.java Wed Dec 12 12:16:30 2012 -0800 +++ b/test/java/util/TimeZone/Bug6912560.java Wed Dec 12 13:09:55 2012 -0800 @@ -40,6 +40,9 @@ // set the user.timezone property String tzname = "Asia/Tokyo"; System.setProperty("user.timezone", tzname); + // make sure the timezone will be initialized by + // the next call to TimeZone.getDefault() + TimeZone.setDefault(null); System.setSecurityManager(new SecurityManager()); TimeZone tz = TimeZone.getDefault();
--- a/test/javax/imageio/stream/StreamCloserLeak/run_test.sh Wed Dec 12 12:16:30 2012 -0800 +++ b/test/javax/imageio/stream/StreamCloserLeak/run_test.sh Wed Dec 12 13:09:55 2012 -0800 @@ -1,6 +1,6 @@ #!/bin/ksh -p # -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -78,28 +78,44 @@ case "$OS" in SunOS ) VAR="One value for Sun" - DEFAULT_JDK=/usr/local/java/jdk1.2/solaris + DEFAULT_JDK=/ + FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + + Linux ) + VAR="A different value for Linux" + DEFAULT_JDK=/ FILESEP="/" PATHSEP=":" TMP="/tmp" ;; - Linux | Darwin ) - VAR="A different value for Linux" - DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386 + Darwin ) + VAR="A different value for MacOSX" + DEFAULT_JDK=/usr FILESEP="/" PATHSEP=":" TMP="/tmp" ;; - Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN* ) + Windows* ) VAR="A different value for Win32" - DEFAULT_JDK=/usr/local/java/jdk1.2/win32 + DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" FILESEP="\\" PATHSEP=";" TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` ;; + CYGWIN* ) + VAR="A different value for Cygwin" + DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0" + FILESEP="/" + PATHSEP=";" + TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` + ;; + # catch all other OSs * ) echo "Unrecognized system! $OS"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JColorChooser/Test7194184.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2012 IBM Corporation + */ + +/* + * @test + * @bug 7194184 + * @summary Tests JColorChooser Swatch keyboard accessibility. + * @author Sean Chou + * @library ../regtesthelpers + * @build Util + * @run main Test7194184 + */ + +import java.awt.Component; +import java.awt.AWTException; +import java.awt.Color; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.KeyEvent; + +import javax.swing.JColorChooser; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +import java.util.concurrent.Callable; +import sun.awt.SunToolkit; + +public class Test7194184 implements Runnable { + private static JFrame frame; + private static JColorChooser colorChooser; + private static Color selectedColor; + + public static void main(String[] args) throws Exception { + testKeyBoardAccess(); + } + + private static void testKeyBoardAccess() throws Exception { + Robot robot = new Robot(); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + SwingUtilities.invokeLater(new Test7194184()); + toolkit.realSync(); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + selectedColor = colorChooser.getColor(); + + Component recentSwatchPanel = Util.findSubComponent(colorChooser, "RecentSwatchPanel"); + if (recentSwatchPanel == null) { + throw new RuntimeException("RecentSwatchPanel not found"); + } + recentSwatchPanel.requestFocusInWindow(); + } + }); + + toolkit.realSync(); + + // Tab to move the focus to MainSwatch + Util.hitKeys(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB); + + // Select the color on right + Util.hitKeys(robot, KeyEvent.VK_RIGHT); + Util.hitKeys(robot, KeyEvent.VK_RIGHT); + Util.hitKeys(robot, KeyEvent.VK_SPACE); + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame.dispose(); + if (selectedColor == colorChooser.getColor()) { + throw new RuntimeException("JColorChooser misses keyboard accessibility"); + } + } + }); + } + + public void run() { + String title = getClass().getName(); + frame = new JFrame(title); + colorChooser = new JColorChooser(); + + frame.add(colorChooser); + frame.pack(); + frame.setVisible(true); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JTree/8003830/bug8003830.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.EventQueue; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import javax.swing.JTree; +import javax.swing.plaf.basic.BasicTreeUI; +import javax.swing.tree.TreePath; + + +/* Originally reported as NetBeans bug 222081. + * + * @test + * @bug 8003830 + * @summary NullPointerException in BasicTreeUI.Actions when getPathBounds returns null + * @author Jaroslav Tulach + * @run main bug8003830 + */ + +public class bug8003830 implements Runnable { + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(new bug8003830()); + } + @Override + public void run() { + testNPEAtActionsPage(); + } + + public void testNPEAtActionsPage() { + JTree tree = new JTree(); + BasicTreeUI ui = new NullReturningTreeUI(); + tree.setUI(ui); + BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down"); + tpa.actionPerformed(new ActionEvent(tree, 0, "")); + } + + private static final class NullReturningTreeUI extends BasicTreeUI { + @Override + public Rectangle getPathBounds(JTree tree, TreePath path) { + // the method can return null and callers have to be ready for + // that. Simulate the case by returning null for unknown reason. + return null; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.html Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,28 @@ +<!-- + Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + This code is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 only, as + published by the Free Software Foundation. + + This code is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + version 2 for more details (a copy is included in the LICENSE file that + accompanied this code). + + You should have received a copy of the GNU General Public License version + 2 along with this work; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + or visit www.oracle.com if you need additional information or have any + questions. +--> + +<Html> +<Body> +<APPLET code="bug4506788.class" WIDTH = 600 HEIGHT = 400></APPLET> +</Body> +</Html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 4506788 7147408 + @summary Tests if cursor gets stuck after insertion a character + @author Denis Sharypov + @run applet bug4506788.html + */ +import java.awt.*; +import java.awt.event.*; +import java.lang.reflect.InvocationTargetException; +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.text.*; +import sun.awt.SunToolkit; + +public class bug4506788 extends JApplet { + + private volatile boolean passed = false; + private JEditorPane jep; + private SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + @Override + public void init() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + createAndShowGUI(); + } + }); + } catch (InterruptedException | InvocationTargetException ex) { + ex.printStackTrace(); + throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed then creating and showing GUI"); + } + } + + @Override + public void start() { + Robot robot; + try { + robot = new Robot(); + } catch (AWTException e) { + throw new RuntimeException("Robot could not be created"); + } + + toolkit.realSync(); + + Point p; + try { + p = getJEPLocOnScreen(); + } catch (Exception e) { + throw new RuntimeException("Could not get JEditorPane location on screen"); + } + + robot.setAutoDelay(50); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + robot.keyPress(KeyEvent.VK_X); + robot.keyRelease(KeyEvent.VK_X); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + + toolkit.realSync(); + + if (!passed) { + throw new RuntimeException("Test failed."); + } + } + + private Point getJEPLocOnScreen() throws Exception { + + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + result[0] = jep.getLocationOnScreen(); + } + }); + + return result[0]; + } + + private void createAndShowGUI() { + jep = new JEditorPane(); + String text = "abc"; + JFrame f = new JFrame(); + jep.setEditorKit(new StyledEditorKit()); + jep.setText(text); + jep.addCaretListener(new CaretListener() { + @Override + public void caretUpdate(CaretEvent e) { + passed = (e.getDot() == 3); + } + }); + + DefaultStyledDocument doc = (DefaultStyledDocument) jep.getDocument(); + MutableAttributeSet atr = new SimpleAttributeSet(); + StyleConstants.setBold(atr, true); + doc.setCharacterAttributes(1, 1, atr, false); + + f.getContentPane().add(jep); + f.setSize(100, 100); + f.setVisible(true); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/java2d/OpenGL/CustomCompositeTest.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7124347 + * @summary Verifies that rendering with XOR composite, and arbitraty + * custom composite doesn not cause internal errors. + * + * @run main/othervm -Dsun.java2d.opengl=True CustomCompositeTest + */ + +import java.awt.AWTException; +import java.awt.Color; +import java.awt.Composite; +import java.awt.CompositeContext; +import java.awt.Dimension; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.ImageCapabilities; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.DataBufferInt; +import java.awt.image.Raster; +import java.awt.image.SinglePixelPackedSampleModel; +import java.awt.image.VolatileImage; +import java.awt.image.WritableRaster; +import java.util.concurrent.CountDownLatch; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class CustomCompositeTest { + + private static JFrame frame; + private static CountDownLatch paintLatch; + private static Throwable paintError; + + public static void main(String[] args) { + + paintLatch = new CountDownLatch(1); + paintError = null; + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + initGUI(); + } + }); + + try { + paintLatch.await(); + } catch (InterruptedException e) { + }; + System.out.println("Paint is done!"); + if (paintError != null) { + frame.dispose(); + throw new RuntimeException("Test FAILED.", paintError); + } + + System.out.println("Phase 1: PASSED."); + + // now resise the frame in order to cause re-paint with accelerated + // source images. + paintError = null; + paintLatch = new CountDownLatch(1); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + Dimension size = frame.getSize(); + size.width += 50; + size.height += 50; + + frame.setSize(size); + } + }); + + try { + paintLatch.await(); + } catch (InterruptedException e) { + }; + if (paintError != null) { + frame.dispose(); + throw new RuntimeException("Resize test FAILED.", paintError); + } + frame.dispose(); + System.out.println("Phase 2: PASSED."); + + GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsConfiguration cfg = env.getDefaultScreenDevice().getDefaultConfiguration(); + // test rendering to accelerated volatile image + testVolatileImage(cfg, true); + System.out.println("Phase 3: PASSED."); + + // test rendering to unaccelerated volatile image + testVolatileImage(cfg, false); + System.out.println("Phase 4: PASSED."); + } + + private static void testVolatileImage(GraphicsConfiguration cfg, + boolean accelerated) + { + VolatileImage dst = null; + try { + dst = cfg.createCompatibleVolatileImage(640, 480, + new ImageCapabilities(accelerated)); + } catch (AWTException e) { + System.out.println("Unable to create volatile image, skip the test."); + return; + } + renderToVolatileImage(dst); + } + + private static void renderToVolatileImage(VolatileImage dst) { + Graphics2D g = dst.createGraphics(); + do { + System.out.println("Render to volatile image.."); + try { + MyComp.renderTest(g, dst.getHeight(), dst.getHeight()); + } catch (Throwable e) { + throw new RuntimeException("Test FAILED.", e); + } + } while (dst.contentsLost()); + System.out.println("Done."); + } + + private static void initGUI() { + frame = new JFrame("Silly composite"); + frame.getContentPane().add(new MyComp()); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } + + private static class MyComp extends JComponent { + + private static BufferedImage theImage; + + public MyComp() { + } + + private static BufferedImage getTestImage() { + if (theImage == null) { + theImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = theImage.createGraphics(); + g2d.setColor(Color.red); + g2d.fillRect(0, 0, 256, 256); + + g2d.setPaint(new GradientPaint(0, 0, Color.red, 256, 256, Color.blue)); + g2d.fillRect(0, 100, 256, 256); + g2d.dispose(); + } + return theImage; + } + + public Dimension getPreferredSize() { + return new Dimension(640, 375); + } + + public void paintComponent(Graphics g) { + + + Graphics2D g2d = (Graphics2D) g; + try { + renderTest(g2d, getWidth(), getHeight()); + } catch (Throwable e) { + paintError = e; + } + if (paintLatch != null) { + paintLatch.countDown(); + } + } + + public static void renderTest(Graphics2D g2d, int w, int h) { + g2d.setColor(Color.yellow); + g2d.fillRect(0, 0, w, h); + + BufferedImage image = getTestImage(); + // draw original image + g2d.drawRenderedImage(image, null); + + // draw image with custom composite + g2d.translate(175, 25); + Composite currentComposite = g2d.getComposite(); + g2d.setComposite(new TestComposite()); + g2d.drawRenderedImage(image, null); + g2d.setComposite(currentComposite); + + // draw image with XOR + g2d.translate(175, 25); + g2d.setXORMode(Color.red); + g2d.drawRenderedImage(image, null); + + + System.out.println("Painting is done..."); + } + } + + // A silly custom Composite to demonstrate the problem - just inverts the RGB + private static class TestComposite implements Composite { + + public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) { + return new TestCompositeContext(); + } + } + + private static class TestCompositeContext implements CompositeContext { + + public void dispose() { + } + + public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { + int w = src.getWidth(); + int h = src.getHeight(); + + DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); + DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); + int srcRGB[] = srcDB.getBankData()[0]; + int dstOutRGB[] = dstOutDB.getBankData()[0]; + int srcOffset = srcDB.getOffset(); + int dstOutOffset = dstOutDB.getOffset(); + int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); + int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); + int srcAdjust = srcScanStride - w; + int dstOutAdjust = dstOutScanStride - w; + + int si = srcOffset; + int doi = dstOutOffset; + + for (int i = 0; i < h; i++) { + for (int j = 0; j < w; j++) { + dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; + si++; + doi++; + } + + si += srcAdjust; + doi += dstOutAdjust; + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/management/AgentCMETest.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2012 IBM Corporation + */ + +/** + * @test + * @bug 7164191 + * @summary properties.putAll API may fail with ConcurrentModifcationException on multi-thread scenario + * @author Deven You + */ + +import java.util.Properties; +import sun.management.Agent; + +public class AgentCMETest { + static Class<?> agentClass; + + /** + * In sun.management.Agent.loadManagementProperties(), call + * properties.putAll API may fail with ConcurrentModifcationException if the + * system properties are modified simultaneously by another thread + * + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + System.out.println("Start..."); + + final Properties properties = System.getProperties(); + Thread t1 = new Thread(new Runnable() { + public void run() { + for (int i = 0; i < 100; i++) { + properties.put(String.valueOf(i), ""); + try { + Thread.sleep(1); + } catch (InterruptedException e) { + // do nothing + } + } + } + }); + t1.start(); + + for (int i = 0; i < 10000; i++) { + Agent.loadManagementProperties(); + } + + System.out.println("Finished..."); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/net/www/MessageHeaderTest.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8003948 + * @run main MessageHeaderTest + */ +import java.io.*; +import sun.net.www.MessageHeader; + +public class MessageHeaderTest { + public static void main (String[] args) throws Exception { + for (int i=0; i<7; i++) { + ByteArrayInputStream bis = new ByteArrayInputStream(headers[i].getBytes()); + MessageHeader h = new MessageHeader(bis); + String before = h.toString(); + before = before.substring(before.indexOf('{')); + boolean result = h.filterNTLMResponses("WWW-Authenticate"); + String after = h.toString(); + after = after.substring(after.indexOf('{')); + if (!expected[i].equals(after)) { + throw new RuntimeException(Integer.toString(i) + " expected != after"); + } + if (result != expectedResult[i]) { + throw new RuntimeException(Integer.toString(i) + " result != expectedResult"); + } + } + } + + static String expected[] = { + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: }", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}{Bar: foo}", + "{null: HTTP/1.1 200 Ok}{WWW-Authenticate: Negotiate}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM}{Bar: foo}{WWW-Authenticate: Kerberos}", + "{null: HTTP/1.1 200 Ok}{Foo: foo}{Bar: }{WWW-Authenticate: NTLM blob}{Bar: foo blob}" + }; + + static boolean[] expectedResult = { + false, false, true, true, true, false, false + }; + + static String[] headers = { + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate:", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nWWW-Authenticate: Negotiate", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nWWW-Authenticate: Negotiate\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nWWW-Authenticate: Negotiate\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nBar: foo\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nWWW-Authenticate: Negotiate\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM\r\nBar: foo\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nFoo: foo\r\nBar:\r\nWWW-Authenticate: NTLM blob\r\nBar: foo blob" + }; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/rmi/rmic/classpath/RMICClassPathTest.java Wed Dec 12 13:09:55 2012 -0800 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Portions Copyright (c) 2012 IBM Corporation + */ + +/* @test + * @bug 6610897 + * @summary New constructor in sun.tools.java.ClassPath builds a path using + * File.separator instead of File.pathSeparator + * @run main RMICClassPathTest + */ + +import java.io.File; + +import sun.rmi.rmic.BatchEnvironment; + +public class RMICClassPathTest { + public static void main(String[] args) throws Exception { + String sysPath = "/home/~user/jdk/jre/lib/rt.jar"; + String extDir = ""; + String clPath = "/home/~user/user.jar" + File.pathSeparator + + "/home/~user/user2.jar" + File.pathSeparator + + "/home/~user/user3.jar"; + + String cpStr = BatchEnvironment.createClassPath(clPath, sysPath, extDir).toString(); + + String[] paths = cpStr.split(File.pathSeparator); + + if (paths.length != 4) { + throw new Exception("ClassPath length is not correct: the expected length is 4 and the actual length is " + paths.length); + } + } +}
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/InterruptedIO.java Wed Dec 12 12:16:30 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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 4393337 - * @summary [TEST RUNS ON SOLARIS ONLY] Throw an InterruptedIOException - * when read on SSLSocket is * interrupted. - */ - -import java.io.InputStream; -import java.io.IOException; -import java.io.InterruptedIOException; -import java.net.Socket; -import javax.net.ssl.*; - -/** - * Interrupts an SSL socket that is blocked on a read. An - * InterruptedIOException will be thrown and handled within the test if the - * test completes correctly. - */ - -public class InterruptedIO { - - /** - * Starts a client and a server thread. Gives the client enough time to - * block in a read, then interrupts it. - */ - public static void main(String[] args) throws Exception { - - String reason = - "Test valid only on SunOS.\n" + - "=========================\n" + - "It was determined that Thread.interrupt() could \n" + - "not be reliably return InterruptedIOException \n" + - "on non-Solaris implementations. Thread.interrupt() \n" + - "API was updated in merlin (JDK 1.4) to reflect this.\n"; - System.out.println(reason); - - String osName = System.getProperty("os.name", ""); - if (!osName.equalsIgnoreCase("SunOS")) { - System.out.println("Ignoring test on '" + osName + "'"); - return; - } - - String testRoot = System.getProperty("test.src", "."); - System.setProperty("javax.net.ssl.keyStore", - testRoot + - "/../../../../../../../etc/keystore"); - System.setProperty("javax.net.ssl.keyStorePassword", - "passphrase"); - System.setProperty("javax.net.ssl.trustStore", - testRoot + - "/../../../../../../../etc/truststore"); - - Server server = new Server(); - server.start(); - - Client client = new Client(server.getPort()); // Will do handshake - client.start(); // Will block in read - - // sleep for 5 seconds - System.out.println("Main - Pausing for 5 seconds..."); - Thread.sleep(5 * 1000); - - System.out.println("Main - Interrupting client reader thread"); - client.interrupt(); - client.join(); // Wait for client thread to complete - - if (client.failed()) - throw new Exception("Main - Test InterruptedIO failed " - + "on client side."); - else - System.out.println("Main - Test InterruptedIO successful!"); - } - - /** - * Accepts an incoming SSL Connection. Then blocks in a read. - */ - static class Server extends Thread { - - private SSLServerSocket ss; - - public Server() throws Exception { - ss = (SSLServerSocket) SSLServerSocketFactory.getDefault(). - createServerSocket(0); - } - - public int getPort() { - return ss.getLocalPort(); - } - - public void run() { - try { - System.out.println("Server - Will accept connections on port " - + getPort()); - Socket s = ss.accept(); - InputStream is = s.getInputStream(); - // We want the client to block so deadlock - is.read(); - } catch (IOException e) { - // Happens when client closese connection. - // If an error occurs, Client will detect problem - } - } - } - - /** - * Initiates an SSL connection to a server. Then blocks in a read. It - * should be interrupted by another thread. An InterruptedIOException - * is expected to be thrown. - */ - static class Client extends Thread { - - private SSLSocket socket; - private InputStream inStream; - private boolean failed = false; - - public Client(int port) throws Exception { - socket = (SSLSocket) SSLSocketFactory.getDefault(). - createSocket("localhost", port); - inStream = socket.getInputStream(); - System.out.println("Client - " - + "Connected to: localhost" + ":" + port); - System.out.println("Client - " - + "Doing SSL Handshake..."); - socket.startHandshake(); // Asynchronous call - System.out.println("Client - Done with SSL Handshake"); - } - - public void run() { - - try { - System.out.println("Client - Reading from input stream ..."); - if (inStream.read() == -1) { - System.out.println("Client - End-of-stream detected"); - failed = true; - } - } catch (InterruptedIOException e) { - System.out.println("Client - " - + "As expected, InterruptedIOException " - + "was thrown. Message: " - + e.getMessage()); - } catch (Exception e) { - System.out.println("Client - Unexpected exception:"); - e.printStackTrace(); - failed = true; - } finally { - try { - socket.close(); - } catch (IOException e) { - // Squelch it - } - } - } - - public boolean failed() { - return failed; - } - - } - -}
--- a/test/sun/text/resources/LocaleData Wed Dec 12 12:16:30 2012 -0800 +++ b/test/sun/text/resources/LocaleData Wed Dec 12 13:09:55 2012 -0800 @@ -7007,3 +7007,8 @@ CurrencyNames/zh_TW/cuc=\u53e4\u5df4\u53ef\u8f49\u63db\u62ab\u7d22 CurrencyNames/zh_TW/tmt=\u571f\u5eab\u66fc\u65b0\u99ac\u7d0d\u7279 CurrencyNames/zh_TW/zwl=\u8f9b\u5df4\u5a01\u5143 (2009) + +# bug 7171028 +FormatData/sl/DateTimePatterns/4=EEEE, dd. MMMM y +FormatData/sl/DateTimePatterns/5=dd. MMMM y +
--- a/test/sun/text/resources/LocaleDataTest.java Wed Dec 12 12:16:30 2012 -0800 +++ b/test/sun/text/resources/LocaleDataTest.java Wed Dec 12 13:09:55 2012 -0800 @@ -34,6 +34,7 @@ * 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611 * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787 * 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7189611 + * 7171028 * @summary Verify locale data * */