--- corba/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ -215,7 +215,7 @@ // 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 --- corba/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ // 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 --- corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ 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 --- corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, 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 @@ 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); @@ -133,7 +133,7 @@ activeObjectMap.remove(key); - if (Util.instance != null) { + if (Util.isInstanceDefined()) { POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; POAFactory factory = pm.getFactory() ; factory.unregisterPOAForServant(poa, s); --- corba/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 void shutdown( boolean waitForCompletion ) { - if (Util.instance != null) { - Util.instance.unregisterTargetsForORB(orb); + if (Util.isInstanceDefined()) { + Util.getInstance().unregisterTargetsForORB(orb); } } --- corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 ParserData[] getParserData() { - return parserData ; + ParserData[] parserArray = new ParserData[parserData.length]; + System.arraycopy(parserData, 0, parserArray, 0, parserData.length); + return parserArray; } private ParserTable() { --- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ // 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 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 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 @@ 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 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 @@ 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 @@ //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 @@ 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"); --- corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ // 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 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 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 @@ 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 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 @@ 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 @@ //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 @@ 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"); --- corba/src/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ // 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; } --- corba/src/share/classes/com/sun/corba/se/impl/util/RepositoryId.java 2012-05-01 17:14:05.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/impl/util/RepositoryId.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ // 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 @@ 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 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 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 @@ 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 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 @@ 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 @@ //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 @@ 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"); --- corba/src/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java 2012-05-01 17:14:06.000000000 -0400 +++ corba/src/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ 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" ; --- corba/src/share/classes/sun/rmi/rmic/iiop/IDLNames.java 2012-05-01 17:14:07.000000000 -0400 +++ corba/src/share/classes/sun/rmi/rmic/iiop/IDLNames.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ (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 @@ 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 @@ 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? --- corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java 2012-05-01 17:14:07.000000000 -0400 +++ corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ // 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 @@ { 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("}"); } } --- hotspot/src/share/vm/ci/ciField.cpp 2012-05-01 17:15:10.000000000 -0400 +++ hotspot/src/share/vm/ci/ciField.cpp 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, 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 @@ 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; @@ -312,6 +312,10 @@ 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 @@ -319,8 +323,22 @@ return false; } - if (_known_to_link_with == accessing_klass) { - return true; + // 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; @@ -331,8 +349,13 @@ 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; } --- hotspot/src/share/vm/ci/ciField.hpp 2012-05-01 17:15:10.000000000 -0400 +++ hotspot/src/share/vm/ci/ciField.hpp 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, 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 @@ 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 --- hotspot/src/share/vm/classfile/verifier.cpp 2012-05-01 17:15:10.000000000 -0400 +++ hotspot/src/share/vm/classfile/verifier.cpp 2012-09-05 19:34:26.000000000 -0400 @@ -1871,10 +1871,10 @@ VerificationType type = current_frame->pop_stack( VerificationType::reference_check(), CHECK_VERIFY(this)); if (type == VerificationType::uninitialized_this_type()) { - // The method must be an method of either this class, or one of its - // superclasses + // The method must be an 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 method call"); return; } --- hotspot/src/share/vm/compiler/compilerOracle.cpp 2012-05-01 17:15:10.000000000 -0400 +++ hotspot/src/share/vm/compiler/compilerOracle.cpp 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, 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,22 @@ } static const char* cc_file() { - if (CompileCommandFile == NULL) +#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 +609,7 @@ } 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 +620,7 @@ } 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 +635,9 @@ void compilerOracle_init() { CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line); CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); - CompilerOracle::parse_from_file(); + 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"); --- hotspot/src/share/vm/compiler/compilerOracle.hpp 2012-05-01 17:15:10.000000000 -0400 +++ hotspot/src/share/vm/compiler/compilerOracle.hpp 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, 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 @@ -38,6 +38,10 @@ 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(); --- hotspot/src/share/vm/opto/runtime.cpp 2012-05-01 17:15:13.000000000 -0400 +++ hotspot/src/share/vm/opto/runtime.cpp 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, 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 @@ -804,7 +804,8 @@ 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)) { --- hotspot/src/share/vm/runtime/arguments.cpp 2012-05-01 17:15:13.000000000 -0400 +++ hotspot/src/share/vm/runtime/arguments.cpp 2012-09-05 19:34:26.000000000 -0400 @@ -2956,12 +2956,14 @@ } } +#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++) { --- jaxp/build.properties 2012-05-01 17:15:26.000000000 -0400 +++ jaxp/build.properties 2012-09-05 19:34:26.000000000 -0400 @@ -77,6 +77,9 @@ # Where patches to drop bundle sources live patches.dir=patches +# Patches to apply +jaxp_src.patch.list=7157609.patch + # Sanity information sanity.info= Sanity Settings:${line.separator}\ ant.home=${ant.home}${line.separator}\ --- jaxp/patches/jaxp_src/7157609.patch 1969-12-31 19:00:00.000000000 -0500 +++ jaxp/patches/jaxp_src/7157609.patch 2012-09-05 19:34:26.000000000 -0400 @@ -0,0 +1,38 @@ +# HG changeset patch +# User joehw +# Date 1333729977 25200 +# Node ID abc9f6855a61c74ca11183ec49fcbbb9e4fa29b1 +# Parent 3f8b55667a6f9d093fcaf4a70c784c426b00685b +7157609: Issues with loop +Reviewed-by: hawtin, lancea + +diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java b/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java +--- src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java ++++ src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java +@@ -402,6 +402,16 @@ public abstract class XMLScanner + + boolean dataFoundForTarget = false; + boolean sawSpace = fEntityScanner.skipSpaces(); ++ // since pseudoattributes are *not* attributes, ++ // their quotes don't need to be preserved in external parameter entities. ++ // the XMLEntityScanner#scanLiteral method will continue to ++ // emit -1 in such cases when it finds a quote; this is ++ // fine for other methods that parse scanned entities, ++ // but not for the scanning of pseudoattributes. So, ++ // temporarily, we must mark the current entity as not being "literal" ++ Entity.ScannedEntity currEnt = fEntityManager.getCurrentEntity(); ++ boolean currLiteral = currEnt.literal; ++ currEnt.literal = false; + while (fEntityScanner.peekChar() != '?') { + dataFoundForTarget = true; + String name = scanPseudoAttribute(scanningTextDecl, fString); +@@ -499,6 +509,9 @@ public abstract class XMLScanner + } + sawSpace = fEntityScanner.skipSpaces(); + } ++ // restore original literal value ++ if(currLiteral) ++ currEnt.literal = true; + // REVISIT: should we remove this error reporting? + if (scanningTextDecl && state != STATE_DONE) { + reportFatalError("MorePseudoAttributes", null); --- jdk/make/com/sun/jmx/Makefile 2012-05-01 17:17:59.000000000 -0400 +++ jdk/make/com/sun/jmx/Makefile 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ -98,6 +98,21 @@ # 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 + +RMIC = $(RMIC_JAVA) $(JAVA_TOOLS_FLAGS) -cp $(OUTPUTDIR)/classes sun.rmi.rmic.Main + $(CLASSDESTDIR)/%_Stub.class: $(CLASSDESTDIR)/%.class $(prep-target) $(RMIC) -classpath "$(CLASSDESTDIR)" \ --- jdk/make/sun/Makefile 2012-05-01 17:18:00.000000000 -0400 +++ jdk/make/sun/Makefile 2012-09-05 19:35:34.000000000 -0400 @@ -64,7 +64,7 @@ SUBDIRS = jar security javazic misc net audio $(RENDER_SUBDIR) image \ awt splashscreen $(XAWT_SUBDIR) $(MOTIF_SUBDIRS) \ $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \ - font jpeg cmm applet rmi beans $(JDBC_SUBDIR) \ + font jpeg cmm applet rmi $(JDBC_SUBDIR) \ jawt text nio launcher management $(ORG_SUBDIR) \ native2ascii serialver tools jconsole --- jdk/make/sun/beans/Makefile 2012-05-01 17:18:00.000000000 -0400 +++ jdk/make/sun/beans/Makefile 2012-09-05 19:35:34.000000000 -0400 @@ -1,43 +0,0 @@ -# -# Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# -# Makefile for building sun.beans.* -# - -BUILDDIR = ../.. -PACKAGE = sun.beans -PRODUCT = sun -include $(BUILDDIR)/common/Defs.gmk - -# -# Files -# -AUTO_FILES_JAVA_DIRS = sun/beans - -# -# Rules -# -include $(BUILDDIR)/common/Classes.gmk --- jdk/src/share/classes/com/sun/beans/editors/BooleanEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/BooleanEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,76 @@ +/* + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "boolean" type. + */ + +import java.beans.*; + +public class BooleanEditor extends PropertyEditorSupport { + + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? value.toString() + : "null"; + } + + public String getAsText() { + Object value = getValue(); + return (value instanceof Boolean) + ? getValidName((Boolean) value) + : "null"; + } + + public void setAsText(String text) throws java.lang.IllegalArgumentException { + if (text == null) { + setValue(null); + } else if (isValidName(true, text)) { + setValue(Boolean.TRUE); + } else if (isValidName(false, text)) { + setValue(Boolean.FALSE); + } else { + throw new java.lang.IllegalArgumentException(text); + } + } + + public String[] getTags() { + return new String[] {getValidName(true), getValidName(false)}; + } + + // the following method should be localized (4890258) + + private String getValidName(boolean value) { + return value ? "True" : "False"; + } + + private boolean isValidName(boolean value, String name) { + return getValidName(value).equalsIgnoreCase(name); + } +} --- jdk/src/share/classes/com/sun/beans/editors/ByteEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/ByteEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,48 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.beans.editors; + +/** + * Property editor for a java builtin "byte" type. + * + */ + +import java.beans.*; + +public class ByteEditor extends NumberEditor { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? "((byte)" + value + ")" + : "null"; + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Byte.decode(text)); + } + +} --- jdk/src/share/classes/com/sun/beans/editors/ColorEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/ColorEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,212 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.beans.editors; + +import java.awt.*; +import java.beans.*; + +public class ColorEditor extends Panel implements PropertyEditor { + public ColorEditor() { + setLayout(null); + + ourWidth = hPad; + + // Create a sample color block bordered in black + Panel p = new Panel(); + p.setLayout(null); + p.setBackground(Color.black); + sample = new Canvas(); + p.add(sample); + sample.reshape(2, 2, sampleWidth, sampleHeight); + add(p); + p.reshape(ourWidth, 2, sampleWidth+4, sampleHeight+4); + ourWidth += sampleWidth + 4 + hPad; + + text = new TextField("", 14); + add(text); + text.reshape(ourWidth,0,100,30); + ourWidth += 100 + hPad; + + choser = new Choice(); + int active = 0; + for (int i = 0; i < colorNames.length; i++) { + choser.addItem(colorNames[i]); + } + add(choser); + choser.reshape(ourWidth,0,100,30); + ourWidth += 100 + hPad; + + resize(ourWidth,40); + } + + public void setValue(Object o) { + Color c = (Color)o; + changeColor(c); + } + + public Dimension preferredSize() { + return new Dimension(ourWidth, 40); + } + + public boolean keyUp(Event e, int key) { + if (e.target == text) { + try { + setAsText(text.getText()); + } catch (IllegalArgumentException ex) { + // Quietly ignore. + } + } + return (false); + } + + public void setAsText(String s) throws java.lang.IllegalArgumentException { + if (s == null) { + changeColor(null); + return; + } + int c1 = s.indexOf(','); + int c2 = s.indexOf(',', c1+1); + if (c1 < 0 || c2 < 0) { + // Invalid string. + throw new IllegalArgumentException(s); + } + try { + int r = Integer.parseInt(s.substring(0,c1)); + int g = Integer.parseInt(s.substring(c1+1, c2)); + int b = Integer.parseInt(s.substring(c2+1)); + Color c = new Color(r,g,b); + changeColor(c); + } catch (Exception ex) { + throw new IllegalArgumentException(s); + } + + } + + public boolean action(Event e, Object arg) { + if (e.target == choser) { + changeColor(colors[choser.getSelectedIndex()]); + } + return false; + } + + public String getJavaInitializationString() { + return (this.color != null) + ? "new java.awt.Color(" + this.color.getRGB() + ",true)" + : "null"; + } + + + private void changeColor(Color c) { + + if (c == null) { + this.color = null; + this.text.setText(""); + return; + } + + color = c; + + text.setText("" + c.getRed() + "," + c.getGreen() + "," + c.getBlue()); + + int active = 0; + for (int i = 0; i < colorNames.length; i++) { + if (color.equals(colors[i])) { + active = i; + } + } + choser.select(active); + + sample.setBackground(color); + sample.repaint(); + + support.firePropertyChange("", null, null); + } + + public Object getValue() { + return color; + } + + public boolean isPaintable() { + return true; + } + + public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { + Color oldColor = gfx.getColor(); + gfx.setColor(Color.black); + gfx.drawRect(box.x, box.y, box.width-3, box.height-3); + gfx.setColor(color); + gfx.fillRect(box.x+1, box.y+1, box.width-4, box.height-4); + gfx.setColor(oldColor); + } + + public String getAsText() { + return (this.color != null) + ? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue() + : "null"; + } + + public String[] getTags() { + return null; + } + + public java.awt.Component getCustomEditor() { + return this; + } + + public boolean supportsCustomEditor() { + return true; + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + support.addPropertyChangeListener(l); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + support.removePropertyChangeListener(l); + } + + + private String colorNames[] = { " ", "white", "lightGray", "gray", "darkGray", + "black", "red", "pink", "orange", + "yellow", "green", "magenta", "cyan", + "blue"}; + private Color colors[] = { null, Color.white, Color.lightGray, Color.gray, Color.darkGray, + Color.black, Color.red, Color.pink, Color.orange, + Color.yellow, Color.green, Color.magenta, Color.cyan, + Color.blue}; + + private Canvas sample; + private int sampleHeight = 20; + private int sampleWidth = 40; + private int hPad = 5; + private int ourWidth; + + private Color color; + private TextField text; + private Choice choser; + + private PropertyChangeSupport support = new PropertyChangeSupport(this); +} --- jdk/src/share/classes/com/sun/beans/editors/DoubleEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/DoubleEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,41 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.beans.editors; + +/** + * Property editor for a java builtin "double" type. + * + */ + +import java.beans.*; + +public class DoubleEditor extends NumberEditor { + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Double.valueOf(text)); + } + +} --- jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,142 @@ +/* + * 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 com.sun.beans.editors; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.ArrayList; +import java.util.List; + +/** + * Property editor for java.lang.Enum subclasses. + * + * @see PropertyEditor + * + * @since 1.7 + * + * @author Sergey A. Malenkov + */ +public final class EnumEditor implements PropertyEditor { + private final List listeners = new ArrayList(); + + private final Class type; + private final String[] tags; + + private Object value; + + public EnumEditor( Class type ) { + Object[] values = type.getEnumConstants(); + if ( values == null ) { + throw new IllegalArgumentException( "Unsupported " + type ); + } + this.type = type; + this.tags = new String[values.length]; + for ( int i = 0; i < values.length; i++ ) { + this.tags[i] = ( ( Enum )values[i] ).name(); + } + } + + public Object getValue() { + return this.value; + } + + public void setValue( Object value ) { + if ( ( value != null ) && !this.type.isInstance( value ) ) { + throw new IllegalArgumentException( "Unsupported value: " + value ); + } + Object oldValue; + PropertyChangeListener[] listeners; + synchronized ( this.listeners ) { + oldValue = this.value; + this.value = value; + + if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) { + return; // do not fire event if value is not changed + } + int size = this.listeners.size(); + if ( size == 0 ) { + return; // do not fire event if there are no any listener + } + listeners = this.listeners.toArray( new PropertyChangeListener[size] ); + } + PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value ); + for ( PropertyChangeListener listener : listeners ) { + listener.propertyChange( event ); + } + } + + public String getAsText() { + return ( this.value != null ) + ? ( ( Enum )this.value ).name() + : "null"; + } + + public void setAsText( String text ) { + setValue( ( text != null ) + ? Enum.valueOf( this.type, text ) + : null ); + } + + public String[] getTags() { + return this.tags.clone(); + } + + public String getJavaInitializationString() { + return ( this.value != null ) + ? this.type.getName() + '.' + ( ( Enum )this.value ).name() + : "null"; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue( Graphics gfx, Rectangle box ) { + } + + public boolean supportsCustomEditor() { + return false; + } + + public Component getCustomEditor() { + return null; + } + + public void addPropertyChangeListener( PropertyChangeListener listener ) { + synchronized ( this.listeners ) { + this.listeners.add( listener ); + } + } + + public void removePropertyChangeListener( PropertyChangeListener listener ) { + synchronized ( this.listeners ) { + this.listeners.remove( listener ); + } + } +} --- jdk/src/share/classes/com/sun/beans/editors/FloatEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/FloatEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,48 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.beans.editors; + +/** + * Property editor for a java builtin "float" type. + * + */ + +import java.beans.*; + +public class FloatEditor extends NumberEditor { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? value + "F" + : "null"; + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Float.valueOf(text)); + } + +} --- jdk/src/share/classes/com/sun/beans/editors/FontEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/FontEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,218 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.beans.editors; + +import java.awt.*; +import java.beans.*; + +public class FontEditor extends Panel implements java.beans.PropertyEditor { + + public FontEditor() { + setLayout(null); + + toolkit = Toolkit.getDefaultToolkit(); + fonts = toolkit.getFontList(); + + familyChoser = new Choice(); + for (int i = 0; i < fonts.length; i++) { + familyChoser.addItem(fonts[i]); + } + add(familyChoser); + familyChoser.reshape(20, 5, 100, 30); + + styleChoser = new Choice(); + for (int i = 0; i < styleNames.length; i++) { + styleChoser.addItem(styleNames[i]); + } + add(styleChoser); + styleChoser.reshape(145, 5, 70, 30); + + sizeChoser = new Choice(); + for (int i = 0; i < pointSizes.length; i++) { + sizeChoser.addItem("" + pointSizes[i]); + } + add(sizeChoser); + sizeChoser.reshape(220, 5, 70, 30); + + resize(300,40); + } + + + public Dimension preferredSize() { + return new Dimension(300, 40); + } + + public void setValue(Object o) { + font = (Font) o; + if (this.font == null) + return; + + changeFont(font); + // Update the current GUI choices. + for (int i = 0; i < fonts.length; i++) { + if (fonts[i].equals(font.getFamily())) { + familyChoser.select(i); + break; + } + } + for (int i = 0; i < styleNames.length; i++) { + if (font.getStyle() == styles[i]) { + styleChoser.select(i); + break; + } + } + for (int i = 0; i < pointSizes.length; i++) { + if (font.getSize() <= pointSizes[i]) { + sizeChoser.select(i); + break; + } + } + } + + private void changeFont(Font f) { + font = f; + if (sample != null) { + remove(sample); + } + sample = new Label(sampleText); + sample.setFont(font); + add(sample); + Component p = getParent(); + if (p != null) { + p.invalidate(); + p.layout(); + } + invalidate(); + layout(); + repaint(); + support.firePropertyChange("", null, null); + } + + public Object getValue() { + return (font); + } + + public String getJavaInitializationString() { + if (this.font == null) + return "null"; + + return "new java.awt.Font(\"" + font.getName() + "\", " + + font.getStyle() + ", " + font.getSize() + ")"; + } + + public boolean action(Event e, Object arg) { + String family = familyChoser.getSelectedItem(); + int style = styles[styleChoser.getSelectedIndex()]; + int size = pointSizes[sizeChoser.getSelectedIndex()]; + try { + Font f = new Font(family, style, size); + changeFont(f); + } catch (Exception ex) { + System.err.println("Couldn't create font " + family + "-" + + styleNames[style] + "-" + size); + } + return (false); + } + + + public boolean isPaintable() { + return true; + } + + public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { + // Silent noop. + Font oldFont = gfx.getFont(); + gfx.setFont(font); + FontMetrics fm = gfx.getFontMetrics(); + int vpad = (box.height - fm.getAscent())/2; + gfx.drawString(sampleText, 0, box.height-vpad); + gfx.setFont(oldFont); + } + + public String getAsText() { + if (this.font == null) { + return "null"; + } + StringBuilder sb = new StringBuilder(); + sb.append(this.font.getName()); + sb.append(' '); + + boolean b = this.font.isBold(); + if (b) { + sb.append("BOLD"); + } + boolean i = this.font.isItalic(); + if (i) { + sb.append("ITALIC"); + } + if (b || i) { + sb.append(' '); + } + sb.append(this.font.getSize()); + return sb.toString(); + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Font.decode(text)); + } + + public String[] getTags() { + return null; + } + + public java.awt.Component getCustomEditor() { + return this; + } + + public boolean supportsCustomEditor() { + return true; + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + support.addPropertyChangeListener(l); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + support.removePropertyChangeListener(l); + } + + private Font font; + private Toolkit toolkit; + private String sampleText = "Abcde..."; + + private Label sample; + private Choice familyChoser; + private Choice styleChoser; + private Choice sizeChoser; + + private String fonts[]; + private String[] styleNames = { "plain", "bold", "italic" }; + private int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC }; + private int[] pointSizes = { 3, 5, 8, 10, 12, 14, 18, 24, 36, 48 }; + + private PropertyChangeSupport support = new PropertyChangeSupport(this); + +} --- jdk/src/share/classes/com/sun/beans/editors/IntegerEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/IntegerEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,42 @@ +/* + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "int" type. + * + */ + +import java.beans.*; + +public class IntegerEditor extends NumberEditor { + + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Integer.decode(text)); + } + +} --- jdk/src/share/classes/com/sun/beans/editors/LongEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/LongEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,48 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.beans.editors; + +/** + * Property editor for a java builtin "long" type. + * + */ + +import java.beans.*; + +public class LongEditor extends NumberEditor { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? value + "L" + : "null"; + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Long.decode(text)); + } + +} --- jdk/src/share/classes/com/sun/beans/editors/NumberEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/NumberEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,44 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.beans.editors; + +/** + * Abstract Property editor for a java builtin number types. + * + */ + +import java.beans.*; + +abstract public class NumberEditor extends PropertyEditorSupport { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? value.toString() + : "null"; + } + +} --- jdk/src/share/classes/com/sun/beans/editors/ShortEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/ShortEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,49 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.beans.editors; + +/** + * Property editor for a java builtin "short" type. + * + */ + +import java.beans.*; + +public class ShortEditor extends NumberEditor { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? "((short)" + value + ")" + : "null"; + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Short.decode(text)); + } + +} --- jdk/src/share/classes/com/sun/beans/editors/StringEditor.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/editors/StringEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,74 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.beans.editors; + +import java.beans.*; + +public class StringEditor extends PropertyEditorSupport { + + public String getJavaInitializationString() { + Object value = getValue(); + if (value == null) + return "null"; + + String str = value.toString(); + int length = str.length(); + StringBuilder sb = new StringBuilder(length + 2); + sb.append('"'); + for (int i = 0; i < length; i++) { + char ch = str.charAt(i); + switch (ch) { + case '\b': sb.append("\\b"); break; + case '\t': sb.append("\\t"); break; + case '\n': sb.append("\\n"); break; + case '\f': sb.append("\\f"); break; + case '\r': sb.append("\\r"); break; + case '\"': sb.append("\\\""); break; + case '\\': sb.append("\\\\"); break; + default: + if ((ch < ' ') || (ch > '~')) { + sb.append("\\u"); + String hex = Integer.toHexString((int) ch); + for (int len = hex.length(); len < 4; len++) { + sb.append('0'); + } + sb.append(hex); + } else { + sb.append(ch); + } + break; + } + } + sb.append('"'); + return sb.toString(); + } + + public void setAsText(String text) { + setValue(text); + } + +} --- jdk/src/share/classes/com/sun/beans/finder/ClassFinder.java 2012-05-01 17:18:02.000000000 -0400 +++ jdk/src/share/classes/com/sun/beans/finder/ClassFinder.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ */ package com.sun.beans.finder; +import static sun.reflect.misc.ReflectUtil.checkPackageAccess; + /** * This is utility class that provides static methods * to find a class with the specified name using the specified class loader. @@ -53,6 +55,7 @@ * @see Thread#getContextClassLoader() */ public static Class findClass( String name ) throws ClassNotFoundException { + checkPackageAccess(name); try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if ( loader == null ) { @@ -93,6 +96,7 @@ * @see Class#forName(String,boolean,ClassLoader) */ public static Class findClass( String name, ClassLoader loader ) throws ClassNotFoundException { + checkPackageAccess(name); if ( loader != null ) { try { return Class.forName( name, false, loader ); --- jdk/src/share/classes/com/sun/beans/infos/ComponentBeanInfo.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/com/sun/beans/infos/ComponentBeanInfo.java 2012-09-05 19:35:34.000000000 -0400 @@ -0,0 +1,62 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.beans.infos; + +import java.beans.*; + +/** + * BeanInfo descriptor for a standard AWT component. + */ + +public class ComponentBeanInfo extends SimpleBeanInfo { + private static final Class beanClass = java.awt.Component.class; + + public PropertyDescriptor[] getPropertyDescriptors() { + try { + PropertyDescriptor + name = new PropertyDescriptor("name", beanClass), + background = new PropertyDescriptor("background", beanClass), + foreground = new PropertyDescriptor("foreground", beanClass), + font = new PropertyDescriptor("font", beanClass), + enabled = new PropertyDescriptor("enabled", beanClass), + visible = new PropertyDescriptor("visible", beanClass), + focusable = new PropertyDescriptor("focusable", beanClass); + + enabled.setExpert(true); + visible.setHidden(true); + + background.setBound(true); + foreground.setBound(true); + font.setBound(true); + focusable.setBound(true); + + PropertyDescriptor[] rv = {name, background, foreground, font, enabled, visible, focusable }; + return rv; + } catch (IntrospectionException e) { + throw new Error(e.toString()); + } + } +} --- jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java 2012-05-01 17:18:04.000000000 -0400 +++ jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -354,8 +354,7 @@ where = new File(".").getAbsoluteFile(); - File f = File.createTempFile(prefix, suffix, where); - return f; + return sun.misc.IOUtils.createTempFile(prefix, suffix, where); } static private --- jdk/src/share/classes/java/awt/AWTEvent.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/AWTEvent.java 2012-09-05 19:35:40.000000000 -0400 @@ -268,9 +268,21 @@ return ev.isSystemGenerated; } + public void setPosted(AWTEvent ev) { + ev.isPosted = true; + } + public AccessControlContext getAccessControlContext(AWTEvent ev) { return ev.getAccessControlContext(); } + + public byte[] getBData(AWTEvent ev) { + return ev.bdata; + } + + public void setBData(AWTEvent ev, byte[] bdata) { + ev.bdata = bdata; + } }); } --- jdk/src/share/classes/java/awt/CheckboxMenuItem.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/CheckboxMenuItem.java 2012-09-05 19:35:40.000000000 -0400 @@ -31,6 +31,7 @@ import java.io.ObjectInputStream; import java.io.IOException; import javax.accessibility.*; +import sun.awt.AWTAccessor; /** @@ -68,6 +69,13 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + + AWTAccessor.setCheckboxMenuItemAccessor( + new AWTAccessor.CheckboxMenuItemAccessor() { + public boolean getState(CheckboxMenuItem cmi) { + return cmi.state; + } + }); } /** --- jdk/src/share/classes/java/awt/Component.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/Component.java 2012-09-05 19:35:40.000000000 -0400 @@ -798,10 +798,25 @@ static { AWTAccessor.setComponentAccessor(new AWTAccessor.ComponentAccessor() { + public AppContext getAppContext(Component comp) { + return comp.appContext; + } + + public void setAppContext(Component comp, AppContext appContext) { + comp.appContext = appContext; + } + public AccessControlContext getAccessControlContext(Component comp) { return comp.getAccessControlContext(); } + public boolean requestFocusInWindow(Component comp, CausedFocusEvent.Cause cause) { + return comp.requestFocusInWindow(cause); + } + + public void requestFocus(Component comp, CausedFocusEvent.Cause cause) { + comp.requestFocus(cause); + } }); } --- jdk/src/share/classes/java/awt/Cursor.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/Cursor.java 2012-09-05 19:35:40.000000000 -0400 @@ -38,6 +38,7 @@ import java.util.logging.*; import java.security.AccessController; +import sun.awt.AWTAccessor; /** * A class to encapsulate the bitmap representation of the mouse cursor. @@ -193,6 +194,21 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + + AWTAccessor.setCursorAccessor( + new AWTAccessor.CursorAccessor() { + public long getPData(Cursor cursor) { + return cursor.pData; + } + + public void setPData(Cursor cursor, long pData) { + cursor.pData = pData; + } + + public int getType(Cursor cursor) { + return cursor.type; + } + }); } /** --- jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java 2012-09-05 19:35:40.000000000 -0400 @@ -40,6 +40,7 @@ import sun.awt.AppContext; import sun.awt.SunToolkit; +import sun.awt.AWTAccessor; import sun.awt.CausedFocusEvent; /** @@ -76,6 +77,16 @@ typeAheadMarkers = new LinkedList(); private boolean consumeNextKeyTyped; + static { + AWTAccessor.setDefaultKeyboardFocusManagerAccessor( + new AWTAccessor.DefaultKeyboardFocusManagerAccessor() { + public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, + KeyEvent e) { + dkfm.consumeNextKeyTyped(e); + } + }); + } + private static class TypeAheadMarker { long after; Component untilFocused; --- jdk/src/share/classes/java/awt/EventQueue.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/EventQueue.java 2012-09-05 19:35:40.000000000 -0400 @@ -42,9 +42,9 @@ import sun.awt.AWTAutoShutdown; import sun.awt.PeerEvent; import sun.awt.SunToolkit; +import sun.awt.AWTAccessor; import java.security.AccessControlContext; -import java.security.ProtectionDomain; import sun.misc.SharedSecrets; import sun.misc.JavaSecurityAccess; @@ -159,6 +159,26 @@ private static final Logger eventLog = Logger.getLogger("java.awt.event.EventQueue"); + static { + AWTAccessor.setEventQueueAccessor( + new AWTAccessor.EventQueueAccessor() { + public boolean noEvents(EventQueue eventQueue) { + return eventQueue.noEvents(); + } + public Thread getDispatchThread(EventQueue eventQueue) { + return eventQueue.dispatchThread; + } + public EventQueue getNextQueue(EventQueue eventQueue) { + return eventQueue.nextQueue; + } + public void removeSourceEvents(EventQueue eventQueue, + Object source, + boolean removeAllEvents) { + eventQueue.removeSourceEvents(source, removeAllEvents); + } + }); + } + public EventQueue() { for (int i = 0; i < NUM_PRIORITIES; i++) { queues[i] = new Queue(); --- jdk/src/share/classes/java/awt/Font.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/Font.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2010, 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 @@ -809,7 +809,7 @@ File f = null; boolean hasPerm = false; try { - f = File.createTempFile("+~JT", ".tmp", null); + f = sun.misc.IOUtils.createTempFile("+~JT", ".tmp", null); f.delete(); f = null; hasPerm = true; @@ -860,7 +860,7 @@ final File tFile = AccessController.doPrivileged( new PrivilegedExceptionAction() { public File run() throws IOException { - return File.createTempFile("+~JF", ".tmp", null); + return sun.misc.IOUtils.createTempFile("+~JF", ".tmp", null); } } ); --- jdk/src/share/classes/java/awt/KeyboardFocusManager.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/KeyboardFocusManager.java 2012-09-05 19:35:40.000000000 -0400 @@ -60,6 +60,7 @@ import sun.awt.HeadlessToolkit; import sun.awt.SunToolkit; import sun.awt.CausedFocusEvent; +import sun.awt.AWTAccessor; /** * The KeyboardFocusManager is responsible for managing the active and focused @@ -117,6 +118,24 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + AWTAccessor.setKeyboardFocusManagerAccessor( + new AWTAccessor.KeyboardFocusManagerAccessor() { + public int shouldNativelyFocusHeavyweight(Component heavyweight, + Component descendant, + boolean temporary, + boolean focusedWindowChangeAllowed, + long time, + CausedFocusEvent.Cause cause) + { + return KeyboardFocusManager.shouldNativelyFocusHeavyweight( + heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause); + } + + public void removeLastFocusRequest(Component heavyweight) { + KeyboardFocusManager.removeLastFocusRequest(heavyweight); + } + } + ); } transient KeyboardFocusManagerPeer peer; --- jdk/src/share/classes/java/awt/Menu.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/Menu.java 2012-09-05 19:35:40.000000000 -0400 @@ -31,6 +31,7 @@ import java.awt.peer.MenuPeer; import java.awt.event.KeyEvent; import javax.accessibility.*; +import sun.awt.AWTAccessor; /** * A Menu object is a pull-down menu component @@ -62,6 +63,12 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + AWTAccessor.setMenuAccessor( + new AWTAccessor.MenuAccessor() { + public Vector getItems(Menu menu) { + return menu.items; + } + }); } /** --- jdk/src/share/classes/java/awt/MenuBar.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/MenuBar.java 2012-09-05 19:35:40.000000000 -0400 @@ -28,6 +28,7 @@ import java.io.ObjectInputStream; import java.util.Vector; import java.util.Enumeration; +import sun.awt.AWTAccessor; import java.awt.peer.MenuBarPeer; import java.awt.event.KeyEvent; import javax.accessibility.*; @@ -74,6 +75,16 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + AWTAccessor.setMenuBarAccessor( + new AWTAccessor.MenuBarAccessor() { + public Menu getHelpMenu(MenuBar menuBar) { + return menuBar.helpMenu; + } + + public Vector getMenus(MenuBar menuBar) { + return menuBar.menus; + } + }); } /** --- jdk/src/share/classes/java/awt/MenuComponent.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/MenuComponent.java 2012-09-05 19:35:40.000000000 -0400 @@ -29,7 +29,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import sun.awt.AppContext; -import sun.awt.SunToolkit; +import sun.awt.AWTAccessor; import javax.accessibility.*; import java.security.AccessControlContext; @@ -55,6 +55,22 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + AWTAccessor.setMenuComponentAccessor( + new AWTAccessor.MenuComponentAccessor() { + public AppContext getAppContext(MenuComponent menuComp) { + return menuComp.appContext; + } + public void setAppContext(MenuComponent menuComp, + AppContext appContext) { + menuComp.appContext = appContext; + } + public MenuContainer getParent(MenuComponent menuComp) { + return menuComp.parent; + } + public Font getFont_NoClientCode(MenuComponent menuComp) { + return menuComp.getFont_NoClientCode(); + } + }); } transient MenuComponentPeer peer; --- jdk/src/share/classes/java/awt/MenuItem.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/MenuItem.java 2012-09-05 19:35:40.000000000 -0400 @@ -31,7 +31,7 @@ import java.io.ObjectInputStream; import java.io.IOException; import javax.accessibility.*; - +import sun.awt.AWTAccessor; /** * All items in a menu must belong to the class @@ -76,6 +76,29 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + + AWTAccessor.setMenuItemAccessor( + new AWTAccessor.MenuItemAccessor() { + public boolean isEnabled(MenuItem item) { + return item.enabled; + } + + public String getLabel(MenuItem item) { + return item.label; + } + + public MenuShortcut getShortcut(MenuItem item) { + return item.shortcut; + } + + public String getActionCommandImpl(MenuItem item) { + return item.getActionCommandImpl(); + } + + public boolean isItemEnabled(MenuItem item) { + return item.isItemEnabled(); + } + }); } /** --- jdk/src/share/classes/java/awt/PopupMenu.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/PopupMenu.java 2012-09-05 19:35:40.000000000 -0400 @@ -28,6 +28,7 @@ import java.awt.peer.PopupMenuPeer; import javax.accessibility.*; +import sun.awt.AWTAccessor; /** * A class that implements a menu which can be dynamically popped up @@ -48,6 +49,15 @@ transient boolean isTrayIconPopup = false; + static { + AWTAccessor.setPopupMenuAccessor( + new AWTAccessor.PopupMenuAccessor() { + public boolean isTrayIconPopup(PopupMenu popupMenu) { + return popupMenu.isTrayIconPopup; + } + }); + } + /* * JDK 1.1 serialVersionUID */ --- jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java 2012-09-05 19:35:40.000000000 -0400 @@ -24,6 +24,8 @@ */ package java.awt; +import sun.awt.AWTAccessor; + import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.peer.ScrollPanePeer; @@ -156,6 +158,12 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + AWTAccessor.setScrollPaneAdjustableAccessor(new AWTAccessor.ScrollPaneAdjustableAccessor() { + public void setTypedValue(final ScrollPaneAdjustable adj, + final int v, final int type) { + adj.setTypedValue(v, type); + } + }); } /** --- jdk/src/share/classes/java/awt/Window.java 2012-05-01 17:18:08.000000000 -0400 +++ jdk/src/share/classes/java/awt/Window.java 2012-09-05 19:35:40.000000000 -0400 @@ -50,6 +50,7 @@ import java.util.logging.Logger; import java.util.concurrent.atomic.AtomicBoolean; import javax.accessibility.*; +import sun.awt.AWTAccessor; import sun.awt.AppContext; import sun.awt.CausedFocusEvent; import sun.awt.SunToolkit; @@ -318,6 +319,12 @@ s = (String) java.security.AccessController.doPrivileged( new GetPropertyAction("java.awt.Window.locationByPlatform")); locationByPlatformProp = (s != null && s.equals("true")); + + AWTAccessor.setWindowAccessor(new AWTAccessor.WindowAccessor() { + public void setLWRequestStatus(Window changed, boolean status) { + changed.syncLWRequests = status; + } + }); } /** --- jdk/src/share/classes/java/beans/Introspector.java 2012-05-01 17:18:09.000000000 -0400 +++ jdk/src/share/classes/java/beans/Introspector.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2009, 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 @@ -139,6 +139,7 @@ private Map events; private final static String DEFAULT_INFO_PATH = "sun.beans.infos"; + private final static String DEFAULT_INFO_PATH_NEW = "com.sun.beans.infos"; private static String[] searchPath = { DEFAULT_INFO_PATH }; @@ -460,12 +461,15 @@ name = name.substring(name.lastIndexOf('.')+1); for (int i = 0; i < searchPath.length; i++) { + String path = searchPath[i]; + if (DEFAULT_INFO_PATH.equals(path)) { + path = DEFAULT_INFO_PATH_NEW; + } // This optimization will only use the BeanInfo search path if is has changed // from the original or trying to get the ComponentBeanInfo. - if (!DEFAULT_INFO_PATH.equals(searchPath[i]) || - DEFAULT_INFO_PATH.equals(searchPath[i]) && "ComponentBeanInfo".equals(name)) { + if (!DEFAULT_INFO_PATH_NEW.equals(path) || "ComponentBeanInfo".equals(name)) { try { - String fullName = searchPath[i] + "." + name; + String fullName = path + "." + name; java.beans.BeanInfo bi = (java.beans.BeanInfo)instantiate(beanClass, fullName); // Make sure that the returned BeanInfo matches the class. --- jdk/src/share/classes/java/beans/PropertyEditorManager.java 2012-05-01 17:18:09.000000000 -0400 +++ jdk/src/share/classes/java/beans/PropertyEditorManager.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, 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 @@ -25,7 +25,7 @@ package java.beans; -import sun.beans.editors.*; +import com.sun.beans.editors.*; /** * The PropertyEditorManager can be used to locate a property editor for @@ -54,6 +54,9 @@ public class PropertyEditorManager { + private static final String DEFAULT_SEARCH_PATH = "sun.beans.editors"; + private static final String DEFAULT_SEARCH_PATH_NEW = "com.sun.beans.editors"; + /** * Register an editor class to be used to edit values of * a given target class. @@ -119,7 +122,7 @@ editorName = editorName.substring(index); } for (String path : searchPath) { - String name = path + '.' + editorName; + String name = (DEFAULT_SEARCH_PATH.equals(path) ? DEFAULT_SEARCH_PATH_NEW : path) + '.' + editorName; try { return (PropertyEditor) Introspector.instantiate(targetType, name); } catch (Exception ex) { @@ -188,6 +191,6 @@ registry.put(Double.TYPE, DoubleEditor.class); } - private static String[] searchPath = { "sun.beans.editors" }; + private static String[] searchPath = { DEFAULT_SEARCH_PATH }; private static java.util.Hashtable registry; } --- jdk/src/share/classes/java/io/File.java 2012-05-01 17:18:09.000000000 -0400 +++ jdk/src/share/classes/java/io/File.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -897,7 +897,7 @@ public boolean createNewFile() throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) security.checkWrite(path); - return fs.createFileExclusively(path); + return fs.createFileExclusively(path, false); } /** @@ -1700,7 +1700,8 @@ return new File(dir, prefix + Long.toString(n) + suffix); } - private static boolean checkAndCreate(String filename, SecurityManager sm) + private static boolean checkAndCreate(String filename, SecurityManager sm, + boolean restrictive) throws IOException { if (sm != null) { @@ -1713,7 +1714,29 @@ throw new SecurityException("Unable to create temporary file"); } } - return fs.createFileExclusively(filename); + return fs.createFileExclusively(filename, restrictive); + } + + // The resulting temporary file may have more restrictive access permission + // on some platforms, if restrictive is true. + private static File createTempFile0(String prefix, String suffix, + File directory, boolean restrictive) + throws IOException + { + if (prefix == null) throw new NullPointerException(); + if (prefix.length() < 3) + throw new IllegalArgumentException("Prefix string too short"); + String s = (suffix == null) ? ".tmp" : suffix; + if (directory == null) { + String tmpDir = LazyInitialization.temporaryDirectory(); + directory = new File(tmpDir, fs.prefixLength(tmpDir)); + } + SecurityManager sm = System.getSecurityManager(); + File f; + do { + f = generateFile(prefix, s, directory); + } while (!checkAndCreate(f.getPath(), sm, restrictive)); + return f; } /** @@ -1789,20 +1812,7 @@ File directory) throws IOException { - if (prefix == null) throw new NullPointerException(); - if (prefix.length() < 3) - throw new IllegalArgumentException("Prefix string too short"); - String s = (suffix == null) ? ".tmp" : suffix; - if (directory == null) { - String tmpDir = LazyInitialization.temporaryDirectory(); - directory = new File(tmpDir, fs.prefixLength(tmpDir)); - } - SecurityManager sm = System.getSecurityManager(); - File f; - do { - f = generateFile(prefix, s, directory); - } while (!checkAndCreate(f.getPath(), sm)); - return f; + return createTempFile0(prefix, suffix, directory, false); } /** @@ -1837,7 +1847,7 @@ public static File createTempFile(String prefix, String suffix) throws IOException { - return createTempFile(prefix, suffix, null); + return createTempFile0(prefix, suffix, null, false); } @@ -1959,6 +1969,15 @@ } ); } - - + + // Set up JavaIOAccess in SharedSecrets + static { + sun.misc.SharedSecrets.setJavaIOFileAccess(new sun.misc.JavaIOFileAccess() { + public File createTempFile(String prefix, String suffix, File directory) + throws IOException + { + return createTempFile0(prefix, suffix, directory, true); + } + }); + } } --- jdk/src/share/classes/java/io/FileSystem.java 2012-05-01 17:18:09.000000000 -0400 +++ jdk/src/share/classes/java/io/FileSystem.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -157,8 +157,13 @@ * true if the file was created and false if a * file or directory with the given pathname already exists. Throw an * IOException if an I/O error occurs. + * + *

