Fix for [HER-1495] ARCRecord throws null pointer when trying to generate a RecoverableIOException

* ARCRecord.java
    guard against bull statusBytes in exception message
This commit is contained in:
gojomo
2009-05-12 19:43:20 +00:00
parent 8de6b2a9c5
commit fb97744dfd
@@ -517,8 +517,9 @@ public class ARCRecord extends ArchiveRecord implements ARCConstants {
byte [] statusBytes = HttpParser.readRawLine(getIn());
int eolCharCount = getEolCharsCount(statusBytes);
if (eolCharCount <= 0) {
throw new RecoverableIOException("Failed to read http status where one " +
" was expected: " + new String(statusBytes));
throw new RecoverableIOException(
"Failed to read http status where one was expected: "
+ ((statusBytes == null) ? "" : new String(statusBytes)));
}
String statusLine = EncodingUtil.getString(statusBytes, 0,
statusBytes.length - eolCharCount, ARCConstants.DEFAULT_ENCODING);