diff --git a/jdk/src/java.base/share/classes/java/lang/BootstrapMethodError.java b/jdk/src/java.base/share/classes/java/lang/BootstrapMethodError.java index a1509a0f32d..dbca27cb223 100644 --- a/jdk/src/java.base/share/classes/java/lang/BootstrapMethodError.java +++ b/jdk/src/java.base/share/classes/java/lang/BootstrapMethodError.java @@ -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 diff --git a/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java index d0487f21214..3af53fb7c36 100644 --- a/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java +++ b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java @@ -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 tree of layers 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}. * diff --git a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java index 7adee534b81..0b145b4e918 100644 --- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java +++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java @@ -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 null input streams. *
- * 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. *
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java index e8ec5f687c5..3d438ffbe44 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java @@ -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}. *
- * 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. *
* 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. *
- * 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}. *
* Otherwise, the call proceeds as if this method handle were first diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index 3671ab11833..5823b9cfdd1 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -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. *
- * 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}. *
* 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}. *
* 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")); *
* Final observations.
{@code
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
index 54875987c60..9f24c2907a4 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
@@ -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);
diff --git a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java
index 371620add35..042a1362dd9 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java
@@ -47,7 +47,8 @@ import jdk.internal.module.ModuleTarget;
/**
* A configuration that is the result of
- * resolution or resolution with service binding.
+ * resolution or resolution with
+ * service binding.
*
* A configuration encapsulates the readability graph 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.
*
- * More specifically, the root modules are
+ *
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 tree of
diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
index ea77af72d51..e09a59c02bd 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
@@ -1331,7 +1331,7 @@ public class ModuleDescriptor
/**
* Returns {@code true} if this is an open module.
*
- * This method is equivalent to testing if the set of {@link #modifiers
+ *
This method is equivalent to testing if the set of {@link #modifiers()
* modifiers} contains the {@link Modifier#OPEN OPEN} modifier.
*
* @return {@code true} if this is an open module
@@ -1343,7 +1343,7 @@ public class ModuleDescriptor
/**
* Returns {@code true} if this is an automatic module.
*
- * This method is equivalent to testing if the set of {@link #modifiers
+ *
This method is equivalent to testing if the set of {@link #modifiers()
* modifiers} contains the {@link Modifier#OPEN AUTOMATIC} modifier.
*
* @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) {
diff --git a/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java b/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java
index 8ce586bdcaa..5e32ab13210 100644
--- a/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java
+++ b/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java
@@ -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,
diff --git a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java
index cc82cb7a83c..8186947fadb 100644
--- a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java
+++ b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java
@@ -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} ... {@code finally} block:
*
- *
+ *
* boolean completed = false;
* try {
* begin();
diff --git a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractSelector.java b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractSelector.java
index 5d710bd832e..9aab22f4550 100644
--- a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractSelector.java
+++ b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractSelector.java
@@ -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} ... {@code finally} block:
*
- *
+ *
* try {
* begin();
* // Perform blocking I/O operation here
diff --git a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
index 2754fa39c0a..8e5db1f3b6a 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
@@ -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.
*
- * The first invocation of the {@link FileSystemProvider#installedProviders
+ *
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
diff --git a/jdk/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java b/jdk/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java
index 26818be4219..01e625aca18 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java
@@ -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}
*
The {@link #flags flags} component is a set of {@link AclEntryFlag + *
The {@link #flags() flags} component is a set of {@link AclEntryFlag * flags} to indicate how entries are inherited and propagated
* In JAR files, all file names must be encoded in the UTF-8 encoding. *
{@code
diff --git a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java
index 4c853c6c621..cff04b6cd19 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java
@@ -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 java.util.zip
+ * the java.util.zip
* package description.
*
* The following code fragment demonstrates a trivial compression
diff --git a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java
index 6fbf0ced382..5a098d0c486 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java
@@ -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 java.util.zip
+ * the java.util.zip
* package description.
*
*
The following code fragment demonstrates a trivial compression
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
index 9fb9055ab67..aa14fe6b3b1 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
@@ -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.");
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java
index a8b3404da36..3e957c900c6 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java
@@ -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;
}
diff --git a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java
index df5733b7544..96bce5446f6 100644
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java
@@ -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.");
diff --git a/jdk/test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java b/jdk/test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java
index 07f94d63508..5292a55a869 100644
--- a/jdk/test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java
+++ b/jdk/test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java
@@ -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
diff --git a/jdk/test/lib/testlibrary/ClassFileInstaller.java b/jdk/test/lib/testlibrary/ClassFileInstaller.java
deleted file mode 100644
index dd8777b1ff2..00000000000
--- a/jdk/test/lib/testlibrary/ClassFileInstaller.java
+++ /dev/null
@@ -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);
- }
- }
-}
diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java
index 633d0d05f1e..b3719bad7e8 100644
--- a/jdk/test/sun/security/krb5/auto/KDC.java
+++ b/jdk/test/sun/security/krb5/auto/KDC.java
@@ -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
);
diff --git a/jdk/test/sun/security/krb5/auto/NullRenewUntil.java b/jdk/test/sun/security/krb5/auto/NullRenewUntil.java
new file mode 100644
index 00000000000..8d3891ae7c5
--- /dev/null
+++ b/jdk/test/sun/security/krb5/auto/NullRenewUntil.java
@@ -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);
+ }
+}
diff --git a/jdk/test/sun/security/pkcs12/EmptyAlias.java b/jdk/test/sun/security/pkcs12/EmptyAlias.java
new file mode 100644
index 00000000000..23d43bc198a
--- /dev/null
+++ b/jdk/test/sun/security/pkcs12/EmptyAlias.java
@@ -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);
+ }
+ }
+}