[ 
https://issues.apache.org/jira/browse/NUTCH-1096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13093762#comment-13093762
 ] 

Ferdy commented on NUTCH-1096:
------------------------------

I do not have an example anymore (the corresponding url seems to be fixed).

It is easy reproducable just by analyzing/executing some test code. The 
following code 

String contentLengthString="";
if (contentLengthString != null) {
  contentLengthString = contentLengthString.trim();
  try {
    contentLength = Integer.parseInt(contentLengthString);
  } catch (NumberFormatException e) {
   e.printStackTrace();
  }
}

throws the following exception


java.lang.NumberFormatException: For input string: ""
        at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:470)
        at java.lang.Integer.parseInt(Integer.java:499)
        at ...


> Empty (not null) ContentLength results in failure of fetch
> ----------------------------------------------------------
>
>                 Key: NUTCH-1096
>                 URL: https://issues.apache.org/jira/browse/NUTCH-1096
>             Project: Nutch
>          Issue Type: Bug
>          Components: fetcher
>    Affects Versions: 1.3
>            Reporter: Ferdy
>            Priority: Minor
>             Fix For: 1.4, 2.0
>
>         Attachments: NUTCH-1096-v1.patch
>
>
> In rare occasions, servers return an empty string ContentLength, which 
> results in a fetch failure. One could argue whether the fetch is allowed to 
> proceed in these cases. I for one believe it is. (Just like the cases where 
> the header is null or not properly trimmed).
> Patch will be right up.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to