Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
robm-openjdk committed May 31, 2022
2 parents 8142081 + 87375b4 commit adc4997
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 12 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/submit.yml
Expand Up @@ -10,7 +10,7 @@ on:
platforms:
description: "Platform(s) to execute on"
required: true
default: "Linux additional (hotspot only), Linux x64, Linux x86, Windows aarch64, Windows x64, macOS x64"
default: "Linux additional (hotspot only), Linux x64, Linux x86, Windows aarch64, Windows x64, macOS x64, macOS aarch64"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -78,7 +78,10 @@ jobs:
FEATURE=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_FEATURE }}
INTERIM=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_INTERIM }}
UPDATE=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_UPDATE }}
if [ "x${UPDATE}" != "x0" ]; then
PATCH=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_PATCH }}
if [ "x${PATCH}" != "x0" ]; then
V=${FEATURE}.${INTERIM}.${UPDATE}.${PATCH}
elif [ "x${UPDATE}" != "x0" ]; then
V=${FEATURE}.${INTERIM}.${UPDATE}
elif [ "x${INTERIM}" != "x0" ]; then
V={FEATURE}.${INTERIM}
Expand Down
12 changes: 9 additions & 3 deletions src/java.base/share/classes/sun/nio/fs/PollingWatchService.java
Expand Up @@ -61,6 +61,11 @@
class PollingWatchService
extends AbstractWatchService
{
// Wait between polling thread creation and first poll (seconds)
private static final int POLLING_INIT_DELAY = 1;
// Default time between polls (seconds)
private static final int DEFAULT_POLLING_INTERVAL = 2;

// map of registrations
private final Map<Object, PollingWatchKey> map = new HashMap<>();

Expand Down Expand Up @@ -115,7 +120,7 @@ WatchKey register(final Path path,
throw new IllegalArgumentException("No events to register");

// Extended modifiers may be used to specify the sensitivity level
int sensitivity = 10;
int sensitivity = DEFAULT_POLLING_INTERVAL;
if (modifiers.length > 0) {
for (WatchEvent.Modifier modifier: modifiers) {
if (modifier == null)
Expand Down Expand Up @@ -247,6 +252,7 @@ void update(long lastModified, int tickCount) {
* directory and queue keys when entries are added, modified, or deleted.
*/
private class PollingWatchKey extends AbstractWatchKey {

private final Object fileKey;

// current event set
Expand Down Expand Up @@ -305,10 +311,10 @@ void enable(Set<? extends WatchEvent.Kind<?>> events, long period) {
// update the events
this.events = events;

// create the periodic task
// create the periodic task with initialDelay set to the specified constant
Runnable thunk = new Runnable() { public void run() { poll(); }};
this.poller = scheduledExecutor
.scheduleAtFixedRate(thunk, period, period, TimeUnit.SECONDS);
.scheduleAtFixedRate(thunk, POLLING_INIT_DELAY, period, TimeUnit.SECONDS);
}
}

Expand Down
@@ -1,10 +1,12 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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.
* 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
Expand Down
@@ -1,9 +1,11 @@
; Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
; Copyright (c) 1997, 2022, 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.
; 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
Expand Down
1 change: 1 addition & 0 deletions src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
Expand Up @@ -796,6 +796,7 @@ invoker_completeInvokeRequest(jthread thread)
(void)outStream_writeObjectTag(env, &out, exc);
(void)outStream_writeObjectRef(env, &out, exc);
outStream_sendReply(&out);
outStream_destroy(&out);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java
Expand Up @@ -151,9 +151,9 @@ class ZipFileSystem extends FileSystem {
this.forceEnd64 = isTrue(env, "forceZIP64End");
this.defaultCompressionMethod = getDefaultCompressionMethod(env);
this.supportPosix = isTrue(env, PROPERTY_POSIX);
this.defaultOwner = initOwner(zfpath, env);
this.defaultGroup = initGroup(zfpath, env);
this.defaultPermissions = initPermissions(env);
this.defaultOwner = supportPosix ? initOwner(zfpath, env) : null;
this.defaultGroup = supportPosix ? initGroup(zfpath, env) : null;
this.defaultPermissions = supportPosix ? initPermissions(env) : null;
this.supportedFileAttributeViews = supportPosix ?
Set.of("basic", "posix", "zip") : Set.of("basic", "zip");
if (Files.notExists(zfpath)) {
Expand Down
2 changes: 2 additions & 0 deletions test/jdk/ProblemList.txt
Expand Up @@ -676,6 +676,8 @@ sun/security/provider/PolicyParser/ExtDirsChange.java 8039280 generic-
sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java 8277970 linux-all,macosx-x64

sun/security/ssl/X509TrustManagerImpl/Symantec/Distrust.java 8287109 generic-all

############################################################################

# jdk_sound
Expand Down
135 changes: 135 additions & 0 deletions test/jdk/tools/jmod/hashes/HashesOrderTest.java
@@ -0,0 +1,135 @@
/*
* Copyright (c) 2022, Huawei Technologies Co., Ltd. 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 8240903
* @summary Test consistency of moduleHashes attribute between builds
* @library /test/lib
* @run testng HashesOrderTest
*/

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.spi.ToolProvider;
import java.util.stream.Collectors;

import jdk.test.lib.compiler.ModuleInfoMaker;

import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;

public class HashesOrderTest {
private ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
.orElseThrow(() ->
new RuntimeException("jmod tool not found")
);

private String DATE = "2021-01-06T14:36:00+02:00";
private int NUM_MODULES = 64;
private Path mods;
private Path lib1;
private Path lib2;
private ModuleInfoMaker builder;

@Test
public void test() throws Exception {
mods = Path.of("mods");
lib1 = Path.of("lib1");
lib2 = Path.of("lib2");
builder = new ModuleInfoMaker(Path.of("src"));

Files.createDirectories(mods);
Files.createDirectories(lib1);
Files.createDirectories(lib2);

makeModule("ma");
String moduleName;
for (int i = 0; i < NUM_MODULES; i++) {
moduleName = "m" + i + "b";
makeModule(moduleName, "ma");
makeJmod(moduleName, lib1);
makeJmod(moduleName, lib2);
}
makeJmod("ma", lib1, "--module-path", lib1.toString(),
"--hash-modules", ".*");
Path jmod1 = lib1.resolve("ma.jmod");

makeJmod("ma", lib2, "--module-path", lib2.toString(),
"--hash-modules", ".*");
Path jmod2 = lib2.resolve("ma.jmod");

assertEquals(Files.mismatch(jmod1, jmod2), -1);
}

private void makeModule(String mn, String... deps)
throws IOException
{
StringBuilder sb = new StringBuilder();
sb.append("module ")
.append(mn)
.append(" {")
.append("\n");
Arrays.stream(deps)
.forEach(req -> {
sb.append(" requires ");
sb.append(req)
.append(";\n");
});
sb.append("}\n");
builder.writeJavaFiles(mn, sb.toString());
builder.compile(mn, mods);
}

private void makeJmod(String moduleName, Path libName, String... options) {
Path mclasses = mods.resolve(moduleName);
Path outfile = libName.resolve(moduleName + ".jmod");
List<String> args = new ArrayList<>();
args.add("create");
Collections.addAll(args, options);
Collections.addAll(args, "--date", DATE);
Collections.addAll(args, "--class-path", mclasses.toString(),
outfile.toString());

runJmod(args);
}

private void runJmod(List<String> args) {
runJmod(args.toArray(new String[args.size()]));
}

private void runJmod(String... args) {
int rc = JMOD_TOOL.run(System.out, System.out, args);
System.out.println("jmod " + Arrays.stream(args).collect(Collectors.joining(" ")));
if (rc != 0) {
throw new AssertionError("jmod failed: rc = " + rc);
}
}

}

0 comments on commit adc4997

Please sign in to comment.