camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Babak Vahdat <babak.vah...@swissonline.ch>
Subject About the commit for CAMEL-6689 http://git-wip-us.apache.org/repos/asf/camel/diff/405c74a2
Date Fri, 22 Nov 2013 12:12:14 GMT
Hi,

Probably instead of duplicating the SAME logic (having an exception
handling) 4 times again and again inside this class we could write a tiny
'private static' utility for this, something like:

private static String decode(String uri) {
    try {
        // try to decode as the uri may contain %20 for spaces etc
        return URLDecoder.decode(uri, "UTF-8");
    } catch (Exception e) {
        LOG.debug("Could not decode the URI [" + uri + "]. This exception
will be ignored.", e);
        return uri;
    }
}

And then reuse the SAME logic as easy as:

uri = decode(uri);

Also if we intend to swallow an exception, maybe we should at least log
this @ debug level so the user has an idea about why decoding went wrong
(e.g. when UTF-32 encoding is in use).

Babak




Mime
View raw message