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

Challenges running java.util.logging.Logger.getLogger in JPF #341

Open
copumpkin opened this issue Sep 8, 2022 · 2 comments
Open

Challenges running java.util.logging.Logger.getLogger in JPF #341

copumpkin opened this issue Sep 8, 2022 · 2 comments
Labels
bug first issue Good issue for first commit

Comments

@copumpkin
Copy link

copumpkin commented Sep 8, 2022

I have this super minimal reproduction:

public class Input {
  public static void main(String[] args) {
    System.out.println("-------- In main!");

    java.util.logging.Logger.getLogger("blah");
  }
}

I'm running it against the java-10-gradle branch (a816054) and the first thing I get when calling that is:

gov.nasa.jpf.vm.NoUncaughtExceptionsProperty
java.lang.NoSuchMethodException: Calling java.lang.Thread.<init>(Ljava/lang/ThreadGroup;Ljava/lang/Runnable;Ljava/lang/String;JZ)V
	at java.util.logging.LogManager$Cleaner.<init>(LogManager.java:261)
	at java.util.logging.LogManager.<init>(LogManager.java:301)
	at java.util.logging.LogManager.<init>(LogManager.java:294)
	at java.util.logging.LogManager$1.run(LogManager.java:248)
	at java.util.logging.LogManager$1.run(LogManager.java:223)
	at java.security.AccessController.doPrivileged(AccessController.java:34)
	at java.util.logging.LogManager.<clinit>(LogManager.java:223)
	at java.util.logging.Logger.demandLogger(Logger.java:648)
	at java.util.logging.Logger.getLogger(Logger.java:717)
	at java.util.logging.Logger.getLogger(Logger.java:701)
	at Input.main(Input.java:5)

So I added an extra method with an (ignored) boolean to here:

public Thread (ThreadGroup group, Runnable target, String name) {
this(group, target, name, 0L);
}

I then ran into a similar issue from java.security.AccessController and added another dummy overload there.

That got me past the initial issue, but now I'm stuck here:

gov.nasa.jpf.vm.NoUncaughtExceptionsProperty
java.lang.UnsatisfiedLinkError: cannot find native jdk.internal.misc.VM.initializeFromArchive
	at jdk.internal.misc.VM.initializeFromArchive(gov.nasa.jpf.vm.JPF_jdk_internal_misc_VM)
	at java.util.ImmutableCollections$SetN.<clinit>(ImmutableCollections.java:583)
	at java.util.Set.of(Set.java:502)
	at java.nio.file.spi.FileSystemProvider.<clinit>(FileSystemProvider.java:428)
	at sun.nio.fs.DefaultFileSystemProvider.<clinit>(DefaultFileSystemProvider.java:35)
	at java.nio.file.FileSystems.getDefault(FileSystems.java:185)
	at java.nio.file.Path.of(Path.java:147)
	at java.nio.file.Paths.get(Paths.java:69)
	at java.util.logging.LogManager.getConfigurationFileName(LogManager.java:1389)
	at java.util.logging.LogManager.readConfiguration(LogManager.java:1375)
	at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:445)
	at java.util.logging.LogManager$2.run(LogManager.java:394)
	at java.security.AccessController.doPrivileged(AccessController.java:39)
	at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:382)
	at java.util.logging.LogManager.getLogManager(LogManager.java:430)
	at java.util.logging.Logger.demandLogger(Logger.java:648)
	at java.util.logging.Logger.getLogger(Logger.java:717)
	at java.util.logging.Logger.getLogger(Logger.java:701)
	at Input.main(Input.java:5)

Which doesn't seem to be as easy to fix as the two above. Anyone have hints for how to get past this?

@quadhier
Copy link
Collaborator

Considering that JDK's implementation of logging API involves interactions with the module system which JPF doesn't fully support yet and core functions of Logger are easy to simulate, creating a model class for java.util.logging.Logger might be a good choice to support logging API.

@quadhier quadhier added the bug label Jul 28, 2023
@cyrille-artho cyrille-artho added the first issue Good issue for first commit label Jul 31, 2023
@Rohan-here
Copy link

is somebody working on this? I would like to pick it up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug first issue Good issue for first commit
Projects
None yet
Development

No branches or pull requests

4 participants