Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug #3737

Closed
wants to merge 3 commits into from
Closed

Debug #3737

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.os.java.version }}
- name: Log branches
run: git branch -a
# https://github.com/actions/cache/blob/main/examples.md#java---maven
- name: Cache local Maven repository
uses: actions/cache@v3
Expand All @@ -88,9 +90,9 @@ jobs:
- name: Building code and running unit tests and basic checks
run: ./mvnw $MAVEN_ARGS install -Pjqassistant -Pdist -Pci-sources-check -DskipITs
- name: Running integration tests in the default environment
run: |
./mvnw $MAVEN_ARGS verify \
-DskipSurefireTests -Pskip-checks -Pci-rebuild \
run: >
./mvnw $MAVEN_ARGS verify
-DskipSurefireTests -Pskip-checks -Pci-rebuild
${{ github.event.pull_request.base.ref && format('-Dincremental -Dgib.referenceBranch=refs/remotes/origin/{0}', github.event.pull_request.base.ref) || '' }}
- name: Docker cleanup
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ else if ( "file".equals( codeSourceLocation.getProtocol() ) ) {
else {
// The URI points to a regular file, so hopefully an actual JAR file.
// We'll try to open a ZIP filesystem to work on the contents of the JAR file.
URI jarUri = new URI( "jar:file", null, path.toString(), null );
URI jarUri = new URI( "jar:file", null, path.toUri().getPath(), null );
tryInitJarFileSystem( jarUri );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ public void directory() throws Exception {
addSimpleClass( root );
} );

try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( dirPath.toUri().toURL() ) ) {
URL dirPathUrl = dirPath.toUri().toURL();
try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( dirPathUrl ) ) {
Class<?> classInIsolatedClassLoader = isolatedClassLoader.loadClass( SimpleClass.class.getName() );

// Check preconditions: this is the situation that we want to test.
URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation();
assertThat( location.getProtocol() ).isEqualTo( "file" );
assertThat( location.toExternalForm() ).contains( dirPath.toString() );
assertThat( location.toExternalForm() ).contains( dirPathUrl.toString() );

// Check that the JAR can be opened and that we can access other files within it
try ( CodeSource codeSource = new CodeSource( location ) ) {
Expand Down Expand Up @@ -86,13 +87,14 @@ public void jar_fileScheme() throws Exception {
addSimpleClass( root );
} );

try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( jarPath.toUri().toURL() ) ) {
URL jarPathUrl = jarPath.toUri().toURL();
try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( jarPathUrl ) ) {
Class<?> classInIsolatedClassLoader = isolatedClassLoader.loadClass( SimpleClass.class.getName() );

// Check preconditions: this is the situation that we want to test.
URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation();
assertThat( location.getProtocol() ).isEqualTo( "file" );
assertThat( location.toExternalForm() ).contains( jarPath.toString() );
assertThat( location.toExternalForm() ).contains( jarPathUrl.toString() );

// Check that the JAR can be opened and that we can access other files within it
try ( CodeSource codeSource = new CodeSource( location ) ) {
Expand Down Expand Up @@ -130,7 +132,7 @@ public void jar_jarScheme_classesInRoot() throws Exception {
URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation();
// For some reason the "jar" scheme gets replaced with "file"
assertThat( location.getProtocol() ).isEqualTo( "file" );
assertThat( location.toExternalForm() ).contains( jarPath.toString() );
assertThat( location.toExternalForm() ).contains( jarPath.toUri().toURL().toString() );

// Check that the JAR can be opened and that we can access other files within it
try ( CodeSource codeSource = new CodeSource( location ) ) {
Expand Down
Loading