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

NPE in windows parsing command line string -e ... #4717

Closed
mkristian opened this issue Jul 14, 2017 · 4 comments
Closed

NPE in windows parsing command line string -e ... #4717

mkristian opened this issue Jul 14, 2017 · 4 comments

Comments

@mkristian
Copy link
Member

Environment

Provide at least:

  • JRuby 9.1.12
  • windows 10

the following commandline execution runs into a NPE:

The ' characters around the executable and arguments are
--
  | not part of the command.
  | [INFO] Setting environment variable: JARS_SKIP=true
  | [INFO] Setting environment variable: GEM_PATH=C:\work\va-ctt\rails\rails_komet\target\rubygems
  | [INFO] Setting environment variable: GEM_HOME=C:\work\va-ctt\rails\rails_komet\target\rubygems
  | [INFO] Setting environment variable: JBUNDLE_SKIP=true
  | [INFO] Execute:Java13CommandLauncher: Executing 'C:\languages\Java\jdk1.8.0_121\jre\bin\java.exe' with arguments:
  | '-cp'
  | 'C:\Users\cshupp\.m2\repository\org\jruby\jruby-complete\9.1.12.0\jruby-complete-9.1.12.0.jar'
  | '-Xmx4000m'
  | '-Djava.awt.headless=true'
  | '-Xbootclasspath/a:C:\Users\cshupp\.m2\repository\org\jruby\jruby-complete\9.1.12.0\jruby-complete-9.1.12.0.jar'
  | 'org.jruby.Main'
  | '-I'
  | 'C:\work\va-ctt\rails\rails_komet\lib'
  | '-e'
  | 'require 'jruby/commands'; JRuby::Commands.generate_dir_info 'C:\work\va-ctt\rails\rails_komet\target\rubygems' if JRuby::Commands.respond_to? :generate_dir_info'
  | '--'
  |  
  | The ' characters around the executable and arguments are
  | not part of the command.
  | [INFO] Unhandled Java exception: java.lang.NullPointerException
  | [INFO] java.lang.NullPointerException: null
  | [INFO]        getBytes at java/lang/String.java:940
  | [INFO]          <init> at org/jruby/ast/SymbolNode.java:54
  | [INFO]        asSymbol at org/jruby/parser/ParserSupport.java:975
  | [INFO]         execute at org/jruby/parser/RubyParser.java:4286
  | [INFO]         yyparse at org/jruby/parser/RubyParser.java:1677
  | [INFO]         yyparse at org/jruby/parser/RubyParser.java:1568
  | [INFO]           parse at org/jruby/parser/RubyParser.java:5365
  | [INFO]           parse at org/jruby/parser/Parser.java:128
  | [INFO]           parse at org/jruby/parser/Parser.java:105
  | [INFO]     parseInline at org/jruby/Ruby.java:2685
  | [INFO]   parseFromMain at org/jruby/Ruby.java:608
  | [INFO]     runFromMain at org/jruby/Ruby.java:556
  | [INFO]   doRunFromMain at org/jruby/Main.java:417
  | [INFO]     internalRun at org/jruby/Main.java:305
  | [INFO]             run at org/jruby/Main.java:232
  | [INFO]            main at org/jruby/Main.java:204

the code clearly points to this commit 01cd84d and since the encoding.getCharset() can be null the errors pops up.

this is related to torquebox/jruby9-maven-plugins#4
and actually #4716 could be related as well (windows + NPE but it is a wild speculation).

once it is clear what charset to use if encoding.getCharset() the fix is easy.

@mkristian
Copy link
Member Author

the original report from torquebox/jruby9-maven-plugins#4
says: started to fail on 9.1.9 but 9.1.8 works.

@enebo enebo added this to the JRuby 9.1.13.0 milestone Aug 17, 2017
@enebo
Copy link
Member

enebo commented Aug 23, 2017

Can anyone tell me a simple way to reproduce this. I have never used maven-plugins directly in any way? @mkristian we use this for one of our tests right? Perhaps I can just try running on windows and see an NPE show up?

@mkristian
Copy link
Member Author

@enebo I am pretty sure you can just execute the command with the -e "require jruby/commands'; JRuby::Commands.generate_dir_info 'some-dir'" from the command-line. the maven plugin just spawns a jvm (actuall via an ant-task) with the given args. a reduced version is:

java.exe -cp jruby-complete-9.1.12.0.jar -e 
  "require 'jruby/commands'; JRuby::Commands.generate_dir_info 'C:\work\some_dir'"

on jruby build we do use the old maven-jruby-plugins not this one. but if the command line does not show the error then I can setup a test-case with this maven plugin.

@headius headius closed this as completed Aug 25, 2017
@headius
Copy link
Member

headius commented Aug 25, 2017

Fixed by changes for #4716.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants