This commit is contained in:
J. Duke 2017-07-05 17:28:05 +02:00
commit 6173d9b8b8
178 changed files with 6771 additions and 4079 deletions

View File

@ -93,3 +93,4 @@ e8ebdf41b9c01a26642848f4134f5504e8fb3233 jdk7-b115
94e9a1bfba8b8d1fe0bfd43b88629b1f27b02a76 jdk7-b116
7220e60b097fa027e922f1aeecdd330f3e37409f jdk7-b117
a12a9e78df8a9d534da0b4a244ed68f0de0bd58e jdk7-b118
661360bef6ccad6c119f067f5829b207de80c936 jdk7-b119

View File

@ -74,6 +74,7 @@ import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
import com.sun.corba.se.spi.protocol.RetryType;
import com.sun.corba.se.spi.transport.CorbaContactInfo;
import com.sun.corba.se.spi.transport.CorbaContactInfoList;
import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator;
@ -110,7 +111,7 @@ public final class ClientRequestInfoImpl
// The current retry request status. True if this request is being
// retried and this info object is to be reused, or false otherwise.
private boolean retryRequest;
private RetryType retryRequest;
// The number of times this info object has been (re)used. This is
// incremented every time a request is retried, and decremented every
@ -163,7 +164,8 @@ public final class ClientRequestInfoImpl
// Please keep these in the same order that they're declared above.
retryRequest = false;
// 6763340
retryRequest = RetryType.NONE;
// Do not reset entryCount because we need to know when to pop this
// from the stack.
@ -824,14 +826,15 @@ public final class ClientRequestInfoImpl
/**
* Set or reset the retry request flag.
*/
void setRetryRequest( boolean retryRequest ) {
void setRetryRequest( RetryType retryRequest ) {
this.retryRequest = retryRequest;
}
/**
* Retrieve the current retry request status.
*/
boolean getRetryRequest() {
RetryType getRetryRequest() {
// 6763340
return this.retryRequest;
}

View File

@ -70,6 +70,7 @@ import com.sun.corba.se.spi.orbutil.closure.ClosureFactory;
import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
import com.sun.corba.se.spi.protocol.ForwardException;
import com.sun.corba.se.spi.protocol.PIHandler;
import com.sun.corba.se.spi.protocol.RetryType;
import com.sun.corba.se.spi.logging.CORBALogDomains;
import com.sun.corba.se.impl.logging.InterceptorsSystemException;
@ -372,9 +373,24 @@ public class PIHandlerImpl implements PIHandler
}
}
public Exception invokeClientPIEndingPoint(
int replyStatus, Exception exception )
{
// Needed when an error forces a retry AFTER initiateClientPIRequest
// but BEFORE invokeClientPIStartingPoint.
public Exception makeCompletedClientRequest( int replyStatus,
Exception exception ) {
// 6763340
return handleClientPIEndingPoint( replyStatus, exception, false ) ;
}
public Exception invokeClientPIEndingPoint( int replyStatus,
Exception exception ) {
// 6763340
return handleClientPIEndingPoint( replyStatus, exception, true ) ;
}
public Exception handleClientPIEndingPoint(
int replyStatus, Exception exception, boolean invokeEndingPoint ) {
if( !hasClientInterceptors ) return exception;
if( !isClientPIEnabledForThisThread() ) return exception;
@ -388,24 +404,31 @@ public class PIHandlerImpl implements PIHandler
ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
info.setReplyStatus( piReplyStatus );
info.setException( exception );
interceptorInvoker.invokeClientInterceptorEndingPoint( info );
piReplyStatus = info.getReplyStatus();
if (invokeEndingPoint) {
// 6763340
interceptorInvoker.invokeClientInterceptorEndingPoint( info );
piReplyStatus = info.getReplyStatus();
}
// Check reply status:
if( (piReplyStatus == LOCATION_FORWARD.value) ||
(piReplyStatus == TRANSPORT_RETRY.value) )
{
(piReplyStatus == TRANSPORT_RETRY.value) ) {
// If this is a forward or a retry, reset and reuse
// info object:
info.reset();
info.setRetryRequest( true );
// fix for 6763340:
if (invokeEndingPoint) {
info.setRetryRequest( RetryType.AFTER_RESPONSE ) ;
} else {
info.setRetryRequest( RetryType.BEFORE_RESPONSE ) ;
}
// ... and return a RemarshalException so the orb internals know
exception = new RemarshalException();
}
else if( (piReplyStatus == SYSTEM_EXCEPTION.value) ||
(piReplyStatus == USER_EXCEPTION.value) )
{
} else if( (piReplyStatus == SYSTEM_EXCEPTION.value) ||
(piReplyStatus == USER_EXCEPTION.value) ) {
exception = info.getException();
}
@ -421,18 +444,21 @@ public class PIHandlerImpl implements PIHandler
RequestInfoStack infoStack =
(RequestInfoStack)threadLocalClientRequestInfoStack.get();
ClientRequestInfoImpl info = null;
if( !infoStack.empty() ) info =
(ClientRequestInfoImpl)infoStack.peek();
if( !diiRequest && (info != null) && info.isDIIInitiate() ) {
if (!infoStack.empty() ) {
info = (ClientRequestInfoImpl)infoStack.peek();
}
if (!diiRequest && (info != null) && info.isDIIInitiate() ) {
// In RequestImpl.doInvocation we already called
// initiateClientPIRequest( true ), so ignore this initiate.
info.setDIIInitiate( false );
}
else {
} else {
// If there is no info object or if we are not retrying a request,
// push a new ClientRequestInfoImpl on the stack:
if( (info == null) || !info.getRetryRequest() ) {
// 6763340: don't push unless this is not a retry
if( (info == null) || !info.getRetryRequest().isRetry() ) {
info = new ClientRequestInfoImpl( orb );
infoStack.push( info );
printPush();
@ -442,9 +468,15 @@ public class PIHandlerImpl implements PIHandler
// Reset the retry request flag so that recursive calls will
// push a new info object, and bump up entry count so we know
// when to pop this info object:
info.setRetryRequest( false );
info.setRetryRequest( RetryType.NONE );
info.incrementEntryCount();
// KMC 6763340: I don't know why this wasn't set earlier,
// but we do not want a retry to pick up the previous
// reply status, so clear it here. Most likely a new
// info was pushed before, so that this was not a problem.
info.setReplyStatus( RequestInfoImpl.UNINITIALIZED ) ;
// If this is a DII request, make sure we ignore the next initiate.
if( diiRequest ) {
info.setDIIInitiate( true );
@ -457,25 +489,34 @@ public class PIHandlerImpl implements PIHandler
if( !isClientPIEnabledForThisThread() ) return;
ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
RetryType rt = info.getRetryRequest() ;
// If the replyStatus has not yet been set, this is an indication
// that the ORB threw an exception before we had a chance to
// invoke the client interceptor ending points.
//
// _REVISIT_ We cannot handle any exceptions or ForwardRequests
// flagged by the ending points here because there is no way
// to gracefully handle this in any of the calling code.
// This is a rare corner case, so we will ignore this for now.
short replyStatus = info.getReplyStatus();
if( replyStatus == info.UNINITIALIZED ) {
invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION,
wrapper.unknownRequestInvoke(
CompletionStatus.COMPLETED_MAYBE ) ) ;
// fix for 6763340
if (!rt.equals( RetryType.BEFORE_RESPONSE )) {
// If the replyStatus has not yet been set, this is an indication
// that the ORB threw an exception before we had a chance to
// invoke the client interceptor ending points.
//
// _REVISIT_ We cannot handle any exceptions or ForwardRequests
// flagged by the ending points here because there is no way
// to gracefully handle this in any of the calling code.
// This is a rare corner case, so we will ignore this for now.
short replyStatus = info.getReplyStatus();
if (replyStatus == info.UNINITIALIZED ) {
invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION,
wrapper.unknownRequestInvoke(
CompletionStatus.COMPLETED_MAYBE ) ) ;
}
}
// Decrement entry count, and if it is zero, pop it from the stack.
info.decrementEntryCount();
if( info.getEntryCount() == 0 ) {
// fix for 6763340, and probably other cases (non-recursive retry)
if (info.getEntryCount() == 0 && !info.getRetryRequest().isRetry()) {
// RequestInfoStack<ClientRequestInfoImpl> infoStack =
// threadLocalClientRequestInfoStack.get();
RequestInfoStack infoStack =
(RequestInfoStack)threadLocalClientRequestInfoStack.get();
infoStack.pop();

View File

@ -107,6 +107,11 @@ public class PINoOpHandlerImpl implements PIHandler
return null;
}
public Exception makeCompletedClientRequest(
int replyStatus, Exception exception ) {
return null;
}
public void initiateClientPIRequest( boolean diiRequest ) {
}

View File

@ -187,7 +187,8 @@ public abstract class RequestInfoImpl
startingPointCall = 0;
intermediatePointCall = 0;
endingPointCall = 0;
replyStatus = UNINITIALIZED;
// 6763340
setReplyStatus( UNINITIALIZED ) ;
currentExecutionPoint = EXECUTION_POINT_STARTING;
alreadyExecuted = false;
connection = null;

View File

@ -1012,7 +1012,11 @@ public class IIOPInputStream
* else,
* Handle it as a serializable class.
*/
if (currentClassDesc.isExternalizable()) {
if (Enum.class.isAssignableFrom( clz )) {
int ordinal = orbStream.read_long() ;
String value = (String)orbStream.read_value( String.class ) ;
return Enum.valueOf( clz, value ) ;
} else if (currentClassDesc.isExternalizable()) {
try {
currentObject = (currentClass == null) ?
null : currentClassDesc.newInstance();

View File

@ -1672,6 +1672,7 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
{
StackImpl invocationInfoStack =
(StackImpl)clientInvocationInfoStack.get();
int entryCount = -1;
ClientInvocationInfo clientInvocationInfo = null;
if (!invocationInfoStack.empty()) {
clientInvocationInfo =
@ -1680,8 +1681,12 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
throw wrapper.invocationInfoStackEmpty() ;
}
clientInvocationInfo.decrementEntryCount();
entryCount = clientInvocationInfo.getEntryCount();
if (clientInvocationInfo.getEntryCount() == 0) {
invocationInfoStack.pop();
// 6763340: don't pop if this is a retry!
if (!clientInvocationInfo.isRetryInvocation()) {
invocationInfoStack.pop();
}
finishedDispatch();
}
}

View File

@ -185,6 +185,7 @@ public class CorbaClientRequestDispatcherImpl
if(getContactInfoListIterator(orb).hasNext()) {
contactInfo = (ContactInfo)
getContactInfoListIterator(orb).next();
unregisterWaiter(orb);
return beginRequest(self, opName,
isOneWay, contactInfo);
} else {
@ -292,10 +293,22 @@ public class CorbaClientRequestDispatcherImpl
// ContactInfoList outside of subcontract.
// Want to move that update to here.
if (getContactInfoListIterator(orb).hasNext()) {
contactInfo = (ContactInfo)
getContactInfoListIterator(orb).next();
contactInfo = (ContactInfo)getContactInfoListIterator(orb).next();
if (orb.subcontractDebugFlag) {
dprint( "RemarshalException: hasNext true\ncontact info " + contactInfo );
}
// Fix for 6763340: Complete the first attempt before starting another.
orb.getPIHandler().makeCompletedClientRequest(
ReplyMessage.LOCATION_FORWARD, null ) ;
unregisterWaiter(orb);
orb.getPIHandler().cleanupClientPIRequest() ;
return beginRequest(self, opName, isOneWay, contactInfo);
} else {
if (orb.subcontractDebugFlag) {
dprint( "RemarshalException: hasNext false" );
}
ORBUtilSystemException wrapper =
ORBUtilSystemException.get(orb,
CORBALogDomains.RPC_PROTOCOL);

View File

@ -141,6 +141,27 @@ public interface PIHandler {
Exception invokeClientPIEndingPoint(
int replyStatus, Exception exception ) ;
/**
* Called when a retry is needed after initiateClientPIRequest but
* before invokeClientPIRequest. In this case, we need to properly
* balance initiateClientPIRequest/cleanupClientPIRequest calls,
* but WITHOUT extraneous calls to invokeClientPIEndingPoint
* (see bug 6763340).
*
* @param replyStatus One of the constants in iiop.messages.ReplyMessage
* indicating which reply status to set.
* @param exception The exception before ending interception points have
* been invoked, or null if no exception at the moment.
* @return The exception to be thrown, after having gone through
* all ending points, or null if there is no exception to be
* thrown. Note that this exception can be either the same or
* different from the exception set using setClientPIException.
* There are four possible return types: null (no exception),
* SystemException, UserException, or RemarshalException.
*/
Exception makeCompletedClientRequest(
int replyStatus, Exception exception ) ;
/**
* Invoked when a request is about to be created. Must be called before
* any of the setClientPI* methods so that a new info object can be

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.corba.se.spi.protocol ;
// Introduce more information about WHY we are re-trying a request
// so we can properly handle the two cases:
// - BEFORE_RESPONSE means that the retry is caused by
// something that happened BEFORE the message was sent: either
// an exception from the SocketFactory, or one from the
// Client side send_request interceptor point.
// - AFTER_RESPONSE means that the retry is a result either of the
// request sent to the server (from the response), or from the
// Client side receive_xxx interceptor point.
public enum RetryType {
NONE( false ),
BEFORE_RESPONSE( true ),
AFTER_RESPONSE( true ) ;
private final boolean isRetry ;
RetryType( boolean isRetry ) {
this.isRetry = isRetry ;
}
public boolean isRetry() {
return this.isRetry ;
}
} ;

View File

@ -93,3 +93,4 @@ dc1612e1d3ac08eb8fcad764daff21c9247d33c9 jdk7-b115
f8d4e6c6cfce1cda23fcbd144628a9791a9e1a63 jdk7-b116
9ee4d96e893436a48607924227dadd2d93b9b00d jdk7-b117
b2f6d9c4f12ffd307a5de40455b2b61b31a5cb79 jdk7-b118
9ee900f01c5872551c06f33ae909662ffd8463ac jdk7-b119

View File

@ -93,3 +93,4 @@ d35c94fd22362f478f75b4bfcd2bef6a83cb9b3f jdk7-b113
376ac153078dd3b5f6d4a0981feee092c1492c96 jdk7-b116
1320fb3bb588298c79716bd2d10b5b4afacb9370 jdk7-b117
19a2fab3f91a275f90791c15d1c21a24e820ff2d jdk7-b118
41fa02b3663795ddf529690df7aa6714210093ec jdk7-b119

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -243,6 +243,11 @@ SUBDIRS = tools java javax sun com
SUBDIRS_tools = launchers
SUBDIRS_misc = org sunw jpda mkdemo mksample
# Alternate classes implementation
ifndef OPENJDK
SUBDIRS_misc += altclasses
endif
include $(BUILDDIR)/common/Subdirs.gmk
all build::

View File

@ -0,0 +1,84 @@
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Makefile for building alternate runtime classes (not used by default)
#
BUILDDIR = ..
PRODUCT = altclasses
include $(BUILDDIR)/common/Defs.gmk
# Root of alternate class sources
ALTCLASSES_SRCDIR = $(CLOSED_SRC)/share/altclasses
# Alternate runtime classes
ALTRT_JAR_FILE = $(LIBDIR)/alt-rt.jar
ALTRT_JAR_SOURCE_FILE = $(TEMPDIR)/alt-rt.jarsrclist
ALTRT_JAR_SOURCES = $(wildcard $(ALTCLASSES_SRCDIR)/java/*/*.java)
# Use a special file suffix for the file that holds the source list
.SUFFIXES: .jarsrclist
# Build rules
all build:
@if [ -d $(ALTCLASSES_SRCDIR) ] ; then \
$(MAKE) $(ALTRT_JAR_FILE); \
fi
# Source list file creation
$(ALTRT_JAR_SOURCE_FILE): $(ALTRT_JAR_SOURCES) FRC
$(prep-target)
$(ECHO) $(ALTRT_JAR_SOURCES) > $@
clean clobber::
$(RM) $(ALTRT_JAR_FILE) $(ALTRT_JAR_SOURCE_FILE)
$(RM) -r $(ALTRT_JAR_SOURCE_FILE).classes
include $(BUILDDIR)/common/Classes.gmk
# Pattern rule to turn a source list file into a jar file
$(LIBDIR)/%.jar : $(TEMPDIR)/%.jarsrclist
$(prep-target)
$(RM) -r $(<).classes
$(MKDIR) -p $(<).classes
$(JAVAC_CMD) -implicit:none -d $(<).classes @$<
$(BOOT_JAR_CMD) cf $@ -C $(<).classes . $(BOOT_JAR_JFLAGS)
# Force target
FRC:
# Non file targets
.PHONY: all build clean clobber

View File

@ -42,3 +42,10 @@ DEMO_DESTDIR = $(DEMODIR)/nio/$(DEMONAME)
#
include $(BUILDDIR)/common/Demo.gmk
#EXTJAR = $(EXTDIR)/$(DEMONAME).jar
#
#all : build $(EXTJAR)
#
#$(EXTJAR) : $(DEMO_JAR)
# $(prep-target)
# $(CP) $(DEMO_JAR) $(EXTJAR)

View File

@ -429,6 +429,7 @@ SUNWprivate_1.1 {
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue;
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName;
Java_sun_awt_X11_GtkFileDialogPeer_initIDs;
Java_sun_awt_X11_GtkFileDialogPeer_run;
Java_sun_awt_X11_GtkFileDialogPeer_quit;

View File

@ -25,8 +25,10 @@
package com.sun.java.util.jar.pack;
import java.util.*;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Adaptive coding.

View File

@ -25,9 +25,17 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import com.sun.java.util.jar.pack.ConstantPool.*;
import com.sun.java.util.jar.pack.ConstantPool.Entry;
import com.sun.java.util.jar.pack.ConstantPool.Index;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Represents an attribute in a class-file.

View File

@ -25,12 +25,28 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import java.util.jar.*;
import com.sun.java.util.jar.pack.Package.Class;
import com.sun.java.util.jar.pack.Package.InnerClass;
import com.sun.java.util.jar.pack.ConstantPool.*;
import com.sun.java.util.jar.pack.ConstantPool.Entry;
import com.sun.java.util.jar.pack.ConstantPool.Index;
import com.sun.java.util.jar.pack.Package.Class.Field;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilterInputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.jar.Pack200;
/**
* Define the structure and ordering of "bands" in a packed file.
@ -1629,7 +1645,7 @@ class BandStructure implements Constants {
}
}
protected void setConstantValueIndex(Class.Field f) {
protected void setConstantValueIndex(com.sun.java.util.jar.pack.Package.Class.Field f) {
Index ix = null;
if (f != null) {
byte tag = f.getLiteralTag();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,12 +25,19 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import com.sun.java.util.jar.pack.ConstantPool.ClassEntry;
import com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry;
import com.sun.java.util.jar.pack.ConstantPool.Entry;
import com.sun.java.util.jar.pack.ConstantPool.SignatureEntry;
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry;
import com.sun.java.util.jar.pack.Package.Class;
import com.sun.java.util.jar.pack.Package.InnerClass;
import com.sun.java.util.jar.pack.ConstantPool.*;
import com.sun.tools.classfile.AttributeException;
import java.io.DataInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Map;
/**
* Reader for a class file that is being incorporated into a package.
@ -422,7 +429,7 @@ class ClassReader implements Constants {
readCode(m.code);
} catch (Instruction.FormatException iie) {
String message = iie.getMessage() + " in " + h;
throw new ClassReader.ClassFormatException(message);
throw new ClassReader.ClassFormatException(message, iie);
}
} else {
assert(h == cls);
@ -477,9 +484,13 @@ class ClassReader implements Constants {
// (Later, ics may be transferred to the pkg.)
}
class ClassFormatException extends IOException {
static class ClassFormatException extends IOException {
public ClassFormatException(String message) {
super(message);
}
public ClassFormatException(String message, Throwable cause) {
super(message, cause);
}
}
}

View File

@ -25,11 +25,19 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import com.sun.java.util.jar.pack.ConstantPool.Entry;
import com.sun.java.util.jar.pack.ConstantPool.Index;
import com.sun.java.util.jar.pack.ConstantPool.NumberEntry;
import com.sun.java.util.jar.pack.Package.Class;
import com.sun.java.util.jar.pack.Package.InnerClass;
import com.sun.java.util.jar.pack.ConstantPool.*;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
/**
* Writer for a class file that is incorporated into a package.

View File

@ -25,10 +25,10 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import com.sun.java.util.jar.pack.Package.Class;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collection;
/**
* Represents a chunk of bytecodes.

View File

@ -25,8 +25,10 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
/**
* Define the conversions between sequences of small integers and raw bytes.

View File

@ -25,9 +25,17 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import java.util.zip.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;
/**
* Heuristic chooser of basic encodings.

View File

@ -25,7 +25,9 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Interface for encoding and decoding int arrays using bytewise codes.

View File

@ -25,7 +25,14 @@
package com.sun.java.util.jar.pack;
import java.util.*;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
/**
* Representation of constant pool entries and indexes.

View File

@ -25,7 +25,8 @@
package com.sun.java.util.jar.pack;
import java.util.*;
import java.util.Arrays;
import java.util.List;
/**
* Shared constants

View File

@ -25,11 +25,32 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.text.MessageFormat;
import java.util.*;
import java.util.jar.*;
import java.util.zip.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
/** Command line interface for Pack200.
*/

View File

@ -25,9 +25,11 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import com.sun.java.util.jar.pack.ConstantPool.*;
import com.sun.java.util.jar.pack.ConstantPool.Entry;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
/**
* Collection of relocatable constant pool references.

View File

@ -25,8 +25,10 @@
package com.sun.java.util.jar.pack;
import java.util.*;
import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
/**
* Histogram derived from an integer array of events (int[]).

View File

@ -26,10 +26,18 @@
package com.sun.java.util.jar.pack;
import java.nio.*;
import java.io.*;
import java.util.jar.*;
import java.util.zip.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.zip.CRC32;
import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
class NativeUnpack {
// Pointer to the native unpacker obj

View File

@ -26,11 +26,32 @@
package com.sun.java.util.jar.pack;
import com.sun.java.util.jar.pack.Attribute.Layout;
import com.sun.java.util.jar.pack.ConstantPool.ClassEntry;
import com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry;
import com.sun.java.util.jar.pack.ConstantPool.Index;
import com.sun.java.util.jar.pack.ConstantPool.LiteralEntry;
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry;
import com.sun.java.util.jar.pack.ConstantPool.Entry;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.SequenceInputStream;
import java.lang.reflect.Modifier;
import java.util.*;
import java.util.jar.*;
import java.io.*;
import com.sun.java.util.jar.pack.ConstantPool.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarFile;
/**
* Define the main data structure transmitted by pack/unpack.

View File

@ -25,12 +25,18 @@
package com.sun.java.util.jar.pack;
import com.sun.java.util.jar.pack.ConstantPool.ClassEntry;
import com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry;
import com.sun.java.util.jar.pack.ConstantPool.Entry;
import com.sun.java.util.jar.pack.ConstantPool.Index;
import com.sun.java.util.jar.pack.ConstantPool.MemberEntry;
import com.sun.java.util.jar.pack.ConstantPool.SignatureEntry;
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry;
import java.io.*;
import java.util.*;
import com.sun.java.util.jar.pack.Package.Class;
import com.sun.java.util.jar.pack.Package.File;
import com.sun.java.util.jar.pack.Package.InnerClass;
import com.sun.java.util.jar.pack.ConstantPool.*;
/**
* Reader for a package file.

View File

@ -25,12 +25,30 @@
package com.sun.java.util.jar.pack;
import java.io.*;
import java.util.*;
import com.sun.java.util.jar.pack.ConstantPool.ClassEntry;
import com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry;
import com.sun.java.util.jar.pack.ConstantPool.Entry;
import com.sun.java.util.jar.pack.ConstantPool.Index;
import com.sun.java.util.jar.pack.ConstantPool.IndexGroup;
import com.sun.java.util.jar.pack.ConstantPool.MemberEntry;
import com.sun.java.util.jar.pack.ConstantPool.NumberEntry;
import com.sun.java.util.jar.pack.ConstantPool.SignatureEntry;
import com.sun.java.util.jar.pack.ConstantPool.StringEntry;
import com.sun.java.util.jar.pack.Package.Class;
import com.sun.java.util.jar.pack.Package.File;
import com.sun.java.util.jar.pack.Package.InnerClass;
import com.sun.java.util.jar.pack.ConstantPool.*;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
/**
* Writer for a package file.

View File

@ -26,10 +26,27 @@
package com.sun.java.util.jar.pack;
import com.sun.java.util.jar.pack.Attribute.Layout;
import java.util.*;
import java.util.jar.*;
import java.io.*;
import java.beans.PropertyChangeListener;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.SortedMap;
import java.util.TimeZone;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.Pack200;
/*
@ -614,10 +631,14 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
List<InFile> scanJar(JarFile jf) throws IOException {
// Collect jar entries, preserving order.
List<InFile> inFiles = new ArrayList<>();
for (JarEntry je : Collections.list(jf.entries())) {
InFile inFile = new InFile(jf, je);
assert(je.isDirectory() == inFile.name.endsWith("/"));
inFiles.add(inFile);
try {
for (JarEntry je : Collections.list(jf.entries())) {
InFile inFile = new InFile(jf, je);
assert(je.isDirectory() == inFile.name.endsWith("/"));
inFiles.add(inFile);
}
} catch (IllegalStateException ise) {
throw new IOException(ise.getLocalizedMessage(), ise);
}
return inFiles;
}

View File

@ -25,8 +25,12 @@
package com.sun.java.util.jar.pack;
import java.util.*;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashSet;
/**
* Population-based coding.

View File

@ -25,13 +25,24 @@
package com.sun.java.util.jar.pack;
import java.util.*;
import java.util.jar.*;
import java.util.jar.Pack200;
import java.util.zip.*;
import java.io.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.jar.Pack200;
/**
* Control block for publishing Pack200 options to the other classes.
*/

View File

@ -25,11 +25,25 @@
package com.sun.java.util.jar.pack;
import java.util.*;
import java.util.jar.*;
import java.util.zip.*;
import java.io.*;
import java.beans.PropertyChangeListener;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashSet;
import java.util.Iterator;
import java.util.SortedMap;
import java.util.TimeZone;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.zip.CRC32;
import java.util.zip.CheckedOutputStream;
import java.util.zip.ZipEntry;
/*
* Implementation of the Pack provider.
@ -92,7 +106,13 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
* @param out a JarOutputStream.
* @exception IOException if an error is encountered.
*/
public void unpack(InputStream in0, JarOutputStream out) throws IOException {
public void unpack(InputStream in, JarOutputStream out) throws IOException {
if (in == null) {
throw new NullPointerException("null input");
}
if (out == null) {
throw new NullPointerException("null output");
}
assert(Utils.currentInstance.get() == null);
TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))
? null
@ -102,18 +122,18 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
Utils.currentInstance.set(this);
if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
final int verbose = props.getInteger(Utils.DEBUG_VERBOSE);
BufferedInputStream in = new BufferedInputStream(in0);
if (Utils.isJarMagic(Utils.readMagic(in))) {
BufferedInputStream in0 = new BufferedInputStream(in);
if (Utils.isJarMagic(Utils.readMagic(in0))) {
if (verbose > 0)
Utils.log.info("Copying unpacked JAR file...");
Utils.copyJarFile(new JarInputStream(in), out);
Utils.copyJarFile(new JarInputStream(in0), out);
} else if (props.getBoolean(Utils.DEBUG_DISABLE_NATIVE)) {
(new DoUnpack()).run(in, out);
in.close();
(new DoUnpack()).run(in0, out);
in0.close();
Utils.markJarFile(out);
} else {
(new NativeUnpack(this)).run(in, out);
in.close();
(new NativeUnpack(this)).run(in0, out);
in0.close();
Utils.markJarFile(out);
}
} finally {
@ -132,6 +152,12 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
* @exception IOException if an error is encountered.
*/
public void unpack(File in, JarOutputStream out) throws IOException {
if (in == null) {
throw new NullPointerException("null input");
}
if (out == null) {
throw new NullPointerException("null output");
}
// Use the stream-based implementation.
// %%% Reconsider if native unpacker learns to memory-map the file.
FileInputStream instr = new FileInputStream(in);

View File

@ -25,18 +25,27 @@
package com.sun.java.util.jar.pack;
import com.sun.java.util.jar.pack.Attribute.Layout;
import com.sun.java.util.jar.pack.ConstantPool.ClassEntry;
import com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry;
import com.sun.java.util.jar.pack.ConstantPool.LiteralEntry;
import com.sun.java.util.jar.pack.ConstantPool.MemberEntry;
import com.sun.java.util.jar.pack.ConstantPool.SignatureEntry;
import com.sun.java.util.jar.pack.ConstantPool.Utf8Entry;
import java.util.*;
import java.util.jar.*;
import java.util.zip.*;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.Enumeration;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import java.util.zip.ZipEntry;
import sun.util.logging.PlatformLogger;
class Utils {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,6 +45,8 @@ import javax.management.InstanceNotFoundException;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanPermission;
import javax.management.MBeanServer;
import javax.management.MBeanServerDelegate;
import javax.management.MBeanServerNotification;
import javax.management.Notification;
import javax.management.NotificationBroadcaster;
import javax.management.NotificationFilter;
@ -272,6 +274,7 @@ public class ServerNotifForwarder {
nr = notifBuffer.fetchNotifications(bufferFilter,
startSequenceNumber,
t, maxNotifications);
snoopOnUnregister(nr);
} catch (InterruptedException ire) {
nr = new NotificationResult(0L, 0L, new TargetedNotification[0]);
}
@ -283,6 +286,34 @@ public class ServerNotifForwarder {
return nr;
}
// The standard RMI connector client will register a listener on the MBeanServerDelegate
// in order to be told when MBeans are unregistered. We snoop on fetched notifications
// so that we can know too, and remove the corresponding entry from the listenerMap.
// See 6957378.
private void snoopOnUnregister(NotificationResult nr) {
Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
if (delegateSet == null || delegateSet.isEmpty()) {
return;
}
for (TargetedNotification tn : nr.getTargetedNotifications()) {
Integer id = tn.getListenerID();
for (IdAndFilter idaf : delegateSet) {
if (idaf.id == id) {
// This is a notification from the MBeanServerDelegate.
Notification n = tn.getNotification();
if (n instanceof MBeanServerNotification &&
n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
MBeanServerNotification mbsn = (MBeanServerNotification) n;
ObjectName gone = mbsn.getMBeanName();
synchronized (listenerMap) {
listenerMap.remove(gone);
}
}
}
}
}
}
public void terminate() {
if (logger.traceOn()) {
logger.trace("terminate", "Be called.");
@ -418,10 +449,12 @@ public class ServerNotifForwarder {
return this.filter;
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public boolean equals(Object o) {
return ((o instanceof IdAndFilter) &&
((IdAndFilter) o).getId().equals(getId()));

View File

@ -27,7 +27,6 @@ package com.sun.rowset;
import java.io.*;
import java.util.*;
import java.lang.*;
/**
* This class is used to help in localization of resources,
@ -42,28 +41,28 @@ public class JdbcRowSetResourceBundle implements Serializable {
* This <code>String</code> variable stores the location
* of the resource bundle location.
*/
static String fileName;
private static String fileName;
/**
* This variable will hold the <code>PropertyResourceBundle</code>
* of the text to be internationalized.
*/
transient PropertyResourceBundle propResBundle;
private transient PropertyResourceBundle propResBundle;
/**
* The constructor initializes to this object
*
*/
static JdbcRowSetResourceBundle jpResBundle;
private static volatile JdbcRowSetResourceBundle jpResBundle;
/**
* The varible which will represent the properties
* The variable which will represent the properties
* the suffix or extension of the resource bundle.
**/
private static final String PROPERTIES = "properties";
/**
* The varibale to represent underscore
* The variable to represent underscore
**/
private static final String UNDERSCORE = "_";

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -68,7 +68,7 @@ public class NTDomainPrincipal implements Principal, java.io.Serializable {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
@ -99,7 +99,7 @@ public class NTDomainPrincipal implements Principal, java.io.Serializable {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTDomainPrincipal: name",
("NTDomainPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -70,7 +70,7 @@ public class NTNumericCredential {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTNumericCredential: name",
("NTNumericCredential.name",
"sun.security.util.AuthResources"));
Object[] source = {Long.toString(impersonationToken)};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -73,7 +73,7 @@ public class NTSid implements Principal, java.io.Serializable {
if (stringSid == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"stringSid"};
throw new NullPointerException(form.format(source));
@ -81,7 +81,7 @@ public class NTSid implements Principal, java.io.Serializable {
if (stringSid.length() == 0) {
throw new IllegalArgumentException
(sun.security.util.ResourcesMgr.getString
("Invalid NTSid value",
("Invalid.NTSid.value",
"sun.security.util.AuthResources"));
}
sid = new String(stringSid);
@ -108,7 +108,7 @@ public class NTSid implements Principal, java.io.Serializable {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSid: name",
("NTSid.name",
"sun.security.util.AuthResources"));
Object[] source = {sid};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -73,7 +73,7 @@ public class NTSidDomainPrincipal extends NTSid {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSidDomainPrincipal: name",
("NTSidDomainPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {getName()};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -68,7 +68,7 @@ public class NTSidGroupPrincipal extends NTSid {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSidGroupPrincipal: name",
("NTSidGroupPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {getName()};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -70,7 +70,7 @@ public class NTSidPrimaryGroupPrincipal extends NTSid {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSidPrimaryGroupPrincipal: name",
("NTSidPrimaryGroupPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {getName()};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,7 +67,7 @@ public class NTSidUserPrincipal extends NTSid {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSidUserPrincipal: name",
("NTSidUserPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {getName()};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -64,7 +64,7 @@ public class NTUserPrincipal implements Principal, java.io.Serializable {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
@ -93,7 +93,7 @@ public class NTUserPrincipal implements Principal, java.io.Serializable {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTUserPrincipal: name",
("NTUserPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -490,9 +490,9 @@ public class PolicyFile extends javax.security.auth.Policy {
}
} catch (PolicyParser.ParsingException pe) {
System.err.println(AUTH_POLICY +
rb.getString(": error parsing ") + policy);
rb.getString(".error.parsing.") + policy);
System.err.println(AUTH_POLICY +
rb.getString(": ") +
rb.getString("COLON") +
pe.getMessage());
if (debug != null)
pe.printStackTrace();
@ -635,16 +635,16 @@ public class PolicyFile extends javax.security.auth.Policy {
} catch (java.lang.reflect.InvocationTargetException ite) {
System.err.println
(AUTH_POLICY +
rb.getString(": error adding Permission ") +
rb.getString(".error.adding.Permission.") +
pe.permission +
rb.getString(" ") +
rb.getString("SPACE") +
ite.getTargetException());
} catch (Exception e) {
System.err.println
(AUTH_POLICY +
rb.getString(": error adding Permission ") +
rb.getString(".error.adding.Permission.") +
pe.permission +
rb.getString(" ") +
rb.getString("SPACE") +
e);
}
}
@ -652,9 +652,9 @@ public class PolicyFile extends javax.security.auth.Policy {
} catch (Exception e) {
System.err.println
(AUTH_POLICY +
rb.getString(": error adding Entry ") +
rb.getString(".error.adding.Entry.") +
ge +
rb.getString(" ") +
rb.getString("SPACE") +
e);
}
@ -1373,18 +1373,18 @@ public class PolicyFile extends javax.security.auth.Policy {
public String toString(){
StringBuffer sb = new StringBuffer();
sb.append(rb.getString("("));
sb.append(rb.getString("LPARAM"));
sb.append(getCodeSource());
sb.append("\n");
for (int j = 0; j < permissions.size(); j++) {
Permission p = permissions.elementAt(j);
sb.append(rb.getString(" "));
sb.append(rb.getString(" "));
sb.append(rb.getString("SPACE"));
sb.append(rb.getString("SPACE"));
sb.append(p);
sb.append(rb.getString("\n"));
sb.append(rb.getString("NEWLINE"));
}
sb.append(rb.getString(")"));
sb.append(rb.getString("\n"));
sb.append(rb.getString("RPARAM"));
sb.append(rb.getString("NEWLINE"));
return sb.toString();
}
@ -1415,7 +1415,7 @@ class PolicyPermissions extends PermissionCollection {
if (isReadOnly())
throw new SecurityException
(PolicyFile.rb.getString
("attempt to add a Permission to a readonly PermissionCollection"));
("attempt.to.add.a.Permission.to.a.readonly.PermissionCollection"));
if (perms == null) {
if (additionalPerms == null)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -300,7 +300,7 @@ class PolicyParser {
keyStoreType = match("quoted string");
} else {
throw new ParsingException(st.lineno(),
rb.getString("expected keystore type"));
rb.getString("expected.keystore.type"));
}
}
@ -368,8 +368,8 @@ class PolicyParser {
"WILDCARD class but no WILDCARD name");
throw new ParsingException
(st.lineno(),
rb.getString("can not specify Principal with a ") +
rb.getString("wildcard class without a wildcard name"));
rb.getString("can.not.specify.Principal.with.a.") +
rb.getString("wildcard.class.without.a.wildcard.name"));
}
try {
@ -389,7 +389,7 @@ class PolicyParser {
} else {
throw new
ParsingException(st.lineno(),
rb.getString("expected codeBase or SignedBy"));
rb.getString("expected.codeBase.or.SignedBy"));
}
}
@ -397,7 +397,7 @@ class PolicyParser {
if (principals == null) {
throw new ParsingException
(st.lineno(),
rb.getString("only Principal-based grant entries permitted"));
rb.getString("only.Principal.based.grant.entries.permitted"));
}
e.principals = principals;
@ -416,7 +416,7 @@ class PolicyParser {
} else {
throw new
ParsingException(st.lineno(),
rb.getString("expected permission entry"));
rb.getString("expected.permission.entry"));
}
}
match("}");
@ -522,12 +522,12 @@ class PolicyParser {
switch (lookahead) {
case StreamTokenizer.TT_NUMBER:
throw new ParsingException(st.lineno(), expect,
rb.getString("number ") +
rb.getString("number.") +
String.valueOf(st.nval));
case StreamTokenizer.TT_EOF:
throw new ParsingException
(rb.getString("expected ") + expect +
rb.getString(", read end of file"));
(rb.getString("expected.") + expect +
rb.getString(".read.end.of.file"));
case StreamTokenizer.TT_WORD:
if (expect.equalsIgnoreCase(st.sval)) {
lookahead = st.nextToken();
@ -603,11 +603,11 @@ class PolicyParser {
switch (lookahead) {
case StreamTokenizer.TT_NUMBER:
throw new ParsingException(st.lineno(), ";",
rb.getString("number ") +
rb.getString("number.") +
String.valueOf(st.nval));
case StreamTokenizer.TT_EOF:
throw new ParsingException
(rb.getString("expected ';', read end of file"));
(rb.getString("expected.read.end.of.file"));
default:
lookahead = st.nextToken();
}
@ -942,13 +942,13 @@ class PolicyParser {
}
public ParsingException(int line, String msg) {
super(rb.getString("line ") + line + rb.getString(": ") + msg);
super(rb.getString("line.") + line + rb.getString("COLON") + msg);
}
public ParsingException(int line, String expect, String actual) {
super(rb.getString("line ") + line + rb.getString(": expected '") +
expect + rb.getString("', found '") + actual +
rb.getString("'"));
super(rb.getString("line.") + line + rb.getString(".expected.") +
expect + rb.getString(".found.") + actual +
rb.getString("QUOTE"));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -89,7 +89,7 @@ public class SolarisNumericGroupPrincipal implements
*/
public SolarisNumericGroupPrincipal(String name, boolean primaryGroup) {
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
throw new NullPointerException(rb.getString("provided.null.name"));
this.name = name;
this.primaryGroup = primaryGroup;
@ -165,9 +165,9 @@ public class SolarisNumericGroupPrincipal implements
public String toString() {
return((primaryGroup ?
rb.getString
("SolarisNumericGroupPrincipal [Primary Group]: ") + name :
("SolarisNumericGroupPrincipal.Primary.Group.") + name :
rb.getString
("SolarisNumericGroupPrincipal [Supplementary Group]: ") + name));
("SolarisNumericGroupPrincipal.Supplementary.Group.") + name));
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -80,7 +80,7 @@ public class SolarisNumericUserPrincipal implements
*/
public SolarisNumericUserPrincipal(String name) {
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
throw new NullPointerException(rb.getString("provided.null.name"));
this.name = name;
}
@ -134,7 +134,7 @@ public class SolarisNumericUserPrincipal implements
* <code>SolarisNumericUserPrincipal</code>.
*/
public String toString() {
return(rb.getString("SolarisNumericUserPrincipal: ") + name);
return(rb.getString("SolarisNumericUserPrincipal.") + name);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -76,7 +76,7 @@ public class SolarisPrincipal implements Principal, java.io.Serializable {
*/
public SolarisPrincipal(String name) {
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
throw new NullPointerException(rb.getString("provided.null.name"));
this.name = name;
}
@ -100,7 +100,7 @@ public class SolarisPrincipal implements Principal, java.io.Serializable {
* @return a string representation of this <code>SolarisPrincipal</code>.
*/
public String toString() {
return(rb.getString("SolarisPrincipal: ") + name);
return(rb.getString("SolarisPrincipal.") + name);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -395,7 +395,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
principals.listIterator();
while (li.hasNext()) {
PolicyParser.PrincipalEntry pppe = li.next();
returnMe = returnMe + rb.getString("\n") +
returnMe = returnMe + rb.getString("NEWLINE") +
pppe.principalClass + " " +
pppe.principalName;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -77,7 +77,7 @@ public class UnixNumericGroupPrincipal implements
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
@ -159,14 +159,14 @@ public class UnixNumericGroupPrincipal implements
if (primaryGroup) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("UnixNumericGroupPrincipal [Primary Group]: name",
("UnixNumericGroupPrincipal.Primary.Group.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);
} else {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("UnixNumericGroupPrincipal [Supplementary Group]: name",
("UnixNumericGroupPrincipal.Supplementary.Group.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,7 +67,7 @@ public class UnixNumericUserPrincipal implements
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
@ -127,7 +127,7 @@ public class UnixNumericUserPrincipal implements
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("UnixNumericUserPrincipal: name",
("UnixNumericUserPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -64,7 +64,7 @@ public class UnixPrincipal implements Principal, java.io.Serializable {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
@ -94,7 +94,7 @@ public class UnixPrincipal implements Principal, java.io.Serializable {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("UnixPrincipal: name",
("UnixPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -87,7 +87,7 @@ public class X500Principal implements Principal, java.io.Serializable {
*/
public X500Principal(String name) {
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
throw new NullPointerException(rb.getString("provided.null.name"));
try {
thisX500Name = new X500Name(name);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -190,7 +190,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
} catch (PropertyExpander.ExpandException peee) {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("Unable to properly expand config",
("Unable.to.properly.expand.config",
"sun.security.util.AuthResources"));
Object[] source = {extra_config};
throw new IOException(form.format(source));
@ -206,7 +206,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
} else {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("extra_config (No such file or directory)",
("extra.config.No.such.file.or.directory.",
"sun.security.util.AuthResources"));
Object[] source = {extra_config};
throw new IOException(form.format(source));
@ -243,7 +243,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
} catch (PropertyExpander.ExpandException peee) {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("Unable to properly expand config",
("Unable.to.properly.expand.config",
"sun.security.util.AuthResources"));
Object[] source = {config_url};
throw new IOException(form.format(source));
@ -286,7 +286,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
debugConfig.println(fnfe.toString());
}
throw new IOException(ResourcesMgr.getString
("Configuration Error:\n\tNo such file or directory",
("Configuration.Error.No.such.file.or.directory",
"sun.security.util.AuthResources"));
} finally {
if (isr != null) {
@ -426,7 +426,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tInvalid control flag, flag",
("Configuration.Error.Invalid.control.flag.flag",
"sun.security.util.AuthResources"));
Object[] source = {sflag};
throw new IOException(form.format(source));
@ -474,8 +474,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
// add this configuration entry
if (newConfig.containsKey(appName)) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\t" +
"Can not specify multiple entries for appName",
("Configuration.Error.Can.not.specify.multiple.entries.for.appName",
"sun.security.util.AuthResources"));
Object[] source = {appName};
throw new IOException(form.format(source));
@ -491,8 +490,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
case StreamTokenizer.TT_EOF:
MessageFormat form1 = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\texpected [expect], " +
"read [end of file]",
("Configuration.Error.expected.expect.read.end.of.file.",
"sun.security.util.AuthResources"));
Object[] source1 = {expect};
throw new IOException(form1.format(source1));
@ -508,8 +506,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: " +
"expected [expect], found [value]",
("Configuration.Error.Line.line.expected.expect.found.value.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
@ -522,7 +519,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: expected [expect]",
("Configuration.Error.Line.line.expected.expect.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
@ -535,7 +532,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: expected [expect]",
("Configuration.Error.Line.line.expected.expect.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
@ -548,7 +545,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: expected [expect]",
("Configuration.Error.Line.line.expected.expect.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
@ -561,7 +558,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: expected [expect]",
("Configuration.Error.Line.line.expected.expect.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
@ -570,8 +567,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
default:
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: " +
"expected [expect], found [value]",
("Configuration.Error.Line.line.expected.expect.found.value.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
@ -667,8 +663,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
if (s == null || s.length() == 0) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: " +
"system property [value] expanded to empty value",
("Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), value};
throw new IOException(form.format(source));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -686,9 +686,9 @@ public class JndiLoginModule implements LoginModule {
Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback(protocol + " "
+ rb.getString("username: "));
+ rb.getString("username."));
callbacks[1] = new PasswordCallback(protocol + " " +
rb.getString("password: "),
rb.getString("password."),
false);
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -150,7 +150,7 @@ public class KeyStoreLoginModule implements LoginModule {
private static final TextOutputCallback bannerCallback =
new TextOutputCallback
(TextOutputCallback.INFORMATION,
rb.getString("Please enter keystore information"));
rb.getString("Please.enter.keystore.information"));
private final ConfirmationCallback confirmationCallback =
new ConfirmationCallback
(ConfirmationCallback.INFORMATION,
@ -364,10 +364,10 @@ public class KeyStoreLoginModule implements LoginModule {
NameCallback aliasCallback;
if (keyStoreAlias == null || keyStoreAlias.length() == 0) {
aliasCallback = new NameCallback(
rb.getString("Keystore alias: "));
rb.getString("Keystore.alias."));
} else {
aliasCallback =
new NameCallback(rb.getString("Keystore alias: "),
new NameCallback(rb.getString("Keystore.alias."),
keyStoreAlias);
}
@ -379,11 +379,11 @@ public class KeyStoreLoginModule implements LoginModule {
break;
case NORMAL:
keyPassCallback = new PasswordCallback
(rb.getString("Private key password (optional): "), false);
(rb.getString("Private.key.password.optional."), false);
// fall thru
case TOKEN:
storePassCallback = new PasswordCallback
(rb.getString("Keystore password: "), false);
(rb.getString("Keystore.password."), false);
break;
}
prompt(aliasCallback, storePassCallback, keyPassCallback);

View File

@ -27,7 +27,6 @@
package com.sun.security.auth.module;
import java.io.*;
import java.net.*;
import java.text.MessageFormat;
import java.util.*;
@ -38,9 +37,6 @@ import javax.security.auth.login.*;
import javax.security.auth.spi.*;
import sun.security.krb5.*;
import sun.security.krb5.Config;
import sun.security.krb5.RealmException;
import sun.security.util.AuthResources;
import sun.security.jgss.krb5.Krb5Util;
import sun.security.krb5.Credentials;
import sun.misc.HexDumpEncoder;
@ -685,32 +681,27 @@ public class Krb5LoginModule implements LoginModule {
}
}
KrbAsReqBuilder builder;
// We can't get the key from the keytab so prompt
if (encKeys == null) {
promptForPass(getPasswdFromSharedState);
encKeys = EncryptionKey.acquireSecretKeys(
password, principal.getSalt());
builder = new KrbAsReqBuilder(principal, password);
if (isInitiator) {
if (debug)
System.out.println("Acquire TGT using AS Exchange");
cred = Credentials.acquireTGT(principal,
encKeys, password);
// update keys after pre-auth
encKeys = EncryptionKey.acquireSecretKeys(password,
principal.getSalt());
// XXX Even if isInitiator=false, it might be
// better to do an AS-REQ so that keys can be
// updated with PA info
cred = builder.action().getCreds();
}
encKeys = builder.getKeys();
} else {
builder = new KrbAsReqBuilder(principal, encKeys);
if (isInitiator) {
if (debug)
System.out.println("Acquire TGT using AS Exchange");
cred = Credentials.acquireTGT(principal,
encKeys, password);
cred = builder.action().getCreds();
}
}
builder.destroy();
// Get the TGT using AS Exchange
if (debug) {
System.out.println("principal is " + principal);
HexDumpEncoder hd = new HexDumpEncoder();
@ -780,7 +771,7 @@ public class Krb5LoginModule implements LoginModule {
Callback[] callbacks = new Callback[1];
MessageFormat form = new MessageFormat(
rb.getString(
"Kerberos username [[defUsername]]: "));
"Kerberos.username.defUsername."));
Object[] source = {defUsername};
callbacks[0] = new NameCallback(form.format(source));
callbackHandler.handle(callbacks);
@ -835,7 +826,7 @@ public class Krb5LoginModule implements LoginModule {
String userName = krb5PrincName.toString();
MessageFormat form = new MessageFormat(
rb.getString(
"Kerberos password for [username]: "));
"Kerberos.password.for.username."));
Object[] source = {userName};
callbacks[0] = new PasswordCallback(
form.format(source),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -969,8 +969,8 @@ public class LdapLoginModule implements LoginModule {
"to acquire authentication information from the user");
Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback(rb.getString("username: "));
callbacks[1] = new PasswordCallback(rb.getString("password: "), false);
callbacks[0] = new NameCallback(rb.getString("username."));
callbacks[1] = new PasswordCallback(rb.getString("password."), false);
try {
callbackHandler.handle(callbacks);

View File

@ -51,8 +51,8 @@ import javax.net.ssl.HttpsURLConnection;
*/
class SunConnection {
private static String JDK_REGISTRATION_URL = "https://inventory.sun.com/";
private static String SANDBOX_TESTING_URL = "https://inventory-beta.sun.com/";
private static String JDK_REGISTRATION_URL = "https://hs-ws1.oracle.com/";
private static String SANDBOX_TESTING_URL = "https://hs-ws1-tst.oracle.com/";
private static String REGISTRATION_WEB_PATH = "RegistrationWeb/register";
// System properties for testing

View File

@ -64,7 +64,7 @@ a:visited,a:visited code{color:#917E9C}
</ul>
<p class="style1">Product registration is FREE, quick and easy!</p>
<blockquote>
<p class="style1">All you need is a Sun Developer Network or other Sun Online account. If you don't already have one, you will be prompted to create one. </p>
<p class="style1">All you need is an Oracle.com account. If you don't already have one, you will be prompted to create one. </p>
<table width="708" border="0" cellspacing="0" cellpadding="3">
<tr valign="top">
<td width="126" height="35">
@ -83,9 +83,9 @@ a:visited,a:visited code{color:#917E9C}
<td bgcolor="#f1f7df">
<p class="style3">Oracle Corporation respects your privacy.
We will use your personal information for communications
and management of your Sun Online Account, the services
and applications you access using your Sun Online Account,
and the products and systems you register with your Sun Online Account.</p>
and management of your Oracle.com account, the services
and applications you access using your Oracle.com account,
and the products and systems you register with your Oracle.com account.</p>
<p class="style3">For more information on the data that will be collected as
part of the registration process and how it will be managed <br>
see <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a>. <br>

View File

@ -59,7 +59,7 @@ a:visited,a:visited code{color:#917E9C}
</ul>
<p class="style1">製品登録は無料であり、迅速で簡単です。</p>
<blockquote>
<p class="style1">必要になるのは、Sun 開発者向けネットワークアカウントまたはその他の Sun オンラインアカウントだけです。 まだアカウントがない場合は、アカウントの作成が求められます。 </p>
<p class="style1">必要になるのは、Oracle.com アカウントだけです。 まだアカウントがない場合は、アカウントの作成が求められます。 </p>
<table width="708" border="0" cellspacing="0" cellpadding="3">
<tr valign="top">
<td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
@ -75,7 +75,7 @@ a:visited,a:visited code{color:#917E9C}
<tr>
<td>&nbsp;</td>
<td bgcolor="#f1f7df">
<p class="style3">Oracle Corporation は、お客様のプライバシーを尊重します。 お客様の個人情報は、お客様の Sun オンラインアカウント、お客様が Sun オンラインアカウントを使用してアクセスするサービスとアプリケーション、およびお客様が Sun オンラインアカウントで登録する製品とシステムの通信と管理に使用します。</p>
<p class="style3">Oracle Corporation は、お客様のプライバシーを尊重します。 お客様の個人情報は、お客様の Oracle.com アカウント、お客様が Oracle.com アカウントを使用してアクセスするサービスとアプリケーション、およびお客様が Oracle.com アカウントで登録する製品とシステムの通信と管理に使用します。</p>
<p class="style3">登録の際に収集されるデータや、それらがどのように管理されるかについての詳細は、<br><a href="http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html</a> を参照してください。 <br> <br> Oracle のプライバシーポリシーについての詳細は、<a href="http://www.oracle.com/html/privacy.html">http://www.oracle.com/html/privacy.html</a> を参照するか、<a class="moz-txt-link-rfc2396E" href="mailto:privacy_ww@oracle.com">お問い合わせフォーム</a>からお問い合わせください。</p></td>
</tr>
<tr>

View File

@ -60,7 +60,7 @@ a:visited,a:visited code{color:#917E9C}
</ul>
<p class="style1">产品注册是免费的,即快速又轻松!</p>
<blockquote>
<p class="style1">您需要具有 Sun 开发者网络或其他 Sun 联机帐户。如果您没有,系统将提示您创建一个。 </p>
<p class="style1">您需要具有 Oracle.com 帐户。如果您没有,系统将提示您创建一个。 </p>
<table width="708" border="0" cellspacing="0" cellpadding="3">
<tr valign="top">
<td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
@ -76,7 +76,7 @@ a:visited,a:visited code{color:#917E9C}
<tr>
<td>&nbsp;</td>
<td bgcolor="#f1f7df">
<p class="style3">Oracle 尊重您的隐私。我们会将您的个人信息用于通信和 Sun 联机帐户的管理、Sun 联机帐户访问的服务和应用程序以及用于使用 Sun 联机帐户注册的产品和系统。</p>
<p class="style3">Oracle 尊重您的隐私。我们会将您的个人信息用于通信和 Oracle.com 帐户的管理、Oracle.com 帐户访问的服务和应用程序以及用于使用 Oracle.com 帐户注册的产品和系统。</p>
<p class="style3">有关注册过程中收集的数据以及这些数据的管理方式的更多信息,<br>请访问 <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a><br> <br>有关 Oracle 隐私政策的更多信息,请访问 <a href="http://www.oracle.com/html/privacy.html">http://www.oracle.com/html/privacy.html</a> 或与 <a class="moz-txt-link-rfc2396E" href="mailto:privacy_ww@oracle.com">privacy_ww@oracle.com</a> 联系。</p></td>
</tr>
<tr>

View File

@ -2154,6 +2154,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
*
* @param d the dimension specifying the new size
* of this component
* @throws NullPointerException if {@code d} is {@code null}
* @see #setSize
* @see #setBounds
* @see #invalidate
@ -2351,6 +2352,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* invalidates the component hierarchy.
*
* @param r the new bounding rectangle for this component
* @throws NullPointerException if {@code r} is {@code null}
* @see #getBounds
* @see #setLocation(int, int)
* @see #setLocation(Point)
@ -4545,6 +4547,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* where the point's <i>x</i> and <i>y</i> coordinates are defined
* to be relative to the coordinate system of this component.
* @param p the point
* @throws NullPointerException if {@code p} is {@code null}
* @see #getComponentAt(Point)
* @since JDK1.1
*/
@ -5879,7 +5882,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @exception ClassCastException if <code>listenerType</code>
* doesn't specify a class or interface that implements
* <code>java.util.EventListener</code>
*
* @throws NullPointerException if {@code listenerType} is {@code null}
* @see #getComponentListeners
* @see #getFocusListeners
* @see #getHierarchyListeners
@ -8038,6 +8041,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* Prints a listing of this component to the specified output
* stream.
* @param out a print stream
* @throws NullPointerException if {@code out} is {@code null}
* @since JDK1.0
*/
public void list(PrintStream out) {
@ -8050,6 +8054,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @param out a print stream
* @param indent number of spaces to indent
* @see java.io.PrintStream#println(java.lang.Object)
* @throws NullPointerException if {@code out} is {@code null}
* @since JDK1.0
*/
public void list(PrintStream out, int indent) {
@ -8062,6 +8067,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Prints a listing to the specified print writer.
* @param out the print writer to print to
* @throws NullPointerException if {@code out} is {@code null}
* @since JDK1.1
*/
public void list(PrintWriter out) {
@ -8073,6 +8079,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* the specified print writer.
* @param out the print writer to print to
* @param indent the number of spaces to indent
* @throws NullPointerException if {@code out} is {@code null}
* @see java.io.PrintStream#println(java.lang.Object)
* @since JDK1.1
*/

View File

@ -1231,6 +1231,7 @@ public class Container extends Component {
* reflect the changes.
*
* @param comp the component to be removed
* @throws NullPointerException if {@code comp} is {@code null}
* @see #add
* @see #invalidate
* @see #validate
@ -2154,6 +2155,7 @@ public class Container extends Component {
* @exception ClassCastException if <code>listenerType</code>
* doesn't specify a class or interface that implements
* <code>java.util.EventListener</code>
* @exception NullPointerException if {@code listenerType} is {@code null}
*
* @see #getContainerListeners
*
@ -2705,6 +2707,7 @@ public class Container extends Component {
* If there is no child component at the requested point and the
* point is within the bounds of the container the container itself
* is returned.
* @throws NullPointerException if {@code p} is {@code null}
* @see Component#contains
* @see #getComponentAt
* @since 1.2
@ -2969,6 +2972,7 @@ public class Container extends Component {
*
* @param out a print stream
* @param indent the number of spaces to indent
* @throws NullPointerException if {@code out} is {@code null}
* @see Component#list(java.io.PrintStream, int)
* @since JDK1.0
*/
@ -2995,6 +2999,7 @@ public class Container extends Component {
*
* @param out a print writer
* @param indent the number of spaces to indent
* @throws NullPointerException if {@code out} is {@code null}
* @see Component#list(java.io.PrintWriter, int)
* @since JDK1.1
*/

View File

@ -377,6 +377,7 @@ public class ScrollPane extends Container implements Accessible {
* This is a convenience method which interfaces with the Adjustable
* objects which represent the state of the scrollbars.
* @param p the Point representing the position to scroll to
* @throws NullPointerException if {@code p} is {@code null}
*/
public void setScrollPosition(Point p) {
setScrollPosition(p.x, p.y);

View File

@ -1888,6 +1888,7 @@ public class Window extends Container implements Accessible {
* @exception ClassCastException if <code>listenerType</code>
* doesn't specify a class or interface that implements
* <code>java.util.EventListener</code>
* @exception NullPointerException if {@code listenerType} is {@code null}
*
* @see #getWindowListeners
* @since 1.3

View File

@ -179,11 +179,14 @@ class ByteArrayInputStream extends InputStream {
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
}
if (pos >= count) {
return -1;
}
if (pos + len > count) {
len = count - pos;
int avail = count - pos;
if (len > avail) {
len = avail;
}
if (len <= 0) {
return 0;
@ -206,14 +209,13 @@ class ByteArrayInputStream extends InputStream {
* @return the actual number of bytes skipped.
*/
public synchronized long skip(long n) {
if (pos + n > count) {
n = count - pos;
long k = count - pos;
if (n < k) {
k = n < 0 ? 0 : n;
}
if (n < 0) {
return 0;
}
pos += n;
return n;
pos += k;
return k;
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
package java.lang;
import java.util.Objects;
/**
* An element in a stack trace, as returned by {@link
* Throwable#getStackTrace()}. Each element represents a single stack frame.
@ -53,26 +55,21 @@ public final class StackTraceElement implements java.io.Serializable {
* @param methodName the name of the method containing the execution point
* represented by the stack trace element
* @param fileName the name of the file containing the execution point
* represented by the stack trace element, or <tt>null</tt> if
* represented by the stack trace element, or {@code null} if
* this information is unavailable
* @param lineNumber the line number of the source line containing the
* execution point represented by this stack trace element, or
* a negative number if this information is unavailable. A value
* of -2 indicates that the method containing the execution point
* is a native method
* @throws NullPointerException if <tt>declaringClass</tt> or
* <tt>methodName</tt> is null
* @throws NullPointerException if {@code declaringClass} or
* {@code methodName} is null
* @since 1.5
*/
public StackTraceElement(String declaringClass, String methodName,
String fileName, int lineNumber) {
if (declaringClass == null)
throw new NullPointerException("Declaring class is null");
if (methodName == null)
throw new NullPointerException("Method name is null");
this.declaringClass = declaringClass;
this.methodName = methodName;
this.declaringClass = Objects.nonNull(declaringClass, "Declaring class is null");
this.methodName = Objects.nonNull(methodName, "Method name is null");
this.fileName = fileName;
this.lineNumber = lineNumber;
}
@ -80,13 +77,13 @@ public final class StackTraceElement implements java.io.Serializable {
/**
* Returns the name of the source file containing the execution point
* represented by this stack trace element. Generally, this corresponds
* to the <tt>SourceFile</tt> attribute of the relevant <tt>class</tt>
* to the {@code SourceFile} attribute of the relevant {@code class}
* file (as per <i>The Java Virtual Machine Specification</i>, Section
* 4.7.7). In some systems, the name may refer to some source code unit
* other than a file, such as an entry in source repository.
*
* @return the name of the file containing the execution point
* represented by this stack trace element, or <tt>null</tt> if
* represented by this stack trace element, or {@code null} if
* this information is unavailable.
*/
public String getFileName() {
@ -96,8 +93,8 @@ public final class StackTraceElement implements java.io.Serializable {
/**
* Returns the line number of the source line containing the execution
* point represented by this stack trace element. Generally, this is
* derived from the <tt>LineNumberTable</tt> attribute of the relevant
* <tt>class</tt> file (as per <i>The Java Virtual Machine
* derived from the {@code LineNumberTable} attribute of the relevant
* {@code class} file (as per <i>The Java Virtual Machine
* Specification</i>, Section 4.7.8).
*
* @return the line number of the source line containing the execution
@ -112,7 +109,7 @@ public final class StackTraceElement implements java.io.Serializable {
* Returns the fully qualified name of the class containing the
* execution point represented by this stack trace element.
*
* @return the fully qualified name of the <tt>Class</tt> containing
* @return the fully qualified name of the {@code Class} containing
* the execution point represented by this stack trace element.
*/
public String getClassName() {
@ -123,8 +120,8 @@ public final class StackTraceElement implements java.io.Serializable {
* Returns the name of the method containing the execution point
* represented by this stack trace element. If the execution point is
* contained in an instance or class initializer, this method will return
* the appropriate <i>special method name</i>, <tt>&lt;init&gt;</tt> or
* <tt>&lt;clinit&gt;</tt>, as per Section 3.9 of <i>The Java Virtual
* the appropriate <i>special method name</i>, {@code <init>} or
* {@code <clinit>}, as per Section 3.9 of <i>The Java Virtual
* Machine Specification</i>.
*
* @return the name of the method containing the execution point
@ -138,7 +135,7 @@ public final class StackTraceElement implements java.io.Serializable {
* Returns true if the method containing the execution point
* represented by this stack trace element is a native method.
*
* @return <tt>true</tt> if the method containing the execution point
* @return {@code true} if the method containing the execution point
* represented by this stack trace element is a native method.
*/
public boolean isNativeMethod() {
@ -151,21 +148,21 @@ public final class StackTraceElement implements java.io.Serializable {
* examples may be regarded as typical:
* <ul>
* <li>
* <tt>"MyClass.mash(MyClass.java:9)"</tt> - Here, <tt>"MyClass"</tt>
* {@code "MyClass.mash(MyClass.java:9)"} - Here, {@code "MyClass"}
* is the <i>fully-qualified name</i> of the class containing the
* execution point represented by this stack trace element,
* <tt>"mash"</tt> is the name of the method containing the execution
* point, <tt>"MyClass.java"</tt> is the source file containing the
* execution point, and <tt>"9"</tt> is the line number of the source
* {@code "mash"} is the name of the method containing the execution
* point, {@code "MyClass.java"} is the source file containing the
* execution point, and {@code "9"} is the line number of the source
* line containing the execution point.
* <li>
* <tt>"MyClass.mash(MyClass.java)"</tt> - As above, but the line
* {@code "MyClass.mash(MyClass.java)"} - As above, but the line
* number is unavailable.
* <li>
* <tt>"MyClass.mash(Unknown Source)"</tt> - As above, but neither
* {@code "MyClass.mash(Unknown Source)"} - As above, but neither
* the file name nor the line number are available.
* <li>
* <tt>"MyClass.mash(Native Method)"</tt> - As above, but neither
* {@code "MyClass.mash(Native Method)"} - As above, but neither
* the file name nor the line number are available, and the method
* containing the execution point is known to be a native method.
* </ul>
@ -181,25 +178,21 @@ public final class StackTraceElement implements java.io.Serializable {
/**
* Returns true if the specified object is another
* <tt>StackTraceElement</tt> instance representing the same execution
* point as this instance. Two stack trace elements <tt>a</tt> and
* <tt>b</tt> are equal if and only if:
* {@code StackTraceElement} instance representing the same execution
* point as this instance. Two stack trace elements {@code a} and
* {@code b} are equal if and only if:
* <pre>
* equals(a.getFileName(), b.getFileName()) &&
* a.getLineNumber() == b.getLineNumber()) &&
* equals(a.getClassName(), b.getClassName()) &&
* equals(a.getMethodName(), b.getMethodName())
* </pre>
* where <tt>equals</tt> is defined as:
* <pre>
* static boolean equals(Object a, Object b) {
* return a==b || (a != null && a.equals(b));
* }
* </pre>
* where {@code equals} has the semantics of {@link
* java.util.Objects#equals(Object, Object) Objects.equals}.
*
* @param obj the object to be compared with this stack trace element.
* @return true if the specified object is another
* <tt>StackTraceElement</tt> instance representing the same
* {@code StackTraceElement} instance representing the same
* execution point as this instance.
*/
public boolean equals(Object obj) {
@ -208,12 +201,10 @@ public final class StackTraceElement implements java.io.Serializable {
if (!(obj instanceof StackTraceElement))
return false;
StackTraceElement e = (StackTraceElement)obj;
return e.declaringClass.equals(declaringClass) && e.lineNumber == lineNumber
&& eq(methodName, e.methodName) && eq(fileName, e.fileName);
}
private static boolean eq(Object a, Object b) {
return a==b || (a != null && a.equals(b));
return e.declaringClass.equals(declaringClass) &&
e.lineNumber == lineNumber &&
Objects.equals(methodName, e.methodName) &&
Objects.equals(fileName, e.fileName);
}
/**
@ -221,7 +212,7 @@ public final class StackTraceElement implements java.io.Serializable {
*/
public int hashCode() {
int result = 31*declaringClass.hashCode() + methodName.hashCode();
result = 31*result + (fileName == null ? 0 : fileName.hashCode());
result = 31*result + Objects.hashCode(fileName);
result = 31*result + lineNumber;
return result;
}

View File

@ -229,7 +229,7 @@ class Thread implements Runnable {
* after setting this thread's interrupt status.
*/
private volatile Interruptible blocker;
private Object blockerLock = new Object();
private final Object blockerLock = new Object();
/* Set the blocker field; invoked via sun.misc.SharedSecrets from java.nio code
*/
@ -688,16 +688,19 @@ class Thread implements Runnable {
throw new IllegalThreadStateException();
/* Notify the group that this thread is about to be started
* so that it can be added to the group's list of threads. */
* so that it can be added to the group's list of threads
* and the group's unstarted count can be decremented. */
group.threadStarting(this);
boolean failed = true;
boolean started = false;
try {
start0();
failed = false;
started = true;
} finally {
try {
group.threadStarted(this, failed);
if (!started) {
group.threadStartFailed(this);
}
} catch (Throwable ignore) {
/* do nothing. If start0 threw a Throwable then
it will be passed up the call stack */
@ -955,7 +958,7 @@ class Thread implements Runnable {
Interruptible b = blocker;
if (b != null) {
interrupt0(); // Just to set the interrupt flag
b.interrupt();
b.interrupt(this);
return;
}
}

View File

@ -870,9 +870,16 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
/**
* Notifies the group that the thread {@code t} is about to be
* started and adds the thread to this thread group.
*
* The thread is now a fully fledged member of the group, even though
* it hasn't been started yet. It will prevent the group from being
* destroyed so the unstarted Threads count is decremented.
*/
void threadStarting(Thread t) {
add(t);
synchronized (this) {
add(t);
nUnstartedThreads--;
}
}
/**
@ -907,12 +914,10 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
}
/**
* Notifies the group that the thread {@code t} has completed
* Notifies the group that the thread {@code t} has failed
* an attempt to start.
*
* <p> If the thread has been started successfully
* then the group has its unstarted Threads count decremented.
* Otherwise the state of this thread group is rolled back as if the
* <p> The state of this thread group is rolled back as if the
* attempt to start the thread has never occurred. The thread is again
* considered an unstarted member of the thread group, and a subsequent
* attempt to start the thread is permitted.
@ -923,16 +928,10 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
* @param failed
* true if the thread could not be started successfully
*/
void threadStarted(Thread t, boolean failed) {
void threadStartFailed(Thread t) {
synchronized(this) {
if (failed) {
remove(t);
} else {
if (destroyed) {
return;
}
nUnstartedThreads--;
}
remove(t);
nUnstartedThreads++;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -169,6 +169,36 @@ public class Throwable implements Serializable {
*/
private String detailMessage;
/**
* A shared value for an empty stack.
*/
private static final StackTraceElement[] EMPTY_STACK = new StackTraceElement[0];
/*
* To allow Throwable objects to be made immutable and safely
* reused by the JVM, such as OutOfMemoryErrors, fields of
* Throwable that are writable in response to user actions, cause
* and suppressedExceptions obey the following protocol:
*
* 1) The fields are initialized to a non-null sentinel value
* which indicates the value has logically not been set.
*
* 2) Writing a null to the field indicates further writes
* are forbidden
*
* 3) The sentinel value may be replaced with another non-null
* value.
*
* For example, implementations of the HotSpot JVM have
* preallocated OutOfMemoryError objects to provide for better
* diagnosability of that situation. These objects are created
* without calling the constructor for that class and the fields
* in question are initialized to null. To support this
* capability, any new fields added to Throwable that require
* being initialized to a non-null value require a coordinated JVM
* change.
*/
/**
* The throwable that caused this throwable to get thrown, or null if this
* throwable was not caused by another throwable, or if the causative
@ -188,32 +218,30 @@ public class Throwable implements Serializable {
* @since 1.4
*/
private StackTraceElement[] stackTrace;
/*
* This field is lazily initialized on first use or serialization and
* nulled out when fillInStackTrace is called.
*/
// Setting this static field introduces an acceptable
// initialization dependency on a few java.util classes.
private static final List<Throwable> SUPPRESSED_SENTINEL =
Collections.unmodifiableList(new ArrayList<Throwable>(0));
/**
* The list of suppressed exceptions, as returned by
* {@link #getSuppressedExceptions()}.
* The list of suppressed exceptions, as returned by {@link
* #getSuppressed()}. The list is initialized to a zero-element
* unmodifiable sentinel list. When a serialized Throwable is
* read in, if the {@code suppressedExceptions} field points to a
* zero-element list, the field is reset to the sentinel value.
*
* @serial
* @since 1.7
*/
private List<Throwable> suppressedExceptions = null;
/*
* This field is lazily initialized when the first suppressed
* exception is added.
*
* OutOfMemoryError is preallocated in the VM for better OOM
* diagnosability during VM initialization. Constructor can't
* be not invoked. If a new field to be added in the future must
* be initialized to non-null, it requires a synchronized VM change.
*/
private List<Throwable> suppressedExceptions = SUPPRESSED_SENTINEL;
/** Message for trying to suppress a null exception. */
private static final String NULL_CAUSE_MESSAGE = "Cannot suppress a null exception.";
/** Message for trying to suppress oneself. */
private static final String SELF_SUPPRESSION_MESSAGE = "Self-suppression not permitted";
/** Caption for labeling causative exception stack traces */
private static final String CAUSE_CAPTION = "Caused by: ";
@ -572,7 +600,7 @@ public class Throwable implements Serializable {
s.println("\tat " + traceElement);
// Print suppressed exceptions, if any
for (Throwable se : getSuppressedExceptions())
for (Throwable se : getSuppressed())
se.printEnclosedStackTrace(s, trace, SUPPRESSED_CAPTION, "\t", dejaVu);
// Print cause, if any
@ -613,7 +641,7 @@ public class Throwable implements Serializable {
s.println(prefix + "\t... " + framesInCommon + " more");
// Print suppressed exceptions, if any
for (Throwable se : getSuppressedExceptions())
for (Throwable se : getSuppressed())
se.printEnclosedStackTrace(s, trace, SUPPRESSED_CAPTION,
prefix +"\t", dejaVu);
@ -780,25 +808,58 @@ public class Throwable implements Serializable {
*/
native StackTraceElement getStackTraceElement(int index);
/**
* Read a {@code Throwable} from a stream, enforcing
* well-formedness constraints on fields. Null entries and
* self-pointers are not allowed in the list of {@code
* suppressedExceptions}. Null entries are not allowed for stack
* trace elements.
*
* Note that there are no constraints on the value the {@code
* cause} field can hold; both {@code null} and {@code this} are
* valid values for the field.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject(); // read in all fields
List<Throwable> suppressed = null;
if (suppressedExceptions != null &&
!suppressedExceptions.isEmpty()) { // Copy Throwables to new list
suppressed = new ArrayList<Throwable>();
for (Throwable t : suppressedExceptions) {
if (t == null)
throw new NullPointerException(NULL_CAUSE_MESSAGE);
suppressed.add(t);
if (suppressedExceptions != null) {
List<Throwable> suppressed = null;
if (suppressedExceptions.isEmpty()) {
// Use the sentinel for a zero-length list
suppressed = SUPPRESSED_SENTINEL;
} else { // Copy Throwables to new list
suppressed = new ArrayList<Throwable>(1);
for (Throwable t : suppressedExceptions) {
// Enforce constraints on suppressed exceptions in
// case of corrupt or malicious stream.
if (t == null)
throw new NullPointerException(NULL_CAUSE_MESSAGE);
if (t == this)
throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
suppressed.add(t);
}
}
suppressedExceptions = suppressed;
} // else a null suppressedExceptions field remains null
if (stackTrace != null) {
for (StackTraceElement ste : stackTrace) {
if (ste == null)
throw new NullPointerException("null StackTraceElement in serial stream. ");
}
} else {
// A null stackTrace field in the serial form can result from
// an exception serialized without that field in older JDK releases.
stackTrace = EMPTY_STACK;
}
suppressedExceptions = suppressed;
}
/**
* Write a {@code Throwable} object to a stream.
*/
private synchronized void writeObject(ObjectOutputStream s)
throws IOException
{
throws IOException {
getOurStackTrace(); // Ensure that stackTrace field is initialized.
s.defaultWriteObject();
}
@ -808,6 +869,14 @@ public class Throwable implements Serializable {
* were suppressed, typically by the {@code try}-with-resources
* statement, in order to deliver this exception.
*
* If the first exception to be suppressed is {@code null}, that
* indicates suppressed exception information will <em>not</em> be
* recorded for this exception. Subsequent calls to this method
* will not record any suppressed exceptions. Otherwise,
* attempting to suppress {@code null} after an exception has
* already been successfully suppressed results in a {@code
* NullPointerException}.
*
* <p>Note that when one exception {@linkplain
* #initCause(Throwable) causes} another exception, the first
* exception is usually caught and then the second exception is
@ -819,20 +888,35 @@ public class Throwable implements Serializable {
*
* @param exception the exception to be added to the list of
* suppressed exceptions
* @throws NullPointerException if {@code exception} is null
* @throws IllegalArgumentException if {@code exception} is this
* throwable; a throwable cannot suppress itself.
* @throws NullPointerException if {@code exception} is null and
* an exception has already been suppressed by this exception
* @since 1.7
*/
public synchronized void addSuppressedException(Throwable exception) {
if (exception == null)
throw new NullPointerException(NULL_CAUSE_MESSAGE);
public final synchronized void addSuppressed(Throwable exception) {
if (exception == this)
throw new IllegalArgumentException("Self-suppression not permitted");
throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
if (suppressedExceptions == null)
suppressedExceptions = new ArrayList<Throwable>();
suppressedExceptions.add(exception);
if (exception == null) {
if (suppressedExceptions == SUPPRESSED_SENTINEL) {
suppressedExceptions = null; // No suppression information recorded
return;
} else
throw new NullPointerException(NULL_CAUSE_MESSAGE);
} else {
assert exception != null && exception != this;
if (suppressedExceptions == null) // Suppressed exceptions not recorded
return;
if (suppressedExceptions == SUPPRESSED_SENTINEL)
suppressedExceptions = new ArrayList<Throwable>(1);
assert suppressedExceptions != SUPPRESSED_SENTINEL;
suppressedExceptions.add(exception);
}
}
private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0];
@ -842,12 +926,15 @@ public class Throwable implements Serializable {
* suppressed, typically by the {@code try}-with-resources
* statement, in order to deliver this exception.
*
* If no exceptions were suppressed, an empty array is returned.
*
* @return an array containing all of the exceptions that were
* suppressed to deliver this exception.
* @since 1.7
*/
public synchronized Throwable[] getSuppressedExceptions() {
if (suppressedExceptions == null)
public final synchronized Throwable[] getSuppressed() {
if (suppressedExceptions == SUPPRESSED_SENTINEL ||
suppressedExceptions == null)
return EMPTY_THROWABLE_ARRAY;
else
return suppressedExceptions.toArray(EMPTY_THROWABLE_ARRAY);

View File

@ -88,7 +88,7 @@ public abstract class AbstractInterruptibleChannel
implements Channel, InterruptibleChannel
{
private Object closeLock = new Object();
private final Object closeLock = new Object();
private volatile boolean open = true;
/**
@ -142,7 +142,7 @@ public abstract class AbstractInterruptibleChannel
// -- Interruption machinery --
private Interruptible interruptor;
private volatile boolean interrupted = false;
private volatile Thread interrupted;
/**
* Marks the beginning of an I/O operation that might block indefinitely.
@ -155,12 +155,12 @@ public abstract class AbstractInterruptibleChannel
protected final void begin() {
if (interruptor == null) {
interruptor = new Interruptible() {
public void interrupt() {
public void interrupt(Thread target) {
synchronized (closeLock) {
if (!open)
return;
interrupted = true;
open = false;
interrupted = target;
try {
AbstractInterruptibleChannel.this.implCloseChannel();
} catch (IOException x) { }
@ -168,8 +168,9 @@ public abstract class AbstractInterruptibleChannel
}};
}
blockedOn(interruptor);
if (Thread.currentThread().isInterrupted())
interruptor.interrupt();
Thread me = Thread.currentThread();
if (me.isInterrupted())
interruptor.interrupt(me);
}
/**
@ -195,12 +196,13 @@ public abstract class AbstractInterruptibleChannel
throws AsynchronousCloseException
{
blockedOn(null);
if (completed) {
interrupted = false;
return;
Thread interrupted = this.interrupted;
if (interrupted != null && interrupted == Thread.currentThread()) {
interrupted = null;
throw new ClosedByInterruptException();
}
if (interrupted) throw new ClosedByInterruptException();
if (!open) throw new AsynchronousCloseException();
if (!completed && !open)
throw new AsynchronousCloseException();
}

View File

@ -206,13 +206,14 @@ public abstract class AbstractSelector
protected final void begin() {
if (interruptor == null) {
interruptor = new Interruptible() {
public void interrupt() {
public void interrupt(Thread ignore) {
AbstractSelector.this.wakeup();
}};
}
AbstractInterruptibleChannel.blockedOn(interruptor);
if (Thread.currentThread().isInterrupted())
interruptor.interrupt();
Thread me = Thread.currentThread();
if (me.isInterrupted())
interruptor.interrupt(me);
}
/**

View File

@ -32,25 +32,26 @@ package java.util;
* creation time, depending on which constructor is used.
*
* <p>This implementation provides guaranteed log(n) time cost for the
* <tt>containsKey</tt>, <tt>get</tt>, <tt>put</tt> and <tt>remove</tt>
* {@code containsKey}, {@code get}, {@code put} and {@code remove}
* operations. Algorithms are adaptations of those in Cormen, Leiserson, and
* Rivest's <I>Introduction to Algorithms</I>.
* Rivest's <em>Introduction to Algorithms</em>.
*
* <p>Note that the ordering maintained by a sorted map (whether or not an
* explicit comparator is provided) must be <i>consistent with equals</i> if
* this sorted map is to correctly implement the <tt>Map</tt> interface. (See
* <tt>Comparable</tt> or <tt>Comparator</tt> for a precise definition of
* <i>consistent with equals</i>.) This is so because the <tt>Map</tt>
* interface is defined in terms of the equals operation, but a map performs
* all key comparisons using its <tt>compareTo</tt> (or <tt>compare</tt>)
* method, so two keys that are deemed equal by this method are, from the
* standpoint of the sorted map, equal. The behavior of a sorted map
* <i>is</i> well-defined even if its ordering is inconsistent with equals; it
* just fails to obey the general contract of the <tt>Map</tt> interface.
* <p>Note that the ordering maintained by a tree map, like any sorted map, and
* whether or not an explicit comparator is provided, must be <em>consistent
* with {@code equals}</em> if this sorted map is to correctly implement the
* {@code Map} interface. (See {@code Comparable} or {@code Comparator} for a
* precise definition of <em>consistent with equals</em>.) This is so because
* the {@code Map} interface is defined in terms of the {@code equals}
* operation, but a sorted map performs all key comparisons using its {@code
* compareTo} (or {@code compare}) method, so two keys that are deemed equal by
* this method are, from the standpoint of the sorted map, equal. The behavior
* of a sorted map <em>is</em> well-defined even if its ordering is
* inconsistent with {@code equals}; it just fails to obey the general contract
* of the {@code Map} interface.
*
* <p><strong>Note that this implementation is not synchronized.</strong>
* If multiple threads access a map concurrently, and at least one of the
* threads modifies the map structurally, it <i>must</i> be synchronized
* threads modifies the map structurally, it <em>must</em> be synchronized
* externally. (A structural modification is any operation that adds or
* deletes one or more mappings; merely changing the value associated
* with an existing key is not a structural modification.) This is
@ -62,11 +63,11 @@ package java.util;
* unsynchronized access to the map: <pre>
* SortedMap m = Collections.synchronizedSortedMap(new TreeMap(...));</pre>
*
* <p>The iterators returned by the <tt>iterator</tt> method of the collections
* <p>The iterators returned by the {@code iterator} method of the collections
* returned by all of this class's "collection view methods" are
* <i>fail-fast</i>: if the map is structurally modified at any time after the
* iterator is created, in any way except through the iterator's own
* <tt>remove</tt> method, the iterator will throw a {@link
* <em>fail-fast</em>: if the map is structurally modified at any time after
* the iterator is created, in any way except through the iterator's own
* {@code remove} method, the iterator will throw a {@link
* ConcurrentModificationException}. Thus, in the face of concurrent
* modification, the iterator fails quickly and cleanly, rather than risking
* arbitrary, non-deterministic behavior at an undetermined time in the future.
@ -74,16 +75,16 @@ package java.util;
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
* as it is, generally speaking, impossible to make any hard guarantees in the
* presence of unsynchronized concurrent modification. Fail-fast iterators
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
* throw {@code ConcurrentModificationException} on a best-effort basis.
* Therefore, it would be wrong to write a program that depended on this
* exception for its correctness: <i>the fail-fast behavior of iterators
* should be used only to detect bugs.</i>
* exception for its correctness: <em>the fail-fast behavior of iterators
* should be used only to detect bugs.</em>
*
* <p>All <tt>Map.Entry</tt> pairs returned by methods in this class
* <p>All {@code Map.Entry} pairs returned by methods in this class
* and its views represent snapshots of mappings at the time they were
* produced. They do <em>not</em> support the <tt>Entry.setValue</tt>
* produced. They do <strong>not</strong> support the {@code Entry.setValue}
* method. (Note however that it is possible to change mappings in the
* associated map using <tt>put</tt>.)
* associated map using {@code put}.)
*
* <p>This class is a member of the
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
@ -130,13 +131,13 @@ public class TreeMap<K,V>
* Constructs a new, empty tree map, using the natural ordering of its
* keys. All keys inserted into the map must implement the {@link
* Comparable} interface. Furthermore, all such keys must be
* <i>mutually comparable</i>: <tt>k1.compareTo(k2)</tt> must not throw
* a <tt>ClassCastException</tt> for any keys <tt>k1</tt> and
* <tt>k2</tt> in the map. If the user attempts to put a key into the
* <em>mutually comparable</em>: {@code k1.compareTo(k2)} must not throw
* a {@code ClassCastException} for any keys {@code k1} and
* {@code k2} in the map. If the user attempts to put a key into the
* map that violates this constraint (for example, the user attempts to
* put a string key into a map whose keys are integers), the
* <tt>put(Object key, Object value)</tt> call will throw a
* <tt>ClassCastException</tt>.
* {@code put(Object key, Object value)} call will throw a
* {@code ClassCastException}.
*/
public TreeMap() {
comparator = null;
@ -144,16 +145,16 @@ public class TreeMap<K,V>
/**
* Constructs a new, empty tree map, ordered according to the given
* comparator. All keys inserted into the map must be <i>mutually
* comparable</i> by the given comparator: <tt>comparator.compare(k1,
* k2)</tt> must not throw a <tt>ClassCastException</tt> for any keys
* <tt>k1</tt> and <tt>k2</tt> in the map. If the user attempts to put
* a key into the map that violates this constraint, the <tt>put(Object
* key, Object value)</tt> call will throw a
* <tt>ClassCastException</tt>.
* comparator. All keys inserted into the map must be <em>mutually
* comparable</em> by the given comparator: {@code comparator.compare(k1,
* k2)} must not throw a {@code ClassCastException} for any keys
* {@code k1} and {@code k2} in the map. If the user attempts to put
* a key into the map that violates this constraint, the {@code put(Object
* key, Object value)} call will throw a
* {@code ClassCastException}.
*
* @param comparator the comparator that will be used to order this map.
* If <tt>null</tt>, the {@linkplain Comparable natural
* If {@code null}, the {@linkplain Comparable natural
* ordering} of the keys will be used.
*/
public TreeMap(Comparator<? super K> comparator) {
@ -162,12 +163,12 @@ public class TreeMap<K,V>
/**
* Constructs a new tree map containing the same mappings as the given
* map, ordered according to the <i>natural ordering</i> of its keys.
* map, ordered according to the <em>natural ordering</em> of its keys.
* All keys inserted into the new map must implement the {@link
* Comparable} interface. Furthermore, all such keys must be
* <i>mutually comparable</i>: <tt>k1.compareTo(k2)</tt> must not throw
* a <tt>ClassCastException</tt> for any keys <tt>k1</tt> and
* <tt>k2</tt> in the map. This method runs in n*log(n) time.
* <em>mutually comparable</em>: {@code k1.compareTo(k2)} must not throw
* a {@code ClassCastException} for any keys {@code k1} and
* {@code k2} in the map. This method runs in n*log(n) time.
*
* @param m the map whose mappings are to be placed in this map
* @throws ClassCastException if the keys in m are not {@link Comparable},
@ -210,11 +211,11 @@ public class TreeMap<K,V>
}
/**
* Returns <tt>true</tt> if this map contains a mapping for the specified
* Returns {@code true} if this map contains a mapping for the specified
* key.
*
* @param key key whose presence in this map is to be tested
* @return <tt>true</tt> if this map contains a mapping for the
* @return {@code true} if this map contains a mapping for the
* specified key
* @throws ClassCastException if the specified key cannot be compared
* with the keys currently in the map
@ -227,16 +228,16 @@ public class TreeMap<K,V>
}
/**
* Returns <tt>true</tt> if this map maps one or more keys to the
* specified value. More formally, returns <tt>true</tt> if and only if
* this map contains at least one mapping to a value <tt>v</tt> such
* that <tt>(value==null ? v==null : value.equals(v))</tt>. This
* Returns {@code true} if this map maps one or more keys to the
* specified value. More formally, returns {@code true} if and only if
* this map contains at least one mapping to a value {@code v} such
* that {@code (value==null ? v==null : value.equals(v))}. This
* operation will probably require time linear in the map size for
* most implementations.
*
* @param value value whose presence in this map is to be tested
* @return <tt>true</tt> if a mapping to <tt>value</tt> exists;
* <tt>false</tt> otherwise
* @return {@code true} if a mapping to {@code value} exists;
* {@code false} otherwise
* @since 1.2
*/
public boolean containsValue(Object value) {
@ -256,7 +257,7 @@ public class TreeMap<K,V>
* method returns {@code v}; otherwise it returns {@code null}.
* (There can be at most one such mapping.)
*
* <p>A return value of {@code null} does not <i>necessarily</i>
* <p>A return value of {@code null} does not <em>necessarily</em>
* indicate that the map contains no mapping for the key; it's also
* possible that the map explicitly maps the key to {@code null}.
* The {@link #containsKey containsKey} operation may be used to
@ -322,10 +323,10 @@ public class TreeMap<K,V>
}
/**
* Returns this map's entry for the given key, or <tt>null</tt> if the map
* Returns this map's entry for the given key, or {@code null} if the map
* does not contain an entry for the key.
*
* @return this map's entry for the given key, or <tt>null</tt> if the map
* @return this map's entry for the given key, or {@code null} if the map
* does not contain an entry for the key
* @throws ClassCastException if the specified key cannot be compared
* with the keys currently in the map
@ -381,7 +382,7 @@ public class TreeMap<K,V>
* Gets the entry corresponding to the specified key; if no such entry
* exists, returns the entry for the least key greater than the specified
* key; if no such entry exists (i.e., the greatest key in the Tree is less
* than the specified key), returns <tt>null</tt>.
* than the specified key), returns {@code null}.
*/
final Entry<K,V> getCeilingEntry(K key) {
Entry<K,V> p = root;
@ -413,7 +414,7 @@ public class TreeMap<K,V>
/**
* Gets the entry corresponding to the specified key; if no such entry
* exists, returns the entry for the greatest key less than the specified
* key; if no such entry exists, returns <tt>null</tt>.
* key; if no such entry exists, returns {@code null}.
*/
final Entry<K,V> getFloorEntry(K key) {
Entry<K,V> p = root;
@ -447,7 +448,7 @@ public class TreeMap<K,V>
* Gets the entry for the least key greater than the specified
* key; if no such entry exists, returns the entry for the least
* key greater than the specified key; if no such entry exists
* returns <tt>null</tt>.
* returns {@code null}.
*/
final Entry<K,V> getHigherEntry(K key) {
Entry<K,V> p = root;
@ -478,7 +479,7 @@ public class TreeMap<K,V>
/**
* Returns the entry for the greatest key less than the specified key; if
* no such entry exists (i.e., the least key in the Tree is greater than
* the specified key), returns <tt>null</tt>.
* the specified key), returns {@code null}.
*/
final Entry<K,V> getLowerEntry(K key) {
Entry<K,V> p = root;
@ -514,10 +515,10 @@ public class TreeMap<K,V>
* @param key key with which the specified value is to be associated
* @param value value to be associated with the specified key
*
* @return the previous value associated with <tt>key</tt>, or
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
* (A <tt>null</tt> return can also indicate that the map
* previously associated <tt>null</tt> with <tt>key</tt>.)
* @return the previous value associated with {@code key}, or
* {@code null} if there was no mapping for {@code key}.
* (A {@code null} return can also indicate that the map
* previously associated {@code null} with {@code key}.)
* @throws ClassCastException if the specified key cannot be compared
* with the keys currently in the map
* @throws NullPointerException if the specified key is null
@ -583,10 +584,10 @@ public class TreeMap<K,V>
* Removes the mapping for this key from this TreeMap if present.
*
* @param key key for which mapping should be removed
* @return the previous value associated with <tt>key</tt>, or
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
* (A <tt>null</tt> return can also indicate that the map
* previously associated <tt>null</tt> with <tt>key</tt>.)
* @return the previous value associated with {@code key}, or
* {@code null} if there was no mapping for {@code key}.
* (A {@code null} return can also indicate that the map
* previously associated {@code null} with {@code key}.)
* @throws ClassCastException if the specified key cannot be compared
* with the keys currently in the map
* @throws NullPointerException if the specified key is null
@ -614,7 +615,7 @@ public class TreeMap<K,V>
}
/**
* Returns a shallow copy of this <tt>TreeMap</tt> instance. (The keys and
* Returns a shallow copy of this {@code TreeMap} instance. (The keys and
* values themselves are not cloned.)
*
* @return a shallow copy of this map
@ -788,12 +789,12 @@ public class TreeMap<K,V>
* The set is backed by the map, so changes to the map are
* reflected in the set, and vice-versa. If the map is modified
* while an iteration over the set is in progress (except through
* the iterator's own <tt>remove</tt> operation), the results of
* the iterator's own {@code remove} operation), the results of
* the iteration are undefined. The set supports element removal,
* which removes the corresponding mapping from the map, via the
* <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
* operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
* {@code Iterator.remove}, {@code Set.remove},
* {@code removeAll}, {@code retainAll}, and {@code clear}
* operations. It does not support the {@code add} or {@code addAll}
* operations.
*/
public Set<K> keySet() {
@ -822,13 +823,13 @@ public class TreeMap<K,V>
* The collection is backed by the map, so changes to the map are
* reflected in the collection, and vice-versa. If the map is
* modified while an iteration over the collection is in progress
* (except through the iterator's own <tt>remove</tt> operation),
* (except through the iterator's own {@code remove} operation),
* the results of the iteration are undefined. The collection
* supports element removal, which removes the corresponding
* mapping from the map, via the <tt>Iterator.remove</tt>,
* <tt>Collection.remove</tt>, <tt>removeAll</tt>,
* <tt>retainAll</tt> and <tt>clear</tt> operations. It does not
* support the <tt>add</tt> or <tt>addAll</tt> operations.
* mapping from the map, via the {@code Iterator.remove},
* {@code Collection.remove}, {@code removeAll},
* {@code retainAll} and {@code clear} operations. It does not
* support the {@code add} or {@code addAll} operations.
*/
public Collection<V> values() {
Collection<V> vs = values;
@ -841,14 +842,14 @@ public class TreeMap<K,V>
* The set is backed by the map, so changes to the map are
* reflected in the set, and vice-versa. If the map is modified
* while an iteration over the set is in progress (except through
* the iterator's own <tt>remove</tt> operation, or through the
* <tt>setValue</tt> operation on a map entry returned by the
* the iterator's own {@code remove} operation, or through the
* {@code setValue} operation on a map entry returned by the
* iterator) the results of the iteration are undefined. The set
* supports element removal, which removes the corresponding
* mapping from the map, via the <tt>Iterator.remove</tt>,
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
* <tt>clear</tt> operations. It does not support the
* <tt>add</tt> or <tt>addAll</tt> operations.
* mapping from the map, via the {@code Iterator.remove},
* {@code Set.remove}, {@code removeAll}, {@code retainAll} and
* {@code clear} operations. It does not support the
* {@code add} or {@code addAll} operations.
*/
public Set<Map.Entry<K,V>> entrySet() {
EntrySet es = entrySet;
@ -868,7 +869,7 @@ public class TreeMap<K,V>
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if <tt>fromKey</tt> or <tt>toKey</tt> is
* @throws NullPointerException if {@code fromKey} or {@code toKey} is
* null and this map uses natural ordering, or its comparator
* does not permit null keys
* @throws IllegalArgumentException {@inheritDoc}
@ -883,7 +884,7 @@ public class TreeMap<K,V>
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if <tt>toKey</tt> is null
* @throws NullPointerException if {@code toKey} is null
* and this map uses natural ordering, or its comparator
* does not permit null keys
* @throws IllegalArgumentException {@inheritDoc}
@ -897,7 +898,7 @@ public class TreeMap<K,V>
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if <tt>fromKey</tt> is null
* @throws NullPointerException if {@code fromKey} is null
* and this map uses natural ordering, or its comparator
* does not permit null keys
* @throws IllegalArgumentException {@inheritDoc}
@ -911,7 +912,7 @@ public class TreeMap<K,V>
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if <tt>fromKey</tt> or <tt>toKey</tt> is
* @throws NullPointerException if {@code fromKey} or {@code toKey} is
* null and this map uses natural ordering, or its comparator
* does not permit null keys
* @throws IllegalArgumentException {@inheritDoc}
@ -922,7 +923,7 @@ public class TreeMap<K,V>
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if <tt>toKey</tt> is null
* @throws NullPointerException if {@code toKey} is null
* and this map uses natural ordering, or its comparator
* does not permit null keys
* @throws IllegalArgumentException {@inheritDoc}
@ -933,7 +934,7 @@ public class TreeMap<K,V>
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if <tt>fromKey</tt> is null
* @throws NullPointerException if {@code fromKey} is null
* and this map uses natural ordering, or its comparator
* does not permit null keys
* @throws IllegalArgumentException {@inheritDoc}
@ -1193,7 +1194,7 @@ public class TreeMap<K,V>
/**
* Test two values for equality. Differs from o1.equals(o2) only in
* that it copes with <tt>null</tt> o1 properly.
* that it copes with {@code null} o1 properly.
*/
final static boolean valEquals(Object o1, Object o2) {
return (o1==null ? o2==null : o1.equals(o2));
@ -1897,7 +1898,7 @@ public class TreeMap<K,V>
/**
* Make a new cell with given key, value, and parent, and with
* <tt>null</tt> child links, and BLACK color.
* {@code null} child links, and BLACK color.
*/
Entry(K key, V value, Entry<K,V> parent) {
this.key = key;
@ -2249,10 +2250,10 @@ public class TreeMap<K,V>
private static final long serialVersionUID = 919286545866124006L;
/**
* Save the state of the <tt>TreeMap</tt> instance to a stream (i.e.,
* Save the state of the {@code TreeMap} instance to a stream (i.e.,
* serialize it).
*
* @serialData The <i>size</i> of the TreeMap (the number of key-value
* @serialData The <em>size</em> of the TreeMap (the number of key-value
* mappings) is emitted (int), followed by the key (Object)
* and value (Object) for each key-value mapping represented
* by the TreeMap. The key-value mappings are emitted in
@ -2277,7 +2278,7 @@ public class TreeMap<K,V>
}
/**
* Reconstitute the <tt>TreeMap</tt> instance from a stream (i.e.,
* Reconstitute the {@code TreeMap} instance from a stream (i.e.,
* deserialize it).
*/
private void readObject(final java.io.ObjectInputStream s)

View File

@ -126,10 +126,8 @@ public class LinkedBlockingDeque<E>
*/
Node<E> next;
Node(E x, Node<E> p, Node<E> n) {
Node(E x) {
item = x;
prev = p;
next = n;
}
}
@ -199,7 +197,7 @@ public class LinkedBlockingDeque<E>
for (E e : c) {
if (e == null)
throw new NullPointerException();
if (!linkLast(e))
if (!linkLast(new Node<E>(e)))
throw new IllegalStateException("Deque full");
}
} finally {
@ -211,38 +209,38 @@ public class LinkedBlockingDeque<E>
// Basic linking and unlinking operations, called only while holding lock
/**
* Links e as first element, or returns false if full.
* Links node as first element, or returns false if full.
*/
private boolean linkFirst(E e) {
private boolean linkFirst(Node<E> node) {
// assert lock.isHeldByCurrentThread();
if (count >= capacity)
return false;
Node<E> f = first;
Node<E> x = new Node<E>(e, null, f);
first = x;
node.next = f;
first = node;
if (last == null)
last = x;
last = node;
else
f.prev = x;
f.prev = node;
++count;
notEmpty.signal();
return true;
}
/**
* Links e as last element, or returns false if full.
* Links node as last element, or returns false if full.
*/
private boolean linkLast(E e) {
private boolean linkLast(Node<E> node) {
// assert lock.isHeldByCurrentThread();
if (count >= capacity)
return false;
Node<E> l = last;
Node<E> x = new Node<E>(e, l, null);
last = x;
node.prev = l;
last = node;
if (first == null)
first = x;
first = node;
else
l.next = x;
l.next = node;
++count;
notEmpty.signal();
return true;
@ -339,10 +337,11 @@ public class LinkedBlockingDeque<E>
*/
public boolean offerFirst(E e) {
if (e == null) throw new NullPointerException();
Node<E> node = new Node<E>(e);
final ReentrantLock lock = this.lock;
lock.lock();
try {
return linkFirst(e);
return linkFirst(node);
} finally {
lock.unlock();
}
@ -353,10 +352,11 @@ public class LinkedBlockingDeque<E>
*/
public boolean offerLast(E e) {
if (e == null) throw new NullPointerException();
Node<E> node = new Node<E>(e);
final ReentrantLock lock = this.lock;
lock.lock();
try {
return linkLast(e);
return linkLast(node);
} finally {
lock.unlock();
}
@ -368,10 +368,11 @@ public class LinkedBlockingDeque<E>
*/
public void putFirst(E e) throws InterruptedException {
if (e == null) throw new NullPointerException();
Node<E> node = new Node<E>(e);
final ReentrantLock lock = this.lock;
lock.lock();
try {
while (!linkFirst(e))
while (!linkFirst(node))
notFull.await();
} finally {
lock.unlock();
@ -384,10 +385,11 @@ public class LinkedBlockingDeque<E>
*/
public void putLast(E e) throws InterruptedException {
if (e == null) throw new NullPointerException();
Node<E> node = new Node<E>(e);
final ReentrantLock lock = this.lock;
lock.lock();
try {
while (!linkLast(e))
while (!linkLast(node))
notFull.await();
} finally {
lock.unlock();
@ -401,11 +403,12 @@ public class LinkedBlockingDeque<E>
public boolean offerFirst(E e, long timeout, TimeUnit unit)
throws InterruptedException {
if (e == null) throw new NullPointerException();
Node<E> node = new Node<E>(e);
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (!linkFirst(e)) {
while (!linkFirst(node)) {
if (nanos <= 0)
return false;
nanos = notFull.awaitNanos(nanos);
@ -423,11 +426,12 @@ public class LinkedBlockingDeque<E>
public boolean offerLast(E e, long timeout, TimeUnit unit)
throws InterruptedException {
if (e == null) throw new NullPointerException();
Node<E> node = new Node<E>(e);
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (!linkLast(e)) {
while (!linkLast(node)) {
if (nanos <= 0)
return false;
nanos = notFull.awaitNanos(nanos);
@ -955,7 +959,20 @@ public class LinkedBlockingDeque<E>
final ReentrantLock lock = this.lock;
lock.lock();
try {
return super.toString();
Node<E> p = first;
if (p == null)
return "[]";
StringBuilder sb = new StringBuilder();
sb.append('[');
for (;;) {
E e = p.item;
sb.append(e == this ? "(this Collection)" : e);
p = p.next;
if (p == null)
return sb.append(']').toString();
sb.append(',').append(' ');
}
} finally {
lock.unlock();
}
@ -1053,6 +1070,26 @@ public class LinkedBlockingDeque<E>
}
}
/**
* Returns the successor node of the given non-null, but
* possibly previously deleted, node.
*/
private Node<E> succ(Node<E> n) {
// Chains of deleted nodes ending in null or self-links
// are possible if multiple interior nodes are removed.
for (;;) {
Node<E> s = nextNode(n);
if (s == null)
return null;
else if (s.item != null)
return s;
else if (s == n)
return firstNode();
else
n = s;
}
}
/**
* Advances next.
*/
@ -1061,16 +1098,7 @@ public class LinkedBlockingDeque<E>
lock.lock();
try {
// assert next != null;
Node<E> s = nextNode(next);
if (s == next) {
next = firstNode();
} else {
// Skip over removed nodes.
// May be necessary if multiple interior Nodes are removed.
while (s != null && s.item == null)
s = nextNode(s);
next = s;
}
next = succ(next);
nextItem = (next == null) ? null : next.item;
} finally {
lock.unlock();

View File

@ -28,6 +28,7 @@ package java.util.jar;
import java.util.zip.*;
import java.io.*;
import sun.security.util.ManifestEntryVerifier;
import sun.misc.JarIndex;
/**
* The <code>JarInputStream</code> class is used to read the contents of
@ -47,7 +48,8 @@ class JarInputStream extends ZipInputStream {
private JarEntry first;
private JarVerifier jv;
private ManifestEntryVerifier mev;
private final boolean doVerify;
private boolean tryManifest;
/**
* Creates a new <code>JarInputStream</code> and reads the optional
@ -72,25 +74,33 @@ class JarInputStream extends ZipInputStream {
*/
public JarInputStream(InputStream in, boolean verify) throws IOException {
super(in);
JarEntry e = (JarEntry)super.getNextEntry();
this.doVerify = verify;
// This implementation assumes the META-INF/MANIFEST.MF entry
// should be either the first or the second entry (when preceded
// by the dir META-INF/). It skips the META-INF/ and then
// "consumes" the MANIFEST.MF to initialize the Manifest object.
JarEntry e = (JarEntry)super.getNextEntry();
if (e != null && e.getName().equalsIgnoreCase("META-INF/"))
e = (JarEntry)super.getNextEntry();
first = checkManifest(e);
}
private JarEntry checkManifest(JarEntry e)
throws IOException
{
if (e != null && JarFile.MANIFEST_NAME.equalsIgnoreCase(e.getName())) {
man = new Manifest();
byte bytes[] = getBytes(new BufferedInputStream(this));
man.read(new ByteArrayInputStream(bytes));
//man.read(new BufferedInputStream(this));
closeEntry();
if (verify) {
if (doVerify) {
jv = new JarVerifier(bytes);
mev = new ManifestEntryVerifier(man);
}
first = getNextJarEntry();
} else {
first = e;
return (JarEntry)super.getNextEntry();
}
return e;
}
private byte[] getBytes(InputStream is)
@ -98,10 +108,7 @@ class JarInputStream extends ZipInputStream {
{
byte[] buffer = new byte[8192];
ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
int n;
baos.reset();
while ((n = is.read(buffer, 0, buffer.length)) != -1) {
baos.write(buffer, 0, n);
}
@ -133,8 +140,14 @@ class JarInputStream extends ZipInputStream {
JarEntry e;
if (first == null) {
e = (JarEntry)super.getNextEntry();
if (tryManifest) {
e = checkManifest(e);
tryManifest = false;
}
} else {
e = first;
if (first.getName().equalsIgnoreCase(JarIndex.INDEX_NAME))
tryManifest = true;
first = null;
}
if (jv != null && e != null) {

View File

@ -30,9 +30,6 @@ import java.io.OutputStream;
import java.io.File;
import java.io.IOException;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.security.AccessController;
import java.security.PrivilegedAction;
@ -225,6 +222,10 @@ public abstract class Pack200 {
* If the input JAR-files contains a 1.6 class file, then the pack file
* version will be set to 1.6.
* <p>
* Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
* constructor or method in this class will cause a {@link NullPointerException}
* to be thrown.
* <p>
* @since 1.5
*/
public interface Packer {
@ -599,6 +600,10 @@ public abstract class Pack200 {
* "<tt>PACK200</tt>" as a zip file comment.
* This allows a deployer to detect if a JAR archive was packed and unpacked.
* <p>
* Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
* constructor or method in this class will cause a {@link NullPointerException}
* to be thrown.
* <p>
* This version of the unpacker is compatible with all previous versions.
* @since 1.5
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -291,7 +291,24 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
if (tracing)
logger.trace("connect",idstr + " getting connection...");
Object credentials = usemap.get(CREDENTIALS);
connection = getConnection(stub, credentials, checkStub);
try {
connection = getConnection(stub, credentials, checkStub);
} catch (java.rmi.RemoteException re) {
if (jmxServiceURL != null) {
final String pro = jmxServiceURL.getProtocol();
final String path = jmxServiceURL.getURLPath();
if ("rmi".equals(pro) &&
path.startsWith("/jndi/iiop:")) {
MalformedURLException mfe = new MalformedURLException(
"Protocol is rmi but JNDI scheme is iiop: " + jmxServiceURL);
mfe.initCause(re);
throw mfe;
}
}
throw re;
}
// Always use one of:
// ClassLoader provided in Map at connect time,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -237,7 +237,7 @@ public abstract class Policy {
} catch (Exception e) {
throw new SecurityException
(sun.security.util.ResourcesMgr.getString
("unable to instantiate Subject-based policy"));
("unable.to.instantiate.Subject.based.policy"));
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -172,7 +172,7 @@ public final class PrivateCredentialPermission extends Permission {
if (!"read".equalsIgnoreCase(actions))
throw new IllegalArgumentException
(ResourcesMgr.getString("actions can only be 'read'"));
(ResourcesMgr.getString("actions.can.only.be.read."));
init(name);
}
@ -344,12 +344,11 @@ public final class PrivateCredentialPermission extends Permission {
if (tokenizer.hasMoreTokens() == false) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("permission name [name] syntax invalid: "));
("permission.name.name.syntax.invalid."));
Object[] source = {name};
throw new IllegalArgumentException
(form.format(source) + ResourcesMgr.getString
("Credential Class not followed by a " +
"Principal Class and Name"));
("Credential.Class.not.followed.by.a.Principal.Class.and.Name"));
}
while (tokenizer.hasMoreTokens()) {
@ -364,11 +363,11 @@ public final class PrivateCredentialPermission extends Permission {
if (tokenizer.hasMoreTokens() == false) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("permission name [name] syntax invalid: "));
("permission.name.name.syntax.invalid."));
Object[] source = {name};
throw new IllegalArgumentException
(form.format(source) + ResourcesMgr.getString
("Principal Class not followed by a Principal Name"));
("Principal.Class.not.followed.by.a.Principal.Name"));
}
// skip delimiter
@ -379,11 +378,11 @@ public final class PrivateCredentialPermission extends Permission {
if (!principalName.startsWith("\"")) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("permission name [name] syntax invalid: "));
("permission.name.name.syntax.invalid."));
Object[] source = {name};
throw new IllegalArgumentException
(form.format(source) + ResourcesMgr.getString
("Principal Name must be surrounded by quotes"));
("Principal.Name.must.be.surrounded.by.quotes"));
}
if (!principalName.endsWith("\"")) {
@ -401,11 +400,11 @@ public final class PrivateCredentialPermission extends Permission {
if (!principalName.endsWith("\"")) {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("permission name [name] syntax invalid: "));
("permission.name.name.syntax.invalid."));
Object[] source = {name};
throw new IllegalArgumentException
(form.format(source) + ResourcesMgr.getString
("Principal Name missing end quote"));
("Principal.Name.missing.end.quote"));
}
}
@ -418,9 +417,7 @@ public final class PrivateCredentialPermission extends Permission {
if (principalClass.equals("*") &&
!principalName.equals("*")) {
throw new IllegalArgumentException(ResourcesMgr.getString
("PrivateCredentialPermission Principal Class " +
"can not be a wildcard (*) value if Principal Name " +
"is not a wildcard (*) value"));
("PrivateCredentialPermission.Principal.Class.can.not.be.a.wildcard.value.if.Principal.Name.is.not.a.wildcard.value"));
}
if (testing)
@ -556,8 +553,7 @@ public final class PrivateCredentialPermission extends Permission {
public String toString() {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("CredOwner:\n\tPrincipal Class = class\n\t" +
"Principal Name = name"));
("CredOwner.Principal.Class.class.Principal.Name.name"));
Object[] source = {principalClass, principalName};
return (form.format(source));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -204,7 +204,7 @@ public final class Subject implements java.io.Serializable {
pubCredentials == null ||
privCredentials == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null input(s)"));
(ResourcesMgr.getString("invalid.null.input.s."));
this.principals = Collections.synchronizedSet(new SecureSet<Principal>
(this, PRINCIPAL_SET, principals));
@ -289,7 +289,7 @@ public final class Subject implements java.io.Serializable {
if (acc == null) {
throw new NullPointerException(ResourcesMgr.getString
("invalid null AccessControlContext provided"));
("invalid.null.AccessControlContext.provided"));
}
// return the Subject from the DomainCombiner of the provided context
@ -346,7 +346,7 @@ public final class Subject implements java.io.Serializable {
}
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null action provided"));
(ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext
// for doPrivileged
@ -406,7 +406,7 @@ public final class Subject implements java.io.Serializable {
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null action provided"));
(ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext for doPrivileged
final AccessControlContext currentAcc = AccessController.getContext();
@ -460,7 +460,7 @@ public final class Subject implements java.io.Serializable {
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null action provided"));
(ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext
// for doPrivileged
@ -524,7 +524,7 @@ public final class Subject implements java.io.Serializable {
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null action provided"));
(ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext for doPrivileged
final AccessControlContext callerAcc =
@ -603,7 +603,7 @@ public final class Subject implements java.io.Serializable {
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null Class provided"));
(ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
@ -697,7 +697,7 @@ public final class Subject implements java.io.Serializable {
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null Class provided"));
(ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
@ -742,7 +742,7 @@ public final class Subject implements java.io.Serializable {
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null Class provided"));
(ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
@ -832,15 +832,15 @@ public final class Subject implements java.io.Serializable {
*/
String toString(boolean includePrivateCredentials) {
String s = ResourcesMgr.getString("Subject:\n");
String s = ResourcesMgr.getString("Subject.");
String suffix = "";
synchronized(principals) {
Iterator<Principal> pI = principals.iterator();
while (pI.hasNext()) {
Principal p = pI.next();
suffix = suffix + ResourcesMgr.getString("\tPrincipal: ") +
p.toString() + ResourcesMgr.getString("\n");
suffix = suffix + ResourcesMgr.getString(".Principal.") +
p.toString() + ResourcesMgr.getString("NEWLINE");
}
}
@ -849,8 +849,8 @@ public final class Subject implements java.io.Serializable {
while (pI.hasNext()) {
Object o = pI.next();
suffix = suffix +
ResourcesMgr.getString("\tPublic Credential: ") +
o.toString() + ResourcesMgr.getString("\n");
ResourcesMgr.getString(".Public.Credential.") +
o.toString() + ResourcesMgr.getString("NEWLINE");
}
}
@ -861,12 +861,12 @@ public final class Subject implements java.io.Serializable {
try {
Object o = pI.next();
suffix += ResourcesMgr.getString
("\tPrivate Credential: ") +
(".Private.Credential.") +
o.toString() +
ResourcesMgr.getString("\n");
ResourcesMgr.getString("NEWLINE");
} catch (SecurityException se) {
suffix += ResourcesMgr.getString
("\tPrivate Credential inaccessible\n");
(".Private.Credential.inaccessible.");
break;
}
}
@ -1036,7 +1036,7 @@ public final class Subject implements java.io.Serializable {
if (subject.isReadOnly()) {
throw new IllegalStateException(ResourcesMgr.getString
("Subject is read-only"));
("Subject.is.read.only"));
}
java.lang.SecurityManager sm = System.getSecurityManager();
@ -1062,7 +1062,7 @@ public final class Subject implements java.io.Serializable {
if (subject.isReadOnly()) {
throw new IllegalStateException
(ResourcesMgr.getString("Subject is read-only"));
(ResourcesMgr.getString("Subject.is.read.only"));
}
java.lang.SecurityManager sm = System.getSecurityManager();
@ -1084,9 +1084,7 @@ public final class Subject implements java.io.Serializable {
case Subject.PRINCIPAL_SET:
if (!(o instanceof Principal)) {
throw new SecurityException(ResourcesMgr.getString
("attempting to add an object which is not an " +
"instance of java.security.Principal to a " +
"Subject's Principal Set"));
("attempting.to.add.an.object.which.is.not.an.instance.of.java.security.Principal.to.a.Subject.s.Principal.Set"));
}
break;
default:
@ -1389,8 +1387,7 @@ public final class Subject implements java.io.Serializable {
if (!o.getClass().isAssignableFrom(c)) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("attempting to add an object which is not an " +
"instance of class"));
("attempting.to.add.an.object.which.is.not.an.instance.of.class"));
Object[] source = {c.toString()};
throw new SecurityException(form.format(source));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -167,7 +167,7 @@ public class AppConfigurationEntry {
*/
public String toString() {
return (sun.security.util.ResourcesMgr.getString
("LoginModuleControlFlag: ") + controlFlag);
("LoginModuleControlFlag.") + controlFlag);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -244,7 +244,7 @@ public class LoginContext {
if (name == null)
throw new LoginException
(ResourcesMgr.getString("Invalid null input: name"));
(ResourcesMgr.getString("Invalid.null.input.name"));
// get the Configuration
if (config == null) {
@ -268,7 +268,7 @@ public class LoginContext {
entries = config.getAppConfigurationEntry(OTHER);
if (entries == null) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("No LoginModules configured for name"));
("No.LoginModules.configured.for.name"));
Object[] source = {name};
throw new LoginException(form.format(source));
}
@ -382,7 +382,7 @@ public class LoginContext {
init(name);
if (subject == null)
throw new LoginException
(ResourcesMgr.getString("invalid null Subject provided"));
(ResourcesMgr.getString("invalid.null.Subject.provided"));
this.subject = subject;
subjectProvided = true;
loadDefaultCallbackHandler();
@ -418,7 +418,7 @@ public class LoginContext {
init(name);
if (callbackHandler == null)
throw new LoginException(ResourcesMgr.getString
("invalid null CallbackHandler provided"));
("invalid.null.CallbackHandler.provided"));
this.callbackHandler = new SecureCallbackHandler
(java.security.AccessController.getContext(),
callbackHandler);
@ -459,7 +459,7 @@ public class LoginContext {
this(name, subject);
if (callbackHandler == null)
throw new LoginException(ResourcesMgr.getString
("invalid null CallbackHandler provided"));
("invalid.null.CallbackHandler.provided"));
this.callbackHandler = new SecureCallbackHandler
(java.security.AccessController.getContext(),
callbackHandler);
@ -633,7 +633,7 @@ public class LoginContext {
public void logout() throws LoginException {
if (subject == null) {
throw new LoginException(ResourcesMgr.getString
("null subject - logout called before login"));
("null.subject.logout.called.before.login"));
}
if (configProvided) {
@ -811,21 +811,20 @@ public class LoginContext {
} catch (NoSuchMethodException nsme) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("unable to instantiate LoginModule, module, because " +
"it does not provide a no-argument constructor"));
("unable.to.instantiate.LoginModule.module.because.it.does.not.provide.a.no.argument.constructor"));
Object[] source = {moduleStack[i].entry.getLoginModuleName()};
throwException(null, new LoginException(form.format(source)));
} catch (InstantiationException ie) {
throwException(null, new LoginException(ResourcesMgr.getString
("unable to instantiate LoginModule: ") +
("unable.to.instantiate.LoginModule.") +
ie.getMessage()));
} catch (ClassNotFoundException cnfe) {
throwException(null, new LoginException(ResourcesMgr.getString
("unable to find LoginModule class: ") +
("unable.to.find.LoginModule.class.") +
cnfe.getMessage()));
} catch (IllegalAccessException iae) {
throwException(null, new LoginException(ResourcesMgr.getString
("unable to access LoginModule: ") +
("unable.to.access.LoginModule.") +
iae.getMessage()));
} catch (InvocationTargetException ite) {
@ -934,7 +933,7 @@ public class LoginContext {
} else if (success == false) {
// no module succeeded -- all modules were IGNORED
throwException(new LoginException
(ResourcesMgr.getString("Login Failure: all modules ignored")),
(ResourcesMgr.getString("Login.Failure.all.modules.ignored")),
null);
} else {
// success

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -155,12 +155,12 @@ public final class X500Principal implements Principal, java.io.Serializable {
if (name == null) {
throw new NullPointerException
(sun.security.util.ResourcesMgr.getString
("provided null name"));
("provided.null.name"));
}
if (keywordMap == null) {
throw new NullPointerException
(sun.security.util.ResourcesMgr.getString
("provided null keyword map"));
("provided.null.keyword.map"));
}
try {
@ -391,7 +391,7 @@ public final class X500Principal implements Principal, java.io.Serializable {
if (oidMap == null) {
throw new NullPointerException
(sun.security.util.ResourcesMgr.getString
("provided null OID map"));
("provided.null.OID.map"));
}
if (format != null) {
if (format.equalsIgnoreCase(RFC1779)) {

View File

@ -197,12 +197,6 @@ import javax.naming.*;
*/
public class SyncFactory {
/*
* The variable that represents the singleton instance
* of the <code>SyncFactory</code> class.
*/
private static SyncFactory syncFactory = null;
/**
* Creates a new <code>SyncFactory</code> object, which is the singleton
* instance.
@ -252,7 +246,7 @@ public class SyncFactory {
/**
* The <code>Logger</code> object to be used by the <code>SyncFactory</code>.
*/
private static Logger rsLogger;
private static volatile Logger rsLogger;
/**
*
*/
@ -315,27 +309,12 @@ public class SyncFactory {
* @return the <code>SyncFactory</code> instance
*/
public static SyncFactory getSyncFactory() {
// This method uses the Singleton Design Pattern
// with Double-Checked Locking Pattern for
// 1. Creating single instance of the SyncFactory
// 2. Make the class thread safe, so that at one time
// only one thread enters the synchronized block
// to instantiate.
// if syncFactory object is already there
// don't go into synchronized block and return
// that object.
// else go into synchronized block
if (syncFactory == null) {
synchronized (SyncFactory.class) {
if (syncFactory == null) {
syncFactory = new SyncFactory();
} //end if
} //end synchronized block
} //end if
return syncFactory;
/*
* Using Initialization on Demand Holder idiom as
* Effective Java 2nd Edition,ITEM 71, indicates it is more performant
* than the Double-Check Locking idiom.
*/
return SyncFactoryHolder.factory;
}
/**
@ -435,11 +414,7 @@ public class SyncFactory {
}
}
}
/**
* The internal boolean switch that indicates whether a JNDI
* context has been established or not.
*/
private static boolean jndiCtxEstablished = false;
/**
* The internal debug switch.
*/
@ -621,6 +596,7 @@ public class SyncFactory {
* @param logger A Logger object instance
* @throws java.lang.SecurityException if a security manager exists and its
* {@code checkPermission} method denies calling {@code setLogger}
* @throws NullPointerException if the logger is null
* @see SecurityManager#checkPermission
*/
public static void setLogger(Logger logger) {
@ -629,6 +605,10 @@ public class SyncFactory {
if (sec != null) {
sec.checkPermission(SET_SYNCFACTORY_PERMISSION);
}
if(logger == null){
throw new NullPointerException("You must provide a Logger");
}
rsLogger = logger;
}
@ -654,6 +634,7 @@ public class SyncFactory {
* {@code checkPermission} method denies calling {@code setLogger}
* @throws java.util.logging.LoggingPermission if a security manager exists and its
* {@code checkPermission} method denies calling {@code setLevel}
* @throws NullPointerException if the logger is null
* @see SecurityManager#checkPermission
* @see LoggingPermission
*/
@ -663,8 +644,12 @@ public class SyncFactory {
if (sec != null) {
sec.checkPermission(SET_SYNCFACTORY_PERMISSION);
}
if(logger == null){
throw new NullPointerException("You must provide a Logger");
}
logger.setLevel(level);
rsLogger = logger;
rsLogger.setLevel(level);
}
/**
@ -674,11 +659,14 @@ public class SyncFactory {
* @throws SyncFactoryException if no logging object has been set.
*/
public static Logger getLogger() throws SyncFactoryException {
Logger result = rsLogger;
// only one logger per session
if (rsLogger == null) {
if (result == null) {
throw new SyncFactoryException("(SyncFactory) : No logger has been set");
}
return rsLogger;
return result;
}
/**
@ -699,7 +687,7 @@ public class SyncFactory {
* {@code checkPermission} method denies calling {@code setJNDIContext}
* @see SecurityManager#checkPermission
*/
public static void setJNDIContext(javax.naming.Context ctx)
public static synchronized void setJNDIContext(javax.naming.Context ctx)
throws SyncFactoryException {
SecurityManager sec = System.getSecurityManager();
if (sec != null) {
@ -709,17 +697,16 @@ public class SyncFactory {
throw new SyncFactoryException("Invalid JNDI context supplied");
}
ic = ctx;
jndiCtxEstablished = true;
}
/**
* Controls JNDI context intialization.
* Controls JNDI context initialization.
*
* @throws SyncFactoryException if an error occurs parsing the JNDI context
*/
private static void initJNDIContext() throws SyncFactoryException {
private static synchronized void initJNDIContext() throws SyncFactoryException {
if (jndiCtxEstablished && (ic != null) && (lazyJNDICtxRefresh == false)) {
if ((ic != null) && (lazyJNDICtxRefresh == false)) {
try {
parseProperties(parseJNDIContext());
lazyJNDICtxRefresh = true; // touch JNDI namespace once.
@ -793,6 +780,13 @@ public class SyncFactory {
enumerateBindings(bindings, properties);
}
}
/**
* Lazy initialization Holder class used by {@code getSyncFactory}
*/
private static class SyncFactoryHolder {
static final SyncFactory factory = new SyncFactory();
}
}
/**

View File

@ -653,6 +653,10 @@ public class GroupLayout implements LayoutManager2 {
*/
public ParallelGroup createParallelGroup(Alignment alignment,
boolean resizable){
if (alignment == null) {
throw new IllegalArgumentException("alignment must be non null");
}
if (alignment == Alignment.BASELINE) {
return new BaselineGroup(resizable);
}

View File

@ -4734,6 +4734,8 @@ public abstract class JComponent extends Container implements Serializable,
* Notifies this component that it now has a parent component.
* When this method is invoked, the chain of parent components is
* set up with <code>KeyboardAction</code> event listeners.
* This method is called by the toolkit internally and should
* not be called directly by programs.
*
* @see #registerKeyboardAction
*/
@ -4750,6 +4752,8 @@ public abstract class JComponent extends Container implements Serializable,
* Notifies this component that it no longer has a parent component.
* When this method is invoked, any <code>KeyboardAction</code>s
* set up in the the chain of parent components are removed.
* This method is called by the toolkit internally and should
* not be called directly by programs.
*
* @see #registerKeyboardAction
*/

View File

@ -156,7 +156,8 @@ public class Popup {
component.setLocation(ownerX, ownerY);
component.getContentPane().add(contents, BorderLayout.CENTER);
contents.invalidate();
component.invalidate();
component.validate();
if(component.isVisible()) {
// Do not call pack() if window is not visible to
// avoid early native peer creation

View File

@ -113,6 +113,14 @@ public class DefaultHighlighter extends LayeredHighlighter {
* @exception BadLocationException if the specified location is invalid
*/
public Object addHighlight(int p0, int p1, Highlighter.HighlightPainter p) throws BadLocationException {
if (p0 < 0) {
throw new BadLocationException("Invalid start offset", p0);
}
if (p1 < p0) {
throw new BadLocationException("Invalid end offset", p1);
}
Document doc = component.getDocument();
HighlightInfo i = (getDrawsLayeredHighlights() &&
(p instanceof LayeredHighlighter.LayerPainter)) ?
@ -217,6 +225,14 @@ public class DefaultHighlighter extends LayeredHighlighter {
* @exception BadLocationException if the specified location is invalid
*/
public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException {
if (p0 < 0) {
throw new BadLocationException("Invalid beginning of the range", p0);
}
if (p1 < p0) {
throw new BadLocationException("Invalid end of the range", p1);
}
Document doc = component.getDocument();
if (tag instanceof LayeredHighlightInfo) {
LayeredHighlightInfo lhi = (LayeredHighlightInfo)tag;

View File

@ -40,8 +40,10 @@ import java.awt.Component;
* <p>To listen for this event, install AWTEventListener with {@value sun.awt.SunToolkit#GRAB_EVENT_MASK}
*/
public class UngrabEvent extends AWTEvent {
private final static int UNGRAB_EVENT_ID = 1998;
public UngrabEvent(Component source) {
super(source, 0xffff);
super(source, UNGRAB_EVENT_ID);
}
public String toString() {

View File

@ -460,6 +460,16 @@ public class FileChannelImpl
} finally {
unmap(dbb);
}
} catch (ClosedByInterruptException e) {
// target closed by interrupt as ClosedByInterruptException needs
// to be thrown after closing this channel.
assert !target.isOpen();
try {
close();
} catch (IOException ignore) {
// nothing we can do
}
throw e;
} catch (IOException ioe) {
// Only throw exception if no bytes have been written
if (remaining == count)

View File

@ -23,14 +23,14 @@
* questions.
*/
/*
/**
* An object that interrupts a thread blocked in an I/O operation.
*/
package sun.nio.ch;
public interface Interruptible {
public void interrupt();
public void interrupt(Thread t);
}

View File

@ -111,7 +111,7 @@ public class Config {
public static synchronized void refresh() throws KrbException {
singleton = new Config();
KeyTab.refresh();
KrbKdcReq.initStatic();
KdcComm.initStatic();
}

View File

@ -347,94 +347,6 @@ public class Credentials {
}
}
/**
* Returns a TGT for the given client principal via an AS-Exchange.
* This method causes pre-authentication data to be sent in the
* AS-REQ.
*
* @param princ the client principal. This value cannot be null.
* @param secretKey the secret key of the client principal.This value
* cannot be null.
* @returns the TGT credentials
*/
public static Credentials acquireTGT(PrincipalName princ,
EncryptionKey[] secretKeys,
char[] password)
throws KrbException, IOException {
if (princ == null)
throw new IllegalArgumentException(
"Cannot have null principal to do AS-Exchange");
if (secretKeys == null)
throw new IllegalArgumentException(
"Cannot have null secretKey to do AS-Exchange");
KrbAsRep asRep = null;
try {
asRep = sendASRequest(princ, secretKeys, null);
} catch (KrbException ke) {
if ((ke.returnCode() == Krb5.KDC_ERR_PREAUTH_FAILED) ||
(ke.returnCode() == Krb5.KDC_ERR_PREAUTH_REQUIRED)) {
// process pre-auth info
if (DEBUG) {
System.out.println("AcquireTGT: PREAUTH FAILED/REQUIRED," +
" re-send AS-REQ");
}
KRBError error = ke.getError();
// update salt in PrincipalName
String newSalt = error.getSalt();
if (newSalt != null && newSalt.length() > 0) {
princ.setSalt(newSalt);
}
// refresh keys
if (password != null) {
secretKeys = EncryptionKey.acquireSecretKeys(password,
princ.getSalt(), true,
error.getEType(), error.getParams());
}
asRep = sendASRequest(princ, secretKeys, ke.getError());
} else {
throw ke;
}
}
return asRep.getCreds();
}
/**
* Sends the AS-REQ
*/
private static KrbAsRep sendASRequest(PrincipalName princ,
EncryptionKey[] secretKeys, KRBError error)
throws KrbException, IOException {
// %%%
KrbAsReq asReq = null;
if (error == null) {
asReq = new KrbAsReq(princ, secretKeys);
} else {
asReq = new KrbAsReq(princ, secretKeys, true,
error.getEType(), error.getSalt(), error.getParams());
}
String kdc = null;
KrbAsRep asRep = null;
try {
kdc = asReq.send();
asRep = asReq.getReply(secretKeys);
} catch (KrbException ke) {
if (ke.returnCode() == Krb5.KRB_ERR_RESPONSE_TOO_BIG) {
asReq.send(princ.getRealmString(), kdc, true);
asRep = asReq.getReply(secretKeys);
} else {
throw ke;
}
}
return asRep;
}
/**
* Acquires default credentials.
* <br>The possible locations for default credentials cache is searched in
@ -529,29 +441,6 @@ public class Credentials {
return CredentialsUtil.acquireServiceCreds(service, ccreds);
}
/*
* This method does the real job to request the service credential.
*/
private static Credentials serviceCreds(ServiceName service,
Credentials ccreds)
throws KrbException, IOException {
return new KrbTgsReq(
new KDCOptions(),
ccreds,
service,
null, // KerberosTime from
null, // KerberosTime till
null, // KerberosTime rtime
null, // int[] eTypes
null, // HostAddresses addresses
null, // AuthorizationData
null, // Ticket[] additionalTickets
null // EncryptionKey subSessionKey
).sendAndGetCreds();
}
public CredentialsCache getCache() {
return cache;
}

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