+ * The resulting file may have more restrictive access permission + * on some platforms, if restrictive is true. */ - public abstract boolean createFileExclusively(String pathname) + public abstract boolean createFileExclusively(String pathname, + boolean restrictive) throws IOException; /** --- jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java 2012-05-01 17:18:13.000000000 -0400 +++ jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ -98,7 +98,7 @@ } this.stream = stream; this.cacheFile = - File.createTempFile("imageio", ".tmp", cacheDir); + sun.misc.IOUtils.createTempFile("imageio", ".tmp", cacheDir); this.cache = new RandomAccessFile(cacheFile, "rw"); this.closeAction = StreamCloser.createCloseAction(this); --- jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java 2012-05-01 17:18:13.000000000 -0400 +++ jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ -84,7 +84,7 @@ } this.stream = stream; this.cacheFile = - File.createTempFile("imageio", ".tmp", cacheDir); + sun.misc.IOUtils.createTempFile("imageio", ".tmp", cacheDir); this.cache = new RandomAccessFile(cacheFile, "rw"); this.closeAction = StreamCloser.createCloseAction(this); --- jdk/src/share/classes/javax/management/loading/MLet.java 2012-05-01 17:18:13.000000000 -0400 +++ jdk/src/share/classes/javax/management/loading/MLet.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, 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 @@ -1152,7 +1152,7 @@ if (is != null) { File directory = new File(libraryDirectory); directory.mkdirs(); - File file = File.createTempFile(libname + ".", null, directory); + File file = sun.misc.IOUtils.createTempFile(libname + ".", null, directory); file.deleteOnExit(); FileOutputStream fileOutput = new FileOutputStream(file); int c; --- jdk/src/share/classes/javax/swing/ClientPropertyKey.java 2012-05-01 17:18:15.000000000 -0400 +++ jdk/src/share/classes/javax/swing/ClientPropertyKey.java 2012-09-05 19:35:40.000000000 -0400 @@ -25,6 +25,8 @@ package javax.swing; +import sun.awt.AWTAccessor; + /** * An enumeration for keys used as client properties within the Swing * implementation. @@ -86,6 +88,15 @@ */ private final boolean reportValueNotSerializable; + static { + AWTAccessor.setClientPropertyKeyAccessor( + new AWTAccessor.ClientPropertyKeyAccessor() { + public Object getJComponent_TRANSFER_HANDLER() { + return JComponent_TRANSFER_HANDLER; + } + }); + } + /** * Constructs a key with the {@code reportValueNotSerializable} property * set to {@code false}. --- jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java 2012-05-01 17:18:17.000000000 -0400 +++ jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java 2012-09-05 19:34:26.000000000 -0400 @@ -135,8 +135,8 @@ 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(); --- jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java 2012-05-01 17:18:17.000000000 -0400 +++ jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java 2012-09-05 19:34:26.000000000 -0400 @@ -94,9 +94,9 @@ 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; } --- jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java 2012-05-01 17:18:17.000000000 -0400 +++ jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java 2012-09-05 19:34:26.000000000 -0400 @@ -78,27 +78,25 @@ private static final Object STYLE_FACTORY_KEY = new Object(); // 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 * lastContext. */ 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 lastContext 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. */ @@ -112,6 +110,10 @@ 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. @@ -123,8 +125,8 @@ 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) { @@ -141,19 +143,32 @@ 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); } @@ -168,10 +183,6 @@ // 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); @@ -185,17 +196,13 @@ */ 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; } } --- jdk/src/share/classes/sun/awt/AWTAccessor.java 2012-05-01 17:18:18.000000000 -0400 +++ jdk/src/share/classes/sun/awt/AWTAccessor.java 2012-09-05 19:35:40.000000000 -0400 @@ -26,16 +26,15 @@ package sun.awt; import java.awt.*; -import java.awt.event.InputEvent; -import java.awt.geom.Point2D; -import java.awt.image.BufferedImage; import sun.misc.Unsafe; -import java.awt.peer.ComponentPeer; -import java.security.AccessController; import java.security.AccessControlContext; +import java.util.Vector; + +import java.awt.event.KeyEvent; + /** * The AWTAccessor utility class. * The main purpose of this class is to enable accessing @@ -55,14 +54,64 @@ private AWTAccessor() { } + /** + * An interface of an accessor for java.awt.Window class. + */ + public interface WindowAccessor { + /** + * Sets the synchronous status of focus requests on lightweight + * components in the specified window to the specified value. + */ + void setLWRequestStatus(Window changed, boolean status); + } + /* * An interface of accessor for the java.awt.Component class. */ public interface ComponentAccessor { + /** + * Returns the appContext of the component. + */ + AppContext getAppContext(Component comp); + + /** + * Sets the appContext of the component. + */ + void setAppContext(Component comp, AppContext appContext); + /* * Returns the acc this component was constructed with. */ AccessControlContext getAccessControlContext(Component comp); + + /** + * Requests that this Component get the input focus, if this + * Component's top-level ancestor is already the focused Window + */ + boolean requestFocusInWindow(Component comp, CausedFocusEvent.Cause cause); + + /** + * Requests that this Component get the input focus, providing the cause + */ + void requestFocus(Component comp, CausedFocusEvent.Cause cause); + } + + /** + * An interface of accessor for the KeyboardFocusManager class. + */ + public interface KeyboardFocusManagerAccessor { + /** + * Indicates whether the native implementation should + * proceed with a pending focus request for the heavyweight. + */ + int shouldNativelyFocusHeavyweight(Component heavyweight, + Component descendant, + boolean temporary, + boolean focusedWindowChangeAllowed, + long time, + CausedFocusEvent.Cause cause); + + void removeLastFocusRequest(Component heavyweight); } /* @@ -70,6 +119,11 @@ */ public interface AWTEventAccessor { /** + * Marks the event as posted. + */ + void setPosted(AWTEvent ev); + + /** * Sets the flag on this AWTEvent indicating that it was * generated by the system. */ @@ -80,20 +134,234 @@ */ boolean isSystemGenerated(AWTEvent ev); - /* * Returns the acc this event was constructed with. */ AccessControlContext getAccessControlContext(AWTEvent ev); + /** + * Returns binary data associated with this event; + */ + byte[] getBData(AWTEvent ev); + + /** + * Associates binary data with this event; + */ + void setBData(AWTEvent ev, byte[] bdata); +} + + /** + * An accessor for the MenuComponent class. + */ + public interface MenuComponentAccessor { + /** + * Returns the appContext of the menu component. + */ + AppContext getAppContext(MenuComponent menuComp); + + /** + * Sets the appContext of the menu component. + */ + void setAppContext(MenuComponent menuComp, AppContext appContext); + + /** + * Returns the parent container for this menu component. + */ + MenuContainer getParent(MenuComponent menuComp); + + /** + * Gets the font used for this menu component. + */ + Font getFont_NoClientCode(MenuComponent menuComp); + } + + /** An accessor for the EventQueue class + */ + public interface EventQueueAccessor { + /** + * Returns whether an event is pending on any of the separate Queues. + */ + boolean noEvents(EventQueue eventQueue); + + /** + * Returns dispatch thread for the given EventQueue which has private access + */ + Thread getDispatchThread(EventQueue eventQueue); + + /** + * Returns next queue for the given EventQueue which has private access + */ + EventQueue getNextQueue(EventQueue eventQueue); + + /** + * Removes any pending events for the specified source object. + */ + void removeSourceEvents(EventQueue eventQueue, Object source, + boolean removeAllEvents); + } + + /** + * An accessor for the PopupMenu class + */ + public interface PopupMenuAccessor { + /** + * Returns whether the popup menu is attached to a tray + */ + boolean isTrayIconPopup(PopupMenu popupMenu); + } + + /** + * An accessor for the ScrollPaneAdjustable class. + */ + public interface ScrollPaneAdjustableAccessor { + /** + * Sets the value of this scrollbar to the specified value. + */ + void setTypedValue(final ScrollPaneAdjustable adj, final int v, + final int type); + } + + /** + * An accessor for the CheckboxMenuItem class + */ + public interface CheckboxMenuItemAccessor { + /** + * Returns whether menu item is checked + */ + boolean getState(CheckboxMenuItem cmi); + } + + /** + * An accessor for the Cursor class + */ + public interface CursorAccessor { + /** + * Returns pData of the Cursor class + */ + long getPData(Cursor cursor); + + /** + * Sets pData to the Cursor class + */ + void setPData(Cursor cursor, long pData); + + /** + * Return type of the Cursor class + */ + int getType(Cursor cursor); + } + + /** + * An accessor for the MenuBar class + */ + public interface MenuBarAccessor { + /** + * Returns help menu + */ + Menu getHelpMenu(MenuBar menuBar); + + /** + * Returns menus + */ + Vector getMenus(MenuBar menuBar); + } + + /** + * An accessor for the MenuItem class + */ + public interface MenuItemAccessor { + /** + * Returns whether menu item is enabled + */ + boolean isEnabled(MenuItem item); + + /** + * Gets the command name of the action event that is fired + * by this menu item. + */ + String getActionCommandImpl(MenuItem item); + + /** + * Returns true if the item and all its ancestors are + * enabled, false otherwise + */ + boolean isItemEnabled(MenuItem item); + + /** + * Returns label + */ + String getLabel(MenuItem item); + + /** + * Returns shortcut + */ + MenuShortcut getShortcut(MenuItem item); + } + + /** + * An accessor for the Menu class + */ + public interface MenuAccessor { + /** + * Returns vector of the items that are part of the Menu + */ + Vector getItems(Menu menu); + } + + /** + * An accessor for the ClientPropertyKey class + */ + public interface ClientPropertyKeyAccessor { + /** + * Retrieves JComponent_TRANSFER_HANDLER enum object + */ + Object getJComponent_TRANSFER_HANDLER(); + } + + /** + * An accessor for the DefaultKeyboardFocusManager class + */ + public interface DefaultKeyboardFocusManagerAccessor { + void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e); } /* * Accessor instances are initialized in the static initializers of * corresponding AWT classes by using setters defined below. */ + private static WindowAccessor windowAccessor; private static ComponentAccessor componentAccessor; + private static KeyboardFocusManagerAccessor kfmAccessor; private static AWTEventAccessor awtEventAccessor; + private static MenuComponentAccessor menuComponentAccessor; + private static EventQueueAccessor eventQueueAccessor; + private static PopupMenuAccessor popupMenuAccessor; + private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor; + private static CheckboxMenuItemAccessor checkboxMenuItemAccessor; + private static CursorAccessor cursorAccessor; + private static MenuBarAccessor menuBarAccessor; + private static MenuItemAccessor menuItemAccessor; + private static MenuAccessor menuAccessor; + private static ClientPropertyKeyAccessor clientPropertyKeyAccessor; + private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor; + + /** + * Set an accessor object for the java.awt.Window class. + */ + public static void setWindowAccessor(WindowAccessor wa) { + windowAccessor = wa; + } + + /** + * Retrieve the accessor object for the java.awt.Window class. + */ + public static WindowAccessor getWindowAccessor() { + if (windowAccessor == null) { + unsafe.ensureClassInitialized(Window.class); + } + + return windowAccessor; + } /* * Set an accessor object for the java.awt.Component class. @@ -113,6 +381,23 @@ return componentAccessor; } + /** + * Set an accessor object for the java.awt.KeyboardFocusManager class. + */ + public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) { + kfmAccessor = kfma; + } + + /** + * Retrieve the accessor object for the java.awt.KeyboardFocusManager class. + */ + public static KeyboardFocusManagerAccessor getKeyboardFocusManagerAccessor() { + if (kfmAccessor == null) { + unsafe.ensureClassInitialized(KeyboardFocusManager.class); + } + return kfmAccessor; + } + /* * Set an accessor object for the java.awt.AWTEvent class. */ @@ -129,4 +414,194 @@ } return awtEventAccessor; } + + /** + * Set an accessor object for the java.awt.MenuComponent class. + */ + public static void setMenuComponentAccessor(MenuComponentAccessor mca) { + menuComponentAccessor = mca; + } + + /** + * Retrieve the accessor object for the java.awt.MenuComponent class. + */ + public static MenuComponentAccessor getMenuComponentAccessor() { + if (menuComponentAccessor == null) { + unsafe.ensureClassInitialized(MenuComponent.class); + } + + return menuComponentAccessor; + } + + /** + * Set an accessor object for the java.awt.EventQueue class. + */ + public static void setEventQueueAccessor(EventQueueAccessor eqa) { + eventQueueAccessor = eqa; + } + + /** + * Retrieve the accessor object for the java.awt.EventQueue class. + */ + public static EventQueueAccessor getEventQueueAccessor() { + if (eventQueueAccessor == null) { + unsafe.ensureClassInitialized(EventQueue.class); + } + return eventQueueAccessor; + } + + /** + * Set an accessor object for the java.awt.PopupMenu class. + */ + public static void setPopupMenuAccessor(PopupMenuAccessor pma) { + popupMenuAccessor = pma; + } + + /** + * Retrieve the accessor object for the java.awt.PopupMenu class. + */ + public static PopupMenuAccessor getPopupMenuAccessor() { + if (popupMenuAccessor == null) { + unsafe.ensureClassInitialized(PopupMenu.class); + } + return popupMenuAccessor; + } + + /** + * Set an accessor object for the java.awt.ScrollPaneAdjustable class. + */ + public static void setScrollPaneAdjustableAccessor(ScrollPaneAdjustableAccessor adj) { + scrollPaneAdjustableAccessor = adj; + } + + /** + * Retrieve the accessor object for the java.awt.ScrollPaneAdjustable + * class. + */ + public static ScrollPaneAdjustableAccessor getScrollPaneAdjustableAccessor() { + if (scrollPaneAdjustableAccessor == null) { + unsafe.ensureClassInitialized(ScrollPaneAdjustable.class); + } + return scrollPaneAdjustableAccessor; + } + + /** + * Set an accessor object for the java.awt.CheckboxMenuItem class. + */ + public static void setCheckboxMenuItemAccessor(CheckboxMenuItemAccessor cmia) { + checkboxMenuItemAccessor = cmia; + } + + /** + * Retrieve the accessor object for the java.awt.CheckboxMenuItem class. + */ + public static CheckboxMenuItemAccessor getCheckboxMenuItemAccessor() { + if (checkboxMenuItemAccessor == null) { + unsafe.ensureClassInitialized(CheckboxMenuItemAccessor.class); + } + return checkboxMenuItemAccessor; + } + + /** + * Set an accessor object for the java.awt.Cursor class. + */ + public static void setCursorAccessor(CursorAccessor ca) { + cursorAccessor = ca; + } + + /** + * Retrieve the accessor object for the java.awt.Cursor class. + */ + public static CursorAccessor getCursorAccessor() { + if (cursorAccessor == null) { + unsafe.ensureClassInitialized(CursorAccessor.class); + } + return cursorAccessor; + } + + /** + * Set an accessor object for the java.awt.MenuBar class. + */ + public static void setMenuBarAccessor(MenuBarAccessor mba) { + menuBarAccessor = mba; + } + + /** + * Retrieve the accessor object for the java.awt.MenuBar class. + */ + public static MenuBarAccessor getMenuBarAccessor() { + if (menuBarAccessor == null) { + unsafe.ensureClassInitialized(MenuBarAccessor.class); + } + return menuBarAccessor; + } + + /** + * Set an accessor object for the java.awt.MenuItem class. + */ + public static void setMenuItemAccessor(MenuItemAccessor mia) { + menuItemAccessor = mia; + } + + /** + * Retrieve the accessor object for the java.awt.MenuItem class. + */ + public static MenuItemAccessor getMenuItemAccessor() { + if (menuItemAccessor == null) { + unsafe.ensureClassInitialized(MenuItemAccessor.class); + } + return menuItemAccessor; + } + + /** + * Set an accessor object for the java.awt.Menu class. + */ + public static void setMenuAccessor(MenuAccessor ma) { + menuAccessor = ma; + } + + /** + * Retrieve the accessor object for the java.awt.Menu class. + */ + public static MenuAccessor getMenuAccessor() { + if (menuAccessor == null) { + unsafe.ensureClassInitialized(MenuAccessor.class); + } + return menuAccessor; + } + + /** + * Set an accessor object for the javax.swing.ClientPropertyKey class. + */ + public static void setClientPropertyKeyAccessor(ClientPropertyKeyAccessor cpka) { + clientPropertyKeyAccessor = cpka; + } + + /** + * Retrieve the accessor object for the javax.swing.ClientPropertyKey class. + */ + public static ClientPropertyKeyAccessor getClientPropertyKeyAccessor() { + if (clientPropertyKeyAccessor == null) { + unsafe.ensureClassInitialized(ClientPropertyKeyAccessor.class); + } + return clientPropertyKeyAccessor; + } + + /** + * Set an accessor object for the java.awt.DefaultKeyboardFocusManager class. + */ + public static void setDefaultKeyboardFocusManagerAccessor( + DefaultKeyboardFocusManagerAccessor dkfma) { + defaultKeyboardFocusManagerAccessor = dkfma; + } + + /** + * Retrieve the accessor object for the java.awt.DefaultKeyboardFocusManager class. + */ + public static DefaultKeyboardFocusManagerAccessor getDefaultKeyboardFocusManagerAccessor() { + if (defaultKeyboardFocusManagerAccessor == null) { + unsafe.ensureClassInitialized(DefaultKeyboardFocusManagerAccessor.class); + } + return defaultKeyboardFocusManagerAccessor; + } } --- jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java 2012-05-01 17:18:18.000000000 -0400 +++ jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java 2012-09-05 19:35:40.000000000 -0400 @@ -30,10 +30,6 @@ import java.awt.peer.KeyboardFocusManagerPeer; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - - public class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer { static native Window getNativeFocusedWindow(); static native Component getNativeFocusOwner(); @@ -56,18 +52,7 @@ clearNativeGlobalFocusOwner(activeWindow); } - static Method m_removeLastFocusRequest = null; public static void removeLastFocusRequest(Component heavyweight) { - try { - if (m_removeLastFocusRequest == null) { - m_removeLastFocusRequest = SunToolkit.getMethod(KeyboardFocusManager.class, "removeLastFocusRequest", - new Class[] {Component.class}); - } - m_removeLastFocusRequest.invoke(null, new Object[]{heavyweight}); - } catch (InvocationTargetException ite) { - ite.printStackTrace(); - } catch (IllegalAccessException ex) { - ex.printStackTrace(); - } + AWTAccessor.getKeyboardFocusManagerAccessor().removeLastFocusRequest(heavyweight); } } --- jdk/src/share/classes/sun/awt/SunToolkit.java 2012-05-01 17:18:18.000000000 -0400 +++ jdk/src/share/classes/sun/awt/SunToolkit.java 2012-09-05 19:35:40.000000000 -0400 @@ -32,14 +32,10 @@ import java.awt.peer.*; import java.awt.event.WindowEvent; import java.awt.event.KeyEvent; -import java.awt.im.spi.InputMethodDescriptor; import java.awt.image.*; -import java.awt.geom.AffineTransform; import java.awt.TrayIcon; import java.awt.SystemTray; -import java.io.*; import java.net.URL; -import java.net.JarURLConnection; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; @@ -49,18 +45,14 @@ import sun.misc.SoftCache; import sun.font.FontDesignMetrics; import sun.awt.im.InputContext; -import sun.awt.im.SimpleInputMethodWindow; import sun.awt.image.*; import sun.security.action.GetPropertyAction; import sun.security.action.GetBooleanAction; -import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.security.AccessController; import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; public abstract class SunToolkit extends Toolkit implements WindowClosingSupport, WindowClosingListener, @@ -82,14 +74,7 @@ */ public static final int GRAB_EVENT_MASK = 0x80000000; - private static Field syncLWRequestsField; private static Method wakeupMethod; - private static Field componentKeyField; - private static Field menuComponentKeyField; - private static Field trayIconKeyField; - private static Field componentAppContextField; - private static Field menuComponentAppContextField; - private static Field isPostedField; /* The key to put()/get() the PostEventQueue into/from the AppContext. */ private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue"; @@ -326,24 +311,6 @@ return appContext; } - public static Field getField(final Class klass, final String fieldName) { - return AccessController.doPrivileged(new PrivilegedAction() { - public Field run() { - try { - Field field = klass.getDeclaredField(fieldName); - assert (field != null); - field.setAccessible(true); - return field; - } catch (SecurityException e) { - assert false; - } catch (NoSuchFieldException e) { - assert false; - } - return null; - }//run - }); - } - static void wakeupEventQueue(EventQueue q, boolean isShutdown){ if (wakeupMethod == null){ wakeupMethod = (Method)AccessController.doPrivileged(new PrivilegedAction(){ @@ -417,25 +384,15 @@ */ private static boolean setAppContext(Object target, AppContext context) { - if (!(target instanceof Component) && !(target instanceof MenuComponent)) { + if (target instanceof Component) { + AWTAccessor.getComponentAccessor(). + setAppContext((Component)target, context); + } else if (target instanceof MenuComponent) { + AWTAccessor.getMenuComponentAccessor(). + setAppContext((MenuComponent)target, context); + } else { return false; } - try{ - if (target instanceof Component){ - if (componentAppContextField == null) { - componentAppContextField = getField(Component.class, "appContext"); - } - componentAppContextField.set(target, context); - } else if (target instanceof MenuComponent) { - if (menuComponentAppContextField == null) { - menuComponentAppContextField = getField(MenuComponent.class, "appContext"); - } - menuComponentAppContextField.set(target, context); - } - } catch( IllegalAccessException e){ - assert false; - } - return true; } @@ -444,23 +401,15 @@ * Component or MenuComponent this returns null. */ private static AppContext getAppContext(Object target) { - AppContext retObj = null; - try{ - if (target instanceof Component){ - if (componentAppContextField == null) { - componentAppContextField = getField(Component.class, "appContext"); - } - retObj = (AppContext) componentAppContextField.get(target); - } else if (target instanceof MenuComponent) { - if (menuComponentAppContextField == null) { - menuComponentAppContextField = getField(MenuComponent.class, "appContext"); - } - retObj = (AppContext) menuComponentAppContextField.get(target); - } - } catch( IllegalAccessException e){ - assert false; + if (target instanceof Component) { + return AWTAccessor.getComponentAccessor(). + getAppContext((Component)target); + } else if (target instanceof MenuComponent) { + return AWTAccessor.getMenuComponentAccessor(). + getAppContext((MenuComponent)target); + } else { + return null; } - return retObj; } /* @@ -508,16 +457,7 @@ */ public static void setLWRequestStatus(Window changed,boolean status){ - if (syncLWRequestsField == null){ - syncLWRequestsField = getField(Window.class, "syncLWRequests"); - } - try{ - if (syncLWRequestsField != null){ - syncLWRequestsField.setBoolean(changed, status); - } - } catch( IllegalAccessException e){ - assert false; - } + AWTAccessor.getWindowAccessor().setLWRequestStatus(changed, status); }; public static void checkAndSetPolicy(Container cont, boolean isSwingCont) @@ -625,18 +565,9 @@ * Post AWTEvent of high priority. */ public static void postPriorityEvent(final AWTEvent e) { - if (isPostedField == null) { - isPostedField = getField(AWTEvent.class, "isPosted"); - } PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() { public void run() { - try { - isPostedField.setBoolean(e, true); - } catch (IllegalArgumentException e) { - assert(false); - } catch (IllegalAccessException e) { - assert(false); - } + AWTAccessor.getAWTEventAccessor().setPosted(e); ((Component)e.getSource()).dispatchEvent(e); } }, PeerEvent.ULTIMATE_PRIORITY_EVENT); @@ -745,36 +676,6 @@ } /* - * Returns next queue for the given EventQueue which has private access - */ - private static EventQueue getNextQueue(final Object o) { - EventQueue result = null; - try{ - Field nextQueueField = getField(EventQueue.class, - "nextQueue"); - result = (EventQueue)nextQueueField.get(o); - } catch( IllegalAccessException e){ - assert false; - } - return result; - } - - /* - * Returns dispatch thread for the given EventQueue which has private access - */ - private static Thread getDispatchThread(final Object o) { - Thread result = null; - try{ - Field dispatchThreadField = getField(EventQueue.class, - "dispatchThread"); - result = (Thread)dispatchThreadField.get(o); - } catch( IllegalAccessException e){ - assert false; - } - return result; - } - - /* * Returns true if the calling thread is the event dispatch thread * contained within AppContext which associated with the given target. * Use this call to ensure that a given task is being executed @@ -784,13 +685,14 @@ AppContext appContext = targetToAppContext(target); EventQueue eq = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY); - EventQueue next = getNextQueue(eq); + EventQueue next = AWTAccessor.getEventQueueAccessor().getNextQueue(eq); while (next != null) { eq = next; - next = getNextQueue(eq); + next = AWTAccessor.getEventQueueAccessor().getNextQueue(eq); } - return (Thread.currentThread() == getDispatchThread(eq)); + return (Thread.currentThread() == AWTAccessor.getEventQueueAccessor() + .getDispatchThread(eq)); } public Dimension getScreenSize() { @@ -1524,22 +1426,6 @@ || comp instanceof Window); } - public static Method getMethod(final Class clz, final String methodName, final Class[] params) { - Method res = null; - try { - res = AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Method run() throws Exception { - Method m = clz.getDeclaredMethod(methodName, params); - m.setAccessible(true); - return m; - } - }); - } catch (PrivilegedActionException ex) { - ex.printStackTrace(); - } - return res; - } - public static class OperationTimedOut extends RuntimeException { public OperationTimedOut(String msg) { super(msg); @@ -1682,21 +1568,9 @@ private boolean queueEmpty = false; private final Object waitLock = "Wait Lock"; - static Method eqNoEvents; - private boolean isEQEmpty() { EventQueue queue = getSystemEventQueueImpl(); - synchronized(SunToolkit.class) { - if (eqNoEvents == null) { - eqNoEvents = getMethod(java.awt.EventQueue.class, "noEvents", null); - } - } - try { - return (Boolean)eqNoEvents.invoke(queue); - } catch (Exception e) { - e.printStackTrace(); - return false; - } + return AWTAccessor.getEventQueueAccessor().noEvents(queue); } /** @@ -1951,20 +1825,14 @@ * consumeNextKeyTyped() method is not currently used, * however Swing could use it in the future. */ - private static Method consumeNextKeyTypedMethod = null; public static synchronized void consumeNextKeyTyped(KeyEvent keyEvent) { - if (consumeNextKeyTypedMethod == null) { - consumeNextKeyTypedMethod = getMethod(DefaultKeyboardFocusManager.class, - "consumeNextKeyTyped", - new Class[] {KeyEvent.class}); - } try { - consumeNextKeyTypedMethod.invoke(KeyboardFocusManager.getCurrentKeyboardFocusManager(), - keyEvent); - } catch (IllegalAccessException iae) { - iae.printStackTrace(); - } catch (InvocationTargetException ite) { - ite.printStackTrace(); + AWTAccessor.getDefaultKeyboardFocusManagerAccessor().consumeNextKeyTyped( + (DefaultKeyboardFocusManager)KeyboardFocusManager. + getCurrentKeyboardFocusManager(), + keyEvent); + } catch (ClassCastException cce) { + cce.printStackTrace(); } } --- jdk/src/share/classes/sun/beans/editors/BooleanEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/BooleanEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -/** - * Property editor for a java builtin "boolean" type. - */ - -import java.beans.*; - -public class BooleanEditor extends PropertyEditorSupport { - - - public String getJavaInitializationString() { - Object value = getValue(); - return (value != null) - ? value.toString() - : "null"; - } - - public String getAsText() { - Object value = getValue(); - return (value instanceof Boolean) - ? getValidName((Boolean) value) - : "null"; - } - - public void setAsText(String text) throws java.lang.IllegalArgumentException { - if (text == null) { - setValue(null); - } else if (isValidName(true, text)) { - setValue(Boolean.TRUE); - } else if (isValidName(false, text)) { - setValue(Boolean.FALSE); - } else { - throw new java.lang.IllegalArgumentException(text); - } - } - - public String[] getTags() { - return new String[] {getValidName(true), getValidName(false)}; - } - - // the following method should be localized (4890258) - - private String getValidName(boolean value) { - return value ? "True" : "False"; - } - - private boolean isValidName(boolean value, String name) { - return getValidName(value).equalsIgnoreCase(name); - } -} --- jdk/src/share/classes/sun/beans/editors/ByteEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/ByteEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -/** - * Property editor for a java builtin "byte" type. - * - */ - -import java.beans.*; - -public class ByteEditor extends NumberEditor { - - public String getJavaInitializationString() { - Object value = getValue(); - return (value != null) - ? "((byte)" + value + ")" - : "null"; - } - - public void setAsText(String text) throws IllegalArgumentException { - setValue((text == null) ? null : Byte.decode(text)); - } - -} --- jdk/src/share/classes/sun/beans/editors/ColorEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/ColorEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,212 +0,0 @@ -/* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -import java.awt.*; -import java.beans.*; - -public class ColorEditor extends Panel implements PropertyEditor { - public ColorEditor() { - setLayout(null); - - ourWidth = hPad; - - // Create a sample color block bordered in black - Panel p = new Panel(); - p.setLayout(null); - p.setBackground(Color.black); - sample = new Canvas(); - p.add(sample); - sample.reshape(2, 2, sampleWidth, sampleHeight); - add(p); - p.reshape(ourWidth, 2, sampleWidth+4, sampleHeight+4); - ourWidth += sampleWidth + 4 + hPad; - - text = new TextField("", 14); - add(text); - text.reshape(ourWidth,0,100,30); - ourWidth += 100 + hPad; - - choser = new Choice(); - int active = 0; - for (int i = 0; i < colorNames.length; i++) { - choser.addItem(colorNames[i]); - } - add(choser); - choser.reshape(ourWidth,0,100,30); - ourWidth += 100 + hPad; - - resize(ourWidth,40); - } - - public void setValue(Object o) { - Color c = (Color)o; - changeColor(c); - } - - public Dimension preferredSize() { - return new Dimension(ourWidth, 40); - } - - public boolean keyUp(Event e, int key) { - if (e.target == text) { - try { - setAsText(text.getText()); - } catch (IllegalArgumentException ex) { - // Quietly ignore. - } - } - return (false); - } - - public void setAsText(String s) throws java.lang.IllegalArgumentException { - if (s == null) { - changeColor(null); - return; - } - int c1 = s.indexOf(','); - int c2 = s.indexOf(',', c1+1); - if (c1 < 0 || c2 < 0) { - // Invalid string. - throw new IllegalArgumentException(s); - } - try { - int r = Integer.parseInt(s.substring(0,c1)); - int g = Integer.parseInt(s.substring(c1+1, c2)); - int b = Integer.parseInt(s.substring(c2+1)); - Color c = new Color(r,g,b); - changeColor(c); - } catch (Exception ex) { - throw new IllegalArgumentException(s); - } - - } - - public boolean action(Event e, Object arg) { - if (e.target == choser) { - changeColor(colors[choser.getSelectedIndex()]); - } - return false; - } - - public String getJavaInitializationString() { - return (this.color != null) - ? "new java.awt.Color(" + this.color.getRGB() + ",true)" - : "null"; - } - - - private void changeColor(Color c) { - - if (c == null) { - this.color = null; - this.text.setText(""); - return; - } - - color = c; - - text.setText("" + c.getRed() + "," + c.getGreen() + "," + c.getBlue()); - - int active = 0; - for (int i = 0; i < colorNames.length; i++) { - if (color.equals(colors[i])) { - active = i; - } - } - choser.select(active); - - sample.setBackground(color); - sample.repaint(); - - support.firePropertyChange("", null, null); - } - - public Object getValue() { - return color; - } - - public boolean isPaintable() { - return true; - } - - public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { - Color oldColor = gfx.getColor(); - gfx.setColor(Color.black); - gfx.drawRect(box.x, box.y, box.width-3, box.height-3); - gfx.setColor(color); - gfx.fillRect(box.x+1, box.y+1, box.width-4, box.height-4); - gfx.setColor(oldColor); - } - - public String getAsText() { - return (this.color != null) - ? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue() - : "null"; - } - - public String[] getTags() { - return null; - } - - public java.awt.Component getCustomEditor() { - return this; - } - - public boolean supportsCustomEditor() { - return true; - } - - public void addPropertyChangeListener(PropertyChangeListener l) { - support.addPropertyChangeListener(l); - } - - public void removePropertyChangeListener(PropertyChangeListener l) { - support.removePropertyChangeListener(l); - } - - - private String colorNames[] = { " ", "white", "lightGray", "gray", "darkGray", - "black", "red", "pink", "orange", - "yellow", "green", "magenta", "cyan", - "blue"}; - private Color colors[] = { null, Color.white, Color.lightGray, Color.gray, Color.darkGray, - Color.black, Color.red, Color.pink, Color.orange, - Color.yellow, Color.green, Color.magenta, Color.cyan, - Color.blue}; - - private Canvas sample; - private int sampleHeight = 20; - private int sampleWidth = 40; - private int hPad = 5; - private int ourWidth; - - private Color color; - private TextField text; - private Choice choser; - - private PropertyChangeSupport support = new PropertyChangeSupport(this); -} --- jdk/src/share/classes/sun/beans/editors/DoubleEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/DoubleEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -/** - * Property editor for a java builtin "double" type. - * - */ - -import java.beans.*; - -public class DoubleEditor extends NumberEditor { - - public void setAsText(String text) throws IllegalArgumentException { - setValue((text == null) ? null : Double.valueOf(text)); - } - -} --- jdk/src/share/classes/sun/beans/editors/EnumEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/EnumEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package sun.beans.editors; - -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.ArrayList; -import java.util.List; - -/** - * Property editor for java.lang.Enum subclasses. - * - * @see PropertyEditor - * - * @since 1.7 - * - * @author Sergey A. Malenkov - */ -public final class EnumEditor implements PropertyEditor { - private final List listeners = new ArrayList(); - - private final Class type; - private final String[] tags; - - private Object value; - - public EnumEditor( Class type ) { - Object[] values = type.getEnumConstants(); - if ( values == null ) { - throw new IllegalArgumentException( "Unsupported " + type ); - } - this.type = type; - this.tags = new String[values.length]; - for ( int i = 0; i < values.length; i++ ) { - this.tags[i] = ( ( Enum )values[i] ).name(); - } - } - - public Object getValue() { - return this.value; - } - - public void setValue( Object value ) { - if ( ( value != null ) && !this.type.isInstance( value ) ) { - throw new IllegalArgumentException( "Unsupported value: " + value ); - } - Object oldValue; - PropertyChangeListener[] listeners; - synchronized ( this.listeners ) { - oldValue = this.value; - this.value = value; - - if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) { - return; // do not fire event if value is not changed - } - int size = this.listeners.size(); - if ( size == 0 ) { - return; // do not fire event if there are no any listener - } - listeners = this.listeners.toArray( new PropertyChangeListener[size] ); - } - PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value ); - for ( PropertyChangeListener listener : listeners ) { - listener.propertyChange( event ); - } - } - - public String getAsText() { - return ( this.value != null ) - ? ( ( Enum )this.value ).name() - : "null"; - } - - public void setAsText( String text ) { - setValue( ( text != null ) - ? Enum.valueOf( this.type, text ) - : null ); - } - - public String[] getTags() { - return this.tags.clone(); - } - - public String getJavaInitializationString() { - return ( this.value != null ) - ? this.type.getName() + '.' + ( ( Enum )this.value ).name() - : "null"; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue( Graphics gfx, Rectangle box ) { - } - - public boolean supportsCustomEditor() { - return false; - } - - public Component getCustomEditor() { - return null; - } - - public void addPropertyChangeListener( PropertyChangeListener listener ) { - synchronized ( this.listeners ) { - this.listeners.add( listener ); - } - } - - public void removePropertyChangeListener( PropertyChangeListener listener ) { - synchronized ( this.listeners ) { - this.listeners.remove( listener ); - } - } -} --- jdk/src/share/classes/sun/beans/editors/FloatEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/FloatEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -/** - * Property editor for a java builtin "float" type. - * - */ - -import java.beans.*; - -public class FloatEditor extends NumberEditor { - - public String getJavaInitializationString() { - Object value = getValue(); - return (value != null) - ? value + "F" - : "null"; - } - - public void setAsText(String text) throws IllegalArgumentException { - setValue((text == null) ? null : Float.valueOf(text)); - } - -} --- jdk/src/share/classes/sun/beans/editors/FontEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/FontEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,218 +0,0 @@ -/* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -import java.awt.*; -import java.beans.*; - -public class FontEditor extends Panel implements java.beans.PropertyEditor { - - public FontEditor() { - setLayout(null); - - toolkit = Toolkit.getDefaultToolkit(); - fonts = toolkit.getFontList(); - - familyChoser = new Choice(); - for (int i = 0; i < fonts.length; i++) { - familyChoser.addItem(fonts[i]); - } - add(familyChoser); - familyChoser.reshape(20, 5, 100, 30); - - styleChoser = new Choice(); - for (int i = 0; i < styleNames.length; i++) { - styleChoser.addItem(styleNames[i]); - } - add(styleChoser); - styleChoser.reshape(145, 5, 70, 30); - - sizeChoser = new Choice(); - for (int i = 0; i < pointSizes.length; i++) { - sizeChoser.addItem("" + pointSizes[i]); - } - add(sizeChoser); - sizeChoser.reshape(220, 5, 70, 30); - - resize(300,40); - } - - - public Dimension preferredSize() { - return new Dimension(300, 40); - } - - public void setValue(Object o) { - font = (Font) o; - if (this.font == null) - return; - - changeFont(font); - // Update the current GUI choices. - for (int i = 0; i < fonts.length; i++) { - if (fonts[i].equals(font.getFamily())) { - familyChoser.select(i); - break; - } - } - for (int i = 0; i < styleNames.length; i++) { - if (font.getStyle() == styles[i]) { - styleChoser.select(i); - break; - } - } - for (int i = 0; i < pointSizes.length; i++) { - if (font.getSize() <= pointSizes[i]) { - sizeChoser.select(i); - break; - } - } - } - - private void changeFont(Font f) { - font = f; - if (sample != null) { - remove(sample); - } - sample = new Label(sampleText); - sample.setFont(font); - add(sample); - Component p = getParent(); - if (p != null) { - p.invalidate(); - p.layout(); - } - invalidate(); - layout(); - repaint(); - support.firePropertyChange("", null, null); - } - - public Object getValue() { - return (font); - } - - public String getJavaInitializationString() { - if (this.font == null) - return "null"; - - return "new java.awt.Font(\"" + font.getName() + "\", " + - font.getStyle() + ", " + font.getSize() + ")"; - } - - public boolean action(Event e, Object arg) { - String family = familyChoser.getSelectedItem(); - int style = styles[styleChoser.getSelectedIndex()]; - int size = pointSizes[sizeChoser.getSelectedIndex()]; - try { - Font f = new Font(family, style, size); - changeFont(f); - } catch (Exception ex) { - System.err.println("Couldn't create font " + family + "-" + - styleNames[style] + "-" + size); - } - return (false); - } - - - public boolean isPaintable() { - return true; - } - - public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { - // Silent noop. - Font oldFont = gfx.getFont(); - gfx.setFont(font); - FontMetrics fm = gfx.getFontMetrics(); - int vpad = (box.height - fm.getAscent())/2; - gfx.drawString(sampleText, 0, box.height-vpad); - gfx.setFont(oldFont); - } - - public String getAsText() { - if (this.font == null) { - return "null"; - } - StringBuilder sb = new StringBuilder(); - sb.append(this.font.getName()); - sb.append(' '); - - boolean b = this.font.isBold(); - if (b) { - sb.append("BOLD"); - } - boolean i = this.font.isItalic(); - if (i) { - sb.append("ITALIC"); - } - if (b || i) { - sb.append(' '); - } - sb.append(this.font.getSize()); - return sb.toString(); - } - - public void setAsText(String text) throws IllegalArgumentException { - setValue((text == null) ? null : Font.decode(text)); - } - - public String[] getTags() { - return null; - } - - public java.awt.Component getCustomEditor() { - return this; - } - - public boolean supportsCustomEditor() { - return true; - } - - public void addPropertyChangeListener(PropertyChangeListener l) { - support.addPropertyChangeListener(l); - } - - public void removePropertyChangeListener(PropertyChangeListener l) { - support.removePropertyChangeListener(l); - } - - private Font font; - private Toolkit toolkit; - private String sampleText = "Abcde..."; - - private Label sample; - private Choice familyChoser; - private Choice styleChoser; - private Choice sizeChoser; - - private String fonts[]; - private String[] styleNames = { "plain", "bold", "italic" }; - private int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC }; - private int[] pointSizes = { 3, 5, 8, 10, 12, 14, 18, 24, 36, 48 }; - - private PropertyChangeSupport support = new PropertyChangeSupport(this); - -} --- jdk/src/share/classes/sun/beans/editors/IntegerEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/IntegerEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -/** - * Property editor for a java builtin "int" type. - * - */ - -import java.beans.*; - -public class IntegerEditor extends NumberEditor { - - - public void setAsText(String text) throws IllegalArgumentException { - setValue((text == null) ? null : Integer.decode(text)); - } - -} --- jdk/src/share/classes/sun/beans/editors/LongEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/LongEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -/** - * Property editor for a java builtin "long" type. - * - */ - -import java.beans.*; - -public class LongEditor extends NumberEditor { - - public String getJavaInitializationString() { - Object value = getValue(); - return (value != null) - ? value + "L" - : "null"; - } - - public void setAsText(String text) throws IllegalArgumentException { - setValue((text == null) ? null : Long.decode(text)); - } - -} --- jdk/src/share/classes/sun/beans/editors/NumberEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/NumberEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.editors; - -/** - * Abstract Property editor for a java builtin number types. - * - */ - -import java.beans.*; - -abstract public class NumberEditor extends PropertyEditorSupport { - - public String getJavaInitializationString() { - Object value = getValue(); - return (value != null) - ? value.toString() - : "null"; - } - -} --- jdk/src/share/classes/sun/beans/editors/ShortEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/ShortEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - -package sun.beans.editors; - -/** - * Property editor for a java builtin "short" type. - * - */ - -import java.beans.*; - -public class ShortEditor extends NumberEditor { - - public String getJavaInitializationString() { - Object value = getValue(); - return (value != null) - ? "((short)" + value + ")" - : "null"; - } - - public void setAsText(String text) throws IllegalArgumentException { - setValue((text == null) ? null : Short.decode(text)); - } - -} --- jdk/src/share/classes/sun/beans/editors/StringEditor.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/editors/StringEditor.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - -package sun.beans.editors; - -import java.beans.*; - -public class StringEditor extends PropertyEditorSupport { - - public String getJavaInitializationString() { - Object value = getValue(); - if (value == null) - return "null"; - - String str = value.toString(); - int length = str.length(); - StringBuilder sb = new StringBuilder(length + 2); - sb.append('"'); - for (int i = 0; i < length; i++) { - char ch = str.charAt(i); - switch (ch) { - case '\b': sb.append("\\b"); break; - case '\t': sb.append("\\t"); break; - case '\n': sb.append("\\n"); break; - case '\f': sb.append("\\f"); break; - case '\r': sb.append("\\r"); break; - case '\"': sb.append("\\\""); break; - case '\\': sb.append("\\\\"); break; - default: - if ((ch < ' ') || (ch > '~')) { - sb.append("\\u"); - String hex = Integer.toHexString((int) ch); - for (int len = hex.length(); len < 4; len++) { - sb.append('0'); - } - sb.append(hex); - } else { - sb.append(ch); - } - break; - } - } - sb.append('"'); - return sb.toString(); - } - - public void setAsText(String text) { - setValue(text); - } - -} --- jdk/src/share/classes/sun/beans/infos/ComponentBeanInfo.java 2012-05-01 17:18:19.000000000 -0400 +++ jdk/src/share/classes/sun/beans/infos/ComponentBeanInfo.java 2012-09-05 19:35:34.000000000 -0400 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.beans.infos; - -import java.beans.*; - -/** - * BeanInfo descriptor for a standard AWT component. - */ - -public class ComponentBeanInfo extends SimpleBeanInfo { - private static final Class beanClass = java.awt.Component.class; - - public PropertyDescriptor[] getPropertyDescriptors() { - try { - PropertyDescriptor - name = new PropertyDescriptor("name", beanClass), - background = new PropertyDescriptor("background", beanClass), - foreground = new PropertyDescriptor("foreground", beanClass), - font = new PropertyDescriptor("font", beanClass), - enabled = new PropertyDescriptor("enabled", beanClass), - visible = new PropertyDescriptor("visible", beanClass), - focusable = new PropertyDescriptor("focusable", beanClass); - - enabled.setExpert(true); - visible.setHidden(true); - - background.setBound(true); - foreground.setBound(true); - font.setBound(true); - focusable.setBound(true); - - PropertyDescriptor[] rv = {name, background, foreground, font, enabled, visible, focusable }; - return rv; - } catch (IntrospectionException e) { - throw new Error(e.toString()); - } - } -} --- jdk/src/share/classes/sun/misc/IOUtils.java 2012-05-01 17:18:21.000000000 -0400 +++ jdk/src/share/classes/sun/misc/IOUtils.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ package sun.misc; import java.io.EOFException; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; @@ -77,4 +78,37 @@ } return output; } + + /* + *

