From a55e645bfec5ec3ee896be72063da6c61fb80f1a Mon Sep 17 00:00:00 2001 From: srowen Date: Wed, 2 Feb 2011 13:55:44 +0000 Subject: [PATCH] Issue 706 user-suggested patch for trimming bad whitespace on URI git-svn-id: https://zxing.googlecode.com/svn/trunk@1712 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- core/src/com/google/zxing/client/result/URIParsedResult.java | 1 + core/src/com/google/zxing/client/result/URIResultParser.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/core/src/com/google/zxing/client/result/URIParsedResult.java b/core/src/com/google/zxing/client/result/URIParsedResult.java index 6931c455e..2b69ae6f7 100644 --- a/core/src/com/google/zxing/client/result/URIParsedResult.java +++ b/core/src/com/google/zxing/client/result/URIParsedResult.java @@ -79,6 +79,7 @@ public final class URIParsedResult extends ParsedResult { * the protocol. */ private static String massageURI(String uri) { + uri = uri.trim(); int protocolEnd = uri.indexOf(':'); if (protocolEnd < 0) { // No protocol, assume http diff --git a/core/src/com/google/zxing/client/result/URIResultParser.java b/core/src/com/google/zxing/client/result/URIResultParser.java index 5b2c24b2e..6d72dc62d 100644 --- a/core/src/com/google/zxing/client/result/URIResultParser.java +++ b/core/src/com/google/zxing/client/result/URIResultParser.java @@ -34,6 +34,9 @@ final class URIResultParser extends ResultParser { if (rawText != null && rawText.startsWith("URL:")) { rawText = rawText.substring(4); } + if (rawText != null) { + rawText = rawText.trim(); + } if (!isBasicallyValidURI(rawText)) { return null; }