Changeset 390 for trunk/openjdk/jdk/src
- Timestamp:
- Jul 2, 2012, 3:05:26 PM (13 years ago)
- Location:
- trunk/openjdk/jdk/src
- Files:
-
- 54 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/openjdk/jdk/src/share/bin/java.c
r341 r390 1 1 /* 2 * Copyright (c) 1995, 20 08, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/share/bin/java.h
r278 r390 1 1 /* 2 * Copyright (c) 1998, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java
r278 r390 772 772 throw new ArrayIndexOutOfBoundsException(off); 773 773 } 774 if ( off + len >b.length) {774 if ((long)off + (long)len > (long)b.length) { 775 775 throw new ArrayIndexOutOfBoundsException(b.length); 776 776 } … … 1001 1001 throw new ArrayIndexOutOfBoundsException(off); 1002 1002 } 1003 if ( off + len >b.length) {1003 if ((long)off + (long)len > (long)b.length) { 1004 1004 throw new ArrayIndexOutOfBoundsException(b.length); 1005 1005 } -
trunk/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
r278 r390 131 131 throw new IllegalArgumentException( 132 132 "Number of bytes does not represent an integral number of sample frames."); 133 if (off < 0) { 134 throw new ArrayIndexOutOfBoundsException(off); 135 } 136 if ((long)off + (long)len > (long)b.length) { 137 throw new ArrayIndexOutOfBoundsException(b.length); 138 } 133 139 134 140 byte[] buff = cycling_buffer; -
trunk/openjdk/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java
r2 r390 49 49 * @author Anli Shundi 50 50 * @author Christian Geuer-Pollmann 51 * @see <A HREF=" ftp://ftp.isi.edu/in-notes/rfc2045.txt">RFC 2045</A>51 * @see <A HREF="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</A> 52 52 * @see com.sun.org.apache.xml.internal.security.transforms.implementations.TransformBase64Decode 53 53 */ -
trunk/openjdk/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java
r278 r390 1 1 /* 2 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 32 32 /** 33 33 * A principal identified by a distinguished name as specified by 34 * <a href="http:// ietf.org//rfc/rfc2253.txt">RFC 2253</a>.34 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. 35 35 * 36 36 * <p> … … 123 123 /** 124 124 * Creates a string representation of this principal's name in the format 125 * defined by <a href="http:// ietf.org/rfc/rfc2253.txt">RFC 2253</a>.125 * defined by <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. 126 126 * If the name has zero components an empty string is returned. 127 127 * -
trunk/openjdk/jdk/src/share/classes/com/sun/security/sasl/CramMD5Client.java
r278 r390 1 1 /* 2 * Copyright (c) 1999, 20 03, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 34 34 /** 35 35 * Implements the CRAM-MD5 SASL client-side mechanism. 36 * (<A HREF=" ftp://ftp.isi.edu/in-notes/rfc2195.txt">RFC 2195</A>).36 * (<A HREF="http://www.ietf.org/rfc/rfc2195.txt">RFC 2195</A>). 37 37 * CRAM-MD5 has no initial response. It receives bytes from 38 38 * the server as a challenge, which it hashes by using MD5 and the password. -
trunk/openjdk/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java
r278 r390 1 1 /* 2 * Copyright (c) 2003, 20 04, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 39 39 /** 40 40 * Implements the CRAM-MD5 SASL server-side mechanism. 41 * (<A HREF=" ftp://ftp.isi.edu/in-notes/rfc2195.txt">RFC 2195</A>).41 * (<A HREF="http://www.ietf.org/rfc/rfc2195.txt">RFC 2195</A>). 42 42 * CRAM-MD5 has no initial response. 43 43 * -
trunk/openjdk/jdk/src/share/classes/com/sun/security/sasl/ExternalClient.java
r278 r390 1 1 /* 2 * Copyright (c) 1999, 20 03, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 30 30 /** 31 31 * Implements the EXTERNAL SASL client mechanism. 32 * (<A HREF=" ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>).32 * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>). 33 33 * The EXTERNAL mechanism returns the optional authorization ID as 34 34 * the initial response. It processes no challenges. -
trunk/openjdk/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 40 40 /** 41 41 * Implements the GSSAPI SASL client mechanism for Kerberos V5. 42 * (<A HREF=" ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>,42 * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>, 43 43 * <a HREF="http://www.ietf.org/internet-drafts/draft-ietf-cat-sasl-gssapi-04.txt">draft-ietf-cat-sasl-gssapi-04.txt</a>). 44 44 * It uses the Java Bindings for GSSAPI 45 * (<A HREF=" ftp://ftp.isi.edu/in-notes/rfc2853.txt">RFC 2853</A>)45 * (<A HREF="http://www.ietf.org/rfc/rfc2853.txt">RFC 2853</A>) 46 46 * for getting GSSAPI/Kerberos V5 support. 47 47 * -
trunk/openjdk/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 20 04, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 40 40 /** 41 41 * Implements the GSSAPI SASL server mechanism for Kerberos V5. 42 * (<A HREF=" ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>,42 * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>, 43 43 * <a HREF="http://www.ietf.org/internet-drafts/draft-ietf-cat-sasl-gssapi-00.txt">draft-ietf-cat-sasl-gssapi-00.txt</a>). 44 44 * -
trunk/openjdk/jdk/src/share/classes/java/awt/AWTKeyStroke.java
r309 r390 1 1 /* 2 * Copyright (c) 2000, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 477 477 protected Component getGlobalFocusOwner() throws SecurityException { 478 478 synchronized (KeyboardFocusManager.class) { 479 if (this == getCurrentKeyboardFocusManager()) { 480 return focusOwner; 481 } else { 482 if (focusLog.isLoggable(Level.FINER)) { 483 focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); 484 } 485 throw new SecurityException(notPrivileged); 486 } 479 checkCurrentKFMSecurity(); 480 return focusOwner; 487 481 } 488 482 } … … 518 512 if (focusOwner == null || focusOwner.isFocusable()) { 519 513 synchronized (KeyboardFocusManager.class) { 514 checkCurrentKFMSecurity(); 520 515 oldFocusOwner = getFocusOwner(); 521 516 … … 567 562 */ 568 563 public void clearGlobalFocusOwner() { 564 synchronized (KeyboardFocusManager.class) { 565 checkCurrentKFMSecurity(); 566 } 567 569 568 if (!GraphicsEnvironment.isHeadless()) { 570 569 // Toolkit must be fully initialized, otherwise … … 646 645 { 647 646 synchronized (KeyboardFocusManager.class) { 648 if (this == getCurrentKeyboardFocusManager()) { 649 return permanentFocusOwner; 650 } else { 651 if (focusLog.isLoggable(Level.FINER)) { 652 focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); 653 } 654 throw new SecurityException(notPrivileged); 655 } 647 checkCurrentKFMSecurity(); 648 return permanentFocusOwner; 656 649 } 657 650 } … … 689 682 if (permanentFocusOwner == null || permanentFocusOwner.isFocusable()) { 690 683 synchronized (KeyboardFocusManager.class) { 684 checkCurrentKFMSecurity(); 691 685 oldPermanentFocusOwner = getPermanentFocusOwner(); 692 686 … … 754 748 protected Window getGlobalFocusedWindow() throws SecurityException { 755 749 synchronized (KeyboardFocusManager.class) { 756 if (this == getCurrentKeyboardFocusManager()) { 757 return focusedWindow; 758 } else { 759 if (focusLog.isLoggable(Level.FINER)) { 760 focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); 761 } 762 throw new SecurityException(notPrivileged); 763 } 750 checkCurrentKFMSecurity(); 751 return focusedWindow; 764 752 } 765 753 } … … 792 780 if (focusedWindow == null || focusedWindow.isFocusableWindow()) { 793 781 synchronized (KeyboardFocusManager.class) { 782 checkCurrentKFMSecurity(); 794 783 oldFocusedWindow = getFocusedWindow(); 795 784 … … 858 847 protected Window getGlobalActiveWindow() throws SecurityException { 859 848 synchronized (KeyboardFocusManager.class) { 860 if (this == getCurrentKeyboardFocusManager()) { 861 return activeWindow; 862 } else { 863 if (focusLog.isLoggable(Level.FINER)) { 864 focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); 865 } 866 throw new SecurityException(notPrivileged); 867 } 849 checkCurrentKFMSecurity(); 850 return activeWindow; 868 851 } 869 852 } … … 894 877 Window oldActiveWindow; 895 878 synchronized (KeyboardFocusManager.class) { 879 checkCurrentKFMSecurity(); 896 880 oldActiveWindow = getActiveWindow(); 897 881 if (focusLog.isLoggable(Level.FINER)) { … … 1188 1172 { 1189 1173 synchronized (KeyboardFocusManager.class) { 1190 if (this == getCurrentKeyboardFocusManager()) { 1191 return currentFocusCycleRoot; 1192 } else { 1193 if (focusLog.isLoggable(Level.FINER)) { 1194 focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); 1195 } 1196 throw new SecurityException(notPrivileged); 1197 } 1174 checkCurrentKFMSecurity(); 1175 return currentFocusCycleRoot; 1198 1176 } 1199 1177 } … … 1219 1197 1220 1198 synchronized (KeyboardFocusManager.class) { 1199 checkCurrentKFMSecurity(); 1221 1200 oldFocusCycleRoot = getCurrentFocusCycleRoot(); 1222 1201 currentFocusCycleRoot = newFocusCycleRoot; … … 3103 3082 } 3104 3083 } 3084 3085 private void checkCurrentKFMSecurity() { 3086 if (this != getCurrentKeyboardFocusManager()) { 3087 if (focusLog.isLoggable(Level.FINER)) { 3088 focusLog.finer("This manager is " + this + 3089 ", current is " + getCurrentKeyboardFocusManager()); 3090 } 3091 throw new SecurityException(notPrivileged); 3092 } 3093 } 3105 3094 } -
trunk/openjdk/jdk/src/share/classes/java/io/ObjectStreamClass.java
r278 r390 1 1 /* 2 * Copyright (c) 1996, 201 0, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 731 731 new InvalidClassException(deserializeEx.classname, 732 732 deserializeEx.getMessage()); 733 ice.initCause(deserializeEx);734 733 throw ice; 735 734 } … … 746 745 new InvalidClassException(serializeEx.classname, 747 746 serializeEx.getMessage()); 748 ice.initCause(serializeEx);749 747 throw ice; 750 748 } … … 763 761 new InvalidClassException(defaultSerializeEx.classname, 764 762 defaultSerializeEx.getMessage()); 765 ice.initCause(defaultSerializeEx);766 763 throw ice; 767 764 } -
trunk/openjdk/jdk/src/share/classes/java/net/NetworkInterface.java
r309 r390 1 1 /* 2 * Copyright (c) 2000, 201 0, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/share/classes/java/net/URI.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 458 458 * @since 1.4 459 459 * 460 * @see <a href="http:// ietf.org/rfc/rfc2279.txt"><i>RFC 2279: UTF-8, a460 * @see <a href="http://www.ietf.org/rfc/rfc2279.txt"><i>RFC 2279: UTF-8, a 461 461 * transformation format of ISO 10646</i></a>, <br><a 462 462 * href="http://www.ietf.org/rfc/rfc2373.txt"><i>RFC 2373: IPv6 Addressing -
trunk/openjdk/jdk/src/share/classes/java/nio/charset/package.html
r278 r390 1 1 <!-- 2 Copyright (c) 2001, 20 05, Oracle and/or its affiliates. All rights reserved.2 Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 … … 49 49 <p> A <i>charset</i> is named mapping between sequences of sixteen-bit Unicode 50 50 characters and sequences of bytes, in the sense defined in <a 51 href="http:// ietf.org/rfc/rfc2278.txt"><i>RFC 2278</i></a>. A51 href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC 2278</i></a>. A 52 52 <i>decoder</i> is an engine which transforms bytes in a specific charset into 53 53 characters, and an <i>encoder</i> is an engine which transforms characters into -
trunk/openjdk/jdk/src/share/classes/java/sql/Timestamp.java
r309 r390 1 1 /* 2 * Copyright (c) 1996, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/share/classes/java/util/TimeZone.java
r278 r390 1 1 /* 2 * Copyright (c) 1996, 20 05, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 44 44 import java.security.PrivilegedAction; 45 45 import java.util.concurrent.ConcurrentHashMap; 46 import sun.misc.SharedSecrets; 47 import sun.misc.JavaAWTAccess; 46 48 import sun.security.action.GetPropertyAction; 47 49 import sun.util.TimeZoneNameUtility; … … 543 545 */ 544 546 static TimeZone getDefaultRef() { 545 TimeZone defaultZone = defaultZoneTL.get();547 TimeZone defaultZone = getDefaultInAppContext(); 546 548 if (defaultZone == null) { 547 549 defaultZone = defaultTimeZone; … … 634 636 synchronized (TimeZone.class) { 635 637 defaultTimeZone = zone; 636 defaultZoneTL.set(null);638 setDefaultInAppContext(null); 637 639 } 638 640 } else { 639 defaultZoneTL.set(zone); 641 setDefaultInAppContext(zone); 642 } 643 } 644 645 /** 646 * Returns the default TimeZone in an AppContext if any AppContext 647 * has ever used. null is returned if any AppContext hasn't been 648 * used or if the AppContext doesn't have the default TimeZone. 649 */ 650 private synchronized static TimeZone getDefaultInAppContext() { 651 javaAWTAccess = SharedSecrets.getJavaAWTAccess(); 652 if (javaAWTAccess == null) { 653 return mainAppContextDefault; 654 } else { 655 if (!javaAWTAccess.isDisposed()) { 656 TimeZone tz = (TimeZone) 657 javaAWTAccess.get(TimeZone.class); 658 if (tz == null && javaAWTAccess.isMainAppContext()) { 659 return mainAppContextDefault; 660 } else { 661 return tz; 662 } 663 } 664 } 665 return null; 666 } 667 668 /** 669 * Sets the default TimeZone in the AppContext to the given 670 * tz. null is handled special: do nothing if any AppContext 671 * hasn't been used, remove the default TimeZone in the 672 * AppContext otherwise. 673 */ 674 private synchronized static void setDefaultInAppContext(TimeZone tz) { 675 javaAWTAccess = SharedSecrets.getJavaAWTAccess(); 676 if (javaAWTAccess == null) { 677 mainAppContextDefault = tz; 678 } else { 679 if (!javaAWTAccess.isDisposed()) { 680 javaAWTAccess.put(TimeZone.class, tz); 681 if (javaAWTAccess.isMainAppContext()) { 682 mainAppContextDefault = null; 683 } 684 } 640 685 } 641 686 } … … 688 733 private String ID; 689 734 private static volatile TimeZone defaultTimeZone; 690 private static final InheritableThreadLocal<TimeZone> defaultZoneTL691 = new InheritableThreadLocal<TimeZone>();692 735 693 736 static final String GMT_ID = "GMT"; 694 737 private static final int GMT_ID_LENGTH = 3; 738 739 /* 740 * Provides access implementation-private methods without using reflection 741 * 742 * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't 743 * been loaded. If so, it implies that AWTSecurityManager is not our 744 * SecurityManager and we can use a local static variable. 745 * This works around a build time issue. 746 */ 747 private static JavaAWTAccess javaAWTAccess; 748 749 // a static TimeZone we can reference if no AppContext is in place 750 private static TimeZone mainAppContextDefault; 751 695 752 696 753 /** -
trunk/openjdk/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java
r278 r390 35 35 36 36 package java.util.concurrent.atomic; 37 import java.lang.reflect.Array; 38 import java.util.Arrays; 37 39 import sun.misc.Unsafe; 38 import java.util.*;39 40 40 41 /** … … 50 51 private static final long serialVersionUID = -6209656149925076980L; 51 52 52 private static final Unsafe unsafe = Unsafe.getUnsafe(); 53 private static final int base = unsafe.arrayBaseOffset(Object[].class); 54 private static final int scale = unsafe.arrayIndexScale(Object[].class); 55 private final Object[] array; 56 57 private long rawIndex(int i) { 53 private static final Unsafe unsafe; 54 private static final int base; 55 private static final int shift; 56 private static final long arrayFieldOffset; 57 private final Object[] array; // must have exact type Object[] 58 59 static { 60 int scale; 61 try { 62 unsafe = Unsafe.getUnsafe(); 63 arrayFieldOffset = unsafe.objectFieldOffset 64 (AtomicReferenceArray.class.getDeclaredField("array")); 65 base = unsafe.arrayBaseOffset(Object[].class); 66 scale = unsafe.arrayIndexScale(Object[].class); 67 } catch (Exception e) { 68 throw new Error(e); 69 } 70 if ((scale & (scale - 1)) != 0) 71 throw new Error("data type scale not a power of two"); 72 shift = 31 - Integer.numberOfLeadingZeros(scale); 73 } 74 75 private long checkedByteOffset(int i) { 58 76 if (i < 0 || i >= array.length) 59 77 throw new IndexOutOfBoundsException("index " + i); 60 return base + (long) i * scale; 78 79 return byteOffset(i); 80 } 81 82 private static long byteOffset(int i) { 83 return ((long) i << shift) + base; 61 84 } 62 85 … … 67 90 public AtomicReferenceArray(int length) { 68 91 array = new Object[length]; 69 // must perform at least one volatile write to conform to JMM70 if (length > 0)71 unsafe.putObjectVolatile(array, rawIndex(0), null);72 92 } 73 93 … … 80 100 */ 81 101 public AtomicReferenceArray(E[] array) { 82 if (array == null) 83 throw new NullPointerException(); 84 int length = array.length; 85 this.array = new Object[length]; 86 if (length > 0) { 87 int last = length-1; 88 for (int i = 0; i < last; ++i) 89 this.array[i] = array[i]; 90 // Do the last write as volatile 91 E e = array[last]; 92 unsafe.putObjectVolatile(this.array, rawIndex(last), e); 93 } 102 // Visibility guaranteed by final field guarantees 103 this.array = Arrays.copyOf(array, array.length, Object[].class); 94 104 } 95 105 … … 110 120 */ 111 121 public final E get(int i) { 112 return (E) unsafe.getObjectVolatile(array, rawIndex(i)); 122 return getRaw(checkedByteOffset(i)); 123 } 124 125 private E getRaw(long offset) { 126 return (E) unsafe.getObjectVolatile(array, offset); 113 127 } 114 128 … … 120 134 */ 121 135 public final void set(int i, E newValue) { 122 unsafe.putObjectVolatile(array, rawIndex(i), newValue);136 unsafe.putObjectVolatile(array, checkedByteOffset(i), newValue); 123 137 } 124 138 … … 131 145 */ 132 146 public final void lazySet(int i, E newValue) { 133 unsafe.putOrderedObject(array, rawIndex(i), newValue);147 unsafe.putOrderedObject(array, checkedByteOffset(i), newValue); 134 148 } 135 149 … … 144 158 */ 145 159 public final E getAndSet(int i, E newValue) { 160 long offset = checkedByteOffset(i); 146 161 while (true) { 147 E current = get (i);148 if (compareAndSet (i, current, newValue))162 E current = getRaw(offset); 163 if (compareAndSetRaw(offset, current, newValue)) 149 164 return current; 150 165 } … … 154 169 * Atomically sets the element at position {@code i} to the given 155 170 * updated value if the current value {@code ==} the expected value. 171 * 156 172 * @param i the index 157 173 * @param expect the expected value … … 161 177 */ 162 178 public final boolean compareAndSet(int i, E expect, E update) { 163 return unsafe.compareAndSwapObject(array, rawIndex(i), 164 expect, update); 179 return compareAndSetRaw(checkedByteOffset(i), expect, update); 180 } 181 182 private boolean compareAndSetRaw(long offset, E expect, E update) { 183 return unsafe.compareAndSwapObject(array, offset, expect, update); 165 184 } 166 185 … … 187 206 */ 188 207 public String toString() { 189 if (array.length > 0) // force volatile read 190 get(0); 191 return Arrays.toString(array); 208 int iMax = array.length - 1; 209 if (iMax == -1) 210 return "[]"; 211 212 StringBuilder b = new StringBuilder(); 213 b.append('['); 214 for (int i = 0; ; i++) { 215 b.append(getRaw(byteOffset(i))); 216 if (i == iMax) 217 return b.append(']').toString(); 218 b.append(',').append(' '); 219 } 220 } 221 222 /** 223 * Reconstitutes the instance from a stream (that is, deserializes it). 224 * @param s the stream 225 */ 226 private void readObject(java.io.ObjectInputStream s) 227 throws java.io.IOException, ClassNotFoundException { 228 // Note: This must be changed if any additional fields are defined 229 Object a = s.readFields().get("array", null); 230 if (a == null || !a.getClass().isArray()) 231 throw new java.io.InvalidObjectException("Not array type"); 232 if (a.getClass() != Object[].class) 233 a = Arrays.copyOf((Object[])a, Array.getLength(a), Object[].class); 234 unsafe.putObjectVolatile(this, arrayFieldOffset, a); 192 235 } 193 236 -
trunk/openjdk/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java
r278 r390 1 1 /* 2 * Copyright (c) 2002, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 108 108 * 109 109 * @see <a 110 * href=" ftp://ftp.rfc-editor.org/in-notes/rfc2609.txt">RFC 2609,110 * href="http://www.ietf.org/rfc/rfc2609.txt">RFC 2609, 111 111 * "Service Templates and <code>Service:</code> Schemes"</a> 112 112 * @see <a 113 * href=" ftp://ftp.rfc-editor.org/in-notes/rfc3111.txt">RFC 3111,113 * href="http://www.ietf.org/rfc/rfc3111.txt">RFC 3111, 114 114 * "Service Location Protocol Modifications for IPv6"</a> 115 115 * -
trunk/openjdk/jdk/src/share/classes/javax/naming/ldap/LdapName.java
r278 r390 1 1 /* 2 * Copyright (c) 2003, 20 04, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 43 43 /** 44 44 * This class represents a distinguished name as specified by 45 * <a href="http:// ietf.org//rfc/rfc2253.txt">RFC 2253</a>.45 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. 46 46 * A distinguished name, or DN, is composed of an ordered list of 47 47 * components called <em>relative distinguished name</em>s, or RDNs. … … 116 116 * @param name This is a non-null distinguished name formatted 117 117 * according to the rules defined in 118 * <a href="http:// ietf.org/rfc/rfc2253.txt">RFC 2253</a>.118 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. 119 119 * 120 120 * @throws InvalidNameException if a syntax violation is detected. … … 615 615 /** 616 616 * Returns a string representation of this LDAP name in a format 617 * defined by <a href="http:// ietf.org/rfc/rfc2253.txt">RFC 2253</a>617 * defined by <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> 618 618 * and described in the class description. If the name has zero 619 619 * components an empty string is returned. -
trunk/openjdk/jdk/src/share/classes/javax/naming/ldap/Rdn.java
r278 r390 1 1 /* 2 * Copyright (c) 2003, 20 05, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 46 46 * This class represents a relative distinguished name, or RDN, which is a 47 47 * component of a distinguished name as specified by 48 * <a href="http:// ietf.org/rfc/rfc2253.txt">RFC 2253</a>.48 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. 49 49 * An example of an RDN is "OU=Sales+CN=J.Smith". In this example, 50 50 * the RDN consist of multiple attribute type/value pairs. The … … 118 118 * <p> 119 119 * The string attribute values are not interpretted as 120 * <a href="http:// ietf.org/rfc/rfc2253.txt">RFC 2253</a>120 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> 121 121 * formatted RDN strings. That is, the values are used 122 122 * literally (not parsed) and assumed to be unescaped. … … 153 153 * Constructs an Rdn from the given string. 154 154 * This constructor takes a string formatted according to the rules 155 * defined in <a href="http:// ietf.org//rfc/rfc2253.txt">RFC 2253</a>155 * defined in <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> 156 156 * and described in the class description for 157 157 * {@link javax.naming.ldap.LdapName}. … … 181 181 * value. 182 182 * The string attribute values are not interpretted as 183 * <a href="http:// ietf.org/rfc/rfc2253.txt">RFC 2253</a>183 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> 184 184 * formatted RDN strings. That is, the values are used 185 185 * literally (not parsed) and assumed to be unescaped. … … 217 217 * Adds the given attribute type and value to this Rdn. 218 218 * The string attribute values are not interpretted as 219 * <a href="http:// ietf.org/rfc/rfc2253.txt">RFC 2253</a>219 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> 220 220 * formatted RDN strings. That is the values are used 221 221 * literally (not parsed) and assumed to be unescaped. … … 281 281 /** 282 282 * Returns this Rdn as a string represented in a format defined by 283 * <a href="http:// ietf.org//rfc/rfc2253.txt">RFC 2253</a> and described283 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> and described 284 284 * in the class description for {@link javax.naming.ldap.LdapName LdapName}. 285 285 * … … 504 504 * Given the value of an attribute, returns a string escaped according 505 505 * to the rules specified in 506 * <a href="http:// ietf.org/rfc/rfc2253.txt">RFC 2253</a>.506 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. 507 507 * <p> 508 508 * For example, if the val is "Sue, Grabbit and Runn", the escaped … … 583 583 * Given an attribute value string formated according to the rules 584 584 * specified in 585 * <a href="http:// ietf.org//rfc/rfc2253.txt">RFC 2253</a>,585 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>, 586 586 * returns the unformated value. Escapes and quotes are 587 587 * stripped away, and hex-encoded UTF-8 is converted to equivalent -
trunk/openjdk/jdk/src/share/classes/javax/net/ssl/SSLContext.java
r278 r390 1 1 /* 2 * Copyright (c) 1999, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 160 160 * @param protocol the standard name of the requested protocol. 161 161 * See Appendix A in the <a href= 162 * "{@docRoot}/../technotes/guides/ /security/jsse/JSSERefGuide.html#AppA">162 * "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html#AppA"> 163 163 * Java Secure Socket Extension Reference Guide </a> 164 164 * for information about standard protocol names. -
trunk/openjdk/jdk/src/share/classes/javax/print/DocFlavor.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 20 05, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 452 452 * A String representing the host operating system encoding. 453 453 * This will follow the conventions documented in 454 * <a href="http:// ietf.org/rfc/rfc2278.txt">454 * <a href="http://www.ietf.org/rfc/rfc2278.txt"> 455 455 * <i>RFC 2278: IANA Charset Registration Procedures</i></a> 456 456 * except where historical names are returned for compatibility with -
trunk/openjdk/jdk/src/share/classes/javax/swing/ImageIcon.java
r309 r390 1 1 /* 2 * Copyright (c) 1997, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/share/classes/sun/awt/AppContext.java
r278 r390 1 1 /* 2 * Copyright (c) 1998, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 768 768 return changeSupport.getPropertyChangeListeners(propertyName); 769 769 } 770 771 // Set up JavaAWTAccess in SharedSecrets 772 static { 773 sun.misc.SharedSecrets.setJavaAWTAccess(new sun.misc.JavaAWTAccess() { 774 public Object get(Object key) { 775 return getAppContext().get(key); 776 } 777 public void put(Object key, Object value) { 778 getAppContext().put(key, value); 779 } 780 public void remove(Object key) { 781 getAppContext().remove(key); 782 } 783 public boolean isDisposed() { 784 return getAppContext().isDisposed(); 785 } 786 public boolean isMainAppContext() { 787 return (numAppContexts == 1); 788 } 789 }); 790 } 770 791 } 771 792 -
trunk/openjdk/jdk/src/share/classes/sun/awt/SunToolkit.java
r309 r390 1 1 /* 2 * Copyright (c) 1997, 20 08, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java
r278 r390 1 1 /* 2 * Copyright (c) 1999, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 33 33 34 34 /** PNG - Portable Network Graphics - image file reader. 35 See <a href= ftp://ds.internic.net/rfc/rfc2083.txt>RFC2083</a> for details. */35 See <a href=http://www.ietf.org/rfc/rfc2083.txt>RFC2083</a> for details. */ 36 36 37 37 /* this is changed -
trunk/openjdk/jdk/src/share/classes/sun/font/FileFontStrike.java
r278 r390 1 1 /* 2 * Copyright (c) 2003, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 57 57 private static final int SEGLONGARRAY = 4; 58 58 59 private int glyphCacheFormat = UNINITIALISED;59 private volatile int glyphCacheFormat = UNINITIALISED; 60 60 61 61 /* segmented arrays are blocks of 256 */ … … 427 427 428 428 /* Called only from synchronized code or constructor */ 429 private void initGlyphCache() {429 private synchronized void initGlyphCache() { 430 430 431 431 int numGlyphs = mapper.getNumGlyphs(); 432 int tmpFormat = UNINITIALISED; 432 433 433 434 if (segmentedCache) { 434 435 int numSegments = (numGlyphs + SEGSIZE-1)/SEGSIZE; 435 436 if (FontManager.longAddresses) { 436 glyphCacheFormat = SEGLONGARRAY;437 tmpFormat = SEGLONGARRAY; 437 438 segLongGlyphImages = new long[numSegments][]; 438 439 this.disposer.segLongGlyphImages = segLongGlyphImages; 439 440 } else { 440 glyphCacheFormat = SEGINTARRAY;441 tmpFormat = SEGINTARRAY; 441 442 segIntGlyphImages = new int[numSegments][]; 442 443 this.disposer.segIntGlyphImages = segIntGlyphImages; … … 444 445 } else { 445 446 if (FontManager.longAddresses) { 446 glyphCacheFormat = LONGARRAY;447 tmpFormat = LONGARRAY; 447 448 longGlyphImages = new long[numGlyphs]; 448 449 this.disposer.longGlyphImages = longGlyphImages; 449 450 } else { 450 glyphCacheFormat = INTARRAY;451 tmpFormat = INTARRAY; 451 452 intGlyphImages = new int[numGlyphs]; 452 453 this.disposer.intGlyphImages = intGlyphImages; 453 454 } 454 455 } 456 glyphCacheFormat = tmpFormat; 455 457 } 456 458 -
trunk/openjdk/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java
r309 r390 1 1 /* 2 * Copyright (c) 2001, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/share/classes/sun/misc/SharedSecrets.java
r309 r390 53 53 private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess; 54 54 private static JavaSecurityAccess javaSecurityAccess; 55 private static JavaAWTAccess javaAWTAccess; 55 56 56 57 public static JavaUtilJarAccess javaUtilJarAccess() { … … 139 140 return javaSecurityAccess; 140 141 } 142 143 public static void setJavaAWTAccess(JavaAWTAccess jaa) { 144 javaAWTAccess = jaa; 145 } 146 147 public static JavaAWTAccess getJavaAWTAccess() { 148 // this may return null in which case calling code needs to 149 // provision for. 150 return javaAWTAccess; 151 } 141 152 } -
trunk/openjdk/jdk/src/share/classes/sun/net/httpserver/Request.java
r278 r390 1 1 /* 2 * Copyright (c) 2005, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 191 191 else 192 192 v = String.copyValueOf(s, keyend, len - keyend); 193 194 if (hdrs.size() >= ServerConfig.getMaxReqHeaders()) { 195 throw new IOException("Maximum number of request headers (" + 196 "sun.net.httpserver.maxReqHeaders) exceeded, " + 197 ServerConfig.getMaxReqHeaders() + "."); 198 } 199 193 200 hdrs.add (k,v); 194 201 } -
trunk/openjdk/jdk/src/share/classes/sun/net/httpserver/ServerConfig.java
r278 r390 1 1 /* 2 * Copyright (c) 2005, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 46 46 static long defaultSelCacheTimeout = 120 ; // seconds 47 47 static int defaultMaxIdleConnections = 200 ; 48 static int defaultMaxReqHeaders = 200 ; 49 48 50 49 51 static long defaultDrainAmount = 64 * 1024; … … 55 57 static long drainAmount; // max # of bytes to drain from an inputstream 56 58 static int maxIdleConnections; 59 // The maximum number of request headers allowable 60 private static int maxReqHeaders; 61 57 62 static boolean debug = false; 58 63 … … 94 99 defaultDrainAmount))).longValue(); 95 100 101 maxReqHeaders = ((Integer)java.security.AccessController.doPrivileged( 102 new sun.security.action.GetIntegerAction( 103 "sun.net.httpserver.maxReqHeaders", 104 defaultMaxReqHeaders))).intValue(); 105 96 106 debug = ((Boolean)java.security.AccessController.doPrivileged( 97 107 new sun.security.action.GetBooleanAction( … … 130 140 return drainAmount; 131 141 } 142 143 static int getMaxReqHeaders() { 144 return maxReqHeaders; 145 } 132 146 } -
trunk/openjdk/jdk/src/share/classes/sun/rmi/registry/RegistryImpl.java
r309 r390 30 30 import java.util.MissingResourceException; 31 31 import java.util.ResourceBundle; 32 import java.io.FilePermission; 32 33 import java.io.IOException; 33 34 import java.net.*; … … 42 43 import java.security.AccessController; 43 44 import java.security.CodeSource; 44 import java.security.Policy; 45 import java.security.Policy; 45 46 import java.security.PrivilegedActionException; 46 47 import java.security.PrivilegedExceptionAction; 47 48 import java.security.PermissionCollection; 48 49 import java.security.Permissions; 49 import java.security.ProtectionDomain; 50 import java.security.ProtectionDomain; 50 51 import java.text.MessageFormat; 51 52 import sun.rmi.server.LoaderHandler; … … 55 56 import sun.rmi.transport.ObjectTable; 56 57 import sun.rmi.transport.Target; 57 import sun.security.action.GetPropertyAction;58 58 59 59 /** … … 77 77 /* indicate compatibility with JDK 1.1.x version of class */ 78 78 private static final long serialVersionUID = 4666870661827494597L; 79 private Hashtable bindings = new Hashtable(101); 80 private static Hashtable allowedAccessCache = new Hashtable(3); 79 private Hashtable<String, Remote> bindings 80 = new Hashtable<String, Remote>(101); 81 private static Hashtable<InetAddress, InetAddress> allowedAccessCache 82 = new Hashtable<InetAddress, InetAddress>(3); 81 83 private static RegistryImpl registry; 82 84 private static ObjID id = new ObjID(ObjID.REGISTRY_ID); … … 130 132 { 131 133 synchronized (bindings) { 132 Remote obj = (Remote)bindings.get(name);134 Remote obj = bindings.get(name); 133 135 if (obj == null) 134 136 throw new NotBoundException(name); … … 147 149 checkAccess("Registry.bind"); 148 150 synchronized (bindings) { 149 Remote curr = (Remote)bindings.get(name);151 Remote curr = bindings.get(name); 150 152 if (curr != null) 151 153 throw new AlreadyBoundException(name); … … 164 166 checkAccess("Registry.unbind"); 165 167 synchronized (bindings) { 166 Remote obj = (Remote)bindings.get(name);168 Remote obj = bindings.get(name); 167 169 if (obj == null) 168 170 throw new NotBoundException(name); … … 214 216 215 217 try { 216 clientHost = (InetAddress) 217 java.security.AccessController.doPrivileged( 218 new java.security.PrivilegedExceptionAction() { 219 public Object run() 218 clientHost = java.security.AccessController.doPrivileged( 219 new java.security.PrivilegedExceptionAction<InetAddress>() { 220 public InetAddress run() 220 221 throws java.net.UnknownHostException 221 222 { … … 239 240 240 241 java.security.AccessController.doPrivileged( 241 new java.security.PrivilegedExceptionAction () {242 public Objectrun() throws java.io.IOException {242 new java.security.PrivilegedExceptionAction<Void>() { 243 public Void run() throws java.io.IOException { 243 244 /* 244 245 * if a ServerSocket can be bound to the client's … … 335 336 ClassLoader cl = new URLClassLoader(urls); 336 337 337 String codebaseProperty = null;338 String prop = java.security.AccessController.doPrivileged(339 new GetPropertyAction("java.rmi.server.codebase"));340 if (prop != null && prop.trim().length() > 0) {341 codebaseProperty = prop;342 }343 URL[] codebaseURLs = null;344 if (codebaseProperty != null) {345 codebaseURLs = sun.misc.URLClassPath.pathToURLs(codebaseProperty);346 } else {347 codebaseURLs = new URL[0];348 }349 350 338 /* 351 339 * Fix bugid 4242317: Classes defined by this class loader should … … 365 353 return new RegistryImpl(regPort); 366 354 } 367 }, getAccessControlContext( codebaseURLs));355 }, getAccessControlContext()); 368 356 } catch (PrivilegedActionException ex) { 369 357 throw (RemoteException) ex.getException(); … … 391 379 392 380 /** 393 * Generates an AccessControlContext from several URLs.381 * Generates an AccessControlContext with minimal permissions. 394 382 * The approach used here is taken from the similar method 395 383 * getAccessControlContext() in the sun.applet.AppletPanel class. 396 384 */ 397 private static AccessControlContext getAccessControlContext( URL[] urls) {385 private static AccessControlContext getAccessControlContext() { 398 386 // begin with permissions granted to all code in current policy 399 387 PermissionCollection perms = AccessController.doPrivileged( … … 420 408 perms.add(new RuntimePermission("accessClassInPackage.sun.*")); 421 409 422 // add permissions required to load from codebase URL path 423 LoaderHandler.addPermissionsForURLs(urls, perms, false); 410 perms.add(new FilePermission("<<ALL FILES>>", "read")); 424 411 425 412 /* … … 428 415 */ 429 416 ProtectionDomain pd = new ProtectionDomain( 430 new CodeSource((urls.length > 0 ? urls[0] : null), 431 (java.security.cert.Certificate[]) null), 432 perms); 417 new CodeSource(null, 418 (java.security.cert.Certificate[]) null), perms); 433 419 return new AccessControlContext(new ProtectionDomain[] { pd }); 434 420 } -
trunk/openjdk/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java
r309 r390 1029 1029 * it is not already implied by the collection. 1030 1030 */ 1031 p ublicstatic void addPermissionsForURLs(URL[] urls,1031 private static void addPermissionsForURLs(URL[] urls, 1032 1032 PermissionCollection perms, 1033 1033 boolean forLoader) -
trunk/openjdk/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java
r278 r390 34 34 import java.security.MessageDigest; 35 35 import java.security.NoSuchAlgorithmException; 36 import java.util.Arrays; 36 37 import sun.security.krb5.*; 37 38 import sun.security.jgss.GSSUtil; … … 226 227 } 227 228 228 byte[] remoteBindingBytes = new byte[CHECKSUM_BINDINGS_SIZE];229 System.arraycopy(checksumBytes, 4, remoteBindingBytes, 0,230 CHECKSUM_BINDINGS_SIZE);231 232 byte[] noBindings = new byte[CHECKSUM_BINDINGS_SIZE];233 boolean tokenContainsBindings =234 (!java.util.Arrays.equals(noBindings, remoteBindingBytes));235 236 229 ChannelBinding localBindings = context.getChannelBinding(); 237 230 238 if (tokenContainsBindings || 239 localBindings != null) { 240 241 boolean badBindings = false; 242 String errorMessage = null; 243 244 if (tokenContainsBindings && 245 localBindings != null) { 231 // Ignore remote channel binding info when not requested at 232 // local side (RFC 4121 4.1.1.2: the acceptor MAY ignore...). 233 // 234 // All major krb5 implementors implement this "MAY", 235 // and some applications depend on it as a workaround 236 // for not having a way to negotiate the use of channel 237 // binding -- the initiator application always uses CB 238 // and hopes the acceptor will ignore the CB if the 239 // acceptor doesn't support CB. 240 if (localBindings != null) { 241 byte[] remoteBindingBytes = new byte[CHECKSUM_BINDINGS_SIZE]; 242 System.arraycopy(checksumBytes, 4, remoteBindingBytes, 0, 243 CHECKSUM_BINDINGS_SIZE); 244 245 byte[] noBindings = new byte[CHECKSUM_BINDINGS_SIZE]; 246 if (!Arrays.equals(noBindings, remoteBindingBytes)) { 246 247 byte[] localBindingsBytes = 247 248 computeChannelBinding(localBindings); 248 // System.out.println("ChannelBinding hash: " 249 // + getHexBytes(localBindingsBytes)); 250 badBindings = 251 (!java.util.Arrays.equals(localBindingsBytes, 252 remoteBindingBytes)); 253 errorMessage = "Bytes mismatch!"; 254 } else if (localBindings == null) { 255 errorMessage = "ChannelBinding not provided!"; 256 badBindings = true; 249 if (!Arrays.equals(localBindingsBytes, 250 remoteBindingBytes)) { 251 throw new GSSException(GSSException.BAD_BINDINGS, -1, 252 "Bytes mismatch!"); 253 } 257 254 } else { 258 errorMessage = "Token missing ChannelBinding!";259 badBindings = true;255 throw new GSSException(GSSException.BAD_BINDINGS, -1, 256 "Token missing ChannelBinding!"); 260 257 } 261 262 if (badBindings)263 throw new GSSException(GSSException.BAD_BINDINGS, -1,264 errorMessage);265 258 } 266 259 -
trunk/openjdk/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 201 0, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 641 641 } 642 642 643 ForwardState currState = (ForwardState) currentState; 643 ForwardState currState = (ForwardState)currentState; 644 645 // Don't bother to verify untrusted certificate. 646 currState.untrustedChecker.check(cert, Collections.<String>emptySet()); 644 647 645 648 /* -
trunk/openjdk/jdk/src/share/classes/sun/security/provider/certpath/ForwardState.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 79 79 /* the checker used for revocation status */ 80 80 public CrlRevocationChecker crlChecker; 81 82 /* the untrusted certificates checker */ 83 UntrustedChecker untrustedChecker; 81 84 82 85 /* The list of user-defined checkers that support forward checking */ -
trunk/openjdk/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 201 0, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 293 293 pkixParam.getPolicyQualifiersRejected(), 294 294 rootNode); 295 UntrustedChecker untrustedChecker = new UntrustedChecker(); 295 296 296 297 // add standard checkers that we will be using 298 certPathCheckers.add(untrustedChecker); 297 299 certPathCheckers.add(algorithmChecker); 298 300 certPathCheckers.add(keyChecker); -
trunk/openjdk/jdk/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 20 09, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 346 346 return; 347 347 } 348 349 // Don't bother to verify untrusted certificate. 350 currentState.untrustedChecker.check(cert, 351 Collections.<String>emptySet()); 348 352 349 353 /* check that the signature algorithm is not disabled. */ -
trunk/openjdk/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 96 96 /* the checker used for revocation status */ 97 97 public CrlRevocationChecker crlChecker; 98 99 /* the untrusted certificates checker */ 100 UntrustedChecker untrustedChecker; 98 101 99 102 /* the trust anchor used to validate the path */ -
trunk/openjdk/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
r278 r390 1 1 /* 2 * Copyright (c) 2000, 201 0, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 305 305 currentState.crlChecker = 306 306 new CrlRevocationChecker(null, buildParams, null, onlyEECert); 307 currentState.untrustedChecker = new UntrustedChecker(); 307 308 try { 308 309 depthFirstSearchReverse(null, currentState, … … 351 352 currentState.crlChecker 352 353 = new CrlRevocationChecker(null, buildParams, null, onlyEECert); 354 currentState.untrustedChecker = new UntrustedChecker(); 353 355 354 356 depthFirstSearchForward(targetSubjectDN, currentState, … … 626 628 627 629 /* recursively search for matching certs at next dN */ 628 depthFirstSearchForward(cert.getIssuerX500Principal(), nextState, builder,629 adjList, certPathList);630 depthFirstSearchForward(cert.getIssuerX500Principal(), 631 nextState, builder, adjList, certPathList); 630 632 631 633 /* -
trunk/openjdk/jdk/src/share/classes/sun/security/ssl/AppOutputStream.java
r309 r390 91 91 int howmuch; 92 92 if (isFirstRecordOfThePayload && c.needToSplitPayload()) { 93 howmuch = Math.min(0x01, r.availableDataBytes()); 93 howmuch = (len == 0) ? 0 : Math.min( 94 0x01, r.availableDataBytes()); 94 95 } else { 95 96 howmuch = Math.min(len, r.availableDataBytes()); -
trunk/openjdk/jdk/src/share/classes/sun/security/ssl/EngineArgs.java
r278 r390 1 1 /* 2 * Copyright (c) 2004, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 26 26 package sun.security.ssl; 27 27 28 import javax.net.ssl.*;29 28 import java.nio.*; 30 29 … … 158 157 appData[i].limit(appData[i].position() + amount); 159 158 netData.put(appData[i]); 159 appRemaining -= amount; 160 160 spaceLeft -= amount; 161 161 } … … 210 210 * In the case of Exception, we want to reset the positions 211 211 * to appear as though no data has been consumed or produced. 212 * 213 * Currently, this method is only called as we are preparing to 214 * fail out, and thus we don't need to actually recalculate 215 * appRemaining. If that assumption changes, that variable should 216 * be updated here. 212 217 */ 213 218 void resetPos() { 214 219 netData.position(netPos); 215 220 for (int i = offset; i < offset + len; i++) { 221 // See comment above about recalculating appRemaining. 216 222 appData[i].position(appPoss[i]); 217 223 } -
trunk/openjdk/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
r309 r390 1 1 /* 2 * Copyright (c) 2003, 201 1, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 735 735 */ 736 736 fatal(Alerts.alert_internal_error, 737 "problem unwrapping net record", e);737 "problem wrapping app data", e); 738 738 return null; // make compiler happy 739 739 } finally { -
trunk/openjdk/jdk/src/share/classes/sun/security/validator/SimpleValidator.java
r278 r390 1 1 /* 2 * Copyright (c) 2002, 20 09, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 42 42 43 43 import sun.security.provider.certpath.AlgorithmChecker; 44 import sun.security.provider.certpath.UntrustedChecker; 44 45 45 46 /** … … 130 131 date = new Date(); 131 132 } 133 134 // create distrusted certificates checker 135 UntrustedChecker untrustedChecker = new UntrustedChecker(); 136 132 137 // verify top down, starting at the certificate issued by 133 138 // the trust anchor … … 135 140 X509Certificate issuerCert = chain[i + 1]; 136 141 X509Certificate cert = chain[i]; 142 143 // check untrusted certificate 144 try { 145 // Untrusted checker does not care about the unresolved 146 // critical extensions. 147 untrustedChecker.check(cert, Collections.<String>emptySet()); 148 } catch (CertPathValidatorException cpve) { 149 throw new ValidatorException( 150 "Untrusted certificate: " + cert.getSubjectX500Principal(), 151 ValidatorException.T_UNTRUSTED_CERT, cert, cpve); 152 } 137 153 138 154 // check certificate algorithm -
trunk/openjdk/jdk/src/share/classes/sun/security/validator/ValidatorException.java
r278 r390 1 1 /* 2 * Copyright (c) 2002, 20 09, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 59 59 "Certificate signature algorithm disabled"; 60 60 61 public final static Object T_UNTRUSTED_CERT = 62 "Untrusted certificate"; 63 61 64 private Object type; 62 65 private X509Certificate cert; -
trunk/openjdk/jdk/src/share/native/java/util/zip/zip_util.c
r388 r390 1 1 /* 2 * Copyright (c) 1995, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 451 451 jint count = 0; 452 452 ptrdiff_t i; 453 for (i = 0; i + CENHDR < end - beg; i += CENSIZE(beg + i))453 for (i = 0; i + CENHDR <= end - beg; i += CENSIZE(beg + i)) 454 454 count++; 455 455 return count; -
trunk/openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
r309 r390 1 1 /* 2 * Copyright (c) 2000, 201 0, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/solaris/bin/java_md.c
r309 r390 1 1 /* 2 * Copyright (c) 1998, 201 0, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/windows/bin/java_md.c
r346 r390 1 1 /* 2 * Copyright (c) 1997, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java
r309 r390 1 1 /* 2 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp
r309 r390 1 1 /* 2 * Copyright (c) 1996, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 *
Note:
See TracChangeset
for help on using the changeset viewer.