From 8118b47797db0d2bf532d050bf0894fffe5a7db1 Mon Sep 17 00:00:00 2001 From: Kenji Nagahashi Date: Mon, 7 Mar 2016 17:17:04 -0800 Subject: [PATCH] Spare NumberUtils.toInt() exception handling for common case of statusCode == "-" --- .../cdxserver/processor/DupeTimestampBestStatusFilter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wayback-cdx-server/src/main/java/org/archive/cdxserver/processor/DupeTimestampBestStatusFilter.java b/wayback-cdx-server/src/main/java/org/archive/cdxserver/processor/DupeTimestampBestStatusFilter.java index f491dceb54..16f3a72815 100644 --- a/wayback-cdx-server/src/main/java/org/archive/cdxserver/processor/DupeTimestampBestStatusFilter.java +++ b/wayback-cdx-server/src/main/java/org/archive/cdxserver/processor/DupeTimestampBestStatusFilter.java @@ -85,7 +85,8 @@ protected boolean include(CDXLine line) { String timestamp = line.getTimestamp(); timestamp = timestamp.substring(0, Math.min(timestampDedupLength, timestamp.length())); - int httpCode = NumberUtils.toInt(line.getStatusCode(), WORST_HTTP_CODE); + final String statusCode = line.getStatusCode(); + int httpCode = "-".equals(statusCode) ? WORST_HTTP_CODE : NumberUtils.toInt(statusCode, WORST_HTTP_CODE); boolean isDupe = false;