Java – warning “[parameter] parameter: invalid block ignored” published from managed bean

I am opening an httpurlconnection from a managed bean to publish to an external service When I call httpurlconnection Getinputstream() I get the following warning:

Everything is going well, but I want to remove some of these warnings from our log What caused this warning and how can I prevent it from happening?

The following are the relevant codes:

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

}

Solution

This warning occurs whenever the query string contains an invalid block, such as a request parameter without a name:

name1=value1&=value2&name3=value3

Or in your case, at the beginning (basically, the first chunk is invalid):

&name1=value1&name2=value2&name3=value3

According to the comments, it seems that you are HTTP connected to the service running on the same container and recorded to the same log file The warning actually comes from the service container itself, not from httpurlconnection

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>