Sebastian Nagel created NUTCH-1807:
--------------------------------------

             Summary: avoid methods relying on system-specific default locale / 
charset
                 Key: NUTCH-1807
                 URL: https://issues.apache.org/jira/browse/NUTCH-1807
             Project: Nutch
          Issue Type: Bug
    Affects Versions: 2.2.1, 1.8
            Reporter: Sebastian Nagel
            Priority: Minor
             Fix For: 2.4, 1.9


Many methods in Java (and libraries) used to convert Strings, Numbers, Dates 
rely on the system-specific default locale / character set. This may cause 
strange behaviour and errors impossible to reproduce on other systems, see 
[~thetaphi]'s [blog 
post|http://blog.thetaphi.de/2012/07/default-locales-default-charsets-and.html],
 and discussions in NUTCH-1693 and NUTCH-1554.

A search with the [forbidden-apis 
client|https://code.google.com/p/forbidden-apis/wiki/CliUsage] shows 120 calls 
of such methods in trunk (without test classes):
{code}
# compile Nutch before check: all tested class files
# are then located in build/ (including plugins)
% CLASSPATH=`find build/ -name '*.jar' | tr '\n' ':'`
% java -jar forbiddenapis-1.5.1.jar -d build/ -c $CLASSPATH \
      -b jdk-unsafe-1.8 -b commons-io-unsafe-2.4
{code}
It is also possible to [integrate the check into the ant 
build|https://code.google.com/p/forbidden-apis/wiki/AntUsage] (to avoid that 
"forbidden" calls slip into the code again).




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to