From dbac8211c342c8830baf0a48424b2769d4ec63af Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 15 Oct 2009 16:55:52 +0000 Subject: reset pos on buf reread (indexoutofboundsEx 4096) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@524 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'bkucommon') diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java index f052ce05..f60b42b3 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java @@ -312,12 +312,18 @@ public class XWWWFormUrlInputIterator implements Iterator { } else if (buf[pos] == '+') { b[off] = ' '; } else if (buf[pos] == '%') { - if (++pos == count && (count = in.read(buf)) == -1) { - throw new IOException("Invalid URL encoding."); + if (++pos == count) { + if ((count = in.read(buf)) == -1) { + throw new IOException("Invalid URL encoding."); + } + pos = 0; } int c1 = Character.digit(buf[pos], 16); - if (++pos == count && (count = in.read(buf)) == -1) { - throw new IOException("Invalid URL encoding."); + if (++pos == count) { + if ((count = in.read(buf)) == -1) { + throw new IOException("Invalid URL encoding."); + } + pos = 0; } int c2 = Character.digit(buf[pos], 16); b[off] = (byte) ((c1 << 4) | c2); -- cgit v1.2.3