amzn / amazon-pay-sdk-java

Amazon Pay Java SDK
https://pay.amazon.com/documentation
Apache License 2.0
58 stars 51 forks source link

getErrorStream() in amazon-pay-sdk-java/src/com/amazon/pay/impl/Util.java may throw NPE #16

Open stefanofornari opened 7 years ago

stefanofornari commented 7 years ago

In Util:114 the line

in = new BufferedReader(new InputStreamReader(con.getErrorStream()));

does not take into account that con.getErrorStream() may return null, in such case a NPE will be thrown.

See https://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html#getErrorStream()