Skip to content

IO.popen with mergeEnv containing nil value raises NullPointerException #299

Description

@samwgoldman

Given the following cgi application:

#!/usr/bin/env ruby

require "cgi"

cgi = CGI.new

cgi.out("nph" => true, "type" => "text/plain", "status" => "OK") do
  ENV["INPUT"]
end

and following test raises NullPointerException instead of printing Hello World!:

env = {
  "REQUEST_METHOD" => "GET",
  "CONTENT_LENGTH" => "0",
  "INPUT" => "Hello, World!",
  "ANYTHING_NIL" => nil
}

IO.popen([env, "./cgi.rb"], "r") do |cgi|
  puts cgi.read
end

The exception is raised on line 242 of ShellLauncher.java, presumably on e.getValue().toString().

MRI and Rubinius do not crash on this test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions