This commit is contained in:
Abhijit Saha 2017-08-25 05:02:36 +00:00
commit a2b2bb8b23
29 changed files with 231 additions and 127 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@ package java.lang;
* failed to find its bootstrap method,
* or the bootstrap method has failed to provide a
* {@linkplain java.lang.invoke.CallSite call site} with a {@linkplain java.lang.invoke.CallSite#getTarget target}
* of the correct {@linkplain java.lang.invoke.MethodHandle#type method type}.
* of the correct {@linkplain java.lang.invoke.MethodHandle#type() method type}.
*
* @author John Rose, JSR 292 EG
* @since 1.7

View File

@ -822,7 +822,7 @@ public final class ModuleLayer {
/**
* Returns the module with the given name in this layer, or if not in this
* layer, the {@linkplain #parents parent} layers. Finding a module in
* layer, the {@linkplain #parents() parent} layers. Finding a module in
* parent layers is equivalent to invoking {@code findModule} on each
* parent, in search order, until the module is found or all parents have
* been searched. In a <em>tree of layers</em> then this is equivalent to
@ -854,7 +854,7 @@ public final class ModuleLayer {
/**
* Returns the {@code ClassLoader} for the module with the given name. If
* a module of the given name is not in this layer then the {@link #parents
* a module of the given name is not in this layer then the {@link #parents()
* parent} layers are searched in the manner specified by {@link
* #findModule(String) findModule}.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2017, 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
@ -1149,7 +1149,7 @@ public final class ProcessBuilder
* The {@link Process#getInputStream standard output} of all processes
* except the last process are <i>null input streams</i>.
* <p>
* The {@link #redirectErrorStream} of each ProcessBuilder applies to the
* The {@link #redirectErrorStream()} of each ProcessBuilder applies to the
* respective process. If set to {@code true}, the error stream is written
* to the same stream as standard output.
* <p>

View File

@ -47,9 +47,9 @@ import static java.lang.invoke.MethodHandleStatics.*;
* Method handles are dynamically and strongly typed according to their parameter and return types.
* They are not distinguished by the name or the defining class of their underlying methods.
* A method handle must be invoked using a symbolic type descriptor which matches
* the method handle's own {@linkplain #type type descriptor}.
* the method handle's own {@linkplain #type() type descriptor}.
* <p>
* Every method handle reports its type descriptor via the {@link #type type} accessor.
* Every method handle reports its type descriptor via the {@link #type() type} accessor.
* This type descriptor is a {@link java.lang.invoke.MethodType MethodType} object,
* whose structure is a series of classes, one of which is
* the return type of the method (or {@code void.class} if none).
@ -468,7 +468,7 @@ public abstract class MethodHandle {
/**
* Invokes the method handle, allowing any caller type descriptor, but requiring an exact type match.
* The symbolic type descriptor at the call site of {@code invokeExact} must
* exactly match this method handle's {@link #type type}.
* exactly match this method handle's {@link #type() type}.
* No conversions are allowed on arguments or return values.
* <p>
* When this method is observed via the Core Reflection API,
@ -489,7 +489,7 @@ public abstract class MethodHandle {
* Invokes the method handle, allowing any caller type descriptor,
* and optionally performing conversions on arguments and return values.
* <p>
* If the call site's symbolic type descriptor exactly matches this method handle's {@link #type type},
* If the call site's symbolic type descriptor exactly matches this method handle's {@link #type() type},
* the call proceeds as if by {@link #invokeExact invokeExact}.
* <p>
* Otherwise, the call proceeds as if this method handle were first

View File

@ -131,7 +131,7 @@ public class MethodHandles {
* It can only be used to create method handles to public members of
* public classes in packages that are exported unconditionally.
* <p>
* As a matter of pure convention, the {@linkplain Lookup#lookupClass lookup class}
* As a matter of pure convention, the {@linkplain Lookup#lookupClass() lookup class}
* of this lookup object will be {@link java.lang.Object}.
*
* @apiNote The use of Object is conventional, and because the lookup modes are
@ -259,10 +259,10 @@ public class MethodHandles {
* Therefore, method handle access
* restrictions must be enforced when a method handle is created.
* The caller class against which those restrictions are enforced
* is known as the {@linkplain #lookupClass lookup class}.
* is known as the {@linkplain #lookupClass() lookup class}.
* <p>
* A lookup class which needs to create method handles will call
* {@link MethodHandles#lookup MethodHandles.lookup} to create a factory for itself.
* {@link MethodHandles#lookup() MethodHandles.lookup} to create a factory for itself.
* When the {@code Lookup} factory object is created, the identity of the lookup class is
* determined, and securely stored in the {@code Lookup} object.
* The lookup class (or its delegates) may then use factory methods
@ -776,7 +776,7 @@ public class MethodHandles {
/**
* Creates a lookup on the specified new lookup class.
* The resulting object will report the specified
* class as its own {@link #lookupClass lookupClass}.
* class as its own {@link #lookupClass() lookupClass}.
* <p>
* However, the resulting {@code Lookup} object is guaranteed
* to have no more access capabilities than the original.
@ -4602,7 +4602,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* <li>At this point, every non-init function parameter list is effectively identical to the internal parameter
* list {@code (V... A...)}, but some lists may be shorter. For every non-init function with a short parameter list,
* pad out the end of the list.
* <li>Argument lists are padded out by {@linkplain #dropArgumentsToMatch dropping unused trailing arguments}.
* <li>Argument lists are padded out by {@linkplain #dropArgumentsToMatch(MethodHandle, int, List, int) dropping unused trailing arguments}.
* </ol>
* <p>
* <em>Final observations.</em><ol type="a">
@ -4697,7 +4697,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* }</pre></blockquote>
* Note that the parameter type lists {@code (V...)} and {@code (A...)} have been expanded
* to their full length, even though individual clause functions may neglect to take them all.
* As noted above, missing parameters are filled in as if by {@link #dropArgumentsToMatch}.
* As noted above, missing parameters are filled in as if by {@link #dropArgumentsToMatch(MethodHandle, int, List, int)}.
*
* @apiNote Example:
* <blockquote><pre>{@code

View File

@ -1826,7 +1826,7 @@ public abstract class VarHandle {
* value associated with method name (indicating the method
* name does not correspond to a {@code VarHandle}
* signature-polymorphic method name).
* @see #methodName
* @see #methodName()
*/
public static AccessMode valueFromMethodName(String methodName) {
AccessMode am = methodNameToAccessMode.get(methodName);

View File

@ -47,7 +47,8 @@ import jdk.internal.module.ModuleTarget;
/**
* A configuration that is the result of <a href="package-summary.html#resolution">
* resolution</a> or resolution with <a href="#service-binding">service binding</a>.
* resolution</a> or resolution with
* <a href="{@docRoot}/java/lang/module/Configuration.html#service-binding">service binding</a>.
*
* <p> A configuration encapsulates the <em>readability graph</em> that is the
* output of resolution. A readability graph is a directed graph whose vertices
@ -421,7 +422,7 @@ public final class Configuration {
* resolve} except that the graph of resolved modules is augmented
* with modules induced by the service-use dependence relation. </p>
*
* <p id="service-binding"> More specifically, the root modules are
* <p><a id="service-binding"></a>More specifically, the root modules are
* resolved as if by calling {@code resolve}. The resolved modules, and
* all modules in the parent configurations, with {@link ModuleDescriptor#uses()
* service dependences} are then examined. All modules found by the given
@ -520,7 +521,7 @@ public final class Configuration {
/**
* Finds a resolved module in this configuration, or if not in this
* configuration, the {@linkplain #parents parent} configurations.
* configuration, the {@linkplain #parents() parent} configurations.
* Finding a module in parent configurations is equivalent to invoking
* {@code findModule} on each parent, in search order, until the module
* is found or all parents have been searched. In a <em>tree of

View File

@ -1331,7 +1331,7 @@ public class ModuleDescriptor
/**
* <p> Returns {@code true} if this is an open module. </p>
*
* <p> This method is equivalent to testing if the set of {@link #modifiers
* <p> This method is equivalent to testing if the set of {@link #modifiers()
* modifiers} contains the {@link Modifier#OPEN OPEN} modifier. </p>
*
* @return {@code true} if this is an open module
@ -1343,7 +1343,7 @@ public class ModuleDescriptor
/**
* <p> Returns {@code true} if this is an automatic module. </p>
*
* <p> This method is equivalent to testing if the set of {@link #modifiers
* <p> This method is equivalent to testing if the set of {@link #modifiers()
* modifiers} contains the {@link Modifier#OPEN AUTOMATIC} modifier. </p>
*
* @return {@code true} if this is an automatic module
@ -1689,7 +1689,7 @@ public class ModuleDescriptor
* @return This builder
*
* @throws IllegalStateException
* If the {@link Exports#source package} is already declared as
* If the {@link Exports#source() package} is already declared as
* exported or this builder is for an automatic module
*/
public Builder exports(Exports e) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2017, 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
@ -531,7 +531,6 @@ public abstract class URLStreamHandler {
* @param ref the reference.
* @exception SecurityException if the protocol handler of the URL is
* different from this one
* @see java.net.URL#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)
* @since 1.3
*/
protected void setURL(URL u, String protocol, String host, int port,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, 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,7 +45,7 @@ import sun.nio.ch.Interruptible;
* invoked, these methods should be used within a
* {@code try}&nbsp;...&nbsp;{@code finally} block:
*
* <blockquote><pre>
* <blockquote><pre id="be">
* boolean completed = false;
* try {
* begin();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, 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,7 +45,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* invoked, these methods should be used within a
* {@code try}&nbsp;...&nbsp;{@code finally} block:
*
* <blockquote><pre>
* <blockquote><pre id="be">
* try {
* begin();
* // Perform blocking I/O operation here

View File

@ -50,7 +50,7 @@ import jdk.internal.misc.VM;
* machine. If the process of loading or initializing the default provider fails
* then an unspecified error is thrown.
*
* <p> The first invocation of the {@link FileSystemProvider#installedProviders
* <p> The first invocation of the {@link FileSystemProvider#installedProviders()
* installedProviders} method, by way of invoking any of the {@code
* newFileSystem} methods defined by this class, locates and loads all
* installed file system providers. Installed providers are loaded using the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2017, 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
@ -48,7 +48,7 @@ import java.util.*;
* {@link AclEntryPermission permissions}
* </p></li>
*
* <li><p> The {@link #flags flags} component is a set of {@link AclEntryFlag
* <li><p> The {@link #flags() flags} component is a set of {@link AclEntryFlag
* flags} to indicate how entries are inherited and propagated </p></li>
* </ol>
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, 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
@ -85,7 +85,8 @@ public final class PKCS12Attribute implements KeyStore.Entry.Attribute {
// Validate value
int length = value.length();
String[] values;
if (value.charAt(0) == '[' && value.charAt(length - 1) == ']') {
if (length > 1 &&
value.charAt(0) == '[' && value.charAt(length - 1) == ']') {
values = value.substring(1, length - 1).split(", ");
} else {
values = new String[]{ value };

View File

@ -1399,7 +1399,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
/**
* Sets the week definition parameters to the values given by
* {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek} that are
* used to determine the <a href="Calendar.html#First_Week">first
* used to determine the <a href="Calendar.html#first_week">first
* week</a> of a year. The parameters given by this method have
* precedence over the default values given by the
* {@linkplain #setLocale(Locale) locale}.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -171,10 +171,10 @@ public interface Collection<E> extends Iterable<E> {
* element
* @throws ClassCastException if the type of the specified element
* is incompatible with this collection
* (<a href="#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
* collection does not permit null elements
* (<a href="#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean contains(Object o);
@ -301,10 +301,10 @@ public interface Collection<E> extends Iterable<E> {
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the type of the specified element
* is incompatible with this collection
* (<a href="#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
* collection does not permit null elements
* (<a href="#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws UnsupportedOperationException if the {@code remove} operation
* is not supported by this collection
*/
@ -323,11 +323,11 @@ public interface Collection<E> extends Iterable<E> {
* @throws ClassCastException if the types of one or more elements
* in the specified collection are incompatible with this
* collection
* (<a href="#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified collection contains one
* or more null elements and this collection does not permit null
* elements
* (<a href="#optional-restrictions">optional</a>),
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>),
* or if the specified collection is null.
* @see #contains(Object)
*/
@ -373,11 +373,11 @@ public interface Collection<E> extends Iterable<E> {
* @throws ClassCastException if the types of one or more elements
* in this collection are incompatible with the specified
* collection
* (<a href="#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if this collection contains one or more
* null elements and the specified collection does not support
* null elements
* (<a href="#optional-restrictions">optional</a>),
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>),
* or if the specified collection is null
* @see #remove(Object)
* @see #contains(Object)
@ -432,11 +432,11 @@ public interface Collection<E> extends Iterable<E> {
* @throws ClassCastException if the types of one or more elements
* in this collection are incompatible with the specified
* collection
* (<a href="#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if this collection contains one or more
* null elements and the specified collection does not permit null
* elements
* (<a href="#optional-restrictions">optional</a>),
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>),
* or if the specified collection is null
* @see #remove(Object)
* @see #contains(Object)

View File

@ -49,7 +49,9 @@ import java.security.ProtectionDomain;
* and termination methods surrounding the main task processing loop.
* If you do create such a subclass, you will also need to supply a
* custom {@link ForkJoinPool.ForkJoinWorkerThreadFactory} to
* {@linkplain ForkJoinPool#ForkJoinPool use it} in a {@code ForkJoinPool}.
* {@linkplain ForkJoinPool#ForkJoinPool(int, ForkJoinWorkerThreadFactory,
* UncaughtExceptionHandler, boolean, int, int, int, Predicate, long, TimeUnit)
* use it} in a {@code ForkJoinPool}.
*
* @since 1.7
* @author Doug Lea

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2017, 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
@ -37,7 +37,7 @@
* <ul>
* <li><b>Info-ZIP file format</b> - The JAR format is based on the Info-ZIP
* file format. See
* <a href="../zip/package-summary.html#package_description">java.util.zip
* <a href="../zip/package-summary.html#package.description">java.util.zip
* package description.</a> <p>
* In JAR files, all file names must be encoded in the UTF-8 encoding.
* <li><a href="{@docRoot}/../specs/jar/jar.html">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, 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
@ -415,7 +415,7 @@
* elements -- but a properly constructed reduce operation is inherently
* parallelizable, so long as the function(s) used to process the elements
* are <a href="package-summary.html#Associativity">associative</a> and
* <a href="package-summary.html#NonInterfering">stateless</a>.
* <a href="package-summary.html#Statelessness">stateless</a>.
* For example, given a stream of numbers for which we want to find the sum, we
* can write:
* <pre>{@code

View File

@ -30,7 +30,7 @@ package java.util.zip;
* popular ZLIB compression library. The ZLIB compression library was
* initially developed as part of the PNG graphics standard and is not
* protected by patents. It is fully described in the specifications at
* the <a href="package-summary.html#package_description">java.util.zip
* the <a href="package-summary.html#package.description">java.util.zip
* package description</a>.
*
* <p>The following code fragment demonstrates a trivial compression

View File

@ -30,7 +30,7 @@ package java.util.zip;
* popular ZLIB compression library. The ZLIB compression library was
* initially developed as part of the PNG graphics standard and is not
* protected by patents. It is fully described in the specifications at
* the <a href="package-summary.html#package_description">java.util.zip
* the <a href="package-summary.html#package.description">java.util.zip
* package description</a>.
*
* <p>The following code fragment demonstrates a trivial compression

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, 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
@ -307,11 +307,7 @@ public class KerberosTicket implements Destroyable, Refreshable,
this.flags = new boolean[NUM_FLAGS];
}
if (this.flags[RENEWABLE_TICKET_FLAG]) {
if (renewTill == null) {
throw new IllegalArgumentException("The renewable period "
+ "end time cannot be null for renewable tickets.");
}
if (this.flags[RENEWABLE_TICKET_FLAG] && renewTill != null) {
this.renewTill = new Date(renewTill.getTime());
}
@ -579,6 +575,12 @@ public class KerberosTicket implements Destroyable, Refreshable,
if (!isRenewable()) {
throw new RefreshFailedException("This ticket is not renewable");
}
if (getRenewTill() == null) {
// Renewable ticket without renew-till. Illegal and ignored.
return;
}
if (System.currentTimeMillis() > getRenewTill().getTime()) {
throw new RefreshFailedException("This ticket is past "
+ "its last renewal time.");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ import sun.security.krb5.internal.*;
import sun.security.krb5.internal.crypto.*;
import java.io.IOException;
import java.net.UnknownHostException;
import java.time.Instant;
/**
* This class encapsulates a Kerberos TGS-REQ that is sent from the
@ -285,7 +286,12 @@ public class KrbTgsReq {
throws IOException, KrbException, UnknownHostException {
KerberosTime req_till = null;
if (till == null) {
req_till = new KerberosTime(0);
String d = Config.getInstance().get("libdefaults", "ticket_lifetime");
if (d != null) {
req_till = new KerberosTime(Instant.now().plusSeconds(Config.duration(d)));
} else {
req_till = new KerberosTime(0); // Choose KDC maximum allowed
}
} else {
req_till = till;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, 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
@ -994,6 +994,10 @@ public class Krb5LoginModule implements LoginModule {
if (!creds.isRenewable())
throw new RefreshFailedException("This ticket" +
" is not renewable");
if (creds.getRenewTill() == null) {
// Renewable ticket without renew-till. Illegal and ignored.
return creds;
}
if (System.currentTimeMillis() > cred.getRenewTill().getTime())
throw new RefreshFailedException("This ticket is past "
+ "its last renewal time.");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, 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
@ -27,10 +27,9 @@
* @summary JSR 292: Cannot create more than 16 instances of an anonymous class
* @modules java.base/jdk.internal.misc
* java.management
* @library /lib/testlibrary
* @library /test/lib
* @author Robert Field
* @compile -XDignore.symbol.file ManyNewInstanceAnonTest.java
* @build jdk.testlibrary.*
* @run main ClassFileInstaller ManyNewInstanceAnonTest
* @run main/othervm -Xbootclasspath/a:. -Xverify:all ManyNewInstanceAnonTest
* @run main/othervm -Xbootclasspath/a:. -Xverify:all -Dsun.reflection.noInflation=true ManyNewInstanceAnonTest

View File

@ -1,56 +0,0 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
/**
* Dump a class file for a class on the class path in the current directory
*/
public class ClassFileInstaller {
/**
* @param args The names of the classes to dump
* @throws Exception
*/
public static void main(String... args) throws Exception {
for (String arg : args) {
ClassLoader cl = ClassFileInstaller.class.getClassLoader();
// Convert dotted class name to a path to a class file
String pathName = arg.replace('.', '/').concat(".class");
InputStream is = cl.getResourceAsStream(pathName);
// Create the class file's package directory
Path p = Paths.get(pathName);
Path parent = p.getParent();
if (parent != null) {
Files.createDirectories(parent);
}
// Create the class file
Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,8 +30,6 @@ import java.lang.reflect.Method;
import java.security.SecureRandom;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAmount;
import java.time.temporal.TemporalUnit;
import java.util.*;
import java.util.concurrent.*;
@ -734,7 +732,7 @@ public class KDC {
if (till == null) {
throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO
} else if (till.isZero()) {
till = new KerberosTime(new Date().getTime() + 1000 * 3600 * 11);
till = new KerberosTime(new Date().getTime() + 1000 * DEFAULT_LIFETIME);
}
boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1];
@ -811,6 +809,18 @@ public class KDC {
}
bFlags[Krb5.TKT_OPTS_INITIAL] = true;
KerberosTime renewTill = etp.renewTill;
if (renewTill != null && body.kdcOptions.get(KDCOptions.RENEW)) {
// till should never pass renewTill
if (till.greaterThan(renewTill)) {
till = renewTill;
}
if (System.getProperty("test.set.null.renew") != null) {
// Testing 8186576, see NullRenewUntil.java.
renewTill = null;
}
}
TicketFlags tFlags = new TicketFlags(bFlags);
EncTicketPart enc = new EncTicketPart(
tFlags,
@ -819,7 +829,7 @@ public class KDC {
new TransitedEncoding(1, new byte[0]), // TODO
new KerberosTime(new Date()),
body.from,
till, etp.renewTill,
till, renewTill,
body.addresses != null ? body.addresses
: etp.caddr,
null);
@ -844,7 +854,7 @@ public class KDC {
tFlags,
new KerberosTime(new Date()),
body.from,
till, etp.renewTill,
till, renewTill,
service,
body.addresses
);

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8186576
* @summary KerberosTicket does not properly handle renewable tickets
* at the end of their lifetime
* @library /test/lib
* @compile -XDignore.symbol.file NullRenewUntil.java
* @run main/othervm -Dtest.set.null.renew NullRenewUntil
*/
import jdk.test.lib.Asserts;
import sun.security.krb5.Config;
import javax.security.auth.kerberos.KerberosTicket;
public class NullRenewUntil {
public static void main(String[] args) throws Exception {
OneKDC kdc = new OneKDC(null);
KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
"ticket_lifetime = 10s",
"renew_lifetime = 11s");
Config.refresh();
KerberosTicket ticket = Context
.fromUserPass(OneKDC.USER, OneKDC.PASS, false).s()
.getPrivateCredentials(KerberosTicket.class).iterator().next();
System.out.println(ticket);
Asserts.assertTrue(ticket.getRenewTill() != null, ticket.toString());
Thread.sleep(2000);
ticket.refresh();
System.out.println(ticket);
Asserts.assertTrue(ticket.getRenewTill() == null, ticket.toString());
Thread.sleep(2000);
ticket.refresh();
System.out.println(ticket);
}
}

View File

@ -0,0 +1,69 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8173181
* @summary KeyStore regression due to default keystore being changed to PKCS12
*/
import java.io.*;
import java.security.KeyStore;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
/**
* Test that a PKCS12 keystore entry can be created with an empty alias name.
*/
public class EmptyAlias {
private static final String DIR = System.getProperty("test.src", ".");
private static final String CERT = DIR + "/trusted.pem";
private static final String EMPTY_ALIAS = "";
public static void main(String[] args) throws Exception {
KeyStore keystore = KeyStore.getInstance("PKCS12");
keystore.load(null, null);
keystore.setCertificateEntry(EMPTY_ALIAS, loadCertificate(CERT));
KeyStore.Entry entry = keystore.getEntry(EMPTY_ALIAS, null);
if (entry == null) {
throw new Exception(
"Error retrieving keystore entry using its (empty) alias");
}
System.out.println("OK");
}
private static Certificate loadCertificate(String certFile)
throws Exception {
X509Certificate cert = null;
try (FileInputStream certStream = new FileInputStream(certFile)) {
CertificateFactory factory =
CertificateFactory.getInstance("X.509");
return factory.generateCertificate(certStream);
}
}
}