Creates a new empty file in the specified directory, using the + * given prefix and suffix strings to generate its name. The resulting + * temporary file may have more restrictive access permission on some + * platforms. + * + * @param prefix The prefix string to be used in generating the file's + * name; must be at least three characters long + * + * @param suffix The suffix string to be used in generating the file's + * name; may be null, in which case the + * suffix ".tmp" will be used + * + * @param directory The directory in which the file is to be created, or + * null if the default temporary-file + * directory is to be used + * + * @return An abstract pathname denoting a newly-created empty file + * + * @see java.io.File#createTempFile(String,String,java.io.File) + */ + public static File createTempFile(String prefix, String suffix, File directory) + throws IOException + { + return SharedSecrets.getJavaIOFileAccess().createTempFile(prefix, suffix, directory); + } + + public static File createTempFile(String prefix, String suffix) + throws IOException + { + return SharedSecrets.getJavaIOFileAccess().createTempFile(prefix, suffix, null); + } } --- jdk/src/share/classes/sun/misc/JavaIOFileAccess.java 1969-12-31 19:00:00.000000000 -0500 +++ jdk/src/share/classes/sun/misc/JavaIOFileAccess.java 2012-09-05 19:34:26.000000000 -0400 @@ -0,0 +1,35 @@ +/* + * 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 sun.misc; + +import java.io.File; +import java.io.IOException; + +public interface JavaIOFileAccess { + public File createTempFile(String prefix, String suffix, File directory) + throws IOException; +} + --- jdk/src/share/classes/sun/misc/SharedSecrets.java 2012-05-01 17:18:21.000000000 -0400 +++ jdk/src/share/classes/sun/misc/SharedSecrets.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, 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 @@ -53,6 +53,7 @@ private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess; private static JavaSecurityAccess javaSecurityAccess; private static JavaAWTAccess javaAWTAccess; + private static JavaIOFileAccess javaIOFileAccess; public static JavaUtilJarAccess javaUtilJarAccess() { if (javaUtilJarAccess == null) { @@ -149,4 +150,12 @@ // provision for. return javaAWTAccess; } + + public static void setJavaIOFileAccess(JavaIOFileAccess access) { + javaIOFileAccess = access; + } + + public static JavaIOFileAccess getJavaIOFileAccess() { + return javaIOFileAccess; + } } --- jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java 2012-05-01 17:18:22.000000000 -0400 +++ jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java 2012-09-05 19:34:26.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2006, 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 @@ -219,7 +219,7 @@ OutputStream out = null; File tmpFile = null; try { - tmpFile = File.createTempFile("jar_cache", null); + tmpFile = sun.misc.IOUtils.createTempFile("jar_cache", null); tmpFile.deleteOnExit(); out = new FileOutputStream(tmpFile); int read = 0; --- jdk/src/share/classes/sun/print/PSPrinterJob.java 2012-05-01 17:18:24.000000000 -0400 +++ jdk/src/share/classes/sun/print/PSPrinterJob.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ -652,7 +652,7 @@ * is not removed for some reason, request that it is * removed when the VM exits. */ - spoolFile = File.createTempFile("javaprint", ".ps", null); + spoolFile = sun.misc.IOUtils.createTempFile("javaprint", ".ps", null); spoolFile.deleteOnExit(); result = new FileOutputStream(spoolFile); --- jdk/src/share/classes/sun/rmi/server/Activation.java 2012-05-01 17:18:25.000000000 -0400 +++ jdk/src/share/classes/sun/rmi/server/Activation.java 2012-09-05 19:34:26.000000000 -0400 @@ -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 @@ -1916,7 +1916,7 @@ new PrivilegedExceptionAction() { public Void run() throws IOException { File file = - File.createTempFile("rmid-err", null, null); + sun.misc.IOUtils.createTempFile("rmid-err", null, null); PrintStream errStream = new PrintStream(new FileOutputStream(file)); System.setErr(errStream); --- jdk/src/share/classes/sun/security/x509/CRLExtensions.java 2012-05-01 17:18:27.000000000 -0400 +++ jdk/src/share/classes/sun/security/x509/CRLExtensions.java 2012-09-05 19:34:26.000000000 -0400 @@ -32,8 +32,10 @@ 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.*; import sun.misc.HexDumpEncoder; @@ -62,7 +64,8 @@ */ public class CRLExtensions { - private Hashtable map = new Hashtable(); + private Map map = Collections.synchronizedMap( + new TreeMap()); private boolean unsupportedCritExt = false; /** @@ -215,7 +218,7 @@ * @return an enumeration of the extensions in this CRL. */ public Enumeration getElements() { - return map.elements(); + return Collections.enumeration(map.values()); } /** --- jdk/src/share/classes/sun/security/x509/CertificateExtensions.java 2012-05-01 17:18:27.000000000 -0400 +++ jdk/src/share/classes/sun/security/x509/CertificateExtensions.java 2012-09-05 19:34:26.000000000 -0400 @@ -57,7 +57,8 @@ private static final Debug debug = Debug.getInstance("x509"); - private Hashtable map = new Hashtable(); + private Map map = Collections.synchronizedMap( + new TreeMap()); private boolean unsupportedCritExt = false; private Map unparseableExtensions; @@ -117,7 +118,7 @@ if (ext.isCritical() == false) { // ignore errors parsing non-critical extensions if (unparseableExtensions == null) { - unparseableExtensions = new HashMap(); + unparseableExtensions = new TreeMap(); } unparseableExtensions.put(ext.getExtensionId().toString(), new UnparseableExtension(ext, e)); @@ -218,6 +219,12 @@ 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. @@ -236,7 +243,7 @@ * attribute. */ public Enumeration getElements() { - return map.elements(); + return Collections.enumeration(map.values()); } /** --- jdk/src/share/classes/sun/security/x509/X509CRLEntryImpl.java 2012-05-01 17:18:27.000000000 -0400 +++ jdk/src/share/classes/sun/security/x509/X509CRLEntryImpl.java 2012-09-05 19:34:26.000000000 -0400 @@ -31,11 +31,7 @@ import java.security.cert.CertificateException; import java.security.cert.X509CRLEntry; import java.math.BigInteger; -import java.util.Collection; -import java.util.Date; -import java.util.Enumeration; -import java.util.Set; -import java.util.HashSet; +import java.util.*; import javax.security.auth.x500.X500Principal; @@ -72,7 +68,8 @@ * @author Hemma Prafullchandra */ -public class X509CRLEntryImpl extends X509CRLEntry { +public class X509CRLEntryImpl extends X509CRLEntry + implements Comparable { private SerialNumber serialNumber = null; private Date revocationDate = null; @@ -193,9 +190,14 @@ * @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 @@ -313,7 +315,7 @@ if (extensions == null) { return null; } - Set extSet = new HashSet(); + Set extSet = new TreeSet(); for (Extension ex : extensions.getAllExtensions()) { if (ex.isCritical()) { extSet.add(ex.getExtensionId().toString()); @@ -334,7 +336,7 @@ if (extensions == null) { return null; } - Set extSet = new HashSet(); + Set extSet = new TreeSet(); for (Extension ex : extensions.getAllExtensions()) { if (!ex.isCritical()) { extSet.add(ex.getExtensionId().toString()); @@ -461,4 +463,24 @@ return (CertificateIssuerExtension) getExtension(PKIXExtensions.CertificateIssuer_Id); } + + @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 - * An implmentation for X509 CRL (Certificate Revocation List). + * An implementation for X509 CRL (Certificate Revocation List). *

