Skip to content

Commit

Permalink
Merge master HEAD into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <[email protected]>
  • Loading branch information
j9build committed Sep 20, 2024
2 parents 688656a + 43e2f95 commit ca99744
Show file tree
Hide file tree
Showing 37 changed files with 2,028 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h2>What should I use instead of <code>Thread.stop</code>?</h2>
communication of the stop-request, the variable must be
<code>volatile</code> (or access to the variable must be
synchronized).</p>
<p>For example, suppose your applet contains the following
<p>For example, suppose your application contains the following
<code>start</code>, <code>stop</code> and <code>run</code>
methods:</p>
<pre>
Expand All @@ -92,12 +92,12 @@ <h2>What should I use instead of <code>Thread.stop</code>?</h2>
Thread.sleep(interval);
} catch (InterruptedException e){
}
repaint();
blink();
}
}
</pre>
You can avoid the use of <code>Thread.stop</code> by replacing the
applet's <code>stop</code> and <code>run</code> methods with:
application's <code>stop</code> and <code>run</code> methods with:
<pre>
private volatile Thread blinker;

Expand All @@ -112,7 +112,7 @@ <h2>What should I use instead of <code>Thread.stop</code>?</h2>
Thread.sleep(interval);
} catch (InterruptedException e){
}
repaint();
blink();
}
}
</pre>
Expand Down
5 changes: 2 additions & 3 deletions src/java.base/share/classes/java/net/HttpURLConnection.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, 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
Expand Down Expand Up @@ -373,8 +373,7 @@ protected HttpURLConnection (URL u) {

/**
* Sets whether HTTP redirects (requests with response code 3xx) should
* be automatically followed by this class. True by default. Applets
* cannot change this variable.
* be automatically followed by this class. True by default.
* <p>
* If there is a security manager, this method first calls
* the security manager's {@code checkSetFactory} method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, 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
Expand Down Expand Up @@ -36,7 +36,7 @@
* zero-argument constructor and some number of associated charset
* implementation classes. Charset providers may be installed in an instance
* of the Java platform as extensions. Providers may also be made available by
* adding them to the applet or application class path or by some other
* adding them to the application class path or by some other
* platform-specific means. Charset providers are looked up via the current
* thread's {@link java.lang.Thread#getContextClassLoader() context class
* loader}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, 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
Expand Down Expand Up @@ -39,7 +39,7 @@
* The {@code CryptoPermission} class extends the
* {@code java.security.Permission} class. A
* {@code CryptoPermission} object is used to represent
* the ability of an application/applet to use certain
* the ability of an application to use certain
* algorithms with certain key sizes and other
* restrictions in certain environments.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, 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
Expand Down Expand Up @@ -43,7 +43,7 @@
* of which are <i>key recovery</i>, <i>key weakening</i>, and
* <i>key escrow</i>.
*
* <p>Applications or applets that use an exemption mechanism may be granted
* <p>Applications that use an exemption mechanism may be granted
* stronger encryption capabilities than those which don't.
*
* @since 1.4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, 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
Expand Down Expand Up @@ -36,9 +36,9 @@
* The JCE security manager.
*
* <p>The JCE security manager is responsible for determining the maximum
* allowable cryptographic strength for a given applet/application, for a given
* allowable cryptographic strength for a given application, for a given
* algorithm, by consulting the configured jurisdiction policy files and
* the cryptographic permissions bundled with the applet/application.
* the cryptographic permissions bundled with the application.
*
* @author Jan Luehe
*
Expand Down Expand Up @@ -85,7 +85,7 @@ private JceSecurityManager() {

/**
* Returns the maximum allowable crypto strength for the given
* applet/application, for the given algorithm.
* application, for the given algorithm.
*/
CryptoPermission getCryptoPermission(String theAlg) {

Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/javax/net/SocketFactory.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, 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
Expand Down Expand Up @@ -60,7 +60,7 @@
*
* <P> Factory classes are specified by environment-specific configuration
* mechanisms. For example, the <em>getDefault</em> method could return
* a factory that was appropriate for a particular user or applet, and a
* a factory that was appropriate for a particular application, and a
* framework could use a factory customized to its own purposes.
*
* @since 1.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,6 @@ && isKeyStoreRelated(command)
}
}

