NullPointerException in plugin manager when HTTP_PROXY value is not a URL.
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 88
Description
Reported here: https://discuss.elastic.co/t/cant-install-x-pack-for-logstash-6-0/104733/6
Reproducing:
Set `http_proxy` to any word.
```
% http_proxy="something" bin/logstash-plugin install x-pack
Unhandled Java exception: java.lang.NullPointerException
java.lang.NullPointerException: null
put at java/util/Hashtable.java:459
setProperty at java/util/Properties.java:166
setProperty at java/lang/System.java:796
invoke at java/lang/reflect/Method.java:498
invokeDirectWithExceptionHandling at org/jruby/javasupport/JavaMethod.java:468
invokeStaticDirect at org/jruby/javasupport/JavaMethod.java:370
apply_env_proxy_settings at /home/jls/build/logstash-6.0.0-rc1/lib/pluginmanager/proxy_support.rb:40
configure_proxy at /home/jls/build/logstash-6.0.0-rc1/lib/pluginmanager/proxy_support.rb:71
at /home/jls/build/logstash-6.0.0-rc1/lib/pluginmanager/main.rb:26
runInterpreter at org/jruby/Ruby.java:845
runInterpreter at org/jruby/Ruby.java:849
runNormally at org/jruby/Ruby.java:752
runNormally at org/jruby/Ruby.java:765
runFromMain at org/jruby/Ruby.java:578
doRunFromMain at org/jruby/Main.java:417
internalRun at org/jruby/Main.java:305
run at org/jruby/Main.java:232
main at org/jruby/Main.java:204
```
Cause:
We assume the http proxy env vars are valid URLs. Maybe they are not always?
Either way, if this is invalid, we should not throw NPE. Instead, we should give the user an actionable error message.
Contributor guide
Research direction
Start with lib/pluginmanager/proxy_support.rb at apply_env_proxy_settings (line 40) and configure_proxy (line 71), reached by bin/logstash-plugin install x-pack. Reproduce with http_proxy="something" and trace how the invalid value reaches the Java system-property call. Done means the command reports an actionable invalid-proxy error instead of raising a NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, ruby
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100