* The X.509 v2 CRL format is described below in ASN.1: *

@@ -104,7 +104,8 @@
     private X500Principal    issuerPrincipal = null;
     private Date             thisUpdate = null;
     private Date             nextUpdate = null;
-    private Map revokedCerts = new LinkedHashMap();
+    private Map revokedMap = new TreeMap();
+    private List revokedList = new LinkedList();
     private CRLExtensions    extensions = null;
     private final static boolean isExplicit = true;
     private static final long YR_2050 = 2524636800000L;
@@ -223,7 +224,8 @@
                 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;
                 }
@@ -305,8 +307,8 @@
                     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);
@@ -490,14 +492,14 @@
             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 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 allExts = extensions.getAllExtensions();
@@ -543,12 +545,12 @@
      * 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);
     }
 
     /**
@@ -638,24 +640,24 @@
      * @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);
     }
 
     /**
@@ -667,10 +669,10 @@
      * @see X509CRLEntry
      */
     public Set getRevokedCertificates() {
-        if (revokedCerts.isEmpty()) {
+        if (revokedList.isEmpty()) {
             return null;
         } else {
-            return new HashSet(revokedCerts.values());
+            return new TreeSet(revokedList);
         }
     }
 
@@ -896,7 +898,7 @@
         if (extensions == null) {
             return null;
         }
-        Set extSet = new HashSet();
+        Set extSet = new TreeSet();
         for (Extension ex : extensions.getAllExtensions()) {
             if (ex.isCritical()) {
                 extSet.add(ex.getExtensionId().toString());
@@ -917,7 +919,7 @@
         if (extensions == null) {
             return null;
         }
-        Set extSet = new HashSet();
+        Set extSet = new TreeSet();
         for (Extension ex : extensions.getAllExtensions()) {
             if (!ex.isCritical()) {
                 extSet.add(ex.getExtensionId().toString());
@@ -1094,7 +1096,8 @@
                 entry.setCertificateIssuer(crlIssuer, badCertIssuer);
                 X509IssuerSerial issuerSerial = new X509IssuerSerial
                     (badCertIssuer, entry.getSerialNumber());
-                revokedCerts.put(issuerSerial, entry);
+                revokedMap.put(issuerSerial, entry);
+                revokedList.add(entry);
             }
         }
 
@@ -1192,7 +1195,8 @@
     /**
      * Immutable X.509 Certificate Issuer DN and serial number pair
      */
-    private final static class X509IssuerSerial {
+    private final static class X509IssuerSerial
+            implements Comparable {
         final X500Principal issuer;
         final BigInteger serial;
         volatile int hashcode = 0;
@@ -1271,5 +1275,13 @@
             }
             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);
+        }
     }
 }
