I am opening a HttpURLConnection from within a managed bean to post to an external service. When I make the call to HttpUrlConnection.getInputStream() I am getting the following warning:
WARN [Parameters] Parameters : Invalid chunk ignored
Everything processes just fine, but I'd like to keep a bunch of those warnings out of our logs. What is causing this warning and how might I stop it from occurring?
Here is the relevant code:
@ManagedBean
@SessionScoped
public class MyController {
private void doStuff() {
...
URL url = new URL(externalServiceUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(postData);
wr.flush();
InputStream is = conn.getInputStream(); // Warning logged after this line
...
}
}
This warning can occur whenever the query string contains an invalid chunk, such as a request parameter without a name:
name1=value1&=value2&name3=value3
or in your particular case, a & in the beginning (essentially, the first chunk is invalid):
&name1=value1&name2=value2&name3=value3
As per the comments, you seem to be HTTP-connecting to a service which runs on the same container and logs to the same logfile. This warning is actually coming from the service container itself, not from HttpURLConnection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With