11/*
22 * Copyright (c) 2022, Red Hat, Inc.
3+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
34 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45 *
56 * This code is free software; you can redistribute it and/or modify it
3031import java .util .Locale ;
3132import java .util .List ;
3233import java .util .ArrayList ;
34+ import java .net .URI ;
3335import java .nio .file .Paths ;
3436import java .nio .file .Path ;
3537import java .nio .file .Files ;
5456 */
5557public class TestSPISigned {
5658
57- private static final String TEST_CLASSES = System .getProperty ("test.classes" , "." );
5859 private static final String TEST_SRC = System .getProperty ("test.src" , "." );
5960
6061 private static final Path META_INF_DIR = Paths .get (TEST_SRC , "provider" , "meta" );
61- private static final Path PROVIDER_PARENT = Paths .get (TEST_CLASSES , ".." );
62- private static final Path PROVIDER_DIR = PROVIDER_PARENT .resolve ("provider" );
6362 private static final Path MODS_DIR = Paths .get ("mods" );
6463 private static final Path UNSIGNED_JAR = MODS_DIR .resolve ("unsigned-with-locale.jar" );
6564 private static final Path SIGNED_JAR = MODS_DIR .resolve ("signed-with-locale.jar" );
@@ -81,7 +80,9 @@ public static void main(String[] args) throws Throwable {
8180 // Set up signed jar with custom calendar data provider
8281 //
8382 // 1. Create jar with custom CalendarDataProvider
84- JarUtils .createJarFile (UNSIGNED_JAR , PROVIDER_DIR );
83+ var codeSource = baz .CalendarDataProviderImpl .class .getProtectionDomain ().getCodeSource ();
84+ var providerDir = Path .of (URI .create (codeSource .getLocation ().toString ()));
85+ JarUtils .createJarFile (UNSIGNED_JAR , providerDir );
8586 JarUtils .updateJarFile (UNSIGNED_JAR , META_INF_DIR );
8687 // create signer's keypair
8788 SecurityTools .keytool ("-genkeypair -keyalg RSA -keystore ks " +
0 commit comments