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

ServerEnvironment.isDevelopment throws NPE if property "sun.java.command" does not exist #774

Closed
mdietrichstein opened this issue Sep 10, 2015 · 3 comments
Milestone

Comments

@mdietrichstein
Copy link

The title says it all. ServerEnvironment.isDevelopment throws an NPE when System.getProperty("sun.java.command") returns null.

This happens for example if I attempt to start a java application as a service via Apache Jsvc.

changing

String command = System.getProperty("sun.java.command");
return command.startsWith(INTELLIJ_MAIN) && !command.contains(INTELLIJ_JUNIT) ? "true" : null;

to

String command = System.getProperty("sun.java.command");
return command != null && command.startsWith(INTELLIJ_MAIN) && !command.contains(INTELLIJ_JUNIT) ? "true" : null;

should fix the problem.

This bug is easily reproducible by executing

Properties props = System.getProperties();
props.remove("sun.java.command");
System.setProperties(props);

before calling ServerConfig.builder()

If anyone needs a workaround, passing the missing property to jsvc bypasses the problem: /usr/bin/jsvc -Dsun.java.command=my.made.up.command ...

@danveloper
Copy link
Member

What JVM are you using?

@mdietrichstein
Copy link
Author

Oracle jdk on debian jessie:

> java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

> uname -a
Linux debian-jessie 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 GNU/Linux

The problem only occurs when I start the app via jsvc. It runs just fine when I start it on the same machine directly via java instead of jsvc.

This is really just a minor issue since a easy workaround exists, but I guess fixing it in 1.0 would still be nice :)

@ldaley
Copy link
Member

ldaley commented Sep 10, 2015

Thanks for the report. We'll get this fixed and issue another RC :)

@ldaley ldaley added this to the release-1.0.0-rc-4 milestone Sep 10, 2015
@ldaley ldaley closed this as completed in f2c8b52 Sep 11, 2015
@ldaley ldaley modified the milestones: release-1.0.0, release-1.0.0-rc-4 Sep 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants