This commit is contained in:
J. Duke 2017-07-05 18:14:44 +02:00
commit 35207fabd8
158 changed files with 6284 additions and 3278 deletions

View File

@ -165,3 +165,4 @@ a2b2d435f1d275fa8010774c653197c64e326d3a jdk8-b40
1a8c7c530f8a9b7f5bdb9b0693b2f5435ca5205e jdk8-b41
1ce5dc16416611c58b7480ca67a2eee5153498a6 jdk8-b42
661c9aae602bbd9766d12590800c90f1edd1d8dd jdk8-b43
e4f81a817447c3a4f6868f083c81c2fb1b15d44c jdk8-b44

View File

@ -165,3 +165,4 @@ b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38
113f0d5f0a08aa0947b3edf783b603e7f042748a jdk8-b41
79cc42c9c71bbd6630ede681642e98f5e4a841fa jdk8-b42
cd879aff5d3cc1f58829aab3116880aa19525b78 jdk8-b43
439d9bf8e4ff204cc89c9974c1515a508b2cc6ff jdk8-b44

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -217,7 +217,7 @@ public final class ClientRequestInfoImpl
// ClientRequestInfo validity table (see ptc/00-08-06 table 21-1).
// Note: These must be in the same order as specified in contants.
protected static final boolean validCall[][] = {
private static final boolean validCall[][] = {
// LEGEND:
// s_req = send_request r_rep = receive_reply
// s_pol = send_poll r_exc = receive_exception

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -195,7 +195,7 @@ public final class ServerRequestInfoImpl
// ServerRequestInfo validity table (see ptc/00-08-06 table 21-2).
// Note: These must be in the same order as specified in contants.
protected static final boolean validCall[][] = {
private static final boolean validCall[][] = {
// LEGEND:
// r_rsc = receive_request_service_contexts
// r_req = receive_request

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -130,10 +130,23 @@ public class Util implements javax.rmi.CORBA.UtilDelegate
private UtilSystemException utilWrapper = UtilSystemException.get(
CORBALogDomains.RPC_ENCODING);
public static Util instance = null;
private static Util instance = null;
public Util() {
instance = this;
setInstance(this);
}
private static void setInstance( Util util ) {
assert instance == null : "Instance already defined";
instance = util;
}
public static Util getInstance() {
return instance;
}
public static boolean isInstanceDefined() {
return instance != null;
}
// Used by TOAFactory.shutdown to unexport all targets for this

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -93,7 +93,7 @@ public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase {
activeObjectMap.putServant( servant, entry ) ;
if (Util.instance != null) {
if (Util.isInstanceDefined()) {
POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
POAFactory factory = pm.getFactory() ;
factory.registerPOAForServant(poa, servant);
@ -129,7 +129,7 @@ public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase {
activeObjectMap.remove(key);
if (Util.instance != null) {
if (Util.isInstanceDefined()) {
POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
POAFactory factory = pm.getFactory() ;
factory.unregisterPOAForServant(poa, s);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -78,8 +78,8 @@ public class TOAFactory implements ObjectAdapterFactory
public void shutdown( boolean waitForCompletion )
{
if (Util.instance != null) {
Util.instance.unregisterTargetsForORB(orb);
if (Util.isInstanceDefined()) {
Util.getInstance().unregisterTargetsForORB(orb);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -106,7 +106,9 @@ public class ParserTable {
public ParserData[] getParserData()
{
return parserData ;
ParserData[] parserArray = new ParserData[parserData.length];
System.arraycopy(parserData, 0, parserArray, 0, parserData.length);
return parserArray;
}
private ParserTable() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -62,7 +62,7 @@ public class RepositoryId_1_3 {
// legal use of '.' in a Java name.
public static final RepositoryIdCache_1_3 cache = new RepositoryIdCache_1_3();
public static final byte[] IDL_IDENTIFIER_CHARS = {
private static final byte[] IDL_IDENTIFIER_CHARS = {
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f
@ -180,7 +180,7 @@ public class RepositoryId_1_3 {
public static final String kRemoteTypeStr = "";
public static final String kRemoteValueRepID = "";
public static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
static {
kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName()));
@ -189,7 +189,7 @@ public class RepositoryId_1_3 {
}
public static final Hashtable kSpecialCasesRepIDs = new Hashtable();
private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
static {
kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID);
@ -197,7 +197,7 @@ public class RepositoryId_1_3 {
kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID);
}
public static final Hashtable kSpecialCasesStubValues = new Hashtable();
private static final Hashtable kSpecialCasesStubValues = new Hashtable();
static {
kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue);
@ -209,7 +209,7 @@ public class RepositoryId_1_3 {
}
public static final Hashtable kSpecialCasesVersions = new Hashtable();
private static final Hashtable kSpecialCasesVersions = new Hashtable();
static {
kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash);
@ -220,7 +220,7 @@ public class RepositoryId_1_3 {
kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash);
}
public static final Hashtable kSpecialCasesClasses = new Hashtable();
private static final Hashtable kSpecialCasesClasses = new Hashtable();
static {
kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class);
@ -232,7 +232,7 @@ public class RepositoryId_1_3 {
//kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
}
public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
static {
kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
@ -243,7 +243,7 @@ public class RepositoryId_1_3 {
kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
}
public static final Hashtable kSpecialPrimitives = new Hashtable();
private static final Hashtable kSpecialPrimitives = new Hashtable();
static {
kSpecialPrimitives.put("int","long");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -63,7 +63,7 @@ public class RepositoryId_1_3_1 {
// uniformly, and is safe because that is the only
// legal use of '.' in a Java name.
public static final byte[] IDL_IDENTIFIER_CHARS = {
private static final byte[] IDL_IDENTIFIER_CHARS = {
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f
@ -198,7 +198,7 @@ public class RepositoryId_1_3_1 {
public static final String kRemoteTypeStr = "";
public static final String kRemoteValueRepID = "";
public static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
static {
kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName()));
@ -207,7 +207,7 @@ public class RepositoryId_1_3_1 {
}
public static final Hashtable kSpecialCasesRepIDs = new Hashtable();
private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
static {
kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID);
@ -215,7 +215,7 @@ public class RepositoryId_1_3_1 {
kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID);
}
public static final Hashtable kSpecialCasesStubValues = new Hashtable();
private static final Hashtable kSpecialCasesStubValues = new Hashtable();
static {
kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue);
@ -227,7 +227,7 @@ public class RepositoryId_1_3_1 {
}
public static final Hashtable kSpecialCasesVersions = new Hashtable();
private static final Hashtable kSpecialCasesVersions = new Hashtable();
static {
kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash);
@ -238,7 +238,7 @@ public class RepositoryId_1_3_1 {
kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash);
}
public static final Hashtable kSpecialCasesClasses = new Hashtable();
private static final Hashtable kSpecialCasesClasses = new Hashtable();
static {
kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class);
@ -250,7 +250,7 @@ public class RepositoryId_1_3_1 {
//kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
}
public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
static {
kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
@ -261,7 +261,7 @@ public class RepositoryId_1_3_1 {
kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
}
public static final Hashtable kSpecialPrimitives = new Hashtable();
private static final Hashtable kSpecialPrimitives = new Hashtable();
static {
kSpecialPrimitives.put("int","long");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ public abstract class LocalClientRequestDispatcherBase implements LocalClientReq
// If isNextIsLocalValid.get() == Boolean.TRUE,
// the next call to isLocal should be valid
protected static ThreadLocal isNextCallValid = new ThreadLocal() {
private static final ThreadLocal isNextCallValid = new ThreadLocal() {
protected synchronized Object initialValue() {
return Boolean.TRUE;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -57,7 +57,7 @@ public class RepositoryId {
// uniformly, and is safe because that is the only
// legal use of '.' in a Java name.
public static final byte[] IDL_IDENTIFIER_CHARS = {
private static final byte[] IDL_IDENTIFIER_CHARS = {
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f
@ -95,7 +95,7 @@ public class RepositoryId {
private static IdentityHashtable classIDLToRepStr = new IdentityHashtable();
private static IdentityHashtable classSeqToRepStr = new IdentityHashtable();
private static IdentityHashtable repStrToByteArray = new IdentityHashtable();
private static final IdentityHashtable repStrToByteArray = new IdentityHashtable();
private static Hashtable repStrToClass = new Hashtable();
private String repId = null;
@ -192,7 +192,7 @@ public class RepositoryId {
public static final String kRemoteTypeStr = "";
public static final String kRemoteValueRepID = "";
public static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
static {
kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName()));
@ -201,7 +201,7 @@ public class RepositoryId {
}
public static final Hashtable kSpecialCasesRepIDs = new Hashtable();
private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
static {
kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID);
@ -209,7 +209,7 @@ public class RepositoryId {
kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID);
}
public static final Hashtable kSpecialCasesStubValues = new Hashtable();
private static final Hashtable kSpecialCasesStubValues = new Hashtable();
static {
kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue);
@ -221,7 +221,7 @@ public class RepositoryId {
}
public static final Hashtable kSpecialCasesVersions = new Hashtable();
private static final Hashtable kSpecialCasesVersions = new Hashtable();
static {
kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash);
@ -232,7 +232,7 @@ public class RepositoryId {
kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash);
}
public static final Hashtable kSpecialCasesClasses = new Hashtable();
private static final Hashtable kSpecialCasesClasses = new Hashtable();
static {
kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class);
@ -244,7 +244,7 @@ public class RepositoryId {
//kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
}
public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable();
static {
kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
@ -255,7 +255,7 @@ public class RepositoryId {
kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix);
}
public static final Hashtable kSpecialPrimitives = new Hashtable();
private static final Hashtable kSpecialPrimitives = new Hashtable();
static {
kSpecialPrimitives.put("int","long");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -58,7 +58,7 @@ public abstract class CORBALogDomains {
private CORBALogDomains() {}
// Top level log domain for CORBA
public static String TOP_LEVEL_DOMAIN = "javax.enterprise.resource.corba";
public static final String TOP_LEVEL_DOMAIN = "javax.enterprise.resource.corba";
public static final String RPC = "rpc" ;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -71,6 +71,34 @@ public class IDLNames implements sun.rmi.rmic.iiop.Constants {
(byte)'F',
};
// Legal IDL Identifier characters (1 = legal). Note
// that '.' (2E) is marked as legal even though it is
// not legal in IDL. This allows us to treat a fully
// qualified Java name with '.' package separators
// uniformly, and is safe because that is the only
// legal use of '.' in a Java name.
private static final byte[] IDL_IDENTIFIER_CHARS = {
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f
1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f
0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f
1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f
0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f
1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf
0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df
1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef
0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff
};
//_____________________________________________________________________
// Public Interfaces
//_____________________________________________________________________
@ -139,7 +167,7 @@ public class IDLNames implements sun.rmi.rmic.iiop.Constants {
result = replace(result,"x\\U","U");
// Now see if we have any remaining illegal characters (see
// RepositoryId.IDL_IDENTIFIER_CHARS array)...
// IDL_IDENTIFIER_CHARS array)...
int length = result.length();
StringBuffer buffer = null;
@ -148,7 +176,7 @@ public class IDLNames implements sun.rmi.rmic.iiop.Constants {
char c = result.charAt(i);
if (c > 255 || RepositoryId.IDL_IDENTIFIER_CHARS[c] == 0) {
if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) {
// We gotta convert. Have we already started?

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -425,7 +425,7 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
// Write the _ids() method...
p.plnI("public String[] _ids() { ");
p.pln("return _type_ids;");
p.pln("return (String[]) _type_ids.clone();");
p.pOln("}");
// Get all the methods and write each stub method...
@ -1860,11 +1860,11 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
{
if(POATie){
p.plnI("public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte[] objectId){");
p.pln("return _type_ids;");
p.pln("return (String[]) _type_ids.clone();");
p.pOln("}");
} else {
p.plnI("public String[] _ids() { ");
p.pln("return _type_ids;");
p.pln("return (String[]) _type_ids.clone();");
p.pOln("}");
}
}

View File

@ -255,3 +255,4 @@ bd568544be7fcd12a9327e6c448592198d57b043 hs24-b13
55954061c6e8750ea39a63523fd65d580db6eeb1 jdk8-b42
e77b8e0ed1f84e3e268239e276c7ab64fa573baa jdk8-b43
5ba29a1db46ecb80a321ca873adb56a3fe6ad320 hs24-b14
831e5c76a20af18f3c08c5a95ed31be0e128a010 jdk8-b44

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -67,7 +67,7 @@
// ------------------------------------------------------------------
// ciField::ciField
ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with(NULL) {
ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
ASSERT_IN_VM;
CompilerThread *thread = CompilerThread::current();
@ -143,7 +143,7 @@ ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with(NULL) {
initialize_from(&field_desc);
}
ciField::ciField(fieldDescriptor *fd): _known_to_link_with(NULL) {
ciField::ciField(fieldDescriptor *fd): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
ASSERT_IN_VM;
_cp_index = -1;
@ -315,6 +315,10 @@ ciType* ciField::compute_type_impl() {
bool ciField::will_link(ciInstanceKlass* accessing_klass,
Bytecodes::Code bc) {
VM_ENTRY_MARK;
assert(bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic ||
bc == Bytecodes::_getfield || bc == Bytecodes::_putfield,
"unexpected bytecode");
if (_offset == -1) {
// at creation we couldn't link to our holder so we need to
// maintain that stance, otherwise there's no safe way to use this
@ -322,9 +326,23 @@ bool ciField::will_link(ciInstanceKlass* accessing_klass,
return false;
}
if (_known_to_link_with == accessing_klass) {
// Check for static/nonstatic mismatch
bool is_static = (bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic);
if (is_static != this->is_static()) {
return false;
}
// Get and put can have different accessibility rules
bool is_put = (bc == Bytecodes::_putfield || bc == Bytecodes::_putstatic);
if (is_put) {
if (_known_to_link_with_put == accessing_klass) {
return true;
}
} else {
if (_known_to_link_with_get == accessing_klass) {
return true;
}
}
FieldAccessInfo result;
constantPoolHandle c_pool(THREAD,
@ -334,8 +352,13 @@ bool ciField::will_link(ciInstanceKlass* accessing_klass,
true, false, KILL_COMPILE_ON_FATAL_(false));
// update the hit-cache, unless there is a problem with memory scoping:
if (accessing_klass->is_shared() || !is_shared())
_known_to_link_with = accessing_klass;
if (accessing_klass->is_shared() || !is_shared()) {
if (is_put) {
_known_to_link_with_put = accessing_klass;
} else {
_known_to_link_with_get = accessing_klass;
}
}
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -49,7 +49,8 @@ private:
ciType* _type;
int _offset;
bool _is_constant;
ciInstanceKlass* _known_to_link_with;
ciInstanceKlass* _known_to_link_with_put;
ciInstanceKlass* _known_to_link_with_get;
ciConstant _constant_value;
// Used for will_link

View File

@ -1884,10 +1884,10 @@ void ClassVerifier::verify_invoke_init(
VerificationType type = current_frame->pop_stack(
VerificationType::reference_check(), CHECK_VERIFY(this));
if (type == VerificationType::uninitialized_this_type()) {
// The method must be an <init> method of either this class, or one of its
// superclasses
// The method must be an <init> method of this class or its superclass
klassOop superk = current_class()->super();
if (ref_class_type.name() != current_class()->name() &&
!name_in_supers(ref_class_type.name(), current_class())) {
ref_class_type.name() != superk->klass_part()->name()) {
verify_error(bci, "Bad <init> method call");
return;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -551,13 +551,21 @@ void CompilerOracle::parse_from_line(char* line) {
}
static const char* cc_file() {
#ifdef ASSERT
if (CompileCommandFile == NULL)
return ".hotspot_compiler";
#endif
return CompileCommandFile;
}
bool CompilerOracle::has_command_file() {
return cc_file() != NULL;
}
bool CompilerOracle::_quiet = false;
void CompilerOracle::parse_from_file() {
assert(has_command_file(), "command file must be specified");
FILE* stream = fopen(cc_file(), "rt");
if (stream == NULL) return;
@ -600,6 +608,7 @@ void CompilerOracle::parse_from_string(const char* str, void (*parse_line)(char*
}
void CompilerOracle::append_comment_to_file(const char* message) {
assert(has_command_file(), "command file must be specified");
fileStream stream(fopen(cc_file(), "at"));
stream.print("# ");
for (int index = 0; message[index] != '\0'; index++) {
@ -610,6 +619,7 @@ void CompilerOracle::append_comment_to_file(const char* message) {
}
void CompilerOracle::append_exclude_to_file(methodHandle method) {
assert(has_command_file(), "command file must be specified");
fileStream stream(fopen(cc_file(), "at"));
stream.print("exclude ");
Klass::cast(method->method_holder())->name()->print_symbol_on(&stream);
@ -624,7 +634,9 @@ void CompilerOracle::append_exclude_to_file(methodHandle method) {
void compilerOracle_init() {
CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line);
CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
if (CompilerOracle::has_command_file()) {
CompilerOracle::parse_from_file();
}
if (lists[PrintCommand] != NULL) {
if (PrintAssembly) {
warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,10 @@ class CompilerOracle : AllStatic {
static bool _quiet;
public:
// True if the command file has been specified or is implicit
static bool has_command_file();
// Reads from file and adds to lists
static void parse_from_file();

View File

@ -896,7 +896,8 @@ static void report_null_exception_in_code_cache(address exception_pc) {
methodOop method = ((nmethod*)n)->method();
tty->print_cr("# Method where it happened %s.%s ", Klass::cast(method->method_holder())->name()->as_C_string(), method->name()->as_C_string());
tty->print_cr("#");
if (ShowMessageBoxOnError && UpdateHotSpotCompilerFileOnError) {
if (ShowMessageBoxOnError && UpdateHotSpotCompilerFileOnError &&
CompilerOracle::has_command_file()) {
const char* title = "HotSpot Runtime Error";
const char* question = "Do you want to exclude compilation of this method in future runs?";
if (os::message_box(title, question)) {

View File

@ -3017,12 +3017,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
}
}
#ifdef ASSERT
// Parse default .hotspotrc settings file
if (!settings_file_specified) {
if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) {
return JNI_EINVAL;
}
}
#endif
if (PrintVMOptions) {
for (index = 0; index < args->nOptions; index++) {

View File

@ -0,0 +1,122 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# @test Test7110720.sh
# @bug 7110720
# @summary improve VM configuration file loading
# @run shell Test7110720.sh
#
if [ "${TESTSRC}" = "" ]
then TESTSRC=.
fi
if [ "${TESTJAVA}" = "" ]
then
PARENT=`dirname \`which java\``
TESTJAVA=`dirname ${PARENT}`
echo "TESTJAVA not set, selecting " ${TESTJAVA}
echo "If this is incorrect, try setting the variable manually."
fi
if [ "${TESTCLASSES}" = "" ]
then
echo "TESTCLASSES not set. Test cannot execute. Failed."
exit 1
fi
# Jtreg sets TESTVMOPTS which may include -d64 which is
# required to test a 64-bit JVM on some platforms.
# If another test harness still creates HOME/JDK64BIT,
# we can recognise that.
# set platform-dependent variables
OS=`uname -s`
case "$OS" in
SunOS | Linux )
FS="/"
RM=/bin/rm
CP=/bin/cp
MV=/bin/mv
## for solaris, linux it's HOME
FILE_LOCATION=$HOME
if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
then
TESTVMOPTS=`cat ${FILE_LOCATION}${FS}JDK64BIT`
fi
;;
Windows_* )
FS="\\"
RM=rm
CP=cp
MV=mv
;;
* )
echo "Unrecognized system!"
exit 1;
;;
esac
JAVA=${TESTJAVA}${FS}bin${FS}java
# Don't test debug builds, they do read the config files:
${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "debug" >/dev/null
if [ "$?" = "0" ]; then
echo Skipping test for debug build.
exit 0
fi
ok=yes
$RM -f .hotspot_compiler .hotspotrc
${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
if [ "$?" = "0" ]; then
echo "FAILED: base case failure"
exit 1
fi
echo "garbage in, garbage out" > .hotspot_compiler
${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
if [ "$?" = "0" ]; then
echo "FAILED: .hotspot_compiler was read"
ok=no
fi
$MV .hotspot_compiler hs_comp.txt
${JAVA} ${TESTVMOPTS} -XX:CompileCommandFile=hs_comp.txt -version 2>&1 | grep "garbage in" >/dev/null
if [ "$?" = "1" ]; then
echo "FAILED: explicit compiler command file not read"
ok=no
fi
$RM -f .hotspot_compiler hs_comp.txt
echo "garbage" > .hotspotrc
${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage" >/dev/null
if [ "$?" = "0" ]; then
echo "FAILED: .hotspotrc was read"
ok=no
fi
$MV .hotspotrc hs_flags.txt
${JAVA} ${TESTVMOPTS} -XX:Flags=hs_flags.txt -version 2>&1 | grep "garbage" >/dev/null
if [ "$?" = "1" ]; then
echo "FAILED: explicit flags file not read"
ok=no
fi
if [ "${ok}" = "no" ]; then
echo "Some tests failed."
exit 1
else
echo "Passed"
exit 0
fi

View File

@ -0,0 +1,82 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test Test7160757.java
* @bug 7160757
* @summary Tests that superclass initialization is not skipped
*/
public class Test7160757 {
public static void main(String args[]) throws Exception {
ClassLoader loader = new SLoader();
try {
Class.forName("S", true, loader);
System.out.println("FAILED");
throw new Exception("Should have thrown a VerifyError.");
} catch (VerifyError e) {
System.out.println(e);
System.out.println("PASSED");
}
}
static class SLoader extends ClassLoader {
/**
* public class S extends Throwable {
* public S() {
* aload_0
* invokespecial Object.<init>()
* return
* }
* }
*/
static byte b(int i) { return (byte)i; }
static byte S_class[] = {
b(0xca), b(0xfe), b(0xba), b(0xbe), 0x00, 0x00, 0x00, 0x32,
0x00, 0x0c, 0x0a, 0x00, 0x0b, 0x00, 0x07, 0x07,
0x00, 0x08, 0x07, 0x00, 0x09, 0x01, 0x00, 0x06,
0x3c, 0x69, 0x6e, 0x69, 0x74, 0x3e, 0x01, 0x00,
0x03, 0x28, 0x29, 0x56, 0x01, 0x00, 0x04, 0x43,
0x6f, 0x64, 0x65, 0x0c, 0x00, 0x04, 0x00, 0x05,
0x01, 0x00, 0x01, 0x53, 0x01, 0x00, 0x13, 0x6a,
0x61, 0x76, 0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67,
0x2f, 0x54, 0x68, 0x72, 0x6f, 0x77, 0x61, 0x62,
0x6c, 0x65, 0x01, 0x00, 0x10, 0x6a, 0x61, 0x76,
0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x4f,
0x62, 0x6a, 0x65, 0x63, 0x74, 0x07, 0x00, 0x0a,
0x00, 0x21, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04,
0x00, 0x05, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00,
0x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
0x00, 0x05, 0x2a, b(0xb7), 0x00, 0x01, b(0xb1), 0x00,
0x00, 0x00, 0x00, 0x00, 0x00
};
public Class findClass(String name) throws ClassNotFoundException {
return defineClass(name, S_class, 0, S_class.length);
}
}
}

View File

@ -165,3 +165,4 @@ b88fc3359dc7edabfa8a228855d8cebf8843c055 jdk8-b40
4eac56f073ea8179b1a35fcd2af9b48b0088be9f jdk8-b41
cf5c1f6fbc5ba14163fe0ef8eb8601b33f951372 jdk8-b42
b3246687c3695dff6f461bb407f9db88f7d072e7 jdk8-b43
db471a7af03168e4441c245b1d9976f720a7cb77 jdk8-b44

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -100,6 +100,23 @@ FILES_ties = $(subst javax/management/remote/rmi/,javax/management/remote/rmi/
# so that *_tie classes are generated in package without the prefix
# org.omg.stub (6375696)
#
# To ensure the latest stub generator files are picked up from corba repo
# when available, we need to run with latest rmic version available. rmic
# launch tool not built at this stage but we can invoke via rmi class.
RMIC_JAVA = $(OUTPUTDIR)/bin/java
# need to treat 64bit solaris differently
ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64)
RMIC_JAVA = $(OUTPUTDIR)/bin/amd64/java
endif
ifeq ($(PLATFORM)-$(LIBARCH), solaris-sparcv9)
RMIC_JAVA = $(OUTPUTDIR)/bin/sparcv9/java
endif
ifeq ($(CROSS_COMPILE_ARCH),)
RMIC = $(RMIC_JAVA) $(JAVA_TOOLS_FLAGS) -cp $(OUTPUTDIR)/classes sun.rmi.rmic.Main
endif
$(CLASSDESTDIR)/%_Stub.class: $(CLASSDESTDIR)/%.class
$(prep-target)
$(RMIC) -classpath "$(CLASSDESTDIR)" \

View File

@ -42,7 +42,7 @@ REQUIRED_ALSA_VERSION =
OTHER_CPPFLAGS += -DJAVASE_EMBEDDED
# Product naming
PRODUCT_SUFFIX = SE Runtime Environment for Embedded
PRODUCT_SUFFIX = SE Embedded Runtime Environment
RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX)
# Reduced JRE locations

View File

@ -372,6 +372,7 @@ JAVA_JAVA_java = \
java/util/spi/CurrencyNameProvider.java \
java/util/spi/LocaleNameProvider.java \
java/util/spi/LocaleServiceProvider.java \
java/util/spi/ResourceBundleControlProvider.java \
java/util/spi/TimeZoneNameProvider.java \
java/io/Closeable.java \
java/io/Flushable.java \

View File

@ -88,6 +88,7 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_IOUtil_fdVal;
Java_sun_nio_ch_IOUtil_fdLimit;
Java_sun_nio_ch_IOUtil_initIDs;
Java_sun_nio_ch_IOUtil_iovMax;
Java_sun_nio_ch_IOUtil_makePipe;
Java_sun_nio_ch_IOUtil_randomBytes;
Java_sun_nio_ch_IOUtil_setfdVal;

View File

@ -76,6 +76,7 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_IOUtil_fdLimit;
Java_sun_nio_ch_IOUtil_fdVal;
Java_sun_nio_ch_IOUtil_initIDs;
Java_sun_nio_ch_IOUtil_iovMax;
Java_sun_nio_ch_IOUtil_makePipe;
Java_sun_nio_ch_IOUtil_randomBytes;
Java_sun_nio_ch_IOUtil_setfdVal;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package apple.applescript;
import java.io.*;
import java.nio.file.Files;
import java.util.*;
import java.util.Map.Entry;
@ -297,7 +298,7 @@ public class AppleScriptEngine implements ScriptEngine {
File tmpfile;
FileWriter tmpwrite;
try {
tmpfile = File.createTempFile("AppleScriptEngine.", ".scpt");
tmpfile = Files.createTempFile("AppleScriptEngine.", ".scpt").toFile();
tmpwrite = new FileWriter(tmpfile);
// read in our input and write directly to tmpfile

View File

@ -63,6 +63,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private static native void nativeSetNSWindowSecurityWarningPositioning(long nsWindowPtr, double x, double y, float biasX, float biasY);
private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled);
private static native void nativeSynthesizeMouseEnteredExitedEvents(long nsWindowPtr);
private static native void nativeDispose(long nsWindowPtr);
private static native int nativeGetNSWindowDisplayID_AppKitThread(long nsWindowPtr);
@ -423,6 +424,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
EventQueue.invokeLater(new Runnable() {
public void run() {
contentView.dispose();
nativeDispose(getNSWindowPtr());
CPlatformWindow.super.dispose();
}
});

View File

@ -41,10 +41,11 @@ final class CToolkitThreadBlockedHandler implements ToolkitThreadBlockedHandler
}
public void enter() {
toolkit.startNativeNestedEventLoop();
// Execute the next AppKit event while we are waiting for system to
// finish our request - this will save us from biting our own tail
toolkit.executeNextAppKitEvent();
}
public void exit() {
toolkit.stopNativeNestedEventLoop();
}
}

View File

@ -63,9 +63,7 @@ public class LWCToolkit extends LWToolkit {
private static native void initIDs();
static native void startNativeNestedEventLoop();
static native void stopNativeNestedEventLoop();
static native void executeNextAppKitEvent();
private static CInputMethodDescriptor sInputMethodDescriptor;
@ -361,9 +359,11 @@ public class LWCToolkit extends LWToolkit {
CWrapper.NSObject.release(screen);
}
// Convert between Cocoa's coordinate system and Java.
return new Insets(fullScreen.height - workArea.height - workArea.y,
workArea.x, workArea.y,
fullScreen.width - workArea.width - workArea.x);
int bottom = workArea.y - fullScreen.y;
int top = fullScreen.height - workArea.height - bottom;
int left = workArea.x - fullScreen.x;
int right = fullScreen.width - workArea.width - left;
return new Insets(top, left, bottom, right);
}
@Override

View File

@ -188,7 +188,9 @@ AWT_ASSERT_APPKIT_THREAD;
#endif
}
} else {
#if IM_DEBUG
NSLog(@"-> IM does not want to handle event");
#endif
[self deliverJavaMouseEvent: event];
}
}

View File

@ -228,6 +228,7 @@ AWT_ASSERT_APPKIT_THREAD;
}
if (self.nsWindow == nil) return nil; // no hope either
[self.nsWindow release]; // the property retains the object already
self.isEnabled = YES;
self.javaPlatformWindow = platformWindow;
@ -677,9 +678,9 @@ AWT_ASSERT_NOT_APPKIT_THREAD;
styleBits:styleBits
frameRect:frameRect
contentView:contentView];
// the window is released is CPlatformWindow.nativeDispose()
if (window) CFRetain(window);
[window release]; // GC
if (window) CFRetain(window.nsWindow);
}];
JNF_COCOA_EXIT(env);
@ -1160,3 +1161,24 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeDispose
(JNIEnv *env, jclass clazz, jlong windowPtr)
{
JNF_COCOA_ENTER(env);
NSWindow *nsWindow = OBJC(windowPtr);
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
// AWTWindow holds a reference to the NSWindow in its nsWindow
// property. Unsetting the delegate allows it to be deallocated
// which releases the reference. This, in turn, allows the window
// itself be deallocated.
[nsWindow setDelegate: nil];
[window release];
}];
JNF_COCOA_EXIT(env);
}

View File

@ -42,7 +42,6 @@ jint* gButtonDownMasks;
@implementation AWTToolkit
static long eventCount;
static bool shouldKeepRunningNestedLoop = NO;
+ (long) getEventCount{
return eventCount;
@ -460,33 +459,18 @@ Java_sun_font_FontManager_populateFontFileNameMap
/*
* Class: sun_lwawt_macosx_LWCToolkit
* Method: startNativeNestedEventLoop
* Method: executeNextAppKitEvent
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_startNativeNestedEventLoop
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_executeNextAppKitEvent
(JNIEnv *env, jclass cls)
{
if(!shouldKeepRunningNestedLoop) {
// Simply get the next event in native loop and pass it to execution
// We'll be called repeatedly so there's no need to block here
NSRunLoop *theRL = [NSRunLoop currentRunLoop];
NSApplication * app = [NSApplication sharedApplication];
shouldKeepRunningNestedLoop = YES;
while (shouldKeepRunningNestedLoop && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]])
{
NSEvent * event = [app nextEventMatchingMask: 0xFFFFFFFF untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES];
if (event != nil) {
[app sendEvent: event];
}
}
}
}
/*
* Class: sun_lwawt_macosx_LWCToolkit
* Method: stopNativeNestedEventLoop
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_stopNativeNestedEventLoop
(JNIEnv *env, jclass cls)
{
shouldKeepRunningNestedLoop = NO;
}

View File

@ -63,12 +63,14 @@ OGLGC_DestroyOGLGraphicsConfig(jlong pConfigInfo)
CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
if (ctxinfo != NULL) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
[NSOpenGLContext clearCurrentContext];
[ctxinfo->context clearDrawable];
[ctxinfo->context release];
if (ctxinfo->scratchSurface != 0) {
[ctxinfo->scratchSurface release];
}
[pool drain];
free(ctxinfo);
}
}

View File

@ -30,6 +30,8 @@
BOOL fHandlesDocumentTypes;
BOOL fHandlesURLTypes;
id <NSApplicationDelegate> realDelegate;
NSMutableArray* queue;
}
@ -40,5 +42,9 @@
- (void)processQueuedEventsWithTargetDelegate:(id <NSApplicationDelegate>)delegate;
@property(retain) id <NSApplicationDelegate> realDelegate;
@property(retain) NSMutableArray* queue;
@end

View File

@ -27,8 +27,6 @@
#import "QueuingApplicationDelegate.h"
static id <NSApplicationDelegate> realDelegate = nil;
@interface NSBundle (EAWTOverrides)
- (BOOL)_hasEAWTOverride:(NSString *)key;
@end
@ -44,6 +42,9 @@ static id <NSApplicationDelegate> realDelegate = nil;
@implementation QueuingApplicationDelegate
@synthesize realDelegate;
@synthesize queue;
+ (QueuingApplicationDelegate*) sharedDelegate
{
static QueuingApplicationDelegate * qad = nil;
@ -62,7 +63,7 @@ static id <NSApplicationDelegate> realDelegate = nil;
return self;
}
self->queue = [[NSMutableArray arrayWithCapacity: 0] retain];
self.queue = [NSMutableArray arrayWithCapacity: 0];
// If the java application has a bundle with an Info.plist file with
// a CFBundleDocumentTypes entry, then it is set up to handle Open Doc
@ -100,8 +101,8 @@ static id <NSApplicationDelegate> realDelegate = nil;
Class clz = [QueuingApplicationDelegate class];
[ctr removeObserver:clz];
[self->queue release];
self->queue = nil;
self.queue = nil;
self.realDelegate = nil;
[super dealloc];
}
@ -109,16 +110,16 @@ static id <NSApplicationDelegate> realDelegate = nil;
- (void)_handleOpenURLEvent:(NSAppleEventDescriptor *)openURLEvent withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
[self->queue addObject:^(){
[realDelegate _handleOpenURLEvent:openURLEvent withReplyEvent:replyEvent];
}];
[self.queue addObject:[^(){
[self.realDelegate _handleOpenURLEvent:openURLEvent withReplyEvent:replyEvent];
} copy]];
}
- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)fileNames
{
[self->queue addObject:^(){
[realDelegate application:theApplication openFiles:fileNames];
}];
[self.queue addObject:[^(){
[self.realDelegate application:theApplication openFiles:fileNames];
} copy]];
}
- (NSApplicationPrintReply)application:(NSApplication *)application printFiles:(NSArray *)fileNames withSettings:(NSDictionary *)printSettings showPrintPanels:(BOOL)showPrintPanels
@ -127,9 +128,9 @@ static id <NSApplicationDelegate> realDelegate = nil;
return NSPrintingCancelled;
}
[self->queue addObject:^(){
[realDelegate application:application printFiles:fileNames withSettings:printSettings showPrintPanels:showPrintPanels];
}];
[self.queue addObject:[^(){
[self.realDelegate application:application printFiles:fileNames withSettings:printSettings showPrintPanels:showPrintPanels];
} copy]];
// well, a bit premature, but what else can we do?..
return NSPrintingSuccess;
@ -137,76 +138,76 @@ static id <NSApplicationDelegate> realDelegate = nil;
- (void)_willFinishLaunching
{
QueuingApplicationDelegate * q = self;
[self->queue addObject:^(){
[[realDelegate class] _willFinishLaunching];
}];
[self.queue addObject:[^(){
[[self.realDelegate class] _willFinishLaunching];
} copy]];
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
{
[self->queue addObject:^(){
[realDelegate applicationShouldHandleReopen:theApplication hasVisibleWindows:flag];
}];
[self.queue addObject:[^(){
[self.realDelegate applicationShouldHandleReopen:theApplication hasVisibleWindows:flag];
} copy]];
return YES;
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
{
[self->queue addObject:^(){
[realDelegate applicationShouldTerminate:app];
}];
[self.queue addObject:[^(){
[self.realDelegate applicationShouldTerminate:app];
} copy]];
return NSTerminateLater;
}
- (void)_systemWillPowerOff
{
[self->queue addObject:^(){
[[realDelegate class] _systemWillPowerOff];
}];
[self.queue addObject:[^(){
[[self.realDelegate class] _systemWillPowerOff];
} copy]];
}
- (void)_appDidActivate
{
[self->queue addObject:^(){
[[realDelegate class] _appDidActivate];
}];
[self.queue addObject:[^(){
[[self.realDelegate class] _appDidActivate];
} copy]];
}
- (void)_appDidDeactivate
{
[self->queue addObject:^(){
[[realDelegate class] _appDidDeactivate];
}];
[self.queue addObject:[^(){
[[self.realDelegate class] _appDidDeactivate];
} copy]];
}
- (void)_appDidHide
{
[self->queue addObject:^(){
[[realDelegate class] _appDidHide];
}];
[self.queue addObject:[^(){
[[self.realDelegate class] _appDidHide];
} copy]];
}
- (void)_appDidUnhide
{
[self->queue addObject:^(){
[[realDelegate class] _appDidUnhide];
}];
[self.queue addObject:[^(){
[[self.realDelegate class] _appDidUnhide];
} copy]];
}
- (void)processQueuedEventsWithTargetDelegate:(id <NSApplicationDelegate>)delegate
{
NSUInteger i;
NSUInteger count = [self->queue count];
self.realDelegate = delegate;
realDelegate = delegate;
NSUInteger i;
NSUInteger count = [self.queue count];
for (i = 0; i < count; i++) {
void (^event)() = (void (^)())[self->queue objectAtIndex: i];
void (^event)() = (void (^)())[self.queue objectAtIndex: i];
event();
[event release];
}
[self->queue removeAllObjects];
[self.queue removeAllObjects];
}
@end

View File

@ -926,9 +926,20 @@ class GTKPainter extends SynthPainter {
int x, int y, int w, int h) {
// Text is odd in that it uses the TEXT_BACKGROUND vs BACKGROUND.
JComponent c = context.getComponent();
Container container = c.getParent();
Container containerParent = null;
GTKStyle style = (GTKStyle)context.getStyle();
Region id = context.getRegion();
int state = context.getComponentState();
if (c instanceof ListCellRenderer && container != null) {
containerParent = container.getParent();
if (containerParent instanceof JComboBox
&& containerParent.hasFocus()) {
state |= SynthConstants.FOCUSED;
}
}
synchronized (UNIXToolkit.GTK_LOCK) {
if (ENGINE.paintCachedImage(g, x, y, w, h, id, state)) {
return;
@ -938,9 +949,10 @@ class GTKPainter extends SynthPainter {
int focusSize = 0;
boolean interiorFocus = style.getClassSpecificBoolValue(
context, "interior-focus", true);
if (!interiorFocus && (state & SynthConstants.FOCUSED) != 0) {
focusSize = style.getClassSpecificIntValue(context,
"focus-line-width",1);
if (!interiorFocus && (state & SynthConstants.FOCUSED) != 0) {
x += focusSize;
y += focusSize;
w -= 2 * focusSize;
@ -961,11 +973,25 @@ class GTKPainter extends SynthPainter {
h - (2 * yThickness),
ColorType.TEXT_BACKGROUND);
if (focusSize > 0) {
if (focusSize > 0 && (state & SynthConstants.FOCUSED) != 0) {
if (!interiorFocus) {
x -= focusSize;
y -= focusSize;
w += 2 * focusSize;
h += 2 * focusSize;
} else {
if (containerParent instanceof JComboBox) {
x += (focusSize + 2);
y += (focusSize + 1);
w -= (2 * focusSize + 1);
h -= (2 * focusSize + 2);
} else {
x += focusSize;
y += focusSize;
w -= 2 * focusSize;
h -= 2 * focusSize;
}
}
ENGINE.paintFocus(g, context, id, gtkState,
"entry", x, y, w, h);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.text.MessageFormat;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -385,9 +386,7 @@ class Driver {
if ( base.getParentFile() == null && suffix.equals(".bak"))
where = new File(".").getAbsoluteFile();
File f = File.createTempFile(prefix, suffix, where);
return f;
return Files.createTempFile(where.toPath(), prefix, suffix).toFile();
}
static private

View File

@ -659,7 +659,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
* us work with drivers that do not support
* getObject with a map in fairly sensible way
*/
if (map == null) {
if (map == null || map.isEmpty()) {
obj = data.getObject(i);
} else {
obj = data.getObject(i, map);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -828,39 +828,55 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
*/
private boolean insertNewRow(CachedRowSet crs,
PreparedStatement pstmt, CachedRowSetImpl crsRes) throws SQLException {
int i = 0;
int icolCount = crs.getMetaData().getColumnCount();
boolean returnVal = false;
PreparedStatement pstmtSel = con.prepareStatement(selectCmd,
ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs, rs2 = null;
DatabaseMetaData dbmd = con.getMetaData();
rs = pstmtSel.executeQuery();
String table = crs.getTableName();
rs2 = dbmd.getPrimaryKeys(null, null, table);
try (PreparedStatement pstmtSel = con.prepareStatement(selectCmd,
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = pstmtSel.executeQuery();
ResultSet rs2 = con.getMetaData().getPrimaryKeys(null, null,
crs.getTableName())
) {
ResultSetMetaData rsmd = crs.getMetaData();
int icolCount = rsmd.getColumnCount();
String[] primaryKeys = new String[icolCount];
int k = 0;
while (rs2.next()) {
String pkcolname = rs2.getString("COLUMN_NAME");
primaryKeys[k] = pkcolname;
primaryKeys[k] = rs2.getString("COLUMN_NAME");
k++;
}
if (rs.next()) {
for(int j=0;j<primaryKeys.length;j++) {
if(primaryKeys[j] != null) {
if(crs.getObject(primaryKeys[j]) == null){
for (String pkName : primaryKeys) {
if (!isPKNameValid(pkName, rsmd)) {
/* We came here as one of the the primary keys
* of the table is not present in the cached
* rowset object, it should be an autoincrement column
* and not included while creating CachedRowSet
* Object, proceed to check for other primary keys
*/
continue;
}
Object crsPK = crs.getObject(pkName);
if (crsPK == null) {
/*
* It is possible that the PK is null on some databases
* and will be filled in at insert time (MySQL for example)
*/
break;
}
String crsPK = (crs.getObject(primaryKeys[j])).toString();
String rsPK = (rs.getObject(primaryKeys[j])).toString();
if(crsPK.equals(rsPK)) {
String rsPK = rs.getObject(pkName).toString();
if (crsPK.toString().equals(rsPK)) {
returnVal = true;
this.crsResolve.moveToInsertRow();
for(i = 1; i <= icolCount; i++) {
for (int i = 1; i <= icolCount; i++) {
String colname = (rs.getMetaData()).getColumnName(i);
if(colname.equals(primaryKeys[j]))
if (colname.equals(pkName))
this.crsResolve.updateObject(i,rsPK);
else
this.crsResolve.updateNull(i);
@ -870,12 +886,13 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
}
}
}
}
if(returnVal)
if (returnVal) {
return returnVal;
}
try {
for (i = 1; i <= icolCount; i++) {
for (int i = 1; i <= icolCount; i++) {
Object obj = crs.getObject(i);
if (obj != null) {
pstmt.setObject(i, obj);
@ -884,20 +901,20 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
}
}
i = pstmt.executeUpdate();
pstmt.executeUpdate();
return false;
} catch (SQLException ex) {
/**
/*
* Cursor will come here if executeUpdate fails.
* There can be many reasons why the insertion failed,
* one can be violation of primary key.
* Hence we cannot exactly identify why the insertion failed
* Present the current row as a null row to the user.
**/
* Hence we cannot exactly identify why the insertion failed,
* present the current row as a null row to the caller.
*/
this.crsResolve.moveToInsertRow();
for(i = 1; i <= icolCount; i++) {
for (int i = 1; i <= icolCount; i++) {
this.crsResolve.updateNull(i);
}
@ -907,6 +924,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
return true;
}
}
}
/**
* Deletes the row in the underlying data source that corresponds to
@ -1437,4 +1455,25 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
}
static final long serialVersionUID =-8506030970299413976L;
/**
* Validate whether the Primary Key is known to the CachedRowSet. If it is
* not, it is an auto-generated key
* @param pk - Primary Key to validate
* @param rsmd - ResultSetMetadata for the RowSet
* @return true if found, false otherwise (auto generated key)
*/
private boolean isPKNameValid(String pk, ResultSetMetaData rsmd) throws SQLException {
boolean isValid = false;
int cols = rsmd.getColumnCount();
for(int i = 1; i<= cols; i++) {
String colName = rsmd.getColumnClassName(i);
if(colName.equalsIgnoreCase(pk)) {
isValid = true;
break;
}
}
return isValid;
}
}

View File

@ -764,6 +764,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
rs.next();
rs.setOriginalRow();
applyUpdates();
rs.deleteRow();
} catch (SQLException ex) {
throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errdel").toString() , ex.getMessage()));
}

View File

@ -41,7 +41,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=Fehler beim Umbenennen von Datei od
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.cancelButton.textAndMnemonic=Abbrechen
FileChooser.saveButton.textAndMnemonic=&Speichern
FileChooser.openButton.textAndMnemonic=\u00D6ffnen(&F)
FileChooser.saveDialogTitle.textAndMnemonic=Speichern

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=Error al cambiar el nombre del arch
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.cancelButton.textAndMnemonic=Cancelar
FileChooser.saveButton.textAndMnemonic=&Guardar
FileChooser.openButton.textAndMnemonic=A&brir
FileChooser.saveDialogTitle.textAndMnemonic=Guardar

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=Erreur lors du changement de nom du
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.cancelButton.textAndMnemonic=Annuler
FileChooser.saveButton.textAndMnemonic=Enregi&strer
FileChooser.openButton.textAndMnemonic=&Ouvrir
FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=Errore durante la ridenominazione d
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.cancelButton.textAndMnemonic=Annulla
FileChooser.saveButton.textAndMnemonic=Sal&va
FileChooser.openButton.textAndMnemonic=A&pri
FileChooser.saveDialogTitle.textAndMnemonic=Salva

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u307E\u305
FileChooser.renameError.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093
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(&C)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58(&S)
FileChooser.openButton.textAndMnemonic=\u958B\u304F(&O)
FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=\uD30C\uC77C \uB610\uB294 \uD3F4\uB
FileChooser.renameError.textAndMnemonic={0}\uC758 \uC774\uB984\uC744 \uBC14\uAFC0 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
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(&C)
FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C
FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5(&S)
FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30(&O)
FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=Erro ao Renomear o Arquivo ou a Pas
FileChooser.renameError.textAndMnemonic=N\u00E3o \u00E9 poss\u00EDvel renomear {0}
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.cancelButton.textAndMnemonic=Cancelar
FileChooser.saveButton.textAndMnemonic=&Salvar
FileChooser.openButton.textAndMnemonic=A&brir
FileChooser.saveDialogTitle.textAndMnemonic=Salvar

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6
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.cancelButton.textAndMnemonic=Avbryt
FileChooser.saveButton.textAndMnemonic=&Spara
FileChooser.openButton.textAndMnemonic=\u00D6ppna(&P)
FileChooser.saveDialogTitle.textAndMnemonic=Spara

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=\u91CD\u547D\u540D\u6587\u4EF6\u621
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(&C)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58(&S)
FileChooser.openButton.textAndMnemonic=\u6253\u5F00(&O)
FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58

View File

@ -40,7 +40,7 @@ FileChooser.renameErrorTitle.textAndMnemonic=\u91CD\u65B0\u547D\u540D\u6A94\u684
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(&C)
FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
FileChooser.saveButton.textAndMnemonic=\u5132\u5B58(&S)
FileChooser.openButton.textAndMnemonic=\u958B\u555F(&O)
FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58

View File

@ -43,6 +43,8 @@ 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

View File

@ -43,6 +43,8 @@ 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

View File

@ -43,6 +43,8 @@ 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

View File

@ -43,6 +43,8 @@ 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

View File

@ -43,6 +43,8 @@ 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

View File

@ -43,6 +43,8 @@ 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)

View File

@ -43,6 +43,8 @@ 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)

View File

@ -43,6 +43,8 @@ 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

View File

@ -43,6 +43,8 @@ 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(&R)

View File

@ -43,6 +43,8 @@ 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)

View File

@ -43,6 +43,8 @@ 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)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ import java.awt.geom.Rectangle2D;
import java.awt.peer.FontPeer;
import java.io.*;
import java.lang.ref.SoftReference;
import java.nio.file.Files;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.text.AttributedCharacterIterator.Attribute;
@ -831,7 +832,7 @@ public class Font implements java.io.Serializable
File f = null;
boolean hasPerm = false;
try {
f = File.createTempFile("+~JT", ".tmp", null);
f = Files.createTempFile("+~JT", ".tmp").toFile();
f.delete();
f = null;
hasPerm = true;
@ -881,7 +882,7 @@ public class Font implements java.io.Serializable
final File tFile = AccessController.doPrivileged(
new PrivilegedExceptionAction<File>() {
public File run() throws IOException {
return File.createTempFile("+~JF", ".tmp", null);
return Files.createTempFile("+~JF", ".tmp").toFile();
}
}
);

View File

@ -1,6 +1,26 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.io;

View File

@ -407,7 +407,7 @@ public class MethodHandles {
* an access$N method.
*/
Lookup() {
this(getCallerClassAtEntryPoint(), ALL_MODES);
this(getCallerClassAtEntryPoint(false), ALL_MODES);
// make sure we haven't accidentally picked up a privileged class:
checkUnprivilegedlookupClass(lookupClass);
}
@ -461,8 +461,8 @@ public class MethodHandles {
&& !VerifyAccess.isSamePackageMember(this.lookupClass, requestedLookupClass)) {
newModes &= ~PRIVATE;
}
if (newModes == PUBLIC
&& !VerifyAccess.isClassAccessible(requestedLookupClass, this.lookupClass)) {
if ((newModes & PUBLIC) != 0
&& !VerifyAccess.isClassAccessible(requestedLookupClass, this.lookupClass, allowedModes)) {
// The requested class it not accessible from the lookup class.
// No permissions.
newModes = 0;
@ -540,13 +540,17 @@ public class MethodHandles {
}
}
// call this from an entry point method in Lookup with extraFrames=0.
private static Class<?> getCallerClassAtEntryPoint() {
/* Obtain the external caller class, when called from Lookup.<init> or a first-level subroutine. */
private static Class<?> getCallerClassAtEntryPoint(boolean inSubroutine) {
final int CALLER_DEPTH = 4;
// Stack for the constructor entry point (inSubroutine=false):
// 0: Reflection.getCC, 1: getCallerClassAtEntryPoint,
// 2: Lookup.<init>, 3: MethodHandles.*, 4: caller
// The stack is slightly different for a subroutine of a Lookup.find* method:
// 2: Lookup.*, 3: Lookup.find*.*, 4: caller
// Note: This should be the only use of getCallerClass in this file.
assert(Reflection.getCallerClass(CALLER_DEPTH-1) == MethodHandles.class);
assert(Reflection.getCallerClass(CALLER_DEPTH-2) == Lookup.class);
assert(Reflection.getCallerClass(CALLER_DEPTH-1) == (inSubroutine ? Lookup.class : MethodHandles.class));
return Reflection.getCallerClass(CALLER_DEPTH);
}
@ -1087,7 +1091,7 @@ return mh1;
void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
Class<?> caller = lookupClassOrNull();
if (caller != null && !VerifyAccess.isClassAccessible(refc, caller))
if (caller != null && !VerifyAccess.isClassAccessible(refc, caller, allowedModes))
throw new MemberName(refc).makeAccessException("symbolic reference class is not public", this);
}
@ -1102,7 +1106,13 @@ return mh1;
// Step 1:
smgr.checkMemberAccess(refc, Member.PUBLIC);
// Step 2:
if (!VerifyAccess.classLoaderIsAncestor(lookupClass, refc))
Class<?> callerClass = ((allowedModes & PRIVATE) != 0
? lookupClass // for strong access modes, no extra check
// next line does stack walk magic; do not refactor:
: getCallerClassAtEntryPoint(true));
if (!VerifyAccess.classLoaderIsAncestor(lookupClass, refc) ||
(callerClass != lookupClass &&
!VerifyAccess.classLoaderIsAncestor(callerClass, refc)))
smgr.checkPackageAccess(VerifyAccess.getPackageName(refc));
// Step 3:
if (m.isPublic()) return;
@ -1153,9 +1163,10 @@ return mh1;
int requestedModes = fixmods(mods); // adjust 0 => PACKAGE
if ((requestedModes & allowedModes) != 0
&& VerifyAccess.isMemberAccessible(refc, m.getDeclaringClass(),
mods, lookupClass()))
mods, lookupClass(), allowedModes))
return;
if (((requestedModes & ~allowedModes) & PROTECTED) != 0
&& (allowedModes & PACKAGE) != 0
&& VerifyAccess.isSamePackage(m.getDeclaringClass(), lookupClass()))
// Protected members can also be checked as if they were package-private.
return;
@ -1170,9 +1181,9 @@ return mh1;
(defc == refc ||
Modifier.isPublic(refc.getModifiers())));
if (!classOK && (allowedModes & PACKAGE) != 0) {
classOK = (VerifyAccess.isClassAccessible(defc, lookupClass()) &&
classOK = (VerifyAccess.isClassAccessible(defc, lookupClass(), ALL_MODES) &&
(defc == refc ||
VerifyAccess.isClassAccessible(refc, lookupClass())));
VerifyAccess.isClassAccessible(refc, lookupClass(), ALL_MODES)));
}
if (!classOK)
return "class is not public";

View File

@ -288,12 +288,11 @@ public class HashMap<K,V>
* in lower bits.
*/
final int hash(Object k) {
int h = hashSeed;
if (k instanceof String) {
return ((String) k).hash32();
}
h ^= k.hashCode();
int h = hashSeed ^ k.hashCode();
// This function ensures that hashCodes that differ only by
// constant multiples at each bit position have a bounded

View File

@ -194,12 +194,11 @@ public class Hashtable<K,V>
transient final int hashSeed = sun.misc.Hashing.randomHashSeed(this);
private int hash(Object k) {
int h = hashSeed;
if (k instanceof String) {
return ((String)k).hash32();
} else {
h ^= k.hashCode();
}
int h = hashSeed ^ k.hashCode();
// This function ensures that hashCodes that differ only by
// constant multiples at each bit position have a bounded
@ -207,7 +206,6 @@ public class Hashtable<K,V>
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
}
}
/**
* Constructs a new, empty hashtable with the specified initial
@ -1015,7 +1013,7 @@ public class Hashtable<K,V>
*/
private static class Entry<K,V> implements Map.Entry<K,V> {
final int hash;
K key;
final K key;
V value;
Entry<K,V> next;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -55,6 +55,7 @@ import java.security.PrivilegedExceptionAction;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.jar.JarEntry;
import java.util.spi.ResourceBundleControlProvider;
import sun.util.locale.BaseLocale;
import sun.util.locale.LocaleObjectCache;
@ -192,6 +193,17 @@ import sun.util.locale.LocaleObjectCache;
* {@link #getBundle(String, Locale, ClassLoader, Control) getBundle}
* factory method for details.
*
* <p><a name="modify_default_behavior">For the {@code getBundle} factory
* methods that take no {@link Control} instance, their <a
* href="#default_behavior"> default behavior</a> of resource bundle loading
* can be modified with <em>installed</em> {@link
* ResourceBundleControlProvider} implementations. Any installed providers are
* detected at the {@code ResourceBundle} class loading time. If any of the
* providers provides a {@link Control} for the given base name, that {@link
* Control} will be used instead of the default {@link Control}. If there is
* more than one service provider installed for supporting the same base name,
* the first one returned from {@link ServiceLoader} will be used.
*
* <h4>Cache Management</h4>
*
* Resource bundle instances created by the <code>getBundle</code> factory
@ -294,8 +306,7 @@ public abstract class ResourceBundle {
/**
* Queue for reference objects referring to class loaders or bundles.
*/
private static final ReferenceQueue<Object> referenceQueue =
new ReferenceQueue<>();
private static final ReferenceQueue<Object> referenceQueue = new ReferenceQueue<>();
/**
* The parent bundle of this bundle.
@ -330,6 +341,21 @@ public abstract class ResourceBundle {
*/
private volatile Set<String> keySet;
private static final List<ResourceBundleControlProvider> providers;
static {
List<ResourceBundleControlProvider> list = null;
ServiceLoader<ResourceBundleControlProvider> serviceLoaders
= ServiceLoader.loadInstalled(ResourceBundleControlProvider.class);
for (ResourceBundleControlProvider provider : serviceLoaders) {
if (list == null) {
list = new ArrayList<>();
}
list.add(provider);
}
providers = list;
}
/**
* Sole constructor. (For invocation by subclass constructors, typically
* implicit.)
@ -725,7 +751,7 @@ public abstract class ResourceBundle {
return getBundleImpl(baseName, Locale.getDefault(),
/* must determine loader here, else we break stack invariant */
getLoader(),
Control.INSTANCE);
getDefaultControl(baseName));
}
/**
@ -797,7 +823,7 @@ public abstract class ResourceBundle {
return getBundleImpl(baseName, locale,
/* must determine loader here, else we break stack invariant */
getLoader(),
Control.INSTANCE);
getDefaultControl(baseName));
}
/**
@ -849,9 +875,15 @@ public abstract class ResourceBundle {
* Gets a resource bundle using the specified base name, locale, and class
* loader.
*
* <p><a name="default_behavior"/>This method behaves the same as calling
* <p>This method behaves the same as calling
* {@link #getBundle(String, Locale, ClassLoader, Control)} passing a
* default instance of {@link Control}. The following describes this behavior.
* default instance of {@link Control} unless another {@link Control} is
* provided with the {@link ResourceBundleControlProvider} SPI. Refer to the
* description of <a href="#modify_default_behavior">modifying the default
* behavior</a>.
*
* <p><a name="default_behavior"/>The following describes the default
* behavior.
*
* <p><code>getBundle</code> uses the base name, the specified locale, and
* the default locale (obtained from {@link java.util.Locale#getDefault()
@ -1026,7 +1058,7 @@ public abstract class ResourceBundle {
if (loader == null) {
throw new NullPointerException();
}
return getBundleImpl(baseName, locale, loader, Control.INSTANCE);
return getBundleImpl(baseName, locale, loader, getDefaultControl(baseName));
}
/**
@ -1247,6 +1279,18 @@ public abstract class ResourceBundle {
return getBundleImpl(baseName, targetLocale, loader, control);
}
private static Control getDefaultControl(String baseName) {
if (providers != null) {
for (ResourceBundleControlProvider provider : providers) {
Control control = provider.getControl(baseName);
if (control != null) {
return control;
}
}
}
return Control.INSTANCE;
}
private static ResourceBundle getBundleImpl(String baseName, Locale locale,
ClassLoader loader, Control control) {
if (locale == null || control == null) {

View File

@ -295,13 +295,11 @@ public class WeakHashMap<K,V>
* otherwise encounter collisions for hashCodes that do not differ
* in lower bits.
*/
int hash(Object k) {
int h = hashSeed;
final int hash(Object k) {
if (k instanceof String) {
return ((String) k).hash32();
} else {
h ^= k.hashCode();
}
int h = hashSeed ^ k.hashCode();
// This function ensures that hashCodes that differ only by
// constant multiples at each bit position have a bounded

View File

@ -269,13 +269,11 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
* differ in lower or upper bits.
*/
private int hash(Object k) {
int h = hashSeed;
if (k instanceof String) {
return ((String) k).hash32();
}
h ^= k.hashCode();
int h = hashSeed ^ k.hashCode();
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. 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 java.util.spi;
import java.util.ResourceBundle;
/**
* An interface for service providers that provide implementations of {@link
* java.util.ResourceBundle.Control}. The <a
* href="../ResourceBundle.html#default_behavior">default resource bundle loading
* behavior</a> of the {@code ResourceBundle.getBundle} factory methods that take
* no {@link java.util.ResourceBundle.Control} instance can be modified with {@code
* ResourceBundleControlProvider} implementations.
*
* <p>Provider implementations must be packaged using the <a
* href="../../../../technotes/guides/extensions/index.html">Java Extension
* Mechanism</a> as installed extensions. Refer to {@link java.util.ServiceLoader}
* for the extension packaging. Any installed {@code
* ResourceBundleControlProvider} implementations are loaded using {@link
* java.util.ServiceLoader} at the {@code ResourceBundle} class loading time.
*
* @author Masayoshi Okutsu
* @since 1.8
* @see ResourceBundle#getBundle(String, java.util.Locale, ClassLoader, ResourceBundle.Control)
* ResourceBundle.getBundle
* @see java.util.ServiceLoader#loadInstalled(Class)
*/
public interface ResourceBundleControlProvider {
/**
* Returns a {@code ResourceBundle.Control} instance that is used
* to handle resource bundle loading for the given {@code
* baseName}. This method must return {@code null} if the given
* {@code baseName} isn't handled by this provider.
*
* @param baseName the base name of the resource bundle
* @return a {@code ResourceBundle.Control} instance,
* or {@code null} if the given {@code baseName} is not
* applicable to this provider.
* @throws NullPointerException if {@code baseName} is {@code null}
*/
public ResourceBundle.Control getControl(String baseName);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.file.Files;
import com.sun.imageio.stream.StreamCloser;
import com.sun.imageio.stream.StreamFinalizer;
import sun.java2d.Disposer;
@ -97,8 +98,11 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl {
throw new IllegalArgumentException("Not a directory!");
}
this.stream = stream;
this.cacheFile =
File.createTempFile("imageio", ".tmp", cacheDir);
if (cacheDir == null)
this.cacheFile = Files.createTempFile("imageio", ".tmp").toFile();
else
this.cacheFile = Files.createTempFile(cacheDir.toPath(), "imageio", ".tmp")
.toFile();
this.cache = new RandomAccessFile(cacheFile, "rw");
this.closeAction = StreamCloser.createCloseAction(this);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.file.Files;
import com.sun.imageio.stream.StreamCloser;
/**
@ -83,8 +84,11 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl {
throw new IllegalArgumentException("Not a directory!");
}
this.stream = stream;
this.cacheFile =
File.createTempFile("imageio", ".tmp", cacheDir);
if (cacheDir == null)
this.cacheFile = Files.createTempFile("imageio", ".tmp").toFile();
else
this.cacheFile = Files.createTempFile(cacheDir.toPath(), "imageio", ".tmp")
.toFile();
this.cache = new RandomAccessFile(cacheFile, "rw");
this.closeAction = StreamCloser.createCloseAction(this);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -44,6 +44,7 @@ import java.lang.reflect.Constructor;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLStreamHandlerFactory;
import java.nio.file.Files;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@ -1160,8 +1161,9 @@ public class MLet extends java.net.URLClassLoader
try {
File directory = new File(libraryDirectory);
directory.mkdirs();
File file = File.createTempFile(libname + ".", null,
directory);
File file = Files.createTempFile(directory.toPath(),
libname + ".", null)
.toFile();
file.deleteOnExit();
FileOutputStream fileOutput = new FileOutputStream(file);
try {

View File

@ -152,8 +152,8 @@ public class SynthButtonUI extends BasicButtonUI implements
if (!c.isEnabled()) {
state = DISABLED;
}
if (SynthLookAndFeel.selectedUI == this) {
return SynthLookAndFeel.selectedUIState | SynthConstants.ENABLED;
if (SynthLookAndFeel.getSelectedUI() == this) {
return SynthLookAndFeel.getSelectedUIState() | SynthConstants.ENABLED;
}
AbstractButton button = (AbstractButton) c;
ButtonModel model = button.getModel();

View File

@ -97,9 +97,9 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI {
private int getComponentState(JComponent c) {
int state = SynthLookAndFeel.getComponentState(c);
if (SynthLookAndFeel.selectedUI == this &&
if (SynthLookAndFeel.getSelectedUI() == this &&
state == SynthConstants.ENABLED) {
state = SynthLookAndFeel.selectedUIState | SynthConstants.ENABLED;
state = SynthLookAndFeel.getSelectedUIState() | SynthConstants.ENABLED;
}
return state;
}

View File

@ -76,28 +76,26 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
private static final Object STYLE_FACTORY_KEY =
new StringBuffer("com.sun.java.swing.plaf.gtk.StyleCache");
/**
* AppContext key to get selectedUI.
*/
private static final Object SELECTED_UI_KEY = new StringBuilder("selectedUI");
/**
* AppContext key to get selectedUIState.
*/
private static final Object SELECTED_UI_STATE_KEY = new StringBuilder("selectedUIState");
/**
* The last SynthStyleFactory that was asked for from AppContext
* <code>lastContext</code>.
*/
private static SynthStyleFactory lastFactory;
/**
* If this is true it indicates there is more than one AppContext active
* and that we need to make sure in getStyleCache the requesting
* AppContext matches that of <code>lastContext</code> before returning
* it.
*/
private static boolean multipleApps;
/**
* AppContext lastLAF came from.
*/
private static AppContext lastContext;
// Refer to setSelectedUI
static ComponentUI selectedUI;
// Refer to setSelectedUI
static int selectedUIState;
/**
* SynthStyleFactory for the this SynthLookAndFeel.
*/
@ -111,6 +109,10 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
private Handler _handler;
static ComponentUI getSelectedUI() {
return (ComponentUI) AppContext.getAppContext().get(SELECTED_UI_KEY);
}
/**
* Used by the renderers. For the most part the renderers are implemented
* as Labels, which is problematic in so far as they are never selected.
@ -122,8 +124,8 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
static void setSelectedUI(ComponentUI uix, boolean selected,
boolean focused, boolean enabled,
boolean rollover) {
selectedUI = uix;
selectedUIState = 0;
int selectedUIState = 0;
if (selected) {
selectedUIState = SynthConstants.SELECTED;
if (focused) {
@ -140,19 +142,32 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
else {
if (enabled) {
selectedUIState |= SynthConstants.ENABLED;
selectedUIState = SynthConstants.FOCUSED;
if (focused) {
selectedUIState |= SynthConstants.FOCUSED;
}
}
else {
selectedUIState |= SynthConstants.DISABLED;
}
}
AppContext context = AppContext.getAppContext();
context.put(SELECTED_UI_KEY, uix);
context.put(SELECTED_UI_STATE_KEY, Integer.valueOf(selectedUIState));
}
static int getSelectedUIState() {
Integer result = (Integer) AppContext.getAppContext().get(SELECTED_UI_STATE_KEY);
return result == null ? 0 : result.intValue();
}
/**
* Clears out the selected UI that was last set in setSelectedUI.
*/
static void resetSelectedUI() {
selectedUI = null;
AppContext.getAppContext().remove(SELECTED_UI_KEY);
}
@ -167,10 +182,6 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
// for a particular AppContext.
synchronized(SynthLookAndFeel.class) {
AppContext context = AppContext.getAppContext();
if (!multipleApps && context != lastContext &&
lastContext != null) {
multipleApps = true;
}
lastFactory = cache;
lastContext = context;
context.put(STYLE_FACTORY_KEY, cache);
@ -184,17 +195,13 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
*/
public static SynthStyleFactory getStyleFactory() {
synchronized(SynthLookAndFeel.class) {
if (!multipleApps) {
return lastFactory;
}
AppContext context = AppContext.getAppContext();
if (lastContext == context) {
return lastFactory;
}
lastContext = context;
lastFactory = (SynthStyleFactory)AppContext.getAppContext().get
(STYLE_FACTORY_KEY);
lastFactory = (SynthStyleFactory) context.get(STYLE_FACTORY_KEY);
return lastFactory;
}
}

View File

@ -1986,8 +1986,6 @@ class Parser implements DTDConstants {
if (i == SCRIPT_END_TAG.length) {
/* '</script>' tag detected */
/* Here, ch == '>' */
ch = readCh();
/* Here, ch == the first character after </script> */
return;
} else {
@ -2060,6 +2058,8 @@ class Parser implements DTDConstants {
handleComment(str.toCharArray());
endTag(false);
lastBlockStartPos = currentPosition;
continue;
} else {
switch (c) {
case '<':

View File

@ -498,7 +498,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
postDropTargetEvent(component, x, y, dropAction, actions,
formats, nativeCtxt,
SunDropTargetEvent.MOUSE_DROPPED,
!SunDropTargetContextPeer.DISPATCH_SYNC);
SunDropTargetContextPeer.DISPATCH_SYNC);
}
/**

View File

@ -33,7 +33,7 @@ package sun.font;
import sun.font.GlyphLayout.*;
import java.awt.geom.Point2D;
import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Locale;
/*
@ -129,9 +129,9 @@ public final class SunLayoutEngine implements LayoutEngine, LayoutEngineFactory
// !!! don't need this unless we have more than one sun layout engine...
public LayoutEngine getEngine(LayoutEngineKey key) {
HashMap cache = (HashMap)cacheref.get();
ConcurrentHashMap cache = (ConcurrentHashMap)cacheref.get();
if (cache == null) {
cache = new HashMap();
cache = new ConcurrentHashMap();
cacheref = new SoftReference(cache);
}

View File

@ -37,6 +37,8 @@ public class VerifyAccess {
private VerifyAccess() { } // cannot instantiate
private static final int PACKAGE_ONLY = 0;
private static final int PACKAGE_ALLOWED = java.lang.invoke.MethodHandles.Lookup.PACKAGE;
private static final int PROTECTED_OR_PACKAGE_ALLOWED = (PACKAGE_ALLOWED|PROTECTED);
private static final int ALL_ACCESS_MODES = (PUBLIC|PRIVATE|PROTECTED|PACKAGE_ONLY);
private static final boolean ALLOW_NESTMATE_ACCESS = false;
@ -82,14 +84,19 @@ public class VerifyAccess {
public static boolean isMemberAccessible(Class<?> refc, // symbolic ref class
Class<?> defc, // actual def class
int mods, // actual member mods
Class<?> lookupClass) {
Class<?> lookupClass,
int allowedModes) {
if (allowedModes == 0) return false;
assert((allowedModes & PUBLIC) != 0 &&
(allowedModes & ~(ALL_ACCESS_MODES|PACKAGE_ALLOWED)) == 0);
// Usually refc and defc are the same, but if they differ, verify them both.
if (refc != defc) {
if (!isClassAccessible(refc, lookupClass)) {
if (!isClassAccessible(refc, lookupClass, allowedModes)) {
// Note that defc is verified in the switch below.
return false;
}
if ((mods & (ALL_ACCESS_MODES|STATIC)) == (PROTECTED|STATIC)) {
if ((mods & (ALL_ACCESS_MODES|STATIC)) == (PROTECTED|STATIC) &&
(allowedModes & PROTECTED_OR_PACKAGE_ALLOWED) != 0) {
// Apply the special rules for refc here.
if (!isRelatedClass(refc, lookupClass))
return isSamePackage(defc, lookupClass);
@ -98,19 +105,28 @@ public class VerifyAccess {
// a superclass of the lookup class.
}
}
if (defc == lookupClass)
if (defc == lookupClass &&
(allowedModes & PRIVATE) != 0)
return true; // easy check; all self-access is OK
switch (mods & ALL_ACCESS_MODES) {
case PUBLIC:
if (refc != defc) return true; // already checked above
return isClassAccessible(refc, lookupClass);
return isClassAccessible(refc, lookupClass, allowedModes);
case PROTECTED:
return isSamePackage(defc, lookupClass) || isPublicSuperClass(defc, lookupClass);
case PACKAGE_ONLY:
return isSamePackage(defc, lookupClass);
if ((allowedModes & PROTECTED_OR_PACKAGE_ALLOWED) != 0 &&
isSamePackage(defc, lookupClass))
return true;
if ((allowedModes & PROTECTED) != 0 &&
isPublicSuperClass(defc, lookupClass))
return true;
return false;
case PACKAGE_ONLY: // That is, zero. Unmarked member is package-only access.
return ((allowedModes & PACKAGE_ALLOWED) != 0 &&
isSamePackage(defc, lookupClass));
case PRIVATE:
// Loosened rules for privates follows access rules for inner classes.
return (ALLOW_NESTMATE_ACCESS &&
(allowedModes & PRIVATE) != 0 &&
isSamePackageMember(defc, lookupClass));
default:
throw new IllegalArgumentException("bad modifiers: "+Modifier.toString(mods));
@ -138,11 +154,16 @@ public class VerifyAccess {
* @param refc the symbolic reference class to which access is being checked (C)
* @param lookupClass the class performing the lookup (D)
*/
public static boolean isClassAccessible(Class<?> refc, Class<?> lookupClass) {
public static boolean isClassAccessible(Class<?> refc, Class<?> lookupClass,
int allowedModes) {
if (allowedModes == 0) return false;
assert((allowedModes & PUBLIC) != 0 &&
(allowedModes & ~(ALL_ACCESS_MODES|PACKAGE_ALLOWED)) == 0);
int mods = refc.getModifiers();
if (isPublic(mods))
return true;
if (isSamePackage(lookupClass, refc))
if ((allowedModes & PACKAGE_ALLOWED) != 0 &&
isSamePackage(lookupClass, refc))
return true;
return false;
}
@ -157,7 +178,7 @@ public class VerifyAccess {
assert(!class1.isArray() && !class2.isArray());
if (class1 == class2)
return true;
if (!loadersAreRelated(class1.getClassLoader(), class2.getClassLoader(), false))
if (class1.getClassLoader() != class2.getClassLoader())
return false;
String name1 = class1.getName(), name2 = class2.getName();
int dot = name1.lastIndexOf('.');

View File

@ -201,23 +201,20 @@ public class JarIndex {
packageName = fileName;
}
// add the mapping to indexMap
addToList(packageName, jarName, indexMap);
// add the mapping to jarMap
addToList(jarName, packageName, jarMap);
addMapping(packageName, jarName);
}
/**
* Same as add(String,String) except that it doesn't strip off from the
* last index of '/'. It just adds the filename.
* last index of '/'. It just adds the jarItem (filename or package)
* as it is received.
*/
private void addExplicit(String fileName, String jarName) {
private void addMapping(String jarItem, String jarName) {
// add the mapping to indexMap
addToList(fileName, jarName, indexMap);
addToList(jarItem, jarName, indexMap);
// add the mapping to jarMap
addToList(jarName, fileName, jarMap);
addToList(jarName, jarItem, jarMap);
}
/**
@ -248,18 +245,14 @@ public class JarIndex {
fileName.equals(JarFile.MANIFEST_NAME))
continue;
if (!metaInfFilenames) {
add(fileName, currentJar);
} else {
if (!fileName.startsWith("META-INF/")) {
if (!metaInfFilenames || !fileName.startsWith("META-INF/")) {
add(fileName, currentJar);
} else if (!entry.isDirectory()) {
// Add files under META-INF explicitly so that certain
// services, like ServiceLoader, etc, can be located
// with greater accuracy. Directories can be skipped
// since each file will be added explicitly.
addExplicit(fileName, currentJar);
}
addMapping(fileName, currentJar);
}
}
@ -324,8 +317,7 @@ public class JarIndex {
jars.add(currentJar);
} else {
String name = line;
addToList(name, currentJar, indexMap);
addToList(currentJar, name, jarMap);
addMapping(name, currentJar);
}
}
@ -354,7 +346,7 @@ public class JarIndex {
if (path != null) {
jarName = path.concat(jarName);
}
toIndex.add(packageName, jarName);
toIndex.addMapping(packageName, jarName);
}
}
}

View File

@ -36,6 +36,11 @@ import java.nio.ByteBuffer;
public class IOUtil {
/**
* Max number of iovec structures that readv/writev supports
*/
static final int IOV_MAX;
private IOUtil() { } // No instantiation
static int write(FileDescriptor fd, ByteBuffer src, long position,
@ -111,7 +116,8 @@ public class IOUtil {
// Iterate over buffers to populate native iovec array.
int count = offset + length;
for (int i=offset; i<count; i++) {
int i = offset;
while (i < count && iov_len < IOV_MAX) {
ByteBuffer buf = bufs[i];
int pos = buf.position();
int lim = buf.limit();
@ -135,6 +141,7 @@ public class IOUtil {
vec.putLen(iov_len, rem);
iov_len++;
}
i++;
}
if (iov_len == 0)
return 0L;
@ -240,7 +247,8 @@ public class IOUtil {
// Iterate over buffers to populate native iovec array.
int count = offset + length;
for (int i=offset; i<count; i++) {
int i = offset;
while (i < count && iov_len < IOV_MAX) {
ByteBuffer buf = bufs[i];
if (buf.isReadOnly())
throw new IllegalArgumentException("Read-only buffer");
@ -264,6 +272,7 @@ public class IOUtil {
vec.putLen(iov_len, rem);
iov_len++;
}
i++;
}
if (iov_len == 0)
return 0L;
@ -336,11 +345,14 @@ public class IOUtil {
static native int fdLimit();
static native int iovMax();
static native void initIDs();
static {
// Note that IOUtil.initIDs is called from within Util.load.
Util.load();
IOV_MAX = iovMax();
}
}

View File

@ -45,7 +45,7 @@ public class Util {
// -- Caches --
// The number of temp buffers in our pool
private static final int TEMP_BUF_POOL_SIZE = 8;
private static final int TEMP_BUF_POOL_SIZE = IOUtil.IOV_MAX;
// Per-thread cache of temporary direct buffers
private static ThreadLocal<BufferCache> bufferCache =

View File

@ -97,6 +97,7 @@ import sun.font.FontUtilities;
import java.nio.charset.*;
import java.nio.CharBuffer;
import java.nio.ByteBuffer;
import java.nio.file.Files;
//REMIND: Remove use of this class when IPPPrintService is moved to share directory.
import java.lang.reflect.Method;
@ -659,7 +660,7 @@ public class PSPrinterJob extends RasterPrinterJob {
* is not removed for some reason, request that it is
* removed when the VM exits.
*/
spoolFile = File.createTempFile("javaprint", ".ps", null);
spoolFile = Files.createTempFile("javaprint", ".ps").toFile();
spoolFile.deleteOnExit();
result = new FileOutputStream(spoolFile);

View File

@ -429,6 +429,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
ValidatingFileChooser jfc = new ValidatingFileChooser();
jfc.setApproveButtonText(getMsg("button.ok"));
jfc.setDialogTitle(getMsg("dialog.printtofile"));
jfc.setDialogType(JFileChooser.SAVE_DIALOG);
jfc.setSelectedFile(fileDest);
int returnVal = jfc.showDialog(this, null);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,6 +43,7 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.file.Files;
import java.nio.channels.Channel;
import java.nio.channels.ServerSocketChannel;
import java.rmi.AccessException;
@ -1940,7 +1941,7 @@ public class Activation implements Serializable {
new PrivilegedExceptionAction<Void>() {
public Void run() throws IOException {
File file =
File.createTempFile("rmid-err", null, null);
Files.createTempFile("rmid-err", null).toFile();
PrintStream errStream =
new PrintStream(new FileOutputStream(file));
System.setErr(errStream);

View File

@ -90,6 +90,7 @@ class BasicChecker extends PKIXCertPathChecker {
this.date = date;
this.sigProvider = sigProvider;
this.sigOnly = sigOnly;
this.prevPubKey = trustedPubKey;
}
/**

View File

@ -1119,6 +1119,7 @@ final public class SSLEngineImpl extends SSLEngine {
* handle a few more records, so the sequence number
* of the last record cannot be wrapped.
*/
hsStatus = getHSStatus(hsStatus);
if (connectionState < cs_ERROR && !isInboundDone() &&
(hsStatus == HandshakeStatus.NOT_HANDSHAKING)) {
if (checkSequenceNumber(readMAC,
@ -1287,6 +1288,7 @@ final public class SSLEngineImpl extends SSLEngine {
* handle a few more records, so the sequence number
* of the last record cannot be wrapped.
*/
hsStatus = getHSStatus(hsStatus);
if (connectionState < cs_ERROR && !isOutboundDone() &&
(hsStatus == HandshakeStatus.NOT_HANDSHAKING)) {
if (checkSequenceNumber(writeMAC, eor.contentType())) {

View File

@ -32,8 +32,10 @@ import java.lang.reflect.InvocationTargetException;
import java.security.cert.CRLException;
import java.security.cert.CertificateException;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map;
import java.util.TreeMap;
import sun.security.util.*;
@ -61,7 +63,8 @@ import sun.security.util.*;
*/
public class CRLExtensions {
private Hashtable<String,Extension> map = new Hashtable<String,Extension>();
private Map<String,Extension> map = Collections.synchronizedMap(
new TreeMap<String,Extension>());
private boolean unsupportedCritExt = false;
/**
@ -214,7 +217,7 @@ public class CRLExtensions {
* @return an enumeration of the extensions in this CRL.
*/
public Enumeration<Extension> getElements() {
return map.elements();
return Collections.enumeration(map.values());
}
/**

View File

@ -57,7 +57,8 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
private static final Debug debug = Debug.getInstance("x509");
private Hashtable<String,Extension> map = new Hashtable<String,Extension>();
private Map<String,Extension> map = Collections.synchronizedMap(
new TreeMap<String,Extension>());
private boolean unsupportedCritExt = false;
private Map<String,Extension> unparseableExtensions;
@ -118,7 +119,7 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
if (ext.isCritical() == false) {
// ignore errors parsing non-critical extensions
if (unparseableExtensions == null) {
unparseableExtensions = new HashMap<String,Extension>();
unparseableExtensions = new TreeMap<String,Extension>();
}
unparseableExtensions.put(ext.getExtensionId().toString(),
new UnparseableExtension(ext, e));
@ -219,6 +220,12 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
return (obj);
}
// Similar to get(String), but throw no exception, might return null.
// Used in X509CertImpl::getExtension(OID).
Extension getExtension(String name) {
return map.get(name);
}
/**
* Delete the attribute value.
* @param name the extension name used in the lookup.
@ -246,7 +253,7 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
* attribute.
*/
public Enumeration<Extension> getElements() {
return map.elements();
return Collections.enumeration(map.values());
}
/**

View File

@ -30,14 +30,7 @@ import java.security.cert.CRLException;
import java.security.cert.CRLReason;
import java.security.cert.X509CRLEntry;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;
import java.util.*;
import javax.security.auth.x500.X500Principal;
@ -74,7 +67,8 @@ import sun.misc.HexDumpEncoder;
* @author Hemma Prafullchandra
*/
public class X509CRLEntryImpl extends X509CRLEntry {
public class X509CRLEntryImpl extends X509CRLEntry
implements Comparable<X509CRLEntryImpl> {
private SerialNumber serialNumber = null;
private Date revocationDate = null;
@ -195,9 +189,14 @@ public class X509CRLEntryImpl extends X509CRLEntry {
* @exception CRLException if an encoding error occurs.
*/
public byte[] getEncoded() throws CRLException {
return getEncoded0().clone();
}
// Called internally to avoid clone
private byte[] getEncoded0() throws CRLException {
if (revokedCert == null)
this.encode(new DerOutputStream());
return revokedCert.clone();
return revokedCert;
}
@Override
@ -351,7 +350,7 @@ public class X509CRLEntryImpl extends X509CRLEntry {
if (extensions == null) {
return null;
}
Set<String> extSet = new HashSet<String>();
Set<String> extSet = new TreeSet<>();
for (Extension ex : extensions.getAllExtensions()) {
if (ex.isCritical()) {
extSet.add(ex.getExtensionId().toString());
@ -372,7 +371,7 @@ public class X509CRLEntryImpl extends X509CRLEntry {
if (extensions == null) {
return null;
}
Set<String> extSet = new HashSet<String>();
Set<String> extSet = new TreeSet<>();
for (Extension ex : extensions.getAllExtensions()) {
if (!ex.isCritical()) {
extSet.add(ex.getExtensionId().toString());
@ -500,16 +499,39 @@ public class X509CRLEntryImpl extends X509CRLEntry {
getExtension(PKIXExtensions.CertificateIssuer_Id);
}
/**
* Returns all extensions for this entry in a map
* @return the extension map, can be empty, but not null
*/
public Map<String, java.security.cert.Extension> getExtensions() {
if (extensions == null) {
return Collections.emptyMap();
}
Collection<Extension> exts = extensions.getAllExtensions();
HashMap<String, java.security.cert.Extension> map =
new HashMap<String, java.security.cert.Extension>(exts.size());
Map<String, java.security.cert.Extension> map = new TreeMap<>();
for (Extension ext : exts) {
map.put(ext.getId(), ext);
}
return map;
}
@Override
public int compareTo(X509CRLEntryImpl that) {
int compSerial = getSerialNumber().compareTo(that.getSerialNumber());
if (compSerial != 0) {
return compSerial;
}
try {
byte[] thisEncoded = this.getEncoded0();
byte[] thatEncoded = that.getEncoded0();
for (int i=0; i<thisEncoded.length && i<thatEncoded.length; i++) {
int a = thisEncoded[i] & 0xff;
int b = thatEncoded[i] & 0xff;
if (a != b) return a-b;
}
return thisEncoded.length -thatEncoded.length;
} catch (CRLException ce) {
return -1;
}
}
}

View File

@ -52,7 +52,7 @@ import sun.misc.HexDumpEncoder;
/**
* <p>
* An implmentation for X509 CRL (Certificate Revocation List).
* An implementation for X509 CRL (Certificate Revocation List).
* <p>
* The X.509 v2 CRL format is described below in ASN.1:
* <pre>
@ -103,7 +103,8 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
private X500Principal issuerPrincipal = null;
private Date thisUpdate = null;
private Date nextUpdate = null;
private Map<X509IssuerSerial,X509CRLEntry> revokedCerts = new LinkedHashMap<X509IssuerSerial,X509CRLEntry>();
private Map<X509IssuerSerial,X509CRLEntry> revokedMap = new TreeMap<>();
private List<X509CRLEntry> revokedList = new LinkedList<>();
private CRLExtensions extensions = null;
private final static boolean isExplicit = true;
private static final long YR_2050 = 2524636800000L;
@ -222,7 +223,8 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
badCert.setCertificateIssuer(crlIssuer, badCertIssuer);
X509IssuerSerial issuerSerial = new X509IssuerSerial
(badCertIssuer, badCert.getSerialNumber());
this.revokedCerts.put(issuerSerial, badCert);
this.revokedMap.put(issuerSerial, badCert);
this.revokedList.add(badCert);
if (badCert.hasExtensions()) {
this.version = 1;
}
@ -304,8 +306,8 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
tmp.putGeneralizedTime(nextUpdate);
}
if (!revokedCerts.isEmpty()) {
for (X509CRLEntry entry : revokedCerts.values()) {
if (!revokedList.isEmpty()) {
for (X509CRLEntry entry : revokedList) {
((X509CRLEntryImpl)entry).encode(rCerts);
}
tmp.write(DerValue.tag_Sequence, rCerts);
@ -489,14 +491,14 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
sb.append("\nThis Update: " + thisUpdate.toString() + "\n");
if (nextUpdate != null)
sb.append("Next Update: " + nextUpdate.toString() + "\n");
if (revokedCerts.isEmpty())
if (revokedList.isEmpty())
sb.append("\nNO certificates have been revoked\n");
else {
sb.append("\nRevoked Certificates: " + revokedCerts.size());
sb.append("\nRevoked Certificates: " + revokedList.size());
int i = 1;
for (Iterator<X509CRLEntry> iter = revokedCerts.values().iterator();
iter.hasNext(); i++)
sb.append("\n[" + i + "] " + iter.next().toString());
for (X509CRLEntry entry: revokedList) {
sb.append("\n[" + i++ + "] " + entry.toString());
}
}
if (extensions != null) {
Collection<Extension> allExts = extensions.getAllExtensions();
@ -542,12 +544,12 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
* false otherwise.
*/
public boolean isRevoked(Certificate cert) {
if (revokedCerts.isEmpty() || (!(cert instanceof X509Certificate))) {
if (revokedMap.isEmpty() || (!(cert instanceof X509Certificate))) {
return false;
}
X509Certificate xcert = (X509Certificate) cert;
X509IssuerSerial issuerSerial = new X509IssuerSerial(xcert);
return revokedCerts.containsKey(issuerSerial);
return revokedMap.containsKey(issuerSerial);
}
/**
@ -637,24 +639,24 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
* @see X509CRLEntry
*/
public X509CRLEntry getRevokedCertificate(BigInteger serialNumber) {
if (revokedCerts.isEmpty()) {
if (revokedMap.isEmpty()) {
return null;
}
// assume this is a direct CRL entry (cert and CRL issuer are the same)
X509IssuerSerial issuerSerial = new X509IssuerSerial
(getIssuerX500Principal(), serialNumber);
return revokedCerts.get(issuerSerial);
return revokedMap.get(issuerSerial);
}
/**
* Gets the CRL entry for the given certificate.
*/
public X509CRLEntry getRevokedCertificate(X509Certificate cert) {
if (revokedCerts.isEmpty()) {
if (revokedMap.isEmpty()) {
return null;
}
X509IssuerSerial issuerSerial = new X509IssuerSerial(cert);
return revokedCerts.get(issuerSerial);
return revokedMap.get(issuerSerial);
}
/**
@ -666,10 +668,10 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
* @see X509CRLEntry
*/
public Set<X509CRLEntry> getRevokedCertificates() {
if (revokedCerts.isEmpty()) {
if (revokedList.isEmpty()) {
return null;
} else {
return new HashSet<X509CRLEntry>(revokedCerts.values());
return new TreeSet<X509CRLEntry>(revokedList);
}
}
@ -905,7 +907,7 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
if (extensions == null) {
return null;
}
Set<String> extSet = new HashSet<String>();
Set<String> extSet = new TreeSet<>();
for (Extension ex : extensions.getAllExtensions()) {
if (ex.isCritical()) {
extSet.add(ex.getExtensionId().toString());
@ -926,7 +928,7 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
if (extensions == null) {
return null;
}
Set<String> extSet = new HashSet<String>();
Set<String> extSet = new TreeSet<>();
for (Extension ex : extensions.getAllExtensions()) {
if (!ex.isCritical()) {
extSet.add(ex.getExtensionId().toString());
@ -1103,7 +1105,8 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
entry.setCertificateIssuer(crlIssuer, badCertIssuer);
X509IssuerSerial issuerSerial = new X509IssuerSerial
(badCertIssuer, entry.getSerialNumber());
revokedCerts.put(issuerSerial, entry);
revokedMap.put(issuerSerial, entry);
revokedList.add(entry);
}
}
@ -1207,7 +1210,8 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
/**
* Immutable X.509 Certificate Issuer DN and serial number pair
*/
private final static class X509IssuerSerial {
private final static class X509IssuerSerial
implements Comparable<X509IssuerSerial> {
final X500Principal issuer;
final BigInteger serial;
volatile int hashcode = 0;
@ -1286,5 +1290,13 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
}
return hashcode;
}
@Override
public int compareTo(X509IssuerSerial another) {
int cissuer = issuer.toString()
.compareTo(another.issuer.toString());
if (cissuer != 0) return cissuer;
return this.serial.compareTo(another.serial);
}
}
}

View File

@ -1202,7 +1202,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
if (exts == null) {
return null;
}
Set<String> extSet = new HashSet<String>();
Set<String> extSet = new TreeSet<>();
for (Extension ex : exts.getAllExtensions()) {
if (ex.isCritical()) {
extSet.add(ex.getExtensionId().toString());
@ -1232,7 +1232,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
if (exts == null) {
return null;
}
Set<String> extSet = new HashSet<String>();
Set<String> extSet = new TreeSet<>();
for (Extension ex : exts.getAllExtensions()) {
if (!ex.isCritical()) {
extSet.add(ex.getExtensionId().toString());
@ -1266,11 +1266,15 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
if (extensions == null) {
return null;
} else {
for (Extension ex : extensions.getAllExtensions()) {
if (ex.getExtensionId().equals((Object)oid)) {
//XXXX May want to consider cloning this
Extension ex = extensions.getExtension(oid.toString());
if (ex != null) {
return ex;
}
for (Extension ex2: extensions.getAllExtensions()) {
if (ex2.getExtensionId().equals((Object)oid)) {
//XXXX May want to consider cloning this
return ex2;
}
}
/* no such extension in this certificate */
return null;
@ -1465,10 +1469,10 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
if (names.isEmpty()) {
return Collections.<List<?>>emptySet();
}
Set<List<?>> newNames = new HashSet<List<?>>();
List<List<?>> newNames = new ArrayList<>();
for (GeneralName gname : names.names()) {
GeneralNameInterface name = gname.getName();
List<Object> nameEntry = new ArrayList<Object>(2);
List<Object> nameEntry = new ArrayList<>(2);
nameEntry.add(Integer.valueOf(name.getType()));
switch (name.getType()) {
case GeneralNameInterface.NAME_RFC822:
@ -1526,12 +1530,12 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
}
}
if (mustClone) {
Set<List<?>> namesCopy = new HashSet<List<?>>();
List<List<?>> namesCopy = new ArrayList<>();
for (List<?> nameEntry : altNames) {
Object nameObject = nameEntry.get(1);
if (nameObject instanceof byte[]) {
List<Object> nameEntryCopy =
new ArrayList<Object>(nameEntry);
new ArrayList<>(nameEntry);
nameEntryCopy.set(1, ((byte[])nameObject).clone());
namesCopy.add(Collections.unmodifiableList(nameEntryCopy));
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -137,7 +137,7 @@ class Main {
File dir = file.getParentFile();
if (dir == null)
dir = new File(".");
return File.createTempFile("jartmp", null, dir);
return Files.createTempFile(dir.toPath(), "jartmp", null).toFile();
}
private boolean ok;

Some files were not shown because too many files have changed in this diff Show More