KeyStore cakstore = buildTrustedCerts();
// -trustcacerts can be specified on -importcert, -printcert or -printcrl.
// Reset it so that warnings on CA cert will remain for other command.
if (command != IMPORTCERT && command != PRINTCERT
Expand All @@ -1141,6 +1140,7 @@ && isKeyStoreRelated(command)
}

if (trustcacerts) {
KeyStore cakstore = buildTrustedCerts();
if (cakstore != null) {
caks = cakstore;
} else {
Expand Down
7 changes: 6 additions & 1 deletion src/java.base/share/native/libjli/java.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,14 +1548,18 @@ ParseArguments(int *pargc, char ***pargv,
JLI_ShowMessage("%s %s", _launcher_name, GetFullVersion());
return JNI_FALSE;
} else if (JLI_StrCmp(arg, "-verbosegc") == 0) {
JLI_ReportErrorMessage(ARG_DEPRECATED, "-verbosegc");
AddOption("-verbose:gc", NULL);
} else if (JLI_StrCmp(arg, "-debug") == 0) {
JLI_ReportErrorMessage(ARG_DEPRECATED, "-debug");
} else if (JLI_StrCmp(arg, "-noclassgc") == 0) {
JLI_ReportErrorMessage(ARG_DEPRECATED, "-noclassgc");
AddOption("-Xnoclassgc", NULL);
} else if (JLI_StrCmp(arg, "-verify") == 0) {
JLI_ReportErrorMessage(ARG_DEPRECATED, "-verify");
AddOption("-Xverify:all", NULL);
} else if (JLI_StrCmp(arg, "-verifyremote") == 0) {
JLI_ReportErrorMessage(ARG_DEPRECATED, "-verifyremote");
AddOption("-Xverify:remote", NULL);
} else if (JLI_StrCmp(arg, "-noverify") == 0) {
/*
Expand All @@ -1564,9 +1568,10 @@ ParseArguments(int *pargc, char ***pargv,
*/
AddOption("-Xverify:none", NULL);
} else if (JLI_StrCCmp(arg, "-ss") == 0 ||
JLI_StrCCmp(arg, "-oss") == 0 ||
JLI_StrCCmp(arg, "-ms") == 0 ||
JLI_StrCCmp(arg, "-mx") == 0) {
JLI_ReportErrorMessage("Warning: %.3s option is deprecated"
" and may be removed in a future release.", arg);
size_t tmpSize = JLI_StrLen(arg) + 6;
char *tmp = JLI_MemAlloc(tmpSize);
snprintf(tmp, tmpSize, "-X%s", arg + 1); /* skip '-' */
Expand Down
18 changes: 10 additions & 8 deletions src/java.base/windows/classes/sun/nio/fs/WindowsLinkSupport.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2024, 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
Expand Down Expand Up @@ -86,7 +86,7 @@ static String readLink(WindowsPath path) throws IOException {
x.rethrowAsIOException(path);
}
try {
return readLinkImpl(handle);
return readLinkImpl(path, handle);
} finally {
CloseHandle(handle);
}
Expand Down Expand Up @@ -297,16 +297,18 @@ static String getRealPath(WindowsPath input, boolean resolveLinks)
* Returns target of a symbolic link given the handle of an open file
* (that should be a link).
*/
private static String readLinkImpl(long handle) throws IOException {
private static String readLinkImpl(WindowsPath path, long handle)
throws IOException
{
int size = MAXIMUM_REPARSE_DATA_BUFFER_SIZE;
try (NativeBuffer buffer = NativeBuffers.getNativeBuffer(size)) {
try {
DeviceIoControlGetReparsePoint(handle, buffer.address(), size);
} catch (WindowsException x) {
// FIXME: exception doesn't have file name
String pathname = path.getPathForExceptionMessage();
if (x.lastError() == ERROR_NOT_A_REPARSE_POINT)
throw new NotLinkException(null, null, x.errorString());
x.rethrowAsIOException((String)null);
throw new NotLinkException(pathname, null, x.errorString());
x.rethrowAsIOException(pathname + ": " + x.errorString());
}

/*
Expand Down Expand Up @@ -342,8 +344,8 @@ private static String readLinkImpl(long handle) throws IOException {

int tag = (int)unsafe.getLong(buffer.address() + OFFSETOF_REPARSETAG);
if (tag != IO_REPARSE_TAG_SYMLINK) {
// FIXME: exception doesn't have file name
throw new NotLinkException(null, null, "Reparse point is not a symbolic link");
String pathname = path.getPathForExceptionMessage();
throw new NotLinkException(pathname, null, "Reparse point is not a symbolic link");
}

// get offset and length of target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ public enum SourceVersion {
* 21: pattern matching for switch and record patterns (string
* templates in preview, unnamed patterns and variables in
* preview, unnamed classes and instance main methods in preview)
* 22: Unnamed Variables & Patterns (Statements before super(...)
* in Preview)
* 22: unnamed variables & patterns (statements before super(...)
* in preview, string templates in second preview, implicitly
* declared classes and instance main methods in second preview)
* 23: no changes (primitive Types in Patterns, instanceof, and
* switch in preview, module Import Declarations in preview,
* implicitly declared classes and instance main in third
* preview, flexible constructor bodies in second preview)
* 24: tbd
*/

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* Copyright (c) 2024, 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.
*/

/* Based on source:
* public class ContendedField {
* @Contended("group1")
* public int field;
* }
*
* We change the value of "value" so it refers to an invalid CP entry
*/

class BadContendedGroupBadCPIndex {
0xCAFEBABE;
0; // minor version
65; // version
[19] { // Constant Pool
; // first element is empty
Method #2 #3; // #1 at 0x0A
class #4; // #2 at 0x0F
NameAndType #5 #6; // #3 at 0x12
Utf8 "java/lang/Object"; // #4 at 0x17
Utf8 "<init>"; // #5 at 0x2A
Utf8 "()V"; // #6 at 0x33
class #8; // #7 at 0x39
Utf8 "BadContendedGroupBadCPIndex"; // #8 at 0x3C
Utf8 "field"; // #9 at 0x4D
Utf8 "I"; // #10 at 0x55
Utf8 "RuntimeVisibleAnnotations"; // #11 at 0x59
Utf8 "Ljdk/internal/vm/annotation/Contended;"; // #12 at 0x75
Utf8 "value"; // #13 at 0x9E
Utf8 "group1"; // #14 at 0xA6
Utf8 "Code"; // #15 at 0xAF
Utf8 "LineNumberTable"; // #16 at 0xB6
Utf8 "SourceFile"; // #17 at 0xC8
Utf8 "BadContendedGroupBadCPIndex.java"; // #18 at 0xD5
} // Constant Pool

0x0021; // access [ ACC_PUBLIC ACC_SUPER ]
#7;// this_cpx
#2;// super_cpx

[0] { // Interfaces
} // Interfaces

[1] { // Fields
{ // field at 0xF5
0x0001; // access
#9; // name_index : field
#10; // descriptor_index : I
[1] { // Attributes
Attr(#11, 11) { // RuntimeVisibleAnnotations at 0xFD
[1] { // annotations
{ // annotation
#12;
[1] { // element_value_pairs
{ // element value pair
#13;
{ // element_value
's';
#1400; // Changed from #14 to #1400
} // element_value
} // element value pair
} // element_value_pairs
} // annotation
}
} // end RuntimeVisibleAnnotations
} // Attributes
}
} // Fields

[1] { // Methods
{ // method at 0x0110
0x0001; // access
#5; // name_index : <init>
#6; // descriptor_index : ()V
[1] { // Attributes
Attr(#15, 29) { // Code at 0x0118
1; // max_stack
1; // max_locals
Bytes[5]{
0x2AB70001B1;
}
[0] { // Traps
} // end Traps
[1] { // Attributes
Attr(#16, 6) { // LineNumberTable at 0x012F
[1] { // line_number_table
0 2; // at 0x013B
}
} // end LineNumberTable
} // Attributes
} // end Code
} // Attributes
}
} // Methods

[1] { // Attributes
Attr(#17, 2) { // SourceFile at 0x013D
#18;
} // end SourceFile
} // Attributes
} // end class BadContendedGroupBadCPIndex
Loading

0 comments on commit ca99744

Please sign in to comment.