Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning "[Parameters] Parameters : Invalid chunk ignored" when posting from a managed bean

Tags:

java

jsf

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
    ...
  }

}
like image 848
Peter Fecteau Avatar asked Sep 13 '11 20:09

Peter Fecteau


1 Answers

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.

like image 177
BalusC Avatar answered Oct 22 '22 20:10

BalusC