--- jdk/src/share/classes/sun/security/x509/X509CertImpl.java	2012-05-01 17:18:27.000000000 -0400
+++ jdk/src/share/classes/sun/security/x509/X509CertImpl.java	2012-09-05 19:34:26.000000000 -0400
@@ -1214,7 +1214,7 @@
             if (exts == null) {
                 return null;
             }
-            Set extSet = new HashSet();
+            Set extSet = new TreeSet();
             for (Extension ex : exts.getAllExtensions()) {
                 if (ex.isCritical()) {
                     extSet.add(ex.getExtensionId().toString());
@@ -1244,7 +1244,7 @@
             if (exts == null) {
                 return null;
             }
-            Set extSet = new HashSet();
+            Set extSet = new TreeSet();
             for (Extension ex : exts.getAllExtensions()) {
                 if (!ex.isCritical()) {
                     extSet.add(ex.getExtensionId().toString());
@@ -1278,10 +1278,14 @@
             if (extensions == null) {
                 return null;
             } else {
-                for (Extension ex : extensions.getAllExtensions()) {
-                    if (ex.getExtensionId().equals(oid)) {
+                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 ex;
+                        return ex2;
                     }
                 }
                 /* no such extension in this certificate */
@@ -1480,7 +1484,7 @@
         if (names.isEmpty()) {
             return Collections.>emptySet();
         }
-        Set> newNames = new HashSet>();
+        List> newNames = new ArrayList>();
         for (GeneralName gname : names.names()) {
             GeneralNameInterface name = gname.getName();
             List nameEntry = new ArrayList(2);
@@ -1541,7 +1545,7 @@
             }
         }
         if (mustClone) {
-            Set> namesCopy = new HashSet>();
+            List> namesCopy = new ArrayList>();
             for (List nameEntry : altNames) {
                 Object nameObject = nameEntry.get(1);
                 if (nameObject instanceof byte[]) {
--- jdk/src/share/classes/sun/tools/jar/Main.java	2012-05-01 17:18:28.000000000 -0400
+++ jdk/src/share/classes/sun/tools/jar/Main.java	2012-09-05 19:34:26.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, 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
@@ -127,14 +127,14 @@
 
     /**
      * Creates a new empty temporary file in the same directory as the
-     * specified file.  A variant of File.createTempFile.
+     * specified file.  A variant of sun.misc.IOUtils.createTempFile.
      */
     private static File createTempFileInSameDirectoryAs(File file)
         throws IOException {
         File dir = file.getParentFile();
         if (dir == null)
             dir = new File(".");
-        return File.createTempFile("jartmp", null, dir);
+        return sun.misc.IOUtils.createTempFile("jartmp", null, dir);
     }
 
     private boolean ok;
--- jdk/src/share/classes/sun/tools/native2ascii/Main.java	2012-05-01 17:18:28.000000000 -0400
+++ jdk/src/share/classes/sun/tools/native2ascii/Main.java	2012-09-05 19:34:26.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, 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
@@ -237,9 +237,7 @@
             if (tempDir == null)
                 tempDir = new File(System.getProperty("user.dir"));
 
-            tempFile = File.createTempFile("_N2A",
-                                           ".TMP",
-                                            tempDir);
+            tempFile = sun.misc.IOUtils.createTempFile("_N2A", ".TMP", tempDir);
             tempFile.deleteOnExit();
 
             try {
--- jdk/src/share/lib/security/java.security	2012-05-01 17:18:31.000000000 -0400
+++ jdk/src/share/lib/security/java.security	2012-09-05 19:34:26.000000000 -0400
@@ -127,7 +127,7 @@
 # passed to checkPackageAccess unless the
 # corresponding RuntimePermission ("accessClassInPackage."+package) has
 # been granted.
-package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
+package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
 
 #
 # List of comma-separated packages that start with or equal this string
@@ -136,10 +136,10 @@
 # corresponding RuntimePermission ("defineClassInPackage."+package) has
 # been granted.
 #
-# by default, no packages are restricted for definition, and none of
-# the class loaders supplied with the JDK call checkPackageDefinition.
+# by default, none of the class loaders supplied with the JDK call
+# checkPackageDefinition.
 #
-#package.definition=
+package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
 
 #
 # Determines whether this properties file can be appended to
--- jdk/src/share/lib/security/java.security-solaris	2012-05-01 17:18:31.000000000 -0400
+++ jdk/src/share/lib/security/java.security-solaris	2012-09-05 19:34:26.000000000 -0400
@@ -137,10 +137,10 @@
 # corresponding RuntimePermission ("defineClassInPackage."+package) has
 # been granted.
 #
-# by default, no packages are restricted for definition, and none of
-# the class loaders supplied with the JDK call checkPackageDefinition.
+# by default, none of the class loaders supplied with the JDK call
+# checkPackageDefinition.
 #
-#package.definition=
+package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
 
 #
 # Determines whether this properties file can be appended to
--- jdk/src/share/lib/security/java.security-windows	2012-05-01 17:18:31.000000000 -0400
+++ jdk/src/share/lib/security/java.security-windows	2012-09-05 19:34:26.000000000 -0400
@@ -137,10 +137,10 @@
 # corresponding RuntimePermission ("defineClassInPackage."+package) has
 # been granted.
 #
-# by default, no packages are restricted for definition, and none of
-# the class loaders supplied with the JDK call checkPackageDefinition.
+# by default, none of the class loaders supplied with the JDK call
+# checkPackageDefinition.
 #
-#package.definition=
+package.definition=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
 
 #
 # Determines whether this properties file can be appended to
--- jdk/src/share/native/sun/font/layout/LookupProcessor.cpp	2012-05-01 17:18:33.000000000 -0400
+++ jdk/src/share/native/sun/font/layout/LookupProcessor.cpp	2012-09-05 19:34:26.000000000 -0400
@@ -86,6 +86,10 @@
 
         if (selectMask != 0) {
             const LookupTable *lookupTable = lookupListTable->getLookupTable(lookup);
+
+            if (!lookupTable)
+                continue;
+
             le_uint16 lookupFlags = SWAPW(lookupTable->lookupFlags);
 
             glyphIterator.reset(lookupFlags, selectMask);
@@ -124,6 +128,9 @@
     for (le_uint16 lookup = 0; lookup < lookupCount; lookup += 1) {
         le_uint16 lookupListIndex = SWAPW(featureTable->lookupListIndexArray[lookup]);
 
+        if (lookupListIndex >= lookupSelectCount)
+            continue;
+
         lookupSelectArray[lookupListIndex] |= featureMask;
         lookupOrderArray[store++] = lookupListIndex;
     }
@@ -135,7 +142,7 @@
         Offset scriptListOffset, Offset featureListOffset, Offset lookupListOffset,
         LETag scriptTag, LETag languageTag, const FeatureMap *featureMap,
         le_int32 featureMapCount, le_bool orderFeatures)
-    : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL),
+    : lookupListTable(NULL), featureListTable(NULL), lookupSelectArray(NULL), lookupSelectCount(0),
       lookupOrderArray(NULL), lookupOrderCount(0)
 {
     const ScriptListTable *scriptListTable = NULL;
@@ -175,6 +182,8 @@
         lookupSelectArray[i] = 0;
     }
 
+    lookupSelectCount = lookupListCount;
+
     le_int32 count, order = 0;
     le_int32 featureReferences = 0;
     const FeatureTable *featureTable = NULL;
@@ -191,6 +200,10 @@
         le_uint16 featureIndex = SWAPW(langSysTable->featureIndexArray[feature]);
 
         featureTable = featureListTable->getFeatureTable(featureIndex, &featureTag);
+
+        if (!featureTable)
+            continue;
+
         featureReferences += SWAPW(featureTable->lookupCount);
     }
 
--- jdk/src/share/native/sun/font/layout/LookupProcessor.h	2012-05-01 17:18:33.000000000 -0400
+++ jdk/src/share/native/sun/font/layout/LookupProcessor.h	2012-09-05 19:34:26.000000000 -0400
@@ -77,6 +77,7 @@
     const FeatureListTable  *featureListTable;
 
     FeatureMask             *lookupSelectArray;
+    le_uint32              lookupSelectCount;
 
     le_uint16               *lookupOrderArray;
     le_uint32               lookupOrderCount;
--- jdk/src/solaris/classes/java/io/UnixFileSystem.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/java/io/UnixFileSystem.java	2012-09-05 19:34:26.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -253,7 +253,7 @@
 
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
         throws IOException;
     public boolean delete(File f) {
         // Keep canonicalization caches in sync after file deletion
--- jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XCheckboxMenuItemPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -29,27 +29,12 @@
 import java.awt.peer.*;
 import java.awt.event.*;
 
-import java.lang.reflect.Field;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 class XCheckboxMenuItemPeer extends XMenuItemPeer implements CheckboxMenuItemPeer {
 
     /************************************************
      *
-     * Data members
-     *
-     ************************************************/
-
-    /*
-     * CheckboxMenuItem's fields
-     */
-    private final static Field f_state;
-    static {
-        f_state = SunToolkit.getField(CheckboxMenuItem.class, "state");
-    }
-
-    /************************************************
-     *
      * Construction
      *
      ************************************************/
@@ -74,16 +59,8 @@
      *
      ************************************************/
     boolean getTargetState() {
-        MenuItem target = getTarget();
-        if (target == null) {
-            return false;
-        }
-        try {
-            return f_state.getBoolean(target);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return false;
+        return AWTAccessor.getCheckboxMenuItemAccessor()
+                   .getState((CheckboxMenuItem)getTarget());
     }
 
     /************************************************
--- jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -31,17 +31,13 @@
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.Cursor;
-import java.awt.DefaultKeyboardFocusManager;
 import java.awt.Dimension;
-import java.awt.Event;
 import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Graphics;
 import java.awt.Image;
 import java.awt.Insets;
 import java.awt.KeyboardFocusManager;
-import java.awt.MenuBar;
-import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.SystemColor;
 import java.awt.Toolkit;
@@ -60,12 +56,9 @@
 import java.awt.image.ImageObserver;
 import java.awt.image.ImageProducer;
 import java.awt.image.VolatileImage;
-import java.awt.peer.CanvasPeer;
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.ContainerPeer;
 import java.awt.peer.LightweightPeer;
-import java.awt.peer.PanelPeer;
-import java.awt.peer.WindowPeer;
 import java.lang.reflect.*;
 import java.security.*;
 import java.util.Collection;
@@ -397,19 +390,8 @@
         }
     }
 
-    static Method requestFocusWithCause;
-
     static void callRequestFocus(Component target, CausedFocusEvent.Cause cause) {
-        if (requestFocusWithCause == null) {
-            requestFocusWithCause = SunToolkit.getMethod(Component.class, "requestFocus", new Class[] {CausedFocusEvent.Cause.class});
-        }
-        if (requestFocusWithCause != null) {
-            try {
-                requestFocusWithCause.invoke(target, new Object[] {cause});
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
+        AWTAccessor.getComponentAccessor().requestFocus(target, cause);
     }
 
     final public boolean requestFocus(Component lightweightChild, boolean temporary,
--- jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -29,14 +29,7 @@
 import java.awt.dnd.DropTarget;
 import java.awt.dnd.DropTargetListener;
 import java.awt.event.*;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.image.VolatileImage;
-import java.awt.peer.*;
 import sun.awt.*;
-import sun.awt.motif.X11FontMetrics;
-import java.lang.reflect.*;
 import java.util.logging.*;
 import java.util.*;
 import static sun.awt.X11.XEmbedHelper.*;
@@ -455,16 +448,8 @@
         }
     }
 
-    static Field bdataField;
     static byte[] getBData(KeyEvent e) {
-        try {
-            if (bdataField == null) {
-                bdataField = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
-            }
-            return (byte[])bdataField.get(e);
-        } catch (IllegalAccessException ex) {
-            return null;
-        }
+        return AWTAccessor.getAWTEventAccessor().getBData(e);
     }
 
     void forwardKeyEvent(KeyEvent e) {
--- jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java	2012-09-05 19:35:40.000000000 -0400
@@ -28,8 +28,7 @@
 import java.awt.*;
 import java.util.HashMap;
 import java.awt.event.KeyEvent;
-import java.lang.reflect.*;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
     HashMap children = new HashMap();
@@ -127,20 +126,8 @@
         }
     }
 
-    static Field bdata;
-    byte[] getBData(KeyEvent e) {
-        try {
-            if (bdata == null) {
-                bdata = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
-            }
-            return (byte[])bdata.get(e);
-        } catch (IllegalAccessException ex) {
-            return null;
-        }
-    }
-
     void forwardKeyEvent(long child, KeyEvent e) {
-        byte[] bdata = getBData(e);
+        byte[] bdata = AWTAccessor.getAWTEventAccessor().getBData(e);
         long data = Native.toData(bdata);
         if (data == 0) {
             return;
--- jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	2012-09-05 19:35:40.000000000 -0400
@@ -29,32 +29,13 @@
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.LightweightPeer;
 import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import sun.awt.ComponentAccessor;
 
 import sun.awt.GlobalCursorManager;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public final class XGlobalCursorManager extends GlobalCursorManager {
 
-    private static Field  field_pData;
-    private static Field  field_type;
-    private static Class  cursorClass;
-    private static Method method_setPData;
-    static {
-        cursorClass = java.awt.Cursor.class;
-        field_pData = SunToolkit.getField(cursorClass, "pData");
-        field_type  = SunToolkit.getField(cursorClass, "type");
-        method_setPData = SunToolkit.getMethod(cursorClass, "setPData", new Class[] {long.class});
-        if (field_pData == null || field_type == null || method_setPData == null) {
-            System.out.println("Unable to initialize XGlobalCursorManager: ");
-            Thread.dumpStack();
-
-        }
-    }
-
-
     // cached nativeContainer
     private WeakReference nativeContainer;
 
@@ -216,8 +197,8 @@
         long pData = 0;
         int type = 0;
         try {
-            pData = field_pData.getLong(c);
-            type = field_type.getInt(c);
+            pData = AWTAccessor.getCursorAccessor().getPData(c);
+            type = AWTAccessor.getCursorAccessor().getType(c);
         }
         catch (Exception e)
         {
@@ -287,7 +268,7 @@
 
     static void setPData(Cursor c, long pData) {
         try {
-            method_setPData.invoke(c, pData);
+            AWTAccessor.getCursorAccessor().setPData(c, pData);
         }
         catch (Exception e)
         {
--- jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -32,14 +32,11 @@
 
 import java.awt.peer.KeyboardFocusManagerPeer;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import sun.awt.CausedFocusEvent;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XKeyboardFocusManagerPeer implements KeyboardFocusManagerPeer {
     private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XKeyboardFocusManagerPeer");
@@ -130,46 +127,16 @@
         return true;
     }
 
-    static Method shouldNativelyFocusHeavyweightMethod;
-
     static int shouldNativelyFocusHeavyweight(Component heavyweight,
          Component descendant, boolean temporary,
          boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
     {
-        if (shouldNativelyFocusHeavyweightMethod == null) {
-            Class[] arg_types =
-                new Class[] { Component.class,
-                              Component.class,
-                              Boolean.TYPE,
-                              Boolean.TYPE,
-                              Long.TYPE,
-                              CausedFocusEvent.Cause.class
-            };
-
-            shouldNativelyFocusHeavyweightMethod =
-                SunToolkit.getMethod(KeyboardFocusManager.class,
-                                   "shouldNativelyFocusHeavyweight",
-                                   arg_types);
-        }
-        Object[] args = new Object[] { heavyweight,
-                                       descendant,
-                                       Boolean.valueOf(temporary),
-                                       Boolean.valueOf(focusedWindowChangeAllowed),
-                                       Long.valueOf(time), cause};
-
-        int result = XComponentPeer.SNFH_FAILURE;
-        if (shouldNativelyFocusHeavyweightMethod != null) {
-            try {
-                result = ((Integer) shouldNativelyFocusHeavyweightMethod.invoke(null, args)).intValue();
-            }
-            catch (IllegalAccessException e) {
-                assert false;
-            }
-            catch (InvocationTargetException e) {
-                assert false;
-            }
-        }
-
-        return result;
+         return AWTAccessor.getKeyboardFocusManagerAccessor()
+                 .shouldNativelyFocusHeavyweight(heavyweight,
+                                                 descendant,
+                                                 temporary,
+                                                 focusedWindowChangeAllowed,
+                                                 time,
+                                                 cause);
     }
 }
--- jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -28,10 +28,9 @@
 import java.awt.peer.*;
 import java.awt.event.*;
 
-import java.lang.reflect.Field;
 import java.util.Vector;
 import java.util.logging.*;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
 
@@ -67,15 +66,6 @@
     private final static int BAR_ITEM_MARGIN_TOP = 2;
     private final static int BAR_ITEM_MARGIN_BOTTOM = 2;
 
-    //fields
-    private static Field f_helpMenu;
-    private static Field f_menus;
-
-    static {
-        f_helpMenu = SunToolkit.getField(MenuBar.class, "helpMenu");
-        f_menus = SunToolkit.getField(MenuBar.class, "menus");
-    }
-
     /************************************************
      *
      * Mapping data
@@ -204,19 +194,12 @@
      */
     void postInit(XCreateWindowParams params) {
         super.postInit(params);
-        Vector targetMenuVector = null;
-        Menu targetHelpMenu = null;
-        try {
-            // Get menus from the target.
-            targetMenuVector = (Vector)f_menus.get(menuBarTarget);
-            targetHelpMenu = (Menu)f_helpMenu.get(menuBarTarget);
-            reloadItems(targetMenuVector);
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
-        }
-        if (targetHelpMenu != null) {
-            addHelpMenu(targetHelpMenu);
-        }
+        // Get menus from the target.
+        Vector targetMenuVector = AWTAccessor.getMenuBarAccessor()
+                                      .getMenus(menuBarTarget);
+        Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor()
+                                  .getHelpMenu(menuBarTarget);
+        reloadItems(targetMenuVector);
         xSetVisible(true);
         toFront();
     }
--- jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -28,12 +28,7 @@
 import java.awt.peer.*;
 import java.awt.event.*;
 
-import java.util.logging.*;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XMenuItemPeer implements MenuItemPeer {
 
@@ -83,24 +78,6 @@
     private final static int SEPARATOR_WIDTH = 20;
     private final static int SEPARATOR_HEIGHT = 5;
 
-    /*
-     * MenuItem's fields & methods
-     */
-    private final static Field f_enabled;
-    private final static Field f_label;
-    private final static Field f_shortcut;
-    private final static Method m_getFont;
-    private final static Method m_isItemEnabled;
-    private final static Method m_getActionCommand;
-    static {
-        f_enabled = SunToolkit.getField(MenuItem.class, "enabled");
-        f_label = SunToolkit.getField(MenuItem.class, "label");
-        f_shortcut = SunToolkit.getField(MenuItem.class, "shortcut");
-
-        m_getFont = SunToolkit.getMethod(MenuComponent.class, "getFont_NoClientCode", null);
-        m_getActionCommand = SunToolkit.getMethod(MenuItem.class, "getActionCommandImpl", null);
-        m_isItemEnabled = SunToolkit.getMethod(MenuItem.class, "isItemEnabled", null);
-    }
     /************************************************
      *
      * Text Metrics
@@ -218,39 +195,21 @@
         if (target == null) {
             return XWindow.defaultFont;
         }
-        try {
-            return (Font)m_getFont.invoke(target, new Object[0]);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
-        return XWindow.defaultFont;
+        return AWTAccessor.getMenuComponentAccessor().getFont_NoClientCode(target);
     }
 
     String getTargetLabel() {
         if (target == null) {
             return "";
         }
-        try {
-            String label = (String)f_label.get(target);
-            return (label == null) ? "" : label;
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return "";
+        return AWTAccessor.getMenuItemAccessor().getLabel(target);
     }
 
     boolean isTargetEnabled() {
         if (target == null) {
             return false;
         }
-        try {
-            return f_enabled.getBoolean(target);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return false;
+        return AWTAccessor.getMenuItemAccessor().isEnabled(target);
     }
 
     /**
@@ -262,40 +221,21 @@
         if (target == null) {
             return false;
         }
-        try {
-            return ((Boolean)m_isItemEnabled.invoke(target, new Object[0])).booleanValue();
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
-        return false;
+        return AWTAccessor.getMenuItemAccessor().isItemEnabled(target);
     }
 
     String getTargetActionCommand() {
         if (target == null) {
             return "";
         }
-        try {
-            return (String) m_getActionCommand.invoke(target,(Object[]) null);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
-        return "";
+        return AWTAccessor.getMenuItemAccessor().getActionCommandImpl(target);
     }
 
     MenuShortcut getTargetShortcut() {
         if (target == null) {
             return null;
         }
-        try {
-            return (MenuShortcut)f_shortcut.get(target);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return null;
+        return AWTAccessor.getMenuItemAccessor().getShortcut(target);
     }
 
     String getShortcutText() {
--- jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -27,10 +27,9 @@
 import java.awt.*;
 import java.awt.peer.*;
 
-import java.lang.reflect.Field;
 import java.util.Vector;
 import java.util.logging.*;
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
 
@@ -46,16 +45,6 @@
      */
     XMenuWindow menuWindow;
 
-
-    /*
-     * Menu's fields & methods
-     */
-    private final static Field f_items;
-
-    static {
-        f_items = SunToolkit.getField(Menu.class, "items");
-    }
-
     /************************************************
      *
      * Construction
@@ -153,12 +142,7 @@
      *
      ************************************************/
     Vector getTargetItems() {
-        try {
-            return (Vector)f_items.get(getTarget());
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
-            return null;
-        }
+        return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget());
     }
 
     /************************************************
--- jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -28,15 +28,10 @@
 import java.awt.peer.*;
 import java.awt.event.*;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-
 import java.util.Vector;
+import sun.awt.AWTAccessor;
 import java.util.logging.*;
 
-import sun.awt.SunToolkit;
-
 public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
 
     /************************************************
@@ -66,24 +61,6 @@
     private final static int CAPTION_MARGIN_TOP = 4;
     private final static int CAPTION_SEPARATOR_HEIGHT = 6;
 
-    /*
-     * Menu's fields & methods
-     */
-    //Fix for 6184485: Popup menu is not disabled on XToolkit even when calling setEnabled (false)
-    private final static Field f_enabled;
-    //Fix for 6267144: PIT: Popup menu label is not shown, XToolkit
-    private final static Field f_label;
-    private final static Method m_getFont;
-    private final static Field f_items;
-
-    static {
-        f_enabled = SunToolkit.getField(MenuItem.class, "enabled");
-        f_label = SunToolkit.getField(MenuItem.class, "label");
-        f_items = SunToolkit.getField(Menu.class, "items");
-        m_getFont = SunToolkit.getMethod(MenuComponent.class, "getFont_NoClientCode", null);
-    }
-
-
     /************************************************
      *
      * Construction
@@ -189,27 +166,16 @@
         if (popupMenuTarget == null) {
             return XWindow.defaultFont;
         }
-        try {
-            return (Font)m_getFont.invoke(popupMenuTarget, new Object[0]);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        } catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
-        return XWindow.defaultFont;
+        return AWTAccessor.getMenuComponentAccessor()
+                   .getFont_NoClientCode(popupMenuTarget);
     }
 
+    //Fix for 6267144: PIT: Popup menu label is not shown, XToolkit
     String getTargetLabel() {
         if (target == null) {
             return "";
         }
-        try {
-            String label = (String)f_label.get(popupMenuTarget);
-            return (label == null) ? "" : label;
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return "";
+        return AWTAccessor.getMenuItemAccessor().getLabel(popupMenuTarget);
     }
 
     //Fix for 6184485: Popup menu is not disabled on XToolkit even when calling setEnabled (false)
@@ -217,21 +183,14 @@
         if (popupMenuTarget == null) {
             return false;
         }
-        try {
-            return f_enabled.getBoolean(popupMenuTarget);
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return false;
+        return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget);
     }
 
     Vector getMenuTargetItems() {
-        try {
-            return (Vector)f_items.get(popupMenuTarget);
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
+        if (popupMenuTarget == null) {
             return null;
         }
+        return AWTAccessor.getMenuAccessor().getItems(popupMenuTarget);
     }
 
     /************************************************
--- jdk/src/solaris/classes/sun/awt/X11/XScrollPanePeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XScrollPanePeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -28,8 +28,8 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.peer.*;
-import java.lang.reflect.*;
-import sun.awt.SunToolkit;
+
+import sun.awt.AWTAccessor;
 
 class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollbarClient {
 
@@ -41,9 +41,7 @@
     public final static int     VERTICAL = 1 << 0;
     public final static int     HORIZONTAL = 1 << 1;
 
-    private static Method m_setValue;
     static {
-        m_setValue = SunToolkit.getMethod(ScrollPaneAdjustable.class, "setTypedValue", new Class[] {Integer.TYPE, Integer.TYPE});
         SCROLLBAR = XToolkit.getUIDefaults().getInt("ScrollBar.defaultWidth");
     }
 
@@ -316,16 +314,8 @@
     }
 
     void setAdjustableValue(ScrollPaneAdjustable adj, int value, int type) {
-        try {
-            m_setValue.invoke(adj, new Object[] {Integer.valueOf(value), Integer.valueOf(type)});
-        } catch (IllegalAccessException iae) {
-            adj.setValue(value);
-        } catch (IllegalArgumentException iae2) {
-            adj.setValue(value);
-        } catch (InvocationTargetException ite) {
-            adj.setValue(value);
-            ite.getCause().printStackTrace();
-        }
+        AWTAccessor.getScrollPaneAdjustableAccessor().setTypedValue(adj, value,
+                                                                    type);
     }
 
 
--- jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -61,6 +61,7 @@
 import java.awt.im.InputMethodRequests;
 import sun.awt.CausedFocusEvent;
 import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 
 class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
@@ -985,8 +986,10 @@
         // loading SystemFlavorMap and associated classes.
         public void setTransferHandler(TransferHandler newHandler) {
             TransferHandler oldHandler = (TransferHandler)
-                getClientProperty(XTextTransferHelper.getTransferHandlerKey());
-            putClientProperty(XTextTransferHelper.getTransferHandlerKey(),
+                getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
+                                      .getJComponent_TRANSFER_HANDLER());
+            putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
+                                  .getJComponent_TRANSFER_HANDLER(),
                               newHandler);
 
             firePropertyChange("transferHandler", oldHandler, newHandler);
--- jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -55,6 +55,7 @@
 import java.util.logging.*;
 import sun.awt.CausedFocusEvent;
 import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
     private static final Logger log = Logger.getLogger("sun.awt.X11.XTextField");
@@ -714,8 +715,10 @@
         // loading SystemFlavorMap and associated classes.
         public void setTransferHandler(TransferHandler newHandler) {
             TransferHandler oldHandler = (TransferHandler)
-                getClientProperty(XTextTransferHelper.getTransferHandlerKey());
-            putClientProperty(XTextTransferHelper.getTransferHandlerKey(),
+                getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
+                                      .getJComponent_TRANSFER_HANDLER());
+            putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
+                                  .getJComponent_TRANSFER_HANDLER(),
                               newHandler);
 
             firePropertyChange("transferHandler", oldHandler, newHandler);
--- jdk/src/solaris/classes/sun/awt/X11/XTextTransferHelper.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XTextTransferHelper.java	2012-09-05 19:35:40.000000000 -0400
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt.X11;
-
-import java.lang.reflect.Field;
-import sun.awt.SunToolkit;
-
-class XTextTransferHelper {
-    private static Object transferHandlerKey = null;
-    static Object getTransferHandlerKey() {
-        if (transferHandlerKey == null) {
-            try {
-                Class clazz = Class.forName("javax.swing.ClientPropertyKey");
-                Field field = SunToolkit.getField(clazz, "JComponent_TRANSFER_HANDLER");
-                transferHandlerKey = field.get(null);
-            } catch (IllegalAccessException ex) {
-                return null;
-            } catch (ClassNotFoundException cnfe) {
-                cnfe.printStackTrace();
-            }
-        }
-        return transferHandlerKey;
-    }
-}
--- jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	2012-09-05 19:35:40.000000000 -0400
@@ -49,7 +49,7 @@
 import sun.misc.PerformanceLogger;
 import sun.print.PrintJob2D;
 import sun.security.action.GetBooleanAction;
-import java.lang.reflect.*;
+import sun.security.action.GetPropertyAction;
 
 public class XToolkit extends UNIXToolkit implements Runnable, XConstants {
     private static Logger log = Logger.getLogger("sun.awt.X11.XToolkit");
@@ -102,7 +102,6 @@
     private static int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
     static long awt_defaultFg; // Pixel
     private static XMouseInfoPeer xPeer;
-    private static Method m_removeSourceEvents;
 
     static {
         initSecurityWarning();
@@ -120,9 +119,9 @@
             initIDs();
             setBackingStoreType();
         }
-        m_removeSourceEvents = SunToolkit.getMethod(EventQueue.class, "removeSourceEvents", new Class[] {Object.class, Boolean.TYPE}) ;
 
-        noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
+        noisyAwtHandler = AccessController.doPrivileged(
+                new GetBooleanAction("sun.awt.noisyerrorhandler"));
     }
 
     //---- ERROR HANDLER CODE ----//
@@ -203,7 +202,8 @@
 
     static void initSecurityWarning() {
         // Enable warning only for internal builds
-        String runtime = getSystemProperty("java.runtime.version");
+        String runtime = AccessController.doPrivileged(
+                new GetPropertyAction("java.runtime.version"));
         securityWarningEnabled = (runtime != null && runtime.contains("internal"));
     }
 
@@ -1126,14 +1126,6 @@
         }
     }
 
-    static String getSystemProperty(final String name) {
-        return (String)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    return System.getProperty(name);
-                }
-            });
-    }
-
     public PrintJob getPrintJob(final Frame frame, final String doctitle,
                                 final Properties props) {
 
@@ -1894,16 +1886,7 @@
     }
 
     static void removeSourceEvents(EventQueue queue, Object source, boolean removeAllEvents) {
-        try {
-            m_removeSourceEvents.invoke(queue, source, removeAllEvents);
-        }
-        catch (IllegalAccessException e)
-        {
-            e.printStackTrace();
-        }
-        catch (InvocationTargetException e) {
-            e.printStackTrace();
-        }
+        AWTAccessor.getEventQueueAccessor().removeSourceEvents(queue, source, removeAllEvents);
     }
 
     public boolean isAlwaysOnTopSupported() {
@@ -1937,8 +1920,8 @@
     }
 
     private static void setBackingStoreType() {
-        String prop = (String)AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("sun.awt.backingStore"));
+        String prop = AccessController.doPrivileged(
+                new GetPropertyAction("sun.awt.backingStore"));
 
         if (prop == null) {
             backingStoreType = XConstants.NotUseful;
--- jdk/src/solaris/classes/sun/awt/X11/XWindow.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XWindow.java	2012-09-05 19:35:40.000000000 -0400
@@ -33,7 +33,6 @@
 import java.lang.ref.WeakReference;
 
 import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -108,7 +107,6 @@
     native void getWindowBounds(long window, long x, long y, long width, long height);
     private native static void initIDs();
 
-    private static Field isPostedField;
     static {
         initIDs();
     }
@@ -361,20 +359,10 @@
         return false;
     }
 
-    static Method m_sendMessage;
     static void sendEvent(final AWTEvent e) {
-        if (isPostedField == null) {
-            isPostedField = SunToolkit.getField(AWTEvent.class, "isPosted");
-        }
         PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
                 public void run() {
-                    try {
-                        isPostedField.setBoolean(e, true);
-                    } catch (IllegalArgumentException e) {
-                        assert(false);
-                    } catch (IllegalAccessException e) {
-                        assert(false);
-                    }
+                    AWTAccessor.getAWTEventAccessor().setPosted(e);
                     ((Component)e.getSource()).dispatchEvent(e);
                 }
             }, PeerEvent.ULTIMATE_PRIORITY_EVENT);
@@ -1250,16 +1238,8 @@
     }
 
 
-    static Field bdata;
     static void setBData(KeyEvent e, byte[] data) {
-        try {
-            if (bdata == null) {
-                bdata = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
-            }
-            bdata.set(e, data);
-        } catch (IllegalAccessException ex) {
-            assert false;
-        }
+        AWTAccessor.getAWTEventAccessor().setBData(e, data);
     }
 
     public void postKeyEvent(int id, long when, int keyCode, char keyChar,
--- jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	2012-05-01 17:18:34.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	2012-09-05 19:35:40.000000000 -0400
@@ -26,7 +26,7 @@
 package sun.awt.X11;
 
 import java.security.AccessController;
-import java.security.PrivilegedAction;
+import sun.security.action.GetPropertyAction;
 import sun.misc.*;
 
 public class XlibWrapper implements XConstants, XUtilConstants, XProtocolConstants,
@@ -562,12 +562,7 @@
     static final boolean isBuildInternal;
 
     static {
-        String dataModelProp = (String)AccessController.doPrivileged(
-            new PrivilegedAction() {
-                    public Object run() {
-                        return System.getProperty("sun.arch.data.model");
-                    }
-                });
+        String dataModelProp = AccessController.doPrivileged(new GetPropertyAction("sun.arch.data.model"));
         try {
             dataModel = Integer.parseInt(dataModelProp);
         } catch (Exception e) {
@@ -610,7 +605,7 @@
     }
 
     private static boolean getBuildInternal() {
-        String javaVersion = XToolkit.getSystemProperty("java.version");
+        String javaVersion = AccessController.doPrivileged(new GetPropertyAction("java.version"));
         return javaVersion != null && javaVersion.contains("internal");
     }
 
--- jdk/src/solaris/classes/sun/awt/motif/MComponentPeer.java	2012-05-01 17:18:35.000000000 -0400
+++ jdk/src/solaris/classes/sun/awt/motif/MComponentPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -400,16 +400,7 @@
     static Method requestFocusWithCause;
 
     static void callRequestFocusInWindow(Component target, CausedFocusEvent.Cause cause) {
-        if (requestFocusWithCause == null) {
-            requestFocusWithCause = SunToolkit.getMethod(Component.class, "requestFocusInWindow", new Class[] {CausedFocusEvent.Cause.class});
-        }
-        if (requestFocusWithCause != null) {
-            try {
-                requestFocusWithCause.invoke(target, new Object[] {cause});
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
+        AWTAccessor.getComponentAccessor().requestFocusInWindow(target, cause);
     }
 
     public void handleEvent(AWTEvent e) {
--- jdk/src/solaris/classes/sun/print/UnixPrintJob.java	2012-05-01 17:18:35.000000000 -0400
+++ jdk/src/solaris/classes/sun/print/UnixPrintJob.java	2012-09-05 19:34:26.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, 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
@@ -937,7 +937,7 @@
                      * is not removed for some reason, request that it is
                      * removed when the VM exits.
                      */
-                    spoolFile = File.createTempFile("javaprint", ".ps", null);
+                    spoolFile = sun.misc.IOUtils.createTempFile("javaprint", ".ps", null);
                     spoolFile.deleteOnExit();
                 }
                 result = new FileOutputStream(spoolFile);
--- jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	2012-05-01 17:18:35.000000000 -0400
+++ jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	2012-09-05 19:34:26.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, 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
@@ -712,7 +712,7 @@
 
                         Process proc;
                         BufferedReader bufferedReader = null;
-                        File f = File.createTempFile("prn","xc");
+                        File f = sun.misc.IOUtils.createTempFile("prn","xc");
                         cmd[2] = cmd[2]+">"+f.getAbsolutePath();
 
                         proc = Runtime.getRuntime().exec(cmd);
--- jdk/src/solaris/native/java/io/UnixFileSystem_md.c	2012-05-01 17:18:35.000000000 -0400
+++ jdk/src/solaris/native/java/io/UnixFileSystem_md.c	2012-09-05 19:34:26.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, 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
@@ -310,7 +310,8 @@
 
 JNIEXPORT jboolean JNICALL
 Java_java_io_UnixFileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                  jstring pathname)
+                                                  jstring pathname,
+                                                  jboolean restrictive)
 {
     jboolean rv = JNI_FALSE;
 
@@ -319,7 +320,8 @@
         if (!strcmp (path, "/")) {
             fd = JVM_EEXIST;    /* The root directory always exists */
         } else {
-            fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, 0666);
+            jint mode = (restrictive == JNI_TRUE) ? 0600 : 0666;
+            fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, mode);
         }
         if (fd < 0) {
             if (fd != JVM_EEXIST) {
--- jdk/src/windows/classes/java/io/Win32FileSystem.java	2012-05-01 17:18:37.000000000 -0400
+++ jdk/src/windows/classes/java/io/Win32FileSystem.java	2012-09-05 19:34:26.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -510,7 +510,7 @@
 
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
         throws IOException;
     public boolean delete(File f) {
         // Keep canonicalization caches in sync after file deletion
--- jdk/src/windows/classes/java/io/WinNTFileSystem.java	2012-05-01 17:18:37.000000000 -0400
+++ jdk/src/windows/classes/java/io/WinNTFileSystem.java	2012-09-05 19:34:26.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, 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
@@ -61,7 +61,7 @@
 
     /* -- File operations -- */
 
-    public native boolean createFileExclusively(String path)
+    public native boolean createFileExclusively(String path, boolean restrictive)
                                                throws IOException;
     protected native boolean delete0(File f);
     public native String[] list(File f);
--- jdk/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java	2012-05-01 17:18:37.000000000 -0400
+++ jdk/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java	2012-09-05 19:35:40.000000000 -0400
@@ -26,36 +26,23 @@
 
 import java.awt.*;
 import java.awt.peer.*;
-import java.lang.reflect.Field;
 
-import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
     // We can't use target.getParent() for TrayIcon popup
     // because this method should return null for the TrayIcon
     // popup regardless of that whether it has parent or not.
-    private static Field f_parent;
-    private static Field f_isTrayIconPopup;
-
-    static {
-        f_parent = SunToolkit.getField(MenuComponent.class, "parent");
-        f_isTrayIconPopup = SunToolkit.getField(PopupMenu.class, "isTrayIconPopup");
-    }
 
     public WPopupMenuPeer(PopupMenu target) {
         this.target = target;
         MenuContainer parent = null;
         boolean isTrayIconPopup = false;
-        try {
-            isTrayIconPopup = ((Boolean)f_isTrayIconPopup.get(target)).booleanValue();
-            if (isTrayIconPopup) {
-                parent = (MenuContainer)f_parent.get(target);
-            } else {
-                parent = target.getParent();
-            }
-        } catch (IllegalAccessException iae) {
-            iae.printStackTrace();
-            return;
+        isTrayIconPopup = AWTAccessor.getPopupMenuAccessor().isTrayIconPopup(target);
+        if (isTrayIconPopup) {
+            parent = AWTAccessor.getMenuComponentAccessor().getParent(target);
+        } else {
+            parent = target.getParent();
         }
 
         if (parent instanceof Component) {
--- jdk/src/windows/native/java/io/Win32FileSystem_md.c	2012-05-01 17:18:37.000000000 -0400
+++ jdk/src/windows/native/java/io/Win32FileSystem_md.c	2012-09-05 19:34:27.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, 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
@@ -262,7 +262,8 @@
 
 JNIEXPORT jboolean JNICALL
 Java_java_io_Win32FileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                   jstring pathname)
+                                                   jstring pathname,
+                                                   jboolean restrictive)
 {
     jboolean rv = JNI_FALSE;
     DWORD a;
--- jdk/src/windows/native/java/io/WinNTFileSystem_md.c	2012-05-01 17:18:37.000000000 -0400
+++ jdk/src/windows/native/java/io/WinNTFileSystem_md.c	2012-09-05 19:34:27.000000000 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, 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
@@ -349,7 +349,8 @@
 
 JNIEXPORT jboolean JNICALL
 Java_java_io_WinNTFileSystem_createFileExclusively(JNIEnv *env, jclass cls,
-                                                   jstring path)
+                                                   jstring path,
+                                                   jboolean restrictive)
 {
     HANDLE h = NULL;
     WCHAR *pathbuf = pathToNTPath(env, path, JNI_FALSE);