NPE in RubyIO.fwrite(RubyString buffer) #1534

Closed
inger opened this Issue Feb 27, 2014 · 5 comments

Projects

None yet

3 participants

@inger
inger commented Feb 27, 2014

The second line of the following snippet is throwing a NPE, when System.console() is not defined, yet somehow tty_p says true (is this breaking an invariant?)

if (Platform.IS_WINDOWS && tty_p(getRuntime().getCurrentContext()).isTrue()) {
System.console().printf("%s", buffer.asJavaString());
return len;
}

This was added 5bd0798 , fixed #1198 but it breaks our client upgrades from an earlier jruby version.
Thanks for you help.

@artembilan

We (Spring IO) are observing similar issue. The latest working version is 1.7.8.
JavaDocs from System.console()
* @return The system console, if any, otherwise <tt>null</tt>

Thank you.

@enebo
Member
enebo commented Mar 3, 2014

I guess I did not consider the JVM may be started without a console and then create a process which has a tty. In this case then unfortunately, for now, we will just need to go back to old broken way when console is not available...

@enebo enebo added this to the JRuby 1.7.12 milestone Mar 3, 2014
@enebo
Member
enebo commented Mar 3, 2014

Fixed in cfee0e7 on jruby-1_7 (will be merged to master soon). So ultimately we will need a better mechanism than using console if we cannot rely on it being there....This at least is a partial fix in that you will see chars if you have a console. If not then we are back to jruby-1.7.8 behavior.

@enebo enebo closed this Mar 3, 2014
@artembilan

Thank you very much! Wouldn't you mind to provide a repository url to check your SNAPSHOT?
And which version, too, please

@enebo
Member
enebo commented Mar 3, 2014

You can download a build of this tomorrow after our nightly dist job finishes here:
http://ci.jruby.org/snapshots/1.7.x/

@ThorbenLindhauer ThorbenLindhauer added a commit to camunda/camunda-spin that referenced this issue Jul 1, 2014
@ThorbenLindhauer ThorbenLindhauer fix(test): upgrade jruby version to 1.7.13
- avoids NPE when running tests from within eclipse
- confer jruby/jruby#1534
625d344
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment