提交 7185d192 编写于 作者: L lana

Merge

......@@ -70,10 +70,7 @@ endif
ifeq ($(OPENJDK_TARGET_OS), windows)
# AccessBridge is compiled separately below.
EXFILES += AccessBridge.java \
AccessBridgeLoader.java \
com/sun/java/accessibility/util/java/awt/ChoiceTranslator.java
# This seems to never be built
EXCLUDES += com/sun/java/accessibility/extensions
AccessBridgeLoader.java
endif
ifneq ($(OPENJDK_TARGET_OS), solaris)
......
......@@ -650,17 +650,8 @@ $(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupArchive,BUILD_JACCESS_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes, \
INCLUDES := com/sun/java/accessibility/util, \
JAR := $(IMAGES_OUTPUTDIR)/lib/ext/jaccess.jar, \
SKIP_METAINF := true))
JARS += $(IMAGES_OUTPUTDIR)/lib/ext/jaccess.jar
ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
$(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_32_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_ab/32bit, \
INCLUDES := com/sun/java/accessibility, \
......@@ -675,7 +666,7 @@ $(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
JARS += $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-32.jar \
$(IMAGES_OUTPUTDIR)/lib/ext/access-bridge.jar
else
else
$(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_64_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_ab/64bit, \
INCLUDES := com/sun/java/accessibility, \
......@@ -683,8 +674,16 @@ $(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
SKIP_METAINF := true))
JARS += $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-64.jar
endif
endif
endif
$(eval $(call SetupArchive,BUILD_JACCESS_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes, \
INCLUDES := com/sun/java/accessibility/util, \
JAR := $(IMAGES_OUTPUTDIR)/lib/ext/jaccess.jar, \
SKIP_METAINF := true))
JARS += $(IMAGES_OUTPUTDIR)/lib/ext/jaccess.jar
##########################################################################################
......
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -630,7 +630,7 @@ class CAccessibility implements PropertyChangeListener {
if (!allowIgnored) {
final AccessibleRole role = context.getAccessibleRole();
if (role != null && ignoredRoles.contains(roleKey(role))) {
if (role != null && ignoredRoles != null && ignoredRoles.contains(roleKey(role))) {
// Get the child's unignored children.
_addChildren(child, whichChildren, false, childrenAndRoles);
} else {
......
/*
* Copyright (c) 1999, 2013 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......
/*
* Copyright (c) 2008, 2013 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error creating directory "{0}": No such file or directory
FileChooser.deleteFileButton.textAndMnemonic=De&lete File
FileChooser.renameFileButton.textAndMnemonic=&Rename File
FileChooser.cancelButton.textAndMnemonic=&Cancel
FileChooser.saveButton.textAndMnemonic=&OK
FileChooser.openButton.textAndMnemonic=&OK
FileChooser.cancelButton.textAndMnemonic=Cancel
FileChooser.saveButton.textAndMnemonic=OK
FileChooser.openButton.textAndMnemonic=OK
FileChooser.saveDialogTitle.textAndMnemonic=Save
FileChooser.openDialogTitle.textAndMnemonic=Open
FileChooser.pathLabel.textAndMnemonic=&Selection:
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fehler
FileChooser.newFolderNoDirectoryError.textAndMnemonic=Fehler beim Erstellen von Verzeichnis "{0}": Datei oder Verzeichnis nicht vorhanden
FileChooser.deleteFileButton.textAndMnemonic=Datei &l\u00F6schen
FileChooser.renameFileButton.textAndMnemonic=Datei &umbenennen
FileChooser.cancelButton.textAndMnemonic=&Abbrechen
FileChooser.saveButton.textAndMnemonic=&OK
FileChooser.openButton.textAndMnemonic=&OK
FileChooser.cancelButton.textAndMnemonic=Abbrechen
FileChooser.saveButton.textAndMnemonic=OK
FileChooser.openButton.textAndMnemonic=OK
FileChooser.saveDialogTitle.textAndMnemonic=Speichern
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error al crear el directorio "{0}": no existe dicho archivo o directorio
FileChooser.deleteFileButton.textAndMnemonic=Su&primir Archivo
FileChooser.renameFileButton.textAndMnemonic=Cambiar Nomb&re de Archivo
FileChooser.cancelButton.textAndMnemonic=&Cancelar
FileChooser.saveButton.textAndMnemonic=&Aceptar
FileChooser.openButton.textAndMnemonic=&Aceptar
FileChooser.cancelButton.textAndMnemonic=Cancelar
FileChooser.saveButton.textAndMnemonic=Aceptar
FileChooser.openButton.textAndMnemonic=Aceptar
FileChooser.saveDialogTitle.textAndMnemonic=Guardar
FileChooser.openDialogTitle.textAndMnemonic=Abrir
FileChooser.pathLabel.textAndMnemonic=&Selecci\u00F3n:
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erreur
FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erreur lors de la cr\u00E9ation du r\u00E9pertoire "{0}" : ce fichier ou r\u00E9pertoire n''existe pas
FileChooser.deleteFileButton.textAndMnemonic=Supprimer &le fichier
FileChooser.renameFileButton.textAndMnemonic=&Renommer le fichier
FileChooser.cancelButton.textAndMnemonic=&Annuler
FileChooser.saveButton.textAndMnemonic=&OK
FileChooser.openButton.textAndMnemonic=&OK
FileChooser.cancelButton.textAndMnemonic=Annuler
FileChooser.saveButton.textAndMnemonic=OK
FileChooser.openButton.textAndMnemonic=OK
FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
FileChooser.pathLabel.textAndMnemonic=&S\u00E9lection :
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Errore
FileChooser.newFolderNoDirectoryError.textAndMnemonic=Errore durante la creazione della directory "{0}": file o directory inesistente
FileChooser.deleteFileButton.textAndMnemonic=E&limina file
FileChooser.renameFileButton.textAndMnemonic=&Rinomina file
FileChooser.cancelButton.textAndMnemonic=&Annulla
FileChooser.saveButton.textAndMnemonic=&OK
FileChooser.openButton.textAndMnemonic=&OK
FileChooser.cancelButton.textAndMnemonic=Annulla
FileChooser.saveButton.textAndMnemonic=OK
FileChooser.openButton.textAndMnemonic=OK
FileChooser.saveDialogTitle.textAndMnemonic=Salva
FileChooser.openDialogTitle.textAndMnemonic=Apri
FileChooser.pathLabel.textAndMnemonic=&Selezione:
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u30A8\u30E9\u30FC
FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA"{0}"\u306E\u4F5C\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: \u3053\u306E\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
FileChooser.deleteFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u524A\u9664(&L)
FileChooser.renameFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u5909\u66F4(&R)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
FileChooser.saveButton.textAndMnemonic=OK(&O)
FileChooser.openButton.textAndMnemonic=OK(&O)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=OK
FileChooser.openButton.textAndMnemonic=OK
FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F
FileChooser.pathLabel.textAndMnemonic=\u9078\u629E(&S):
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\uC624\uB958
FileChooser.newFolderNoDirectoryError.textAndMnemonic="{0}" \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
FileChooser.deleteFileButton.textAndMnemonic=\uD30C\uC77C \uC0AD\uC81C(&L)
FileChooser.renameFileButton.textAndMnemonic=\uD30C\uC77C \uC774\uB984 \uBC14\uAFB8\uAE30(&R)
FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C(&C)
FileChooser.saveButton.textAndMnemonic=\uD655\uC778(&O)
FileChooser.openButton.textAndMnemonic=\uD655\uC778(&O)
FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C
FileChooser.saveButton.textAndMnemonic=\uD655\uC778
FileChooser.openButton.textAndMnemonic=\uD655\uC778
FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5
FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30
FileChooser.pathLabel.textAndMnemonic=\uC120\uD0DD \uC0AC\uD56D(&S):
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erro
FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erro ao criar o diret\u00F3rio "{0}": N\u00E3o h\u00E1 arquivo ou diret\u00F3rio
FileChooser.deleteFileButton.textAndMnemonic=De&letar Arquivo
FileChooser.renameFileButton.textAndMnemonic=&Renomear Arquivo
FileChooser.cancelButton.textAndMnemonic=&Cancelar
FileChooser.saveButton.textAndMnemonic=&OK
FileChooser.openButton.textAndMnemonic=&OK
FileChooser.cancelButton.textAndMnemonic=Cancelar
FileChooser.saveButton.textAndMnemonic=OK
FileChooser.openButton.textAndMnemonic=OK
FileChooser.saveDialogTitle.textAndMnemonic=Salvar
FileChooser.openDialogTitle.textAndMnemonic=Abrir
FileChooser.pathLabel.textAndMnemonic=&Sele\u00E7\u00E3o:
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fel
FileChooser.newFolderNoDirectoryError.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6rs\u00F6k att skapa katalogen "{0}": Filen eller katalogen finns inte
FileChooser.deleteFileButton.textAndMnemonic=Ta &bort fil
FileChooser.renameFileButton.textAndMnemonic=&\u00C4ndra namn p\u00E5 filen
FileChooser.cancelButton.textAndMnemonic=&Avbryt
FileChooser.saveButton.textAndMnemonic=&OK
FileChooser.openButton.textAndMnemonic=&OK
FileChooser.cancelButton.textAndMnemonic=Avbryt
FileChooser.saveButton.textAndMnemonic=OK
FileChooser.openButton.textAndMnemonic=OK
FileChooser.saveDialogTitle.textAndMnemonic=Spara
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
FileChooser.pathLabel.textAndMnemonic=&Urval:
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u9519\u8BEF
FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u521B\u5EFA\u76EE\u5F55 "{0}" \u65F6\u51FA\u9519: \u6CA1\u6709\u6B64\u7C7B\u6587\u4EF6\u6216\u76EE\u5F55
FileChooser.deleteFileButton.textAndMnemonic=\u5220\u9664\u6587\u4EF6(&L)
FileChooser.renameFileButton.textAndMnemonic=\u91CD\u547D\u540D\u6587\u4EF6(&R)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
FileChooser.saveButton.textAndMnemonic=\u786E\u5B9A(&O)
FileChooser.openButton.textAndMnemonic=\u786E\u5B9A(&O)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u786E\u5B9A
FileChooser.openButton.textAndMnemonic=\u786E\u5B9A
FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
FileChooser.pathLabel.textAndMnemonic=\u9009\u5B9A\u5185\u5BB9(&S):
......
......@@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u932F\u8AA4
FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u5EFA\u7ACB\u76EE\u9304 "{0}" \u6642\u767C\u751F\u932F\u8AA4: \u6C92\u6709\u6B64\u6A94\u6848\u6216\u76EE\u9304
FileChooser.deleteFileButton.textAndMnemonic=\u522A\u9664\u6A94\u6848(&L)
FileChooser.renameFileButton.textAndMnemonic=\u91CD\u65B0\u547D\u540D\u6A94\u6848(&R)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
FileChooser.saveButton.textAndMnemonic=\u78BA\u5B9A(&O)
FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A(&O)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u78BA\u5B9A
FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A
FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58
FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F
FileChooser.pathLabel.textAndMnemonic=\u9078\u53D6(&S):
......
......@@ -79,18 +79,20 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
* Takes a JarFile and converts into a pack-stream.
* <p>
* Closes its input but not its output. (Pack200 archives are appendable.)
* @param in a JarFile
*
* @param in a JarFile
* @param out an OutputStream
* @exception IOException if an error is encountered.
*/
public synchronized void pack(JarFile in, OutputStream out) throws IOException {
assert(Utils.currentInstance.get() == null);
TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))
? null
: TimeZone.getDefault();
assert (Utils.currentInstance.get() == null);
boolean needUTC = !props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE);
try {
Utils.currentInstance.set(this);
if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
if (needUTC) {
Utils.changeDefaultTimeZoneToUtc();
}
if ("0".equals(props.getProperty(Pack200.Packer.EFFORT))) {
Utils.copyJarFile(in, out);
......@@ -99,7 +101,9 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
}
} finally {
Utils.currentInstance.set(null);
if (tz != null) TimeZone.setDefault(tz);
if (needUTC) {
Utils.restoreDefaultTimeZone();
}
in.close();
}
}
......@@ -119,12 +123,13 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
* @exception IOException if an error is encountered.
*/
public synchronized void pack(JarInputStream in, OutputStream out) throws IOException {
assert(Utils.currentInstance.get() == null);
TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)) ? null :
TimeZone.getDefault();
assert (Utils.currentInstance.get() == null);
boolean needUTC = !props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE);
try {
Utils.currentInstance.set(this);
if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
if (needUTC) {
Utils.changeDefaultTimeZoneToUtc();
}
if ("0".equals(props.getProperty(Pack200.Packer.EFFORT))) {
Utils.copyJarFile(in, out);
} else {
......@@ -132,10 +137,13 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
}
} finally {
Utils.currentInstance.set(null);
if (tz != null) TimeZone.setDefault(tz);
if (needUTC) {
Utils.restoreDefaultTimeZone();
}
in.close();
}
}
/**
* Register a listener for changes to options.
* @param listener An object to be invoked when a property is changed.
......
......@@ -96,13 +96,15 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
//Driver routines
// The unpack worker...
/**
* Takes a packed-stream InputStream, and writes to a JarOutputStream. Internally
* the entire buffer must be read, it may be more efficient to read the packed-stream
* to a file and pass the File object, in the alternate method described below.
* <p>
* Closes its input but not its output. (The output can accumulate more elements.)
* @param in an InputStream.
*
* @param in an InputStream.
* @param out a JarOutputStream.
* @exception IOException if an error is encountered.
*/
......@@ -113,19 +115,19 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
if (out == null) {
throw new NullPointerException("null output");
}
assert(Utils.currentInstance.get() == null);
TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))
? null
: TimeZone.getDefault();
assert (Utils.currentInstance.get() == null);
boolean needUTC = !props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE);
try {
Utils.currentInstance.set(this);
if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
if (needUTC) {
Utils.changeDefaultTimeZoneToUtc();
}
final int verbose = props.getInteger(Utils.DEBUG_VERBOSE);
BufferedInputStream in0 = new BufferedInputStream(in);
if (Utils.isJarMagic(Utils.readMagic(in0))) {
if (verbose > 0)
if (verbose > 0) {
Utils.log.info("Copying unpacked JAR file...");
}
Utils.copyJarFile(new JarInputStream(in0), out);
} else if (props.getBoolean(Utils.DEBUG_DISABLE_NATIVE)) {
(new DoUnpack()).run(in0, out);
......@@ -144,7 +146,9 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
} finally {
_nunp = null;
Utils.currentInstance.set(null);
if (tz != null) TimeZone.setDefault(tz);
if (needUTC) {
Utils.restoreDefaultTimeZone();
}
}
}
......@@ -152,7 +156,8 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
* Takes an input File containing the pack file, and generates a JarOutputStream.
* <p>
* Does not close its output. (The output can accumulate more elements.)
* @param in a File.
*
* @param in a File.
* @param out a JarOutputStream.
* @exception IOException if an error is encountered.
*/
......
......@@ -34,6 +34,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collections;
import java.util.Date;
import java.util.TimeZone;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
......@@ -133,6 +134,9 @@ class Utils {
// to the engine code, especially the native code.
static final ThreadLocal<TLGlobals> currentInstance = new ThreadLocal<>();
private static TimeZone tz;
private static int workingPackerCount = 0;
// convenience method to access the TL globals
static TLGlobals getTLGlobals() {
return currentInstance.get();
......@@ -203,6 +207,24 @@ class Utils {
}
}
static synchronized void changeDefaultTimeZoneToUtc() {
if (workingPackerCount++ == 0) {
// only first thread saves default TZ
tz = TimeZone.getDefault();
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
}
static synchronized void restoreDefaultTimeZone() {
if (--workingPackerCount == 0) {
// reset timezone when all the packer/unpacker instances have terminated
if (tz != null) {
TimeZone.setDefault(tz);
}
tz = null;
}
}
static final Pack200Logger log
= new Pack200Logger("java.util.jar.Pack200");
......
......@@ -43,13 +43,13 @@ FileChooser.renameErrorFileExists.textAndMnemonic=Cannot rename {0}: A file with
Specify a different file name.
FileChooser.acceptAllFileFilter.textAndMnemonic=All Files
FileChooser.cancelButton.textAndMnemonic=Cancel
FileChooser.saveButton.textAndMnemonic=&Save
FileChooser.openButton.textAndMnemonic=&Open
FileChooser.saveButton.textAndMnemonic=Save
FileChooser.openButton.textAndMnemonic=Open
FileChooser.saveDialogTitle.textAndMnemonic=Save
FileChooser.openDialogTitle.textAndMnemonic=Open
FileChooser.updateButton.textAndMnemonic=&Update
FileChooser.helpButton.textAndMnemonic=&Help
FileChooser.directoryOpenButton.textAndMnemonic=&Open
FileChooser.directoryOpenButton.textAndMnemonic=Open
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic={0} kann nicht umbenannt werden
FileChooser.renameErrorFileExists.textAndMnemonic={0} kann nicht umbenannt werden: Es ist bereits eine Datei mit dem angegebenen Namen vorhanden. Geben Sie einen anderen Dateinamen an.
FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
FileChooser.cancelButton.textAndMnemonic=Abbrechen
FileChooser.saveButton.textAndMnemonic=&Speichern
FileChooser.openButton.textAndMnemonic=\u00D6&ffnen
FileChooser.saveButton.textAndMnemonic=Speichern
FileChooser.openButton.textAndMnemonic=\u00D6ffnen
FileChooser.saveDialogTitle.textAndMnemonic=Speichern
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
FileChooser.updateButton.textAndMnemonic=A&ktualisieren
FileChooser.helpButton.textAndMnemonic=&Hilfe
FileChooser.directoryOpenButton.textAndMnemonic=\u00D6&ffnen
FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ffnen
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=No se puede cambiar el nombre de {0}
FileChooser.renameErrorFileExists.textAndMnemonic=No se puede cambiar el nombre de {0}: ya existe un archivo con el nombre especificado. Especifique otro nombre de archivo.
FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
FileChooser.cancelButton.textAndMnemonic=Cancelar
FileChooser.saveButton.textAndMnemonic=&Guardar
FileChooser.openButton.textAndMnemonic=&Abrir
FileChooser.saveButton.textAndMnemonic=Guardar
FileChooser.openButton.textAndMnemonic=Abrir
FileChooser.saveDialogTitle.textAndMnemonic=Guardar
FileChooser.openDialogTitle.textAndMnemonic=Abrir
FileChooser.updateButton.textAndMnemonic=Act&ualizar
FileChooser.helpButton.textAndMnemonic=A&yuda
FileChooser.directoryOpenButton.textAndMnemonic=&Abrir
FileChooser.directoryOpenButton.textAndMnemonic=Abrir
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=Impossible de renommer {0}
FileChooser.renameErrorFileExists.textAndMnemonic=Impossible de renommer {0} : il existe d\u00E9j\u00E0 un fichier portant le nom indiqu\u00E9. Indiquez-en un autre.
FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
FileChooser.cancelButton.textAndMnemonic=Annuler
FileChooser.saveButton.textAndMnemonic=Enregi&strer
FileChooser.openButton.textAndMnemonic=&Ouvrir
FileChooser.saveButton.textAndMnemonic=Enregistrer
FileChooser.openButton.textAndMnemonic=Ouvrir
FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jo&ur
FileChooser.helpButton.textAndMnemonic=&Aide
FileChooser.directoryOpenButton.textAndMnemonic=&Ouvrir
FileChooser.directoryOpenButton.textAndMnemonic=Ouvrir
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=Impossibile rinominare {0}
FileChooser.renameErrorFileExists.textAndMnemonic=Impossibile rinominare {0}: esiste gi\u00E0 un file con il nome specificato. Specificare un altro nome.
FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
FileChooser.cancelButton.textAndMnemonic=Annulla
FileChooser.saveButton.textAndMnemonic=Sal&va
FileChooser.openButton.textAndMnemonic=&Apri
FileChooser.saveButton.textAndMnemonic=Salva
FileChooser.openButton.textAndMnemonic=Apri
FileChooser.saveDialogTitle.textAndMnemonic=Salva
FileChooser.openDialogTitle.textAndMnemonic=Apri
FileChooser.updateButton.textAndMnemonic=Ag&giorna
FileChooser.helpButton.textAndMnemonic=&?
FileChooser.directoryOpenButton.textAndMnemonic=&Apri
FileChooser.directoryOpenButton.textAndMnemonic=Apri
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\
FileChooser.renameErrorFileExists.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093: \u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u5225\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002
FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58(&S)
FileChooser.openButton.textAndMnemonic=\u958B\u304F(&O)
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58
FileChooser.openButton.textAndMnemonic=\u958B\u304F
FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F
FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0(&U)
FileChooser.helpButton.textAndMnemonic=\u30D8\u30EB\u30D7(&H)
FileChooser.directoryOpenButton.textAndMnemonic=\u958B\u304F(&O)
FileChooser.directoryOpenButton.textAndMnemonic=\u958B\u304F
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic={0}\uC758 \uC774\uB984\uC744 \uBC14\uAFC
FileChooser.renameErrorFileExists.textAndMnemonic={0}\uC758 \uC774\uB984\uC744 \uBC14\uAFC0 \uC218 \uC5C6\uC74C: \uC9C0\uC815\uD55C \uC774\uB984\uC744 \uC0AC\uC6A9\uD558\uB294 \uD30C\uC77C\uC774 \uC874\uC7AC\uD569\uB2C8\uB2E4. \uB2E4\uB978 \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD558\uC2ED\uC2DC\uC624.
FileChooser.acceptAllFileFilter.textAndMnemonic=\uBAA8\uB4E0 \uD30C\uC77C
FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C
FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5(&S)
FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30(&O)
FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5
FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30
FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5
FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30
FileChooser.updateButton.textAndMnemonic=\uC5C5\uB370\uC774\uD2B8(&U)
FileChooser.helpButton.textAndMnemonic=\uB3C4\uC6C0\uB9D0(&H)
FileChooser.directoryOpenButton.textAndMnemonic=\uC5F4\uAE30(&O)
FileChooser.directoryOpenButton.textAndMnemonic=\uC5F4\uAE30
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=N\u00E3o \u00E9 poss\u00EDvel renomear {
FileChooser.renameErrorFileExists.textAndMnemonic=N\u00E3o \u00E9 poss\u00EDvel renomear {0}: Um arquivo com o nome especificado j\u00E1 existe. Especifique outro nome de arquivo.
FileChooser.acceptAllFileFilter.textAndMnemonic=Todos os Arquivos
FileChooser.cancelButton.textAndMnemonic=Cancelar
FileChooser.saveButton.textAndMnemonic=&Salvar
FileChooser.openButton.textAndMnemonic=A&brir
FileChooser.saveButton.textAndMnemonic=Salvar
FileChooser.openButton.textAndMnemonic=Abrir
FileChooser.saveDialogTitle.textAndMnemonic=Salvar
FileChooser.openDialogTitle.textAndMnemonic=Abrir
FileChooser.updateButton.textAndMnemonic=At&ualizar
FileChooser.helpButton.textAndMnemonic=Aj&uda
FileChooser.directoryOpenButton.textAndMnemonic=A&brir
FileChooser.directoryOpenButton.textAndMnemonic=Abrir
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=Kan inte namn\u00E4ndra {0}
FileChooser.renameErrorFileExists.textAndMnemonic=Kan inte namn\u00E4ndra {0}: En fil med angivet namn finns redan. Ange ett annat filnamn.
FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
FileChooser.cancelButton.textAndMnemonic=Avbryt
FileChooser.saveButton.textAndMnemonic=&Spara
FileChooser.openButton.textAndMnemonic=&\u00D6ppna
FileChooser.saveButton.textAndMnemonic=Spara
FileChooser.openButton.textAndMnemonic=\u00D6ppna
FileChooser.saveDialogTitle.textAndMnemonic=Spara
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
FileChooser.updateButton.textAndMnemonic=Upp&datera
FileChooser.helpButton.textAndMnemonic=&Hj\u00E4lp
FileChooser.directoryOpenButton.textAndMnemonic=&\u00D6ppna
FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ppna
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=\u65E0\u6CD5\u91CD\u547D\u540D{0}
FileChooser.renameErrorFileExists.textAndMnemonic=\u65E0\u6CD5\u91CD\u547D\u540D{0}: \u5DF2\u5B58\u5728\u5177\u6709\u6240\u6307\u5B9A\u540D\u79F0\u7684\u6587\u4EF6\u3002\u8BF7\u6307\u5B9A\u5176\u4ED6\u6587\u4EF6\u540D\u3002
FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6587\u4EF6
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58(&S)
FileChooser.openButton.textAndMnemonic=\u6253\u5F00(&O)
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58
FileChooser.openButton.textAndMnemonic=\u6253\u5F00
FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0(&U)
FileChooser.helpButton.textAndMnemonic=\u5E2E\u52A9(&H)
FileChooser.directoryOpenButton.textAndMnemonic=\u6253\u5F00(&O)
FileChooser.directoryOpenButton.textAndMnemonic=\u6253\u5F00
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=\u7121\u6CD5\u91CD\u65B0\u547D\u540D {0}
FileChooser.renameErrorFileExists.textAndMnemonic=\u7121\u6CD5\u91CD\u65B0\u547D\u540D {0}: \u5DF2\u7D93\u5B58\u5728\u60A8\u6240\u6307\u5B9A\u540D\u7A31\u7684\u6A94\u6848\u3002\u8ACB\u6307\u5B9A\u4E0D\u540C\u7684\u540D\u7A31\u3002
FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6A94\u6848
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u5132\u5B58(&S)
FileChooser.openButton.textAndMnemonic=\u958B\u555F(&O)
FileChooser.saveButton.textAndMnemonic=\u5132\u5B58
FileChooser.openButton.textAndMnemonic=\u958B\u555F
FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58
FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F
FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0(&U)
FileChooser.helpButton.textAndMnemonic=\u8AAA\u660E(&H)
FileChooser.directoryOpenButton.textAndMnemonic=\u958B\u555F(&O)
FileChooser.directoryOpenButton.textAndMnemonic=\u958B\u555F
# File Size Units
FileChooser.fileSizeKiloBytes={0} KB
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Size
FileChooser.fileTypeHeader.textAndMnemonic=Type
FileChooser.fileDateHeader.textAndMnemonic=Modified
FileChooser.fileAttrHeader.textAndMnemonic=Attributes
FileChooser.saveButton.textAndMnemonic=Save
FileChooser.openButton.textAndMnemonic=Open
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=&Restore
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Gr\u00F6\u00DFe
FileChooser.fileTypeHeader.textAndMnemonic=Typ
FileChooser.fileDateHeader.textAndMnemonic=Ge\u00E4ndert
FileChooser.fileAttrHeader.textAndMnemonic=Attribute
FileChooser.saveButton.textAndMnemonic=Speichern
FileChooser.openButton.textAndMnemonic=\u00D6ffnen
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=&Wiederherstellen
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Tama\u00F1o
FileChooser.fileTypeHeader.textAndMnemonic=Tipo
FileChooser.fileDateHeader.textAndMnemonic=Modificado
FileChooser.fileAttrHeader.textAndMnemonic=Atributos
FileChooser.saveButton.textAndMnemonic=Guardar
FileChooser.openButton.textAndMnemonic=Abrir
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=&Restaurar
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Taille
FileChooser.fileTypeHeader.textAndMnemonic=Type
FileChooser.fileDateHeader.textAndMnemonic=Modifi\u00E9
FileChooser.fileAttrHeader.textAndMnemonic=Attributs
FileChooser.saveButton.textAndMnemonic=Enregistrer
FileChooser.openButton.textAndMnemonic=Ouvrir
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=&Restaurer
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Dimensioni
FileChooser.fileTypeHeader.textAndMnemonic=Tipo
FileChooser.fileDateHeader.textAndMnemonic=Modificato
FileChooser.fileAttrHeader.textAndMnemonic=Attributi
FileChooser.saveButton.textAndMnemonic=Salva
FileChooser.openButton.textAndMnemonic=Apri
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=&Ripristina
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=\u30B5\u30A4\u30BA
FileChooser.fileTypeHeader.textAndMnemonic=\u30BF\u30A4\u30D7
FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6B63\u65E5
FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58
FileChooser.openButton.textAndMnemonic=\u958B\u304F
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=\u5FA9\u5143(&R)
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30
FileChooser.fileTypeHeader.textAndMnemonic=\uC720\uD615
FileChooser.fileDateHeader.textAndMnemonic=\uC218\uC815 \uB0A0\uC9DC
FileChooser.fileAttrHeader.textAndMnemonic=\uC18D\uC131
FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5
FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=\uBCF5\uC6D0(&R)
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Tamanho
FileChooser.fileTypeHeader.textAndMnemonic=Tipo
FileChooser.fileDateHeader.textAndMnemonic=Modificado
FileChooser.fileAttrHeader.textAndMnemonic=Atributos
FileChooser.saveButton.textAndMnemonic=Salvar
FileChooser.openButton.textAndMnemonic=Abrir
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=&Restaurar
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Storlek
FileChooser.fileTypeHeader.textAndMnemonic=Typ
FileChooser.fileDateHeader.textAndMnemonic=\u00C4ndrad
FileChooser.fileAttrHeader.textAndMnemonic=Attribut
FileChooser.saveButton.textAndMnemonic=Spara
FileChooser.openButton.textAndMnemonic=\u00D6ppna
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=&\u00C5terst\u00E4ll
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
FileChooser.fileTypeHeader.textAndMnemonic=\u7C7B\u578B
FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58
FileChooser.openButton.textAndMnemonic=\u6253\u5F00
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=\u8FD8\u539F(&R)
......
......@@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
FileChooser.fileTypeHeader.textAndMnemonic=\u985E\u578B
FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
FileChooser.fileAttrHeader.textAndMnemonic=\u5C6C\u6027
FileChooser.saveButton.textAndMnemonic=\u5132\u5B58
FileChooser.openButton.textAndMnemonic=\u958B\u555F
############ Used by MetalTitlePane if rendering window decorations############
MetalTitlePane.restore.titleAndMnemonic=\u56DE\u5FA9(&R)
......
/*
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -101,6 +101,8 @@ public abstract class Path2D implements Shape, Cloneable {
static final int INIT_SIZE = 20;
static final int EXPAND_MAX = 500;
static final int EXPAND_MAX_COORDS = EXPAND_MAX * 2;
static final int EXPAND_MIN = 10; // ensure > 6 (cubics)
/**
* Constructs a new empty {@code Path2D} object.
......@@ -141,6 +143,42 @@ public abstract class Path2D implements Shape, Cloneable {
abstract int rectCrossings(double rxmin, double rymin,
double rxmax, double rymax);
static byte[] expandPointTypes(byte[] oldPointTypes, int needed) {
final int oldSize = oldPointTypes.length;
final int newSizeMin = oldSize + needed;
if (newSizeMin < oldSize) {
// hard overflow failure - we can't even accommodate
// new items without overflowing
throw new ArrayIndexOutOfBoundsException(
"pointTypes exceeds maximum capacity !");
}
// growth algorithm computation
int grow = oldSize;
if (grow > EXPAND_MAX) {
grow = Math.max(EXPAND_MAX, oldSize >> 3); // 1/8th min
} else if (grow < EXPAND_MIN) {
grow = EXPAND_MIN;
}
assert grow > 0;
int newSize = oldSize + grow;
if (newSize < newSizeMin) {
// overflow in growth algorithm computation
newSize = Integer.MAX_VALUE;
}
while (true) {
try {
// try allocating the larger array
return Arrays.copyOf(oldPointTypes, newSize);
} catch (OutOfMemoryError oome) {
if (newSize == newSizeMin) {
throw oome;
}
}
newSize = newSizeMin + (newSize - newSizeMin) / 2;
}
}
/**
* The {@code Float} class defines a geometric path with
* coordinates stored in single precision floating point.
......@@ -224,8 +262,8 @@ public abstract class Path2D implements Shape, Cloneable {
Path2D p2d = (Path2D) s;
setWindingRule(p2d.windingRule);
this.numTypes = p2d.numTypes;
this.pointTypes = Arrays.copyOf(p2d.pointTypes,
p2d.pointTypes.length);
// trim arrays:
this.pointTypes = Arrays.copyOf(p2d.pointTypes, p2d.numTypes);
this.numCoords = p2d.numCoords;
this.floatCoords = p2d.cloneCoordsFloat(at);
} else {
......@@ -237,19 +275,23 @@ public abstract class Path2D implements Shape, Cloneable {
}
}
@Override
float[] cloneCoordsFloat(AffineTransform at) {
// trim arrays:
float ret[];
if (at == null) {
ret = Arrays.copyOf(this.floatCoords, this.floatCoords.length);
ret = Arrays.copyOf(floatCoords, numCoords);
} else {
ret = new float[floatCoords.length];
ret = new float[numCoords];
at.transform(floatCoords, 0, ret, 0, numCoords / 2);
}
return ret;
}
@Override
double[] cloneCoordsDouble(AffineTransform at) {
double ret[] = new double[floatCoords.length];
// trim arrays:
double ret[] = new double[numCoords];
if (at == null) {
for (int i = 0; i < numCoords; i++) {
ret[i] = floatCoords[i];
......@@ -275,31 +317,53 @@ public abstract class Path2D implements Shape, Cloneable {
floatCoords[coordindex+1]);
}
@Override
void needRoom(boolean needMove, int newCoords) {
if (needMove && numTypes == 0) {
if ((numTypes == 0) && needMove) {
throw new IllegalPathStateException("missing initial moveto "+
"in path definition");
}
int size = pointTypes.length;
if (numTypes >= size) {
int grow = size;
if (grow > EXPAND_MAX) {
grow = EXPAND_MAX;
} else if (grow == 0) {
grow = 1;
}
pointTypes = Arrays.copyOf(pointTypes, size+grow);
if (numTypes >= pointTypes.length) {
pointTypes = expandPointTypes(pointTypes, 1);
}
size = floatCoords.length;
if (numCoords + newCoords > size) {
int grow = size;
if (grow > EXPAND_MAX * 2) {
grow = EXPAND_MAX * 2;
}
if (grow < newCoords) {
grow = newCoords;
if (numCoords > (floatCoords.length - newCoords)) {
floatCoords = expandCoords(floatCoords, newCoords);
}
}
static float[] expandCoords(float[] oldCoords, int needed) {
final int oldSize = oldCoords.length;
final int newSizeMin = oldSize + needed;
if (newSizeMin < oldSize) {
// hard overflow failure - we can't even accommodate
// new items without overflowing
throw new ArrayIndexOutOfBoundsException(
"coords exceeds maximum capacity !");
}
// growth algorithm computation
int grow = oldSize;
if (grow > EXPAND_MAX_COORDS) {
grow = Math.max(EXPAND_MAX_COORDS, oldSize >> 3); // 1/8th min
} else if (grow < EXPAND_MIN) {
grow = EXPAND_MIN;
}
assert grow > needed;
int newSize = oldSize + grow;
if (newSize < newSizeMin) {
// overflow in growth algorithm computation
newSize = Integer.MAX_VALUE;
}
while (true) {
try {
// try allocating the larger array
return Arrays.copyOf(oldCoords, newSize);
} catch (OutOfMemoryError oome) {
if (newSize == newSizeMin) {
throw oome;
}
}
floatCoords = Arrays.copyOf(floatCoords, size+grow);
newSize = newSizeMin + (newSize - newSizeMin) / 2;
}
}
......@@ -475,6 +539,9 @@ public abstract class Path2D implements Shape, Cloneable {
}
int pointCrossings(double px, double py) {
if (numTypes == 0) {
return 0;
}
double movx, movy, curx, cury, endx, endy;
float coords[] = floatCoords;
curx = movx = coords[0];
......@@ -552,6 +619,9 @@ public abstract class Path2D implements Shape, Cloneable {
int rectCrossings(double rxmin, double rymin,
double rxmax, double rymax)
{
if (numTypes == 0) {
return 0;
}
float coords[] = floatCoords;
double curx, cury, movx, movy, endx, endy;
curx = movx = coords[0];
......@@ -1061,8 +1131,8 @@ public abstract class Path2D implements Shape, Cloneable {
Path2D p2d = (Path2D) s;
setWindingRule(p2d.windingRule);
this.numTypes = p2d.numTypes;
this.pointTypes = Arrays.copyOf(p2d.pointTypes,
p2d.pointTypes.length);
// trim arrays:
this.pointTypes = Arrays.copyOf(p2d.pointTypes, p2d.numTypes);
this.numCoords = p2d.numCoords;
this.doubleCoords = p2d.cloneCoordsDouble(at);
} else {
......@@ -1074,8 +1144,10 @@ public abstract class Path2D implements Shape, Cloneable {
}
}
@Override
float[] cloneCoordsFloat(AffineTransform at) {
float ret[] = new float[doubleCoords.length];
// trim arrays:
float ret[] = new float[numCoords];
if (at == null) {
for (int i = 0; i < numCoords; i++) {
ret[i] = (float) doubleCoords[i];
......@@ -1086,13 +1158,14 @@ public abstract class Path2D implements Shape, Cloneable {
return ret;
}
@Override
double[] cloneCoordsDouble(AffineTransform at) {
// trim arrays:
double ret[];
if (at == null) {
ret = Arrays.copyOf(this.doubleCoords,
this.doubleCoords.length);
ret = Arrays.copyOf(doubleCoords, numCoords);
} else {
ret = new double[doubleCoords.length];
ret = new double[numCoords];
at.transform(doubleCoords, 0, ret, 0, numCoords / 2);
}
return ret;
......@@ -1113,31 +1186,53 @@ public abstract class Path2D implements Shape, Cloneable {
doubleCoords[coordindex+1]);
}
@Override
void needRoom(boolean needMove, int newCoords) {
if (needMove && numTypes == 0) {
if ((numTypes == 0) && needMove) {
throw new IllegalPathStateException("missing initial moveto "+
"in path definition");
}
int size = pointTypes.length;
if (numTypes >= size) {
int grow = size;
if (grow > EXPAND_MAX) {
grow = EXPAND_MAX;
} else if (grow == 0) {
grow = 1;
}
pointTypes = Arrays.copyOf(pointTypes, size+grow);
if (numTypes >= pointTypes.length) {
pointTypes = expandPointTypes(pointTypes, 1);
}
size = doubleCoords.length;
if (numCoords + newCoords > size) {
int grow = size;
if (grow > EXPAND_MAX * 2) {
grow = EXPAND_MAX * 2;
}
if (grow < newCoords) {
grow = newCoords;
if (numCoords > (doubleCoords.length - newCoords)) {
doubleCoords = expandCoords(doubleCoords, newCoords);
}
}
static double[] expandCoords(double[] oldCoords, int needed) {
final int oldSize = oldCoords.length;
final int newSizeMin = oldSize + needed;
if (newSizeMin < oldSize) {
// hard overflow failure - we can't even accommodate
// new items without overflowing
throw new ArrayIndexOutOfBoundsException(
"coords exceeds maximum capacity !");
}
// growth algorithm computation
int grow = oldSize;
if (grow > EXPAND_MAX_COORDS) {
grow = Math.max(EXPAND_MAX_COORDS, oldSize >> 3); // 1/8th min
} else if (grow < EXPAND_MIN) {
grow = EXPAND_MIN;
}
assert grow > needed;
int newSize = oldSize + grow;
if (newSize < newSizeMin) {
// overflow in growth algorithm computation
newSize = Integer.MAX_VALUE;
}
while (true) {
try {
// try allocating the larger array
return Arrays.copyOf(oldCoords, newSize);
} catch (OutOfMemoryError oome) {
if (newSize == newSizeMin) {
throw oome;
}
}
doubleCoords = Arrays.copyOf(doubleCoords, size+grow);
newSize = newSizeMin + (newSize - newSizeMin) / 2;
}
}
......@@ -1202,6 +1297,9 @@ public abstract class Path2D implements Shape, Cloneable {
}
int pointCrossings(double px, double py) {
if (numTypes == 0) {
return 0;
}
double movx, movy, curx, cury, endx, endy;
double coords[] = doubleCoords;
curx = movx = coords[0];
......@@ -1279,6 +1377,9 @@ public abstract class Path2D implements Shape, Cloneable {
int rectCrossings(double rxmin, double rymin,
double rxmax, double rymax)
{
if (numTypes == 0) {
return 0;
}
double coords[] = doubleCoords;
double curx, cury, movx, movy, endx, endy;
curx = movx = coords[0];
......
......@@ -281,7 +281,7 @@ class Invokers {
outArgs[0] = names[CHECK_TYPE];
}
if (CHECK_CUSTOM != -1) {
names[CHECK_CUSTOM] = new Name(NF_checkCustomized, names[CALL_MH]);
names[CHECK_CUSTOM] = new Name(NF_checkCustomized, outArgs[0]);
}
names[LINKER_CALL] = new Name(outCallType, outArgs);
lform = new LambdaForm(debugName, INARG_LIMIT, names);
......
......@@ -631,7 +631,7 @@ class LambdaForm {
* as a sort of pre-invocation linkage step.)
*/
public void prepare() {
if (COMPILE_THRESHOLD == 0) {
if (COMPILE_THRESHOLD == 0 && !isCompiled) {
compileToBytecode();
}
if (this.vmentry != null) {
......@@ -645,11 +645,11 @@ class LambdaForm {
/** Generate optimizable bytecode for this form. */
MemberName compileToBytecode() {
MethodType invokerType = methodType();
assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
if (vmentry != null && isCompiled) {
return vmentry; // already compiled somehow
}
MethodType invokerType = methodType();
assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
try {
vmentry = InvokerBytecodeGenerator.generateCustomizedCode(this, invokerType);
if (TRACE_INTERPRETER)
......
......@@ -1323,13 +1323,16 @@ public class ForkJoinPool extends AbstractExecutorService {
/**
* Number of times to spin-wait before blocking. The spins (in
* awaitRunStateLock and awaitWork) currently use randomized
* spins. If/when MWAIT-like intrinsics becomes available, they
* may allow quieter spinning. The value of SPINS must be a power
* of two, at least 4. The current value causes spinning for a
* small fraction of typical context-switch times, well worthwhile
* given the typical likelihoods that blocking is not necessary.
* spins. Currently set to zero to reduce CPU usage.
*
* If greater than zero the value of SPINS must be a power
* of two, at least 4. A value of 2048 causes spinning for a
* small fraction of typical context-switch times.
*
* If/when MWAIT-like intrinsics becomes available, they
* may allow quieter spinning.
*/
private static final int SPINS = 1 << 11;
private static final int SPINS = 0;
/**
* Increment for seed generators. See class ThreadLocal for
......
......@@ -42,7 +42,7 @@ public interface Compilable {
*
* @param script The source of the script, represented as a <code>String</code>.
*
* @return An subclass of <code>CompiledScript</code> to be executed later using one
* @return An instance of a subclass of <code>CompiledScript</code> to be executed later using one
* of the <code>eval</code> methods of <code>CompiledScript</code>.
*
* @throws ScriptException if compilation fails.
......@@ -61,7 +61,7 @@ public interface Compilable {
*
* @param script The reader from which the script source is obtained.
*
* @return An implementation of <code>CompiledScript</code> to be executed
* @return An instance of a subclass of <code>CompiledScript</code> to be executed
* later using one of its <code>eval</code> methods of <code>CompiledScript</code>.
*
* @throws ScriptException if compilation fails.
......
......@@ -140,6 +140,7 @@ public class SimpleScriptContext implements ScriptContext {
* @throws IllegalArgumentException if the name is empty.
*/
public Object getAttribute(String name) {
checkName(name);
if (engineScope.containsKey(name)) {
return getAttribute(name, ENGINE_SCOPE);
} else if (globalScope != null && globalScope.containsKey(name)) {
......@@ -162,7 +163,7 @@ public class SimpleScriptContext implements ScriptContext {
* @throws NullPointerException if the name is null.
*/
public Object getAttribute(String name, int scope) {
checkName(name);
switch (scope) {
case ENGINE_SCOPE:
......@@ -191,7 +192,7 @@ public class SimpleScriptContext implements ScriptContext {
* @throws NullPointerException if the name is null.
*/
public Object removeAttribute(String name, int scope) {
checkName(name);
switch (scope) {
case ENGINE_SCOPE:
......@@ -223,7 +224,7 @@ public class SimpleScriptContext implements ScriptContext {
* @throws NullPointerException if the name is null.
*/
public void setAttribute(String name, Object value, int scope) {
checkName(name);
switch (scope) {
case ENGINE_SCOPE:
......@@ -281,6 +282,7 @@ public class SimpleScriptContext implements ScriptContext {
* @throws IllegalArgumentException if name is empty.
*/
public int getAttributesScope(String name) {
checkName(name);
if (engineScope.containsKey(name)) {
return ENGINE_SCOPE;
} else if (globalScope != null && globalScope.containsKey(name)) {
......@@ -314,6 +316,13 @@ public class SimpleScriptContext implements ScriptContext {
return scopes;
}
private void checkName(String name) {
Objects.requireNonNull(name);
if (name.isEmpty()) {
throw new IllegalArgumentException("name cannot be empty");
}
}
private static List<Integer> scopes;
static {
scopes = new ArrayList<Integer>(2);
......
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -66,7 +66,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* value of this <code>SerialBlob</code> object.
* @serial
*/
private byte buf[];
private byte[] buf;
/**
* The internal representation of the <code>Blob</code> object on which this
......@@ -102,12 +102,13 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* @throws SerialException if an error occurs during serialization
* @throws SQLException if a SQL errors occurs
*/
public SerialBlob(byte[] b) throws SerialException, SQLException {
public SerialBlob(byte[] b)
throws SerialException, SQLException {
len = b.length;
buf = new byte[(int)len];
for(int i = 0; i < len; i++) {
buf[i] = b[i];
buf[i] = b[i];
}
origLen = len;
}
......@@ -132,19 +133,17 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* to this constructor is a <code>null</code>.
* @see java.sql.Blob
*/
public SerialBlob (Blob blob) throws SerialException, SQLException {
public SerialBlob (Blob blob)
throws SerialException, SQLException {
if (blob == null) {
throw new SQLException("Cannot instantiate a SerialBlob " +
"object with a null Blob object");
throw new SQLException(
"Cannot instantiate a SerialBlob object with a null Blob object");
}
len = blob.length();
buf = blob.getBytes(1, (int)len );
this.blob = blob;
//if ( len < 10240000)
// len = 10240000;
origLen = len;
}
......@@ -245,7 +244,8 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* value from the database
*/
public long position(byte[] pattern, long start)
throws SerialException, SQLException {
throws SerialException, SQLException {
isValid();
if (start < 1 || start > len) {
return -1;
......@@ -290,7 +290,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* value from the database
*/
public long position(Blob pattern, long start)
throws SerialException, SQLException {
throws SerialException, SQLException {
isValid();
return position(pattern.getBytes(1, (int)(pattern.length())), start);
}
......@@ -316,8 +316,8 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* @see #getBytes
*/
public int setBytes(long pos, byte[] bytes)
throws SerialException, SQLException {
return (setBytes(pos, bytes, 0, bytes.length));
throws SerialException, SQLException {
return setBytes(pos, bytes, 0, bytes.length);
}
/**
......@@ -352,7 +352,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* @see #getBytes
*/
public int setBytes(long pos, byte[] bytes, int offset, int length)
throws SerialException, SQLException {
throws SerialException, SQLException {
isValid();
if (offset < 0 || offset > bytes.length) {
......@@ -369,7 +369,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
if ((length + offset) > bytes.length) {
throw new SerialException("Invalid OffSet. Cannot have combined offset " +
"and length that is greater that the Blob buffer");
"and length that is greater that the Blob buffer");
}
int i = 0;
......@@ -402,7 +402,8 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* @see #getBinaryStream
*/
public java.io.OutputStream setBinaryStream(long pos)
throws SerialException, SQLException {
throws SerialException, SQLException {
isValid();
if (this.blob != null) {
return this.blob.setBinaryStream(pos);
......@@ -425,17 +426,16 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
* if {@code free} had previously been called on this object
*/
public void truncate(long length) throws SerialException {
isValid();
if (length > len) {
throw new SerialException
("Length more than what can be truncated");
throw new SerialException(
"Length more than what can be truncated");
} else if((int)length == 0) {
buf = new byte[0];
len = length;
buf = new byte[0];
len = length;
} else {
len = length;
buf = this.getBytes(1, (int)len);
len = length;
buf = this.getBytes(1, (int)len);
}
}
......@@ -466,8 +466,8 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
throw new SerialException("Invalid position in BLOB object set");
}
if (length < 1 || length > len - pos + 1) {
throw new SerialException("length is < 1 or pos + length >"
+ "total number of bytes");
throw new SerialException(
"length is < 1 or pos + length > total number of bytes");
}
return new ByteArrayInputStream(buf, (int) pos - 1, (int) length);
}
......@@ -536,14 +536,13 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
public Object clone() {
try {
SerialBlob sb = (SerialBlob) super.clone();
sb.buf = (buf != null) ? Arrays.copyOf(buf, (int)len) : null;
sb.buf = (buf != null) ? Arrays.copyOf(buf, (int)len) : null;
sb.blob = null;
return sb;
} catch (CloneNotSupportedException ex) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
/**
......@@ -554,15 +553,15 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = s.readFields();
byte[] tmp = (byte[])fields.get("buf", null);
if (tmp == null)
throw new InvalidObjectException("buf is null and should not be!");
buf = tmp.clone();
len = fields.get("len", 0L);
if (buf.length != len)
throw new InvalidObjectException("buf is not the expected size");
origLen = fields.get("origLen", 0L);
blob = (Blob) fields.get("blob", null);
byte[] tmp = (byte[])fields.get("buf", null);
if (tmp == null)
throw new InvalidObjectException("buf is null and should not be!");
buf = tmp.clone();
len = fields.get("len", 0L);
if (buf.length != len)
throw new InvalidObjectException("buf is not the expected size");
origLen = fields.get("origLen", 0L);
blob = (Blob) fields.get("blob", null);
}
/**
......@@ -590,8 +589,8 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
*/
private void isValid() throws SerialException {
if (buf == null) {
throw new SerialException("Error: You cannot call a method on a "
+ "SerialBlob instance once free() has been called.");
throw new SerialException("Error: You cannot call a method on a " +
"SerialBlob instance once free() has been called.");
}
}
......
......@@ -125,6 +125,8 @@ public class BasicComboBoxUI extends ComboBoxUI {
protected MouseMotionListener popupMouseMotionListener;
protected KeyListener popupKeyListener;
private MouseWheelListener mouseWheelListener;
// This is used for knowing when to cache the minimum preferred size.
// If the data in the list changes, the cached value get marked for recalc.
// Added to the current JComboBox model
......@@ -375,6 +377,10 @@ public class BasicComboBoxUI extends ComboBoxUI {
comboBox.getModel().addListDataListener( listDataListener );
}
}
if ((mouseWheelListener = createMouseWheelListener()) != null) {
comboBox.addMouseWheelListener(mouseWheelListener);
}
}
/**
......@@ -421,6 +427,9 @@ public class BasicComboBoxUI extends ComboBoxUI {
comboBox.getModel().removeListDataListener( listDataListener );
}
}
if (mouseWheelListener != null) {
comboBox.removeMouseWheelListener(mouseWheelListener);
}
}
/**
......@@ -534,6 +543,10 @@ public class BasicComboBoxUI extends ComboBoxUI {
return handler;
}
private MouseWheelListener createMouseWheelListener() {
return getHandler();
}
//
// end UI Initialization
//======================
......@@ -1669,7 +1682,8 @@ public class BasicComboBoxUI extends ComboBoxUI {
//
private class Handler implements ActionListener, FocusListener,
KeyListener, LayoutManager,
ListDataListener, PropertyChangeListener {
ListDataListener, PropertyChangeListener,
MouseWheelListener {
//
// PropertyChangeListener
//
......@@ -1939,21 +1953,25 @@ public class BasicComboBoxUI extends ComboBoxUI {
public void actionPerformed(ActionEvent evt) {
Object item = comboBox.getEditor().getItem();
if (item != null) {
if(!comboBox.isPopupVisible() && !item.equals(comboBox.getSelectedItem())) {
comboBox.setSelectedItem(comboBox.getEditor().getItem());
}
ActionMap am = comboBox.getActionMap();
if (am != null) {
Action action = am.get("enterPressed");
if (action != null) {
action.actionPerformed(new ActionEvent(comboBox, evt.getID(),
evt.getActionCommand(),
evt.getModifiers()));
if (!comboBox.isPopupVisible() && !item.equals(comboBox.getSelectedItem())) {
comboBox.setSelectedItem(comboBox.getEditor().getItem());
}
ActionMap am = comboBox.getActionMap();
if (am != null) {
Action action = am.get("enterPressed");
if (action != null) {
action.actionPerformed(new ActionEvent(comboBox, evt.getID(),
evt.getActionCommand(),
evt.getModifiers()));
}
}
}
}
}
public void mouseWheelMoved(MouseWheelEvent e) {
e.consume();
}
}
}
class DefaultKeySelectionManager implements JComboBox.KeySelectionManager, UIResource {
private String prefix = "";
......
......@@ -180,6 +180,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
*/
protected ItemListener itemListener;
private MouseWheelListener scrollerMouseWheelListener;
/**
* This protected field is implementation specific. Do not access directly
* or override.
......@@ -286,6 +288,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
uninstallComboBoxModelListeners(comboBox.getModel());
uninstallKeyboardActions();
uninstallListListeners();
uninstallScrollerListeners();
// We do this, otherwise the listener the ui installs on
// the model (the combobox model in this case) will keep a
// reference to the list, causing the list (and us) to never get gced.
......@@ -572,6 +575,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
scroller.setFocusable( false );
scroller.getVerticalScrollBar().setFocusable( false );
scroller.setBorder( null );
installScrollerListeners();
}
/**
......@@ -588,6 +592,20 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
setFocusable( false );
}
private void installScrollerListeners() {
scrollerMouseWheelListener = getHandler();
if (scrollerMouseWheelListener != null) {
scroller.addMouseWheelListener(scrollerMouseWheelListener);
}
}
private void uninstallScrollerListeners() {
if (scrollerMouseWheelListener != null) {
scroller.removeMouseWheelListener(scrollerMouseWheelListener);
scrollerMouseWheelListener = null;
}
}
/**
* This method adds the necessary listeners to the JComboBox.
*/
......@@ -796,8 +814,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
private class Handler implements ItemListener, MouseListener,
MouseMotionListener, PropertyChangeListener,
Serializable {
MouseMotionListener, MouseWheelListener,
PropertyChangeListener, Serializable {
//
// MouseListener
// NOTE: this is added to both the JList and JComboBox
......@@ -981,6 +999,13 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
setListSelection(comboBox.getSelectedIndex());
}
}
//
// MouseWheelListener
//
public void mouseWheelMoved(MouseWheelEvent e) {
e.consume();
}
}
//
......
......@@ -884,7 +884,9 @@ public class BasicPopupMenuUI extends PopupMenuUI {
processMouseEvent(me);
break;
case MouseEvent.MOUSE_WHEEL:
if (isInPopup(src)) {
if (isInPopup(src)
|| ((src instanceof JComboBox) && ((JComboBox) src).isPopupVisible())) {
return;
}
cancelPopupMenu();
......
......@@ -982,7 +982,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) {
try {
AccessController.doPrivileged(
AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<Void>() {
public Void run() throws IOException {
plainConnect0();
......@@ -1243,7 +1243,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (p != null) {
try {
return AccessController.doPrivileged(
return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<OutputStream>() {
public OutputStream run() throws IOException {
return getOutputStream0();
......@@ -1426,7 +1426,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (p != null) {
try {
return AccessController.doPrivileged(
return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<InputStream>() {
public InputStream run() throws IOException {
return getInputStream0();
......@@ -2568,7 +2568,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (p != null) {
try {
return AccessController.doPrivileged(
return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<Boolean>() {
public Boolean run() throws IOException {
return followRedirect0(loc, stat, locUrl0);
......
......@@ -231,6 +231,31 @@ public class Config {
return v.lastElement();
}
/**
* Gets the boolean value for the specified keys. Returns TRUE if the
* string value is "yes", or "true", FALSE if "no", or "false", or null
* if otherwise or not defined. The comparision is case-insensitive.
*
* @param keys the keys, see {@link #get(String...)}
* @return the boolean value, or null if there is no value defined or the
* value does not look like a boolean value.
* @throws IllegalArgumentException see {@link #get(String...)}
*/
private Boolean getBooleanObject(String... keys) {
String s = get(keys);
if (s == null) {
return null;
}
switch (s.toLowerCase(Locale.US)) {
case "yes": case "true":
return Boolean.TRUE;
case "no": case "false":
return Boolean.FALSE;
default:
return null;
}
}
/**
* Gets all values for the specified keys.
* @throws IllegalArgumentException if any of the keys is illegal
......@@ -942,32 +967,30 @@ public class Config {
/**
* Check if need to use DNS to locate Kerberos services
*/
private boolean useDNS(String name) {
String value = get("libdefaults", name);
if (value == null) {
value = get("libdefaults", "dns_fallback");
if ("false".equalsIgnoreCase(value)) {
return false;
} else {
return true;
}
} else {
return value.equalsIgnoreCase("true");
private boolean useDNS(String name, boolean defaultValue) {
Boolean value = getBooleanObject("libdefaults", name);
if (value != null) {
return value.booleanValue();
}
value = getBooleanObject("libdefaults", "dns_fallback");
if (value != null) {
return value.booleanValue();
}
return defaultValue;
}
/**
* Check if need to use DNS to locate the KDC
*/
private boolean useDNS_KDC() {
return useDNS("dns_lookup_kdc");
return useDNS("dns_lookup_kdc", true);
}
/*
* Check if need to use DNS to locate the Realm
*/
private boolean useDNS_Realm() {
return useDNS("dns_lookup_realm");
return useDNS("dns_lookup_realm", false);
}
/**
......
......@@ -1057,6 +1057,39 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
}
}
/**
* Determines if the keystore {@code Entry} for the specified
* {@code alias} is an instance or subclass of the specified
* {@code entryClass}.
*
* @param alias the alias name
* @param entryClass the entry class
*
* @return true if the keystore {@code Entry} for the specified
* {@code alias} is an instance or subclass of the
* specified {@code entryClass}, false otherwise
*
* @since 1.5
*/
@Override
public boolean
engineEntryInstanceOf(String alias,
Class<? extends KeyStore.Entry> entryClass)
{
if (entryClass == KeyStore.TrustedCertificateEntry.class) {
return engineIsCertificateEntry(alias);
}
Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
if (entryClass == KeyStore.PrivateKeyEntry.class) {
return (entry != null && entry instanceof PrivateKeyEntry);
}
if (entryClass == KeyStore.SecretKeyEntry.class) {
return (entry != null && entry instanceof SecretKeyEntry);
}
return false;
}
/**
* Returns the (alias) name of the first keystore entry whose certificate
* matches the given certificate.
......@@ -1089,7 +1122,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
} else {
continue;
}
if (certElem.equals(cert)) {
if (certElem != null && certElem.equals(cert)) {
return alias;
}
}
......@@ -1932,7 +1965,12 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
safeContentsData = safeContents.getData();
} else if (contentType.equals((Object)ContentInfo.ENCRYPTED_DATA_OID)) {
if (password == null) {
continue;
if (debug != null) {
debug.println("Warning: skipping PKCS#7 encryptedData" +
" content-type - no password was supplied");
}
continue;
}
if (debug != null) {
......@@ -1974,8 +2012,9 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
password = new char[1];
continue;
}
throw new IOException(
"failed to decrypt safe contents entry: " + e, e);
throw new IOException("keystore password was incorrect",
new UnrecoverableKeyException(
"failed to decrypt safe contents entry: " + e));
}
}
} else {
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -31,9 +31,10 @@ import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.CertificateException;
import java.util.*;
import sun.misc.IOUtils;
import sun.misc.IOUtils;
import sun.security.pkcs.EncryptedPrivateKeyInfo;
import sun.security.pkcs12.PKCS12KeyStore;
/**
* This class provides the keystore implementation referred to as "JKS".
......@@ -65,6 +66,13 @@ abstract class JavaKeyStore extends KeyStoreSpi {
}
}
// special JKS that supports JKS and PKCS12 file formats
public static final class DualFormatJKS extends KeyStoreDelegator {
public DualFormatJKS() {
super("JKS", JKS.class, "PKCS12", PKCS12KeyStore.class);
}
}
private static final int MAGIC = 0xfeedfeed;
private static final int VERSION_1 = 0x01;
private static final int VERSION_2 = 0x02;
......
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
package sun.security.provider;
import java.io.*;
import java.security.*;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.CertificateException;
import java.util.*;
import sun.security.util.Debug;
/**
* This class delegates to a primary or secondary keystore implementation.
*
* @since 1.8
*/
class KeyStoreDelegator extends KeyStoreSpi {
private static final String KEYSTORE_TYPE_COMPAT = "keystore.type.compat";
private static final Debug debug = Debug.getInstance("keystore");
private final String primaryType; // the primary keystore's type
private final String secondaryType; // the secondary keystore's type
private final Class<? extends KeyStoreSpi> primaryKeyStore;
// the primary keystore's class
private final Class<? extends KeyStoreSpi> secondaryKeyStore;
// the secondary keystore's class
private String type; // the delegate's type
private KeyStoreSpi keystore; // the delegate
private boolean compatModeEnabled = true;
public KeyStoreDelegator(
String primaryType,
Class<? extends KeyStoreSpi> primaryKeyStore,
String secondaryType,
Class<? extends KeyStoreSpi> secondaryKeyStore) {
// Check whether compatibility mode has been disabled
// (Use inner-class instead of lambda to avoid init/ClassLoader problem)
compatModeEnabled = "true".equalsIgnoreCase(
AccessController.doPrivileged(
new PrivilegedAction<String>() {
public String run() {
return Security.getProperty(KEYSTORE_TYPE_COMPAT);
}
}
));
if (compatModeEnabled) {
this.primaryType = primaryType;
this.secondaryType = secondaryType;
this.primaryKeyStore = primaryKeyStore;
this.secondaryKeyStore = secondaryKeyStore;
} else {
this.primaryType = primaryType;
this.secondaryType = null;
this.primaryKeyStore = primaryKeyStore;
this.secondaryKeyStore = null;
if (debug != null) {
debug.println("WARNING: compatibility mode disabled for " +
primaryType + " and " + secondaryType + " keystore types");
}
}
}
@Override
public Key engineGetKey(String alias, char[] password)
throws NoSuchAlgorithmException, UnrecoverableKeyException {
return keystore.engineGetKey(alias, password);
}
@Override
public Certificate[] engineGetCertificateChain(String alias) {
return keystore.engineGetCertificateChain(alias);
}
@Override
public Certificate engineGetCertificate(String alias) {
return keystore.engineGetCertificate(alias);
}
@Override
public Date engineGetCreationDate(String alias) {
return keystore.engineGetCreationDate(alias);
}
@Override
public void engineSetKeyEntry(String alias, Key key, char[] password,
Certificate[] chain) throws KeyStoreException {
keystore.engineSetKeyEntry(alias, key, password, chain);
}
@Override
public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
throws KeyStoreException {
keystore.engineSetKeyEntry(alias, key, chain);
}
@Override
public void engineSetCertificateEntry(String alias, Certificate cert)
throws KeyStoreException {
keystore.engineSetCertificateEntry(alias, cert);
}
@Override
public void engineDeleteEntry(String alias) throws KeyStoreException {
keystore.engineDeleteEntry(alias);
}
@Override
public Enumeration<String> engineAliases() {
return keystore.engineAliases();
}
@Override
public boolean engineContainsAlias(String alias) {
return keystore.engineContainsAlias(alias);
}
@Override
public int engineSize() {
return keystore.engineSize();
}
@Override
public boolean engineIsKeyEntry(String alias) {
return keystore.engineIsKeyEntry(alias);
}
@Override
public boolean engineIsCertificateEntry(String alias) {
return keystore.engineIsCertificateEntry(alias);
}
@Override
public String engineGetCertificateAlias(Certificate cert) {
return keystore.engineGetCertificateAlias(cert);
}
@Override
public KeyStore.Entry engineGetEntry(String alias,
KeyStore.ProtectionParameter protParam)
throws KeyStoreException, NoSuchAlgorithmException,
UnrecoverableEntryException {
return keystore.engineGetEntry(alias, protParam);
}
@Override
public void engineSetEntry(String alias, KeyStore.Entry entry,
KeyStore.ProtectionParameter protParam)
throws KeyStoreException {
keystore.engineSetEntry(alias, entry, protParam);
}
@Override
public boolean engineEntryInstanceOf(String alias,
Class<? extends KeyStore.Entry> entryClass) {
return keystore.engineEntryInstanceOf(alias, entryClass);
}
@Override
public void engineStore(OutputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException {
if (debug != null) {
debug.println("Storing keystore in " + type + " format");
}
keystore.engineStore(stream, password);
}
@Override
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException {
// A new keystore is always created in the primary keystore format
if (stream == null || !compatModeEnabled) {
try {
keystore = primaryKeyStore.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
// can safely ignore
}
type = primaryType;
if (debug != null && stream == null) {
debug.println("Creating a new keystore in " + type + " format");
}
keystore.engineLoad(stream, password);
} else {
// First try the primary keystore then try the secondary keystore
try (InputStream bufferedStream = new BufferedInputStream(stream)) {
bufferedStream.mark(Integer.MAX_VALUE);
try {
keystore = primaryKeyStore.newInstance();
type = primaryType;
keystore.engineLoad(bufferedStream, password);
} catch (Exception e) {
// incorrect password
if (e instanceof IOException &&
e.getCause() instanceof UnrecoverableKeyException) {
throw (IOException)e;
}
try {
keystore = secondaryKeyStore.newInstance();
type = secondaryType;
bufferedStream.reset();
keystore.engineLoad(bufferedStream, password);
if (debug != null) {
debug.println("WARNING: switching from " +
primaryType + " to " + secondaryType +
" keystore file format has altered the " +
"keystore security level");
}
} catch (InstantiationException |
IllegalAccessException e2) {
// can safely ignore
} catch (IOException |
NoSuchAlgorithmException |
CertificateException e3) {
// incorrect password
if (e3 instanceof IOException &&
e3.getCause() instanceof
UnrecoverableKeyException) {
throw (IOException)e3;
}
// rethrow the outer exception
if (e instanceof IOException) {
throw (IOException)e;
} else if (e instanceof CertificateException) {
throw (CertificateException)e;
} else if (e instanceof NoSuchAlgorithmException) {
throw (NoSuchAlgorithmException)e;
}
}
}
}
if (debug != null) {
debug.println("Loaded a keystore in " + type + " format");
}
}
}
}
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -228,7 +228,8 @@ final class SunEntries {
/*
* KeyStore
*/
map.put("KeyStore.JKS", "sun.security.provider.JavaKeyStore$JKS");
map.put("KeyStore.JKS",
"sun.security.provider.JavaKeyStore$DualFormatJKS");
map.put("KeyStore.CaseExactJKS",
"sun.security.provider.JavaKeyStore$CaseExactJKS");
map.put("KeyStore.DKS", "sun.security.provider.DomainKeyStore$DKS");
......
......@@ -170,6 +170,15 @@ policy.ignoreIdentityScope=false
#
keystore.type=jks
#
# Controls compatibility mode for the JKS keystore type.
#
# When set to 'true', the JKS keystore type supports loading
# keystore files in either JKS or PKCS12 format. When set to 'false'
# it supports loading only JKS keystore files.
#
keystore.type.compat=true
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
......
......@@ -170,6 +170,15 @@ policy.ignoreIdentityScope=false
#
keystore.type=jks
#
# Controls compatibility mode for the JKS keystore type.
#
# When set to 'true', the JKS keystore type supports loading
# keystore files in either JKS or PKCS12 format. When set to 'false'
# it supports loading only JKS keystore files.
#
keystore.type.compat=true
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
......
......@@ -171,6 +171,15 @@ policy.ignoreIdentityScope=false
#
keystore.type=jks
#
# Controls compatibility mode for the JKS keystore type.
#
# When set to 'true', the JKS keystore type supports loading
# keystore files in either JKS or PKCS12 format. When set to 'false'
# it supports loading only JKS keystore files.
#
keystore.type.compat=true
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
......
......@@ -172,6 +172,15 @@ policy.ignoreIdentityScope=false
#
keystore.type=jks
#
# Controls compatibility mode for the JKS keystore type.
#
# When set to 'true', the JKS keystore type supports loading
# keystore files in either JKS or PKCS12 format. When set to 'false'
# it supports loading only JKS keystore files.
#
keystore.type.compat=true
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
......
......@@ -171,6 +171,15 @@ policy.ignoreIdentityScope=false
#
keystore.type=jks
#
# Controls compatibility mode for the JKS keystore type.
#
# When set to 'true', the JKS keystore type supports loading
# keystore files in either JKS or PKCS12 format. When set to 'false'
# it supports loading only JKS keystore files.
#
keystore.type.compat=true
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
......
......@@ -568,10 +568,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
}
static int getModifiers(int state, int button, int keyCode) {
return getModifiers(state, button, keyCode, 0, false);
}
static int getModifiers(int state, int button, int keyCode, int type, boolean wheel_mouse) {
int modifiers = 0;
if (((state & XConstants.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) {
......@@ -602,7 +598,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
// ONLY one of these conditions should be TRUE to add that modifier.
if (((state & XlibUtil.getButtonMask(i + 1)) != 0) != (button == XConstants.buttons[i])){
//exclude wheel buttons from adding their numbers as modifiers
if (!wheel_mouse) {
if (!isWheel(XConstants.buttons[i])) {
modifiers |= InputEvent.getMaskForButton(i+1);
}
}
......@@ -610,6 +606,11 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
return modifiers;
}
static boolean isWheel(int button) {
// 4 and 5 buttons are usually considered assigned to a first wheel
return button == XConstants.buttons[3] || button == XConstants.buttons[4];
}
static int getXModifiers(AWTKeyStroke stroke) {
int mods = stroke.getModifiers();
int res = 0;
......@@ -649,7 +650,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
int modifiers;
boolean popupTrigger = false;
int button=0;
boolean wheel_mouse = false;
int lbutton = xbe.get_button();
/*
* Ignore the buttons above 20 due to the bit limit for
......@@ -702,11 +702,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
}
button = XConstants.buttons[lbutton - 1];
// 4 and 5 buttons are usually considered assigned to a first wheel
if (lbutton == XConstants.buttons[3] ||
lbutton == XConstants.buttons[4]) {
wheel_mouse = true;
}
// mapping extra buttons to numbers starting from 4.
if ((button > XConstants.buttons[4]) && (!Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled())){
......@@ -716,9 +711,9 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
if (button > XConstants.buttons[4]){
button -= 2;
}
modifiers = getModifiers(xbe.get_state(),button,0, type, wheel_mouse);
modifiers = getModifiers(xbe.get_state(),button,0);
if (!wheel_mouse) {
if (!isWheel(lbutton)) {
MouseEvent me = new MouseEvent((Component)getEventSource(),
type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
jWhen,modifiers, x, y,
......
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -904,7 +904,6 @@ static void adjustStatusWindow(Window shell){
static Bool
createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
{
XIC active_ic, passive_ic;
XVaNestedList preedit = NULL;
XVaNestedList status = NULL;
XIMStyle on_the_spot_styles = XIMPreeditCallbacks,
......@@ -974,6 +973,12 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
}
if (active_styles == on_the_spot_styles) {
pX11IMData->ic_passive = XCreateIC(X11im,
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, passive_styles,
NULL);
callbacks = (XIMCallback *)malloc(sizeof(XIMCallback) * NCALLBACKS);
if (callbacks == (XIMCallback *)NULL)
return False;
......@@ -1024,12 +1029,6 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
NULL);
XFree((void *)preedit);
#endif /* __linux__ || MACOSX */
pX11IMData->ic_passive = XCreateIC(X11im,
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, passive_styles,
NULL);
} else {
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, w,
......
/*
* Copyright (c) 2007, 2014 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2014, 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
......
......@@ -1403,6 +1403,26 @@ ProcessPlatformOption(const char *arg)
return JNI_FALSE;
}
int
filterArgs(StdArg *stdargs, const int nargc, StdArg **pargv) {
StdArg* argv = NULL;
int nargs = 0;
int i;
/* Copy the non-vm args */
for (i = 0; i < nargc ; i++) {
const char *arg = stdargs[i].arg;
if (arg[0] == '-' && arg[1] == 'J')
continue;
argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
argv[nargs].arg = JLI_StringDup(arg);
argv[nargs].has_wildcard = stdargs[i].has_wildcard;
nargs++;
}
*pargv = argv;
return nargs;
}
/*
* At this point we have the arguments to the application, and we need to
* check with original stdargs in order to compare which of these truly
......@@ -1417,8 +1437,9 @@ CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
char *ostart, *astart, **nargv;
jboolean needs_expansion = JNI_FALSE;
jmethodID mid;
int stdargc;
int filteredargc, stdargc;
StdArg *stdargs;
StdArg *filteredargs;
jclass cls = GetLauncherHelperClass(env);
NULL_CHECK0(cls);
......@@ -1429,6 +1450,8 @@ CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
stdargs = JLI_GetStdArgs();
stdargc = JLI_GetStdArgc();
filteredargc = filterArgs(stdargs, stdargc, &filteredargs);
// sanity check, this should never happen
if (argc > stdargc) {
JLI_TraceLauncher("Warning: app args is larger than the original, %d %d\n", argc, stdargc);
......@@ -1437,8 +1460,8 @@ CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
}
// sanity check, match the args we have, to the holy grail
idx = stdargc - argc;
ostart = stdargs[idx].arg;
idx = filteredargc - argc;
ostart = filteredargs[idx].arg;
astart = strv[0];
// sanity check, ensure that the first argument of the arrays are the same
if (JLI_StrCmp(ostart, astart) != 0) {
......@@ -1451,8 +1474,8 @@ CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
// make a copy of the args which will be expanded in java if required.
nargv = (char **)JLI_MemAlloc(argc * sizeof(char*));
for (i = 0, j = idx; i < argc; i++, j++) {
jboolean arg_expand = (JLI_StrCmp(stdargs[j].arg, strv[i]) == 0)
? stdargs[j].has_wildcard
jboolean arg_expand = (JLI_StrCmp(filteredargs[j].arg, strv[i]) == 0)
? filteredargs[j].has_wildcard
: JNI_FALSE;
if (needs_expansion == JNI_FALSE)
needs_expansion = arg_expand;
......@@ -1489,5 +1512,6 @@ CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
JLI_MemFree(nargv[i]);
}
JLI_MemFree(nargv);
JLI_MemFree(filteredargs);
return outArray;
}
/*
* Copyright (c) 2002, 2010, 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.
*/
package com.sun.java.accessibility.extensions;
import javax.accessibility.*;
/**
* <P>Class AccessibleExtendedRelation contains extensions to the class
* AccessibleRelation that are currently not in a public API.
*
* <P>Class AccessibleRelation describes a relation between the
* object that implements the AccessibleRelation and one or more other
* objects. The actual relations that an object has with other
* objects are defined as an AccessibleRelationSet, which is a composed
* set of AccessibleRelations.
* <p>The toDisplayString method allows you to obtain the localized string
* for a locale independent key from a predefined ResourceBundle for the
* keys defined in this class.
* <p>The constants in this class present a strongly typed enumeration
* of common object roles. If the constants in this class are not sufficient
* to describe the role of an object, a subclass should be generated
* from this class and it should provide constants in a similar manner.
*
*/
public class AccessibleExtendedRelation
extends AccessibleExtendedRelationConstants {
public AccessibleExtendedRelation(String s) {
super(s);
}
public AccessibleExtendedRelation(String key, Object target) {
super(key, target);
}
}
/*
* Copyright (c) 2002, 2010, 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.
*/
package com.sun.java.accessibility.extensions;
import javax.accessibility.*;
/**
* <P>Class AccessibleExtendedRelation contains extensions to the class
* AccessibleRelation that are currently not in a public API.
*
* <P>Class AccessibleRelation describes a relation between the
* object that implements the AccessibleRelation and one or more other
* objects. The actual relations that an object has with other
* objects are defined as an AccessibleRelationSet, which is a composed
* set of AccessibleRelations.
* <p>The toDisplayString method allows you to obtain the localized string
* for a locale independent key from a predefined ResourceBundle for the
* keys defined in this class.
* <p>The constants in this class present a strongly typed enumeration
* of common object roles. If the constants in this class are not sufficient
* to describe the role of an object, a subclass should be generated
* from this class and it should provide constants in a similar manner.
*
*/
public abstract class AccessibleExtendedRelationConstants
extends AccessibleRelation {
/**
* Indicates that one AccessibleText object is linked to the
* target AccessibleText object(s). <p> A good example is a StarOffice
* text window with the bottom of one page, a footer, a header,
* and the top of another page all visible in the window. There
* should be a FLOWS_TO relation from the last chunk of AccessibleText
* in the bottom of one page to the first AccessibleText object at the
* top of the next page, skipping over the AccessibleText object(s)
* that make up the header and footer. A corresponding FLOWS_FROM
* relation would link the AccessibleText object in the next page to
* the last one in the previous page.
* @see AccessibleExtendedRole.FLOWS_FROM
*/
public static final String FLOWS_TO = "flowsTo";
/**
* Indicates that one AccessibleText object is linked to the
* target AccessibleText object(s).
* @see AccessibleExtendedRole.FLOWS_TO
*/
public static final String FLOWS_FROM = "flowsFrom";
/**
* Indicates a component is a subwindow of a target component
*/
public static final String SUBWINDOW_OF = "subwindowOf";
/**
* Identifies that the linkage between one AccessibleText
* object and the target AccessibleText object(s) has changed.
* @see AccessibleExtendedRole.FLOWS_TO
* @see AccessibleExtendedRole.FLOWS_FROM
*/
public static final String FLOWS_TO_PROPERTY = "flowsToProperty";
/**
* Identifies that the linkage between one AccessibleText
* object and the target AccessibleText object(s) has changed.
* @see AccessibleExtendedRole.FLOWS_TO
* @see AccessibleExtendedRole.FLOWS_FROM
*/
public static final String FLOWS_FROM_PROPERTY = "flowsFromProperty";
/**
* Identifies the subwindow relationship between two components
* has changed
*/
public static final String SUBWINDOW_OF_PROPERTY = "subwindowOfProperty";
public AccessibleExtendedRelationConstants(String s) {
super(s);
}
public AccessibleExtendedRelationConstants(String key, Object target) {
super(key, target);
}
}
/*
* 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
* 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.
*/
package com.sun.java.accessibility.extensions;
import javax.accessibility.*;
/**
* <P>Class AccessibleExtendedRole contains extensions to the class
* AccessibleRole that are currently not in a public API.
*
* <P>Class AccessibleRole determines the role of a component. The role
* of a component describes its generic function. (E.G.,
* "push button," "table," or "list.")
* <p>The constants in this class present a strongly typed enumeration
* of common object roles. A public constructor for this class has been
* purposely omitted and applications should use one of the constants
* from this class. If the constants in this class are not sufficient
* to describe the role of an object, a subclass should be generated
* from this class and it should provide constants in a similar manner.
*
*/
public abstract class AccessibleExtendedRoleConstants extends AccessibleRole {
/**
* Indicates this component is a text header.
*/
public static final AccessibleExtendedRole HEADER
= new AccessibleExtendedRole("Header");
/**
* Indicates this component is a text footer.
*/
public static final AccessibleExtendedRole FOOTER
= new AccessibleExtendedRole("Footer");
/**
* Indicates this component is a text paragraph.
*/
public static final AccessibleExtendedRole PARAGRAPH
= new AccessibleExtendedRole("Paragraph");
/**
* Indicates this component is a ruler.
*/
public static final AccessibleExtendedRole RULER
= new AccessibleExtendedRole("RULER");
public AccessibleExtendedRoleConstants(String s) {
super(s);
}
}
/*
* 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
* 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.
*/
package com.sun.java.accessibility.extensions;
import javax.accessibility.*;
/**
* <P>Class AccessibleState describes a component's particular state. The actual
* state of the component is defined as an AccessibleStateSet, which is a
* composed set of AccessibleStates.
* <p>The toDisplayString method allows you to obtain the localized string
* for a locale independent key from a predefined ResourceBundle for the
* keys defined in this class.
* <p>The constants in this class present a strongly typed enumeration
* of common object roles. A public constructor for this class has been
* purposely omitted and applications should use one of the constants
* from this class. If the constants in this class are not sufficient
* to describe the role of an object, a subclass should be generated
* from this class and it should provide constants in a similar manner.
*
*/
public abstract class AccessibleExtendedState
extends AccessibleExtendedStateConstants {
public AccessibleExtendedState(String s) {
super(s);
}
}
/*
* 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
* 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.
*/
package com.sun.java.accessibility.extensions;
import javax.accessibility.*;
/**
* <P>Class AccessibleState describes a component's particular state. The actual
* state of the component is defined as an AccessibleStateSet, which is a
* composed set of AccessibleStates.
* <p>The toDisplayString method allows you to obtain the localized string
* for a locale independent key from a predefined ResourceBundle for the
* keys defined in this class.
* <p>The constants in this class present a strongly typed enumeration
* of common object roles. A public constructor for this class has been
* purposely omitted and applications should use one of the constants
* from this class. If the constants in this class are not sufficient
* to describe the role of an object, a subclass should be generated
* from this class and it should provide constants in a similar manner.
*
*/
public abstract class AccessibleExtendedStateConstants extends AccessibleState {
/**
* Indicates a component is responsible for managing
* its subcomponents.
*/
public static final AccessibleExtendedState MANAGES_DESCENDENTS
= new AccessibleExtendedState("managesDescendents");
public AccessibleExtendedStateConstants(String s) {
super(s);
}
}
/*
* 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
* 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.
*/
package com.sun.java.accessibility.util.java.awt;
import java.lang.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import javax.accessibility.*;
import com.sun.java.accessibility.util.*;
/**
* <p>The Translator class provides a translation to interface Accessible
* for objects that do not implement interface Accessible. Assistive
* technologies can use the 'getAccessible' class method of Translator to
* obtain an object that implements interface Accessible. If the object
* passed in already implements interface Accessible, getAccessible merely
* returns the object.
*
* <p>An example of how an assistive technology might use the Translator
* class is as follows:
*
* <PRE>
* Accessible accessible = Translator.getAccessible(someObj);
* // obtain information from the 'accessible' object.
* </PRE>
*
* <P>This class extends the Translator class to provide specific support
* for the Choice class. Translator.getAccessible() will automatically
* load this class when an assistive technology asks for an accessible
* translator for Choice.
*
*/
public class ChoiceTranslator extends Translator {
/**
* Get the state of this object.
* @return an instance of AccessibleState containing the current state of the object
* @see AccessibleState
*/
public AccessibleStateSet getAccessibleStateSet() {
AccessibleStateSet states = super.getAccessibleStateSet();
states.add(AccessibleState.SELECTED);
return states;
}
public AccessibleRole getAccessibleRole() {
return AccessibleRole.CHOICE;
}
}
......@@ -828,7 +828,7 @@ HWND D3DPipelineManager::CreateDefaultFocusWindow()
return 0;
}
HWND hWnd = CreateWindow(L"D3DFocusWindow", L"D3DFocusWindow", 0,
HWND hWnd = CreateWindow(L"D3DFocusWindow", L"D3DFocusWindow", WS_POPUP,
mi.rcMonitor.left, mi.rcMonitor.top, 1, 1,
NULL, NULL, GetModuleHandle(NULL), NULL);
if (hWnd == 0) {
......
......@@ -8,7 +8,7 @@ keys=2d dnd i18n
othervm.dirs=java/awt java/beans java/rmi javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces sun/rmi
# Tests that cannot run concurrently
exclusiveAccess.dirs=java/rmi/Naming java/util/Currency java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
exclusiveAccess.dirs=java/rmi/Naming java/util/Currency java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi javax/rmi
# Group definitions
groups=TEST.groups [closed/TEST.groups]
......@@ -111,7 +111,6 @@ jdk_time = \
jdk_rmi = \
java/rmi \
javax/rmi/ssl \
sun/rmi
jdk_security1 = \
......@@ -195,6 +194,7 @@ jdk_tools = \
jdk_other = \
java/sql \
javax/sql \
javax/rmi \
javax/naming \
javax/script \
javax/smartcardio \
......
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 8041470
@summary JButtons stay pressed after they have lost focus if you use the mouse wheel
@author Anton Nashatyrev
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.concurrent.CountDownLatch;
public class WheelModifier {
JFrame f;
JButton fb;
CountDownLatch pressSema = new CountDownLatch(1);
CountDownLatch exitSema = new CountDownLatch(1);
CountDownLatch releaseSema = new CountDownLatch(1);
volatile CountDownLatch wheelSema;
void createGui() {
f = new JFrame("frame");
fb = new JButton("frame_button");
fb.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
System.out.println("WheelModifier.mouseReleased: " + e);
releaseSema.countDown();
}
@Override
public void mouseEntered(MouseEvent e) {
System.out.println("WheelModifier.mouseEntered: " + e);
}
@Override
public void mouseExited(MouseEvent e) {
System.out.println("WheelModifier.mouseExited: " + e);
exitSema.countDown();
}
@Override
public void mousePressed(MouseEvent e) {
System.out.println("WheelModifier.mousePressed: " + e);
pressSema.countDown();
}
@Override
public void mouseDragged(MouseEvent e) {
System.out.println("WheelModifier.mouseDragged: " + e);
}
});
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
@Override
public void eventDispatched(AWTEvent event) {
System.out.println("WheelModifier.mouseWheel: " + event);
wheelSema.countDown();
}
}, MouseEvent.MOUSE_WHEEL_EVENT_MASK);
f.setLayout(new FlowLayout());
f.add(fb);
f.setSize(200, 200);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
void run() throws Exception {
Robot r = new Robot();
r.waitForIdle();
System.out.println("# Started");
Point sLoc = fb.getLocationOnScreen();
Dimension bSize = fb.getSize();
r.mouseMove(sLoc.x + bSize.width / 2, sLoc.y + bSize.height / 2);
r.mousePress(MouseEvent.BUTTON1_MASK);
pressSema.await();
System.out.println("# Pressed");
r.mouseMove(sLoc.x + bSize.width / 2, sLoc.y + bSize.height * 2);
exitSema.await();
System.out.println("# Exited");
wheelSema = new CountDownLatch(1);
r.mouseWheel(1);
wheelSema.await();
System.out.println("# Wheeled 1");
wheelSema = new CountDownLatch(1);
r.mouseWheel(-1);
wheelSema.await();
System.out.println("# Wheeled 2");
r.mouseRelease(MouseEvent.BUTTON1_MASK);
releaseSema.await();
System.out.println("# Released!");
}
public static void main(String[] args) throws Exception {
WheelModifier test = new WheelModifier();
SwingUtilities.invokeAndWait(() -> test.createGui());
test.run();
System.out.println("Done.");
}
}
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.Rectangle;
import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.IllegalPathStateException;
import java.awt.geom.Path2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.Arrays;
/**
* @test
* @bug 8076419
* @summary Check Path2D copy constructor (trims arrays)
* and constructor with zero capacity
* @run main Path2DCopyConstructor
*/
public class Path2DCopyConstructor {
private final static float EPSILON = 5e-6f;
private final static float FLATNESS = 1e-2f;
private final static AffineTransform at
= AffineTransform.getScaleInstance(1.3, 2.4);
private final static Rectangle2D.Double rect2d
= new Rectangle2D.Double(3.2, 4.1, 5.0, 10.0);
private final static Point2D.Double pt2d
= new Point2D.Double(2.0, 2.5);
public static boolean verbose;
static void log(String msg) {
if (verbose) {
System.out.println(msg);
}
}
public static void main(String argv[]) {
verbose = (argv.length != 0);
testEmptyDoublePaths();
testDoublePaths();
testEmptyFloatPaths();
testFloatPaths();
testEmptyGeneralPath();
testGeneralPath();
}
static void testEmptyDoublePaths() {
log("\n - Test(Path2D.Double[0]) ---");
test(() -> new Path2D.Double(Path2D.WIND_NON_ZERO, 0));
}
static void testDoublePaths() {
log("\n - Test(Path2D.Double) ---");
test(() -> new Path2D.Double());
}
static void testEmptyFloatPaths() {
log("\n - Test(Path2D.Float[0]) ---");
test(() -> new Path2D.Float(Path2D.WIND_NON_ZERO, 0));
}
static void testFloatPaths() {
log("\n - Test(Path2D.Float) ---");
test(() -> new Path2D.Float());
}
static void testEmptyGeneralPath() {
log("\n - Test(GeneralPath[0]) ---");
test(() -> new GeneralPath(Path2D.WIND_NON_ZERO, 0));
}
static void testGeneralPath() {
log("\n - Test(GeneralPath) ---");
test(() -> new GeneralPath());
}
interface PathFactory {
Path2D makePath();
}
static void test(PathFactory pf) {
log("\n --- test: path(empty) ---");
test(pf.makePath(), true);
log("\n\n --- test: path(addMove) ---");
test(addMove(pf.makePath()), false);
log("\n\n --- test: path(addMoveAndLines) ---");
test(addMoveAndLines(pf.makePath()), false);
log("\n\n --- test: path(addMoveAndQuads) ---");
test(addMoveAndQuads(pf.makePath()), false);
log("\n\n --- test: path(addMoveAndCubics) ---");
test(addMoveAndCubics(pf.makePath()), false);
log("\n\n --- test: path(addMoveAndClose) ---");
test(addMoveAndClose(pf.makePath()), false);
}
static Path2D addMove(Path2D p2d) {
p2d.moveTo(1.0, 0.5);
return p2d;
}
static Path2D addMoveAndLines(Path2D p2d) {
addMove(p2d);
addLines(p2d);
return p2d;
}
static Path2D addLines(Path2D p2d) {
for (int i = 0; i < 10; i++) {
p2d.lineTo(1.1 * i, 2.3 * i);
}
return p2d;
}
static Path2D addMoveAndCubics(Path2D p2d) {
addMove(p2d);
addCubics(p2d);
return p2d;
}
static Path2D addCubics(Path2D p2d) {
for (int i = 0; i < 10; i++) {
p2d.curveTo(1.1 * i, 1.2 * i, 1.3 * i, 1.4 * i, 1.5 * i, 1.6 * i);
}
return p2d;
}
static Path2D addMoveAndQuads(Path2D p2d) {
addMove(p2d);
addQuads(p2d);
return p2d;
}
static Path2D addQuads(Path2D p2d) {
for (int i = 0; i < 10; i++) {
p2d.quadTo(1.1 * i, 1.2 * i, 1.3 * i, 1.4 * i);
}
return p2d;
}
static Path2D addMoveAndClose(Path2D p2d) {
addMove(p2d);
addClose(p2d);
return p2d;
}
static Path2D addClose(Path2D p2d) {
p2d.closePath();
return p2d;
}
static void test(Path2D p2d, boolean isEmpty) {
testEqual(new Path2D.Float(p2d), p2d);
testEqual(new Path2D.Double(p2d), p2d);
testEqual(new GeneralPath(p2d), p2d);
testIterator(new Path2D.Float(p2d), p2d);
testIterator(new Path2D.Double(p2d), p2d);
testIterator((Path2D) p2d.clone(), p2d);
testFlattening(new Path2D.Float(p2d), p2d);
testFlattening(new Path2D.Double(p2d), p2d);
testFlattening((Path2D) p2d.clone(), p2d);
testAddMove(new Path2D.Float(p2d));
testAddMove(new Path2D.Double(p2d));
testAddMove((Path2D) p2d.clone());
// These should expect exception if empty
testAddLine(new Path2D.Float(p2d), isEmpty);
testAddLine(new Path2D.Double(p2d), isEmpty);
testAddLine((Path2D) p2d.clone(), isEmpty);
testAddQuad(new Path2D.Float(p2d), isEmpty);
testAddQuad(new Path2D.Double(p2d), isEmpty);
testAddQuad((Path2D) p2d.clone(), isEmpty);
testAddCubic(new Path2D.Float(p2d), isEmpty);
testAddCubic(new Path2D.Double(p2d), isEmpty);
testAddCubic((Path2D) p2d.clone(), isEmpty);
testAddClose(new Path2D.Float(p2d), isEmpty);
testAddClose(new Path2D.Double(p2d), isEmpty);
testAddClose((Path2D) p2d.clone(), isEmpty);
testGetBounds(new Path2D.Float(p2d), p2d);
testGetBounds(new Path2D.Double(p2d), p2d);
testGetBounds((Path2D) p2d.clone(), p2d);
testTransform(new Path2D.Float(p2d));
testTransform(new Path2D.Double(p2d));
testTransform((Path2D) p2d.clone());
testIntersect(new Path2D.Float(p2d), p2d);
testIntersect(new Path2D.Double(p2d), p2d);
testIntersect((Path2D) p2d.clone(), p2d);
testContains(new Path2D.Float(p2d), p2d);
testContains(new Path2D.Double(p2d), p2d);
testContains((Path2D) p2d.clone(), p2d);
testGetCurrentPoint(new Path2D.Float(p2d), p2d);
testGetCurrentPoint(new Path2D.Double(p2d), p2d);
testGetCurrentPoint((Path2D) p2d.clone(), p2d);
}
static void testEqual(Path2D pathA, Path2D pathB) {
final PathIterator itA = pathA.getPathIterator(null);
final PathIterator itB = pathB.getPathIterator(null);
float[] coordsA = new float[6];
float[] coordsB = new float[6];
int n = 0;
for (; !itA.isDone() && !itB.isDone(); itA.next(), itB.next(), n++) {
int typeA = itA.currentSegment(coordsA);
int typeB = itB.currentSegment(coordsB);
if (typeA != typeB) {
throw new IllegalStateException("Path-segment[" + n + "] "
+ " type are not equals [" + typeA + "|" + typeB + "] !");
}
if (!equalsArray(coordsA, coordsB, getLength(typeA))) {
throw new IllegalStateException("Path-segment[" + n + "] coords"
+ " are not equals [" + Arrays.toString(coordsA) + "|"
+ Arrays.toString(coordsB) + "] !");
}
}
if (!itA.isDone() || !itB.isDone()) {
throw new IllegalStateException("Paths do not have same lengths !");
}
log("testEqual: " + n + " segments.");
}
static void testIterator(Path2D pathA, Path2D pathB) {
final PathIterator itA = pathA.getPathIterator(at);
final PathIterator itB = pathB.getPathIterator(at);
float[] coordsA = new float[6];
float[] coordsB = new float[6];
int n = 0;
for (; !itA.isDone() && !itB.isDone(); itA.next(), itB.next(), n++) {
int typeA = itA.currentSegment(coordsA);
int typeB = itB.currentSegment(coordsB);
if (typeA != typeB) {
throw new IllegalStateException("Path-segment[" + n + "] "
+ "type are not equals [" + typeA + "|" + typeB + "] !");
}
// Take care of floating-point precision:
if (!equalsArrayEps(coordsA, coordsB, getLength(typeA))) {
throw new IllegalStateException("Path-segment[" + n + "] coords"
+ " are not equals [" + Arrays.toString(coordsA) + "|"
+ Arrays.toString(coordsB) + "] !");
}
}
if (!itA.isDone() || !itB.isDone()) {
throw new IllegalStateException("Paths do not have same lengths !");
}
log("testIterator: " + n + " segments.");
}
static void testFlattening(Path2D pathA, Path2D pathB) {
final PathIterator itA = pathA.getPathIterator(at, FLATNESS);
final PathIterator itB = pathB.getPathIterator(at, FLATNESS);
float[] coordsA = new float[6];
float[] coordsB = new float[6];
int n = 0;
for (; !itA.isDone() && !itB.isDone(); itA.next(), itB.next(), n++) {
int typeA = itA.currentSegment(coordsA);
int typeB = itB.currentSegment(coordsB);
if (typeA != typeB) {
throw new IllegalStateException("Path-segment[" + n + "] "
+ "type are not equals [" + typeA + "|" + typeB + "] !");
}
// Take care of floating-point precision:
if (!equalsArrayEps(coordsA, coordsB, getLength(typeA))) {
throw new IllegalStateException("Path-segment[" + n + "] coords"
+ " are not equals [" + Arrays.toString(coordsA) + "|"
+ Arrays.toString(coordsB) + "] !");
}
}
if (!itA.isDone() || !itB.isDone()) {
throw new IllegalStateException("Paths do not have same lengths !");
}
log("testFlattening: " + n + " segments.");
}
static void testAddMove(Path2D pathA) {
addMove(pathA);
log("testAddMove: passed.");
}
static void testAddLine(Path2D pathA, boolean isEmpty) {
try {
addLines(pathA);
}
catch (IllegalPathStateException ipse) {
if (isEmpty) {
log("testAddLine: passed "
+ "(expected IllegalPathStateException catched).");
return;
} else {
throw ipse;
}
}
if (isEmpty) {
throw new IllegalStateException("IllegalPathStateException not thrown !");
}
log("testAddLine: passed.");
}
static void testAddQuad(Path2D pathA, boolean isEmpty) {
try {
addQuads(pathA);
}
catch (IllegalPathStateException ipse) {
if (isEmpty) {
log("testAddQuad: passed "
+ "(expected IllegalPathStateException catched).");
return;
} else {
throw ipse;
}
}
if (isEmpty) {
throw new IllegalStateException("IllegalPathStateException not thrown !");
}
log("testAddQuad: passed.");
}
static void testAddCubic(Path2D pathA, boolean isEmpty) {
try {
addCubics(pathA);
}
catch (IllegalPathStateException ipse) {
if (isEmpty) {
log("testAddCubic: passed "
+ "(expected IllegalPathStateException catched).");
return;
} else {
throw ipse;
}
}
if (isEmpty) {
throw new IllegalStateException("IllegalPathStateException not thrown !");
}
log("testAddCubic: passed.");
}
static void testAddClose(Path2D pathA, boolean isEmpty) {
try {
addClose(pathA);
}
catch (IllegalPathStateException ipse) {
if (isEmpty) {
log("testAddClose: passed "
+ "(expected IllegalPathStateException catched).");
return;
} else {
throw ipse;
}
}
if (isEmpty) {
throw new IllegalStateException("IllegalPathStateException not thrown !");
}
log("testAddClose: passed.");
}
static void testGetBounds(Path2D pathA, Path2D pathB) {
final Rectangle rA = pathA.getBounds();
final Rectangle rB = pathB.getBounds();
if (!rA.equals(rB)) {
throw new IllegalStateException("Bounds are not equals [" + rA
+ "|" + rB + "] !");
}
final Rectangle2D r2dA = pathA.getBounds2D();
final Rectangle2D r2dB = pathB.getBounds2D();
if (!equalsRectangle2D(r2dA, r2dB)) {
throw new IllegalStateException("Bounds2D are not equals ["
+ r2dA + "|" + r2dB + "] !");
}
log("testGetBounds: passed.");
}
static void testTransform(Path2D pathA) {
pathA.transform(at);
log("testTransform: passed.");
}
static void testIntersect(Path2D pathA, Path2D pathB) {
boolean resA = pathA.intersects(rect2d);
boolean resB = pathB.intersects(rect2d);
if (resA != resB) {
throw new IllegalStateException("Intersects(rect2d) are not equals ["
+ resA + "|" + resB + "] !");
}
resA = pathA.intersects(1.0, 2.0, 13.0, 17.0);
resB = pathB.intersects(1.0, 2.0, 13.0, 17.0);
if (resA != resB) {
throw new IllegalStateException("Intersects(doubles) are not equals ["
+ resA + "|" + resB + "] !");
}
log("testIntersect: passed.");
}
static void testContains(Path2D pathA, Path2D pathB) {
boolean resA = pathA.contains(pt2d);
boolean resB = pathB.contains(pt2d);
if (resA != resB) {
throw new IllegalStateException("Contains(pt) are not equals ["
+ resA + "|" + resB + "] !");
}
resA = pathA.contains(pt2d.getX(), pt2d.getY());
resB = pathB.contains(pt2d.getX(), pt2d.getY());
if (resA != resB) {
throw new IllegalStateException("Contains(x,y) are not equals ["
+ resA + "|" + resB + "] !");
}
resA = pathA.contains(rect2d);
resB = pathB.contains(rect2d);
if (resA != resB) {
throw new IllegalStateException("Contains(rect2d) are not equals ["
+ resA + "|" + resB + "] !");
}
resA = pathA.contains(1.0, 2.0, 13.0, 17.0);
resB = pathB.contains(1.0, 2.0, 13.0, 17.0);
if (resA != resB) {
throw new IllegalStateException("Contains(doubles) are not equals ["
+ resA + "|" + resB + "] !");
}
log("testContains: passed.");
}
static void testGetCurrentPoint(Path2D pathA, Path2D pathB) {
final Point2D ptA = pathA.getCurrentPoint();
final Point2D ptB = pathA.getCurrentPoint();
if (((ptA == null) && (ptB != null))
|| ((ptA != null) && !ptA.equals(ptB)))
{
throw new IllegalStateException("getCurrentPoint() are not equals ["
+ ptA + "|" + ptB + "] !");
}
log("testGetCurrentPoint: passed.");
}
static int getLength(int type) {
switch(type) {
case PathIterator.SEG_CUBICTO:
return 6;
case PathIterator.SEG_QUADTO:
return 4;
case PathIterator.SEG_LINETO:
case PathIterator.SEG_MOVETO:
return 2;
case PathIterator.SEG_CLOSE:
return 0;
default:
throw new IllegalStateException("Invalid type: " + type);
}
}
// Custom equals methods ---
public static boolean equalsArray(float[] a, float[] a2, final int len) {
for (int i = 0; i < len; i++) {
if (Float.floatToIntBits(a[i]) != Float.floatToIntBits(a2[i])) {
return false;
}
}
return true;
}
static boolean equalsArrayEps(float[] a, float[] a2, final int len) {
for (int i = 0; i < len; i++) {
if (!equalsEps(a[i], a2[i])) {
return false;
}
}
return true;
}
static boolean equalsRectangle2D(Rectangle2D a, Rectangle2D b) {
if (a == b) {
return true;
}
return equalsEps(a.getX(), b.getX())
&& equalsEps(a.getY(), b.getY())
&& equalsEps(a.getWidth(), b.getWidth())
&& equalsEps(a.getHeight(), b.getHeight());
}
static boolean equalsEps(float a, float b) {
return (Math.abs(a - b) <= EPSILON);
}
static boolean equalsEps(double a, double b) {
return (Math.abs(a - b) <= EPSILON);
}
}
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.geom.GeneralPath;
import java.awt.geom.Path2D;
/**
* @test
* @bug 8078464
* @summary Check the growth algorithm (needRoom) in Path2D implementations
* @run main Path2DGrow
*/
public class Path2DGrow {
public static final int N = 1000 * 1000;
public static boolean verbose = false;
public static boolean force = false;
static void echo(String msg) {
System.out.println(msg);
}
static void log(String msg) {
if (verbose || force) {
echo(msg);
}
}
public static void main(String argv[]) {
verbose = (argv.length != 0);
testEmptyDoublePaths();
testDoublePaths();
testEmptyFloatPaths();
testFloatPaths();
testEmptyGeneralPath();
testGeneralPath();
}
static void testEmptyDoublePaths() {
echo("\n - Test(Path2D.Double[0]) ---");
test(() -> new Path2D.Double(Path2D.WIND_NON_ZERO, 0));
}
static void testDoublePaths() {
echo("\n - Test(Path2D.Double) ---");
test(() -> new Path2D.Double());
}
static void testEmptyFloatPaths() {
echo("\n - Test(Path2D.Float[0]) ---");
test(() -> new Path2D.Float(Path2D.WIND_NON_ZERO, 0));
}
static void testFloatPaths() {
echo("\n - Test(Path2D.Float) ---");
test(() -> new Path2D.Float());
}
static void testEmptyGeneralPath() {
echo("\n - Test(GeneralPath[0]) ---");
test(() -> new GeneralPath(Path2D.WIND_NON_ZERO, 0));
}
static void testGeneralPath() {
echo("\n - Test(GeneralPath) ---");
test(() -> new GeneralPath());
}
interface PathFactory {
Path2D makePath();
}
static void test(PathFactory pf) {
long start, end;
for (int n = 1; n <= N; n *= 10) {
force = (n == N);
start = System.nanoTime();
testAddMoves(pf.makePath(), n);
end = System.nanoTime();
log("testAddMoves[" + n + "] duration= "
+ (1e-6 * (end - start)) + " ms.");
start = System.nanoTime();
testAddLines(pf.makePath(), n);
end = System.nanoTime();
log("testAddLines[" + n + "] duration= "
+ (1e-6 * (end - start)) + " ms.");
start = System.nanoTime();
testAddQuads(pf.makePath(), n);
end = System.nanoTime();
log("testAddQuads[" + n + "] duration= "
+ (1e-6 * (end - start)) + " ms.");
start = System.nanoTime();
testAddCubics(pf.makePath(), n);
end = System.nanoTime();
log("testAddCubics[" + n + "] duration= "
+ (1e-6 * (end - start)) + " ms.");
start = System.nanoTime();
testAddMoveAndCloses(pf.makePath(), n);
end = System.nanoTime();
log("testAddMoveAndCloses[" + n + "] duration= "
+ (1e-6 * (end - start)) + " ms.");
}
}
static void addMove(Path2D p2d, int i) {
p2d.moveTo(1.0 * i, 0.5 * i);
}
static void addLine(Path2D p2d, int i) {
p2d.lineTo(1.1 * i, 2.3 * i);
}
static void addCubic(Path2D p2d, int i) {
p2d.curveTo(1.1 * i, 1.2 * i, 1.3 * i, 1.4 * i, 1.5 * i, 1.6 * i);
}
static void addQuad(Path2D p2d, int i) {
p2d.quadTo(1.1 * i, 1.2 * i, 1.3 * i, 1.4 * i);
}
static void addClose(Path2D p2d) {
p2d.closePath();
}
static void testAddMoves(Path2D pathA, int n) {
for (int i = 0; i < n; i++) {
addMove(pathA, i);
}
}
static void testAddLines(Path2D pathA, int n) {
addMove(pathA, 0);
for (int i = 0; i < n; i++) {
addLine(pathA, i);
}
}
static void testAddQuads(Path2D pathA, int n) {
addMove(pathA, 0);
for (int i = 0; i < n; i++) {
addQuad(pathA, i);
}
}
static void testAddCubics(Path2D pathA, int n) {
addMove(pathA, 0);
for (int i = 0; i < n; i++) {
addCubic(pathA, i);
}
}
static void testAddMoveAndCloses(Path2D pathA, int n) {
for (int i = 0; i < n; i++) {
addMove(pathA, i);
addClose(pathA);
}
}
}
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 8062552
* @run main/othervm TestKeystoreCompat
* @summary test compatibility mode for JKS and PKCS12 keystores
*/
import java.io.*;
import java.security.*;
import java.security.KeyStore.*;
import java.security.cert.*;
import javax.crypto.*;
import javax.security.auth.callback.*;
public class TestKeystoreCompat {
private static final char[] PASSWORD = "changeit".toCharArray();
private static final String DIR = System.getProperty("test.src", ".");
// This is an arbitrary X.509 certificate
private static final String CERT_FILE = "trusted.pem";
public static final void main(String[] args) throws Exception {
// Testing empty keystores
init("empty.jks", "JKS");
init("empty.jceks", "JCEKS");
init("empty.p12", "PKCS12");
load("empty.jks", "JKS");
load("empty.jceks", "JCEKS");
load("empty.p12", "PKCS12");
load("empty.p12", "JKS"); // test compatibility mode
load("empty.jks", "PKCS12", true); // test without compatibility mode
load("empty.jks", "JKS", false); // test without compatibility mode
load("empty.p12", "JKS", true); // test without compatibility mode
load("empty.p12", "PKCS12", false); // test without compatibility mode
build("empty.jks", "JKS", true);
build("empty.jks", "JKS", false);
build("empty.jceks", "JCEKS", true);
build("empty.jceks", "JCEKS", false);
build("empty.p12", "PKCS12", true);
build("empty.p12", "PKCS12", false);
// Testing keystores containing an X.509 certificate
X509Certificate cert = loadCertificate(CERT_FILE);
init("onecert.jks", "JKS", cert);
init("onecert.jceks", "JCEKS", cert);
init("onecert.p12", "PKCS12", cert);
load("onecert.jks", "JKS");
load("onecert.jceks", "JCEKS");
load("onecert.p12", "PKCS12");
load("onecert.p12", "JKS"); // test compatibility mode
load("onecert.jks", "PKCS12", true); // test without compatibility mode
load("onecert.jks", "JKS", false); // test without compatibility mode
load("onecert.p12", "JKS", true); // test without compatibility mode
load("onecert.p12", "PKCS12", false); // test without compatibility mode
build("onecert.jks", "JKS", true);
build("onecert.jks", "JKS", false);
build("onecert.jceks", "JCEKS", true);
build("onecert.jceks", "JCEKS", false);
build("onecert.p12", "PKCS12", true);
build("onecert.p12", "PKCS12", false);
// Testing keystores containing a secret key
SecretKey key = generateSecretKey("AES", 128);
init("onekey.jceks", "JCEKS", key);
init("onekey.p12", "PKCS12", key);
load("onekey.jceks", "JCEKS");
load("onekey.p12", "PKCS12");
load("onekey.p12", "JKS"); // test compatibility mode
load("onekey.p12", "JKS", true); // test without compatibility mode
load("onekey.p12", "PKCS12", false); // test without compatibility mode
build("onekey.jceks", "JCEKS", true);
build("onekey.jceks", "JCEKS", false);
build("onekey.p12", "PKCS12", true);
build("onekey.p12", "PKCS12", false);
System.out.println("OK.");
}
// Instantiate an empty keystore using the supplied keystore type
private static void init(String file, String type) throws Exception {
KeyStore ks = KeyStore.getInstance(type);
ks.load(null, null);
try (OutputStream stream = new FileOutputStream(file)) {
ks.store(stream, PASSWORD);
}
System.out.println("Created a " + type + " keystore named '" + file + "'");
}
// Instantiate a keystore using the supplied keystore type & create an entry
private static void init(String file, String type, X509Certificate cert)
throws Exception {
KeyStore ks = KeyStore.getInstance(type);
ks.load(null, null);
ks.setEntry("mycert", new KeyStore.TrustedCertificateEntry(cert), null);
try (OutputStream stream = new FileOutputStream(file)) {
ks.store(stream, PASSWORD);
}
System.out.println("Created a " + type + " keystore named '" + file + "'");
}
// Instantiate a keystore using the supplied keystore type & create an entry
private static void init(String file, String type, SecretKey key)
throws Exception {
KeyStore ks = KeyStore.getInstance(type);
ks.load(null, null);
ks.setEntry("mykey", new KeyStore.SecretKeyEntry(key),
new PasswordProtection(PASSWORD));
try (OutputStream stream = new FileOutputStream(file)) {
ks.store(stream, PASSWORD);
}
System.out.println("Created a " + type + " keystore named '" + file + "'");
}
// Instantiate a keystore by probing the supplied file for the keystore type
private static void build(String file, String type, boolean usePassword)
throws Exception {
Builder builder;
if (usePassword) {
builder = Builder.newInstance(type, null, new File(file),
new PasswordProtection(PASSWORD));
} else {
builder = Builder.newInstance(type, null, new File(file),
new CallbackHandlerProtection(new DummyHandler()));
}
KeyStore ks = builder.getKeyStore();
if (!type.equalsIgnoreCase(ks.getType())) {
throw new Exception("ERROR: expected a " + type + " keystore, " +
"got a " + ks.getType() + " keystore instead");
} else {
System.out.println("Built a " + type + " keystore named '" + file + "'");
}
}
// Load the keystore entries
private static void load(String file, String type) throws Exception {
KeyStore ks = KeyStore.getInstance(type);
try (InputStream stream = new FileInputStream(file)) {
ks.load(stream, PASSWORD);
}
if (!type.equalsIgnoreCase(ks.getType())) {
throw new Exception("ERROR: expected a " + type + " keystore, " +
"got a " + ks.getType() + " keystore instead");
} else {
System.out.println("Loaded a " + type + " keystore named '" + file + "'");
}
}
// Load the keystore entries (with compatibility mode disabled)
private static void load(String file, String type, boolean expectFailure)
throws Exception {
Security.setProperty("keystore.type.compat", "false");
try {
load(file, type);
if (expectFailure) {
throw new Exception("ERROR: expected load to fail but it didn't");
}
} catch (IOException e) {
if (expectFailure) {
System.out.println("Failed to load a " + type + " keystore named '" + file + "' (as expected)");
} else {
throw e;
}
} finally {
Security.setProperty("keystore.type.compat", "true");
}
}
// Read an X.509 certificate from the supplied file
private static X509Certificate loadCertificate(String certFile)
throws Exception {
X509Certificate cert = null;
try (FileInputStream certStream =
new FileInputStream(DIR + "/" + certFile)) {
CertificateFactory factory =
CertificateFactory.getInstance("X.509");
return (X509Certificate) factory.generateCertificate(certStream);
}
}
// Generate a secret key using the supplied algorithm name and key size
private static SecretKey generateSecretKey(String algorithm, int size)
throws NoSuchAlgorithmException {
KeyGenerator generator = KeyGenerator.getInstance(algorithm);
generator.init(size);
return generator.generateKey();
}
private static class DummyHandler implements CallbackHandler {
public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException {
System.out.println("** Callbackhandler invoked");
for (int i = 0; i < callbacks.length; i++) {
Callback cb = callbacks[i];
if (cb instanceof PasswordCallback) {
PasswordCallback pcb = (PasswordCallback)cb;
pcb.setPassword(PASSWORD);
break;
}
}
}
}
}
-----BEGIN CERTIFICATE-----
MIIF5DCCBMygAwIBAgIQGVCD3zqdD1ZMZZ/zLAPnQzANBgkqhkiG9w0BAQUFADCBvDELMAkGA1UE
BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
ZXR3b3JrMTswOQYDVQQLEzJUZXJtcyBvZiB1c2UgYXQgaHR0cHM6Ly93d3cudmVyaXNpZ24uY29t
L3JwYSAoYykxMDE2MDQGA1UEAxMtVmVyaVNpZ24gQ2xhc3MgMyBJbnRlcm5hdGlvbmFsIFNlcnZl
ciBDQSAtIEczMB4XDTEyMDcxMDAwMDAwMFoXDTEzMDczMTIzNTk1OVowgbgxCzAJBgNVBAYTAlVT
MRMwEQYDVQQIEwpDYWxpZm9ybmlhMRcwFQYDVQQHFA5SZWR3b29kIFNob3JlczEbMBkGA1UEChQS
T3JhY2xlIENvcnBvcmF0aW9uMRIwEAYDVQQLFAlHbG9iYWwgSVQxMzAxBgNVBAsUKlRlcm1zIG9m
IHVzZSBhdCB3d3cudmVyaXNpZ24uY29tL3JwYSAoYykwNTEVMBMGA1UEAxQMKi5vcmFjbGUuY29t
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz/dOCGrWzPj62q0ZkF59Oj9Fli4wHAuX
U4/S0yBXF8j6K7TKWFTQkGZt3+08KUhmLm1CE1DbbyRJT292YNXYXunNaKdABob8kaBO/NESUOEJ
0SZh7fd0xCSJAAPiwOMrM5jLeb/dEpU6nP74Afrhu5ffvKdcvTRGguj9H2oVsisTK8Z1HsiiwcJG
JXcrjvdCZoPU4FHvK03XZPAqPHKNSaJOrux6kRIWYjQMlmL+qDOb0nNHa6gBdi+VqqJHJHeAM677
dcUd0jn2m2OWtUnrM3MJZQof7/z27RTdX5J8np0ChkUgm63biDgRZO7uZP0DARQ0I6lZMlrarT8/
sct3twIDAQABo4IB4jCCAd4wFwYDVR0RBBAwDoIMKi5vcmFjbGUuY29tMAkGA1UdEwQCMAAwCwYD
VR0PBAQDAgWgMEQGA1UdIAQ9MDswOQYLYIZIAYb4RQEHFwMwKjAoBggrBgEFBQcCARYcaHR0cHM6
Ly93d3cudmVyaXNpZ24uY29tL3JwYTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwbgYI
KwYBBQUHAQwEYjBgoV6gXDBaMFgwVhYJaW1hZ2UvZ2lmMCEwHzAHBgUrDgMCGgQUS2u5KJYGDLvQ
UjibKaxLB4shBRgwJhYkaHR0cDovL2xvZ28udmVyaXNpZ24uY29tL3ZzbG9nbzEuZ2lmMHIGCCsG
AQUFBwEBBGYwZDAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AudmVyaXNpZ24uY29tMDwGCCsGAQUF
BzAChjBodHRwOi8vc3ZyaW50bC1nMy1haWEudmVyaXNpZ24uY29tL1NWUkludGxHMy5jZXIwQQYD
VR0fBDowODA2oDSgMoYwaHR0cDovL3N2cmludGwtZzMtY3JsLnZlcmlzaWduLmNvbS9TVlJJbnRs
RzMuY3JsMB8GA1UdIwQYMBaAFNebfNgioBX33a1fzimbWMO8RgC1MA0GCSqGSIb3DQEBBQUAA4IB
AQAITRBlEo+qXLwCL53Db2BGnhDgnSomjne8aCmU7Yt4Kp91tzJdhNuaC/wwDuzD2dPJqzemae3s
wKiOXrmDQZDj9NNTdkrXHnCvDR4TpOynWe3zBa0bwKnV2cIRKcv482yV53u0kALyFZbagYPwOOz3
YJA/2SqdcDn9Ztc/ABQ1SkyXyA5j4LJdf2g7BtYrFxjy0RG6We2iM781WSB/9MCNKyHgiwd3KpLf
urdSKLzy1elNAyt1P3UHwBIIvZ6sJIr/eeELc54Lxt6PtQCXx8qwxYTYXWPXbLgKBHdebgrmAbPK
TfD69wysvjk6vwSHjmvaqB4R4WRcgkuT+1gxx+ve
-----END CERTIFICATE-----
# Threeten test uses TestNG
TestNG.dirs = .
othervm.dirs = tck/java/time/chrono test/java/time/chrono test/java/time/format
lib.dirs = ../../lib/testlibrary
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -42,10 +42,17 @@ import java.util.Locale;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import jdk.testlibrary.RandomFactory;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/*
* @test
* @bug 8081022
* @key randomness
*/
/**
* Test ZoneTextPrinterParser
*/
......@@ -59,8 +66,8 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser {
}
public void test_printText() {
Random r = new Random();
int N = 50;
Random r = RandomFactory.getRandom();
int N = 8;
Locale[] locales = Locale.getAvailableLocales();
Set<String> zids = ZoneRulesProvider.getAvailableZoneIds();
ZonedDateTime zdt = ZonedDateTime.now();
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册