Class DefaultEncodingDetector

  • All Implemented Interfaces:
    Detector, Priorities, org.apache.bcel.classfile.Visitor

    public class DefaultEncodingDetector
    extends OpcodeStackDetector

    Finds invocations of JDK methods that rely on the default platform encoding.

    If a Java application assumes that the default platform encoding is acceptable, the app's behaviour will vary from platform to platform. In particular, conversions between byte[] and java.lang.String (in either direction) may yield inconsistent results. To ensure Java code is portable, the desired encoding should be specified explicitly wherever such a conversion takes place.

    This FindBugs pattern detects invocations of Java Class Library methods and constructors that are known to use the default platform encoding.

    Author:
    Robin Fernandes