RuedigerMoeller / fast-serialization

FST: fast java serialization drop in-replacement
Apache License 2.0
1.59k stars 247 forks source link

should not use "System.out.println" in release version,please! #186

Closed yuanhaoliang closed 6 years ago

yuanhaoliang commented 7 years ago

org.nustaq.serialization.FSTConfiguration#asObject

`

/**
 * convenience
 */
public Object asObject( byte b[] ) {
    try {
        return getObjectInput(b).readObject();
    } catch (Exception e) {
        System.out.println("unable to decode:" +new String(b,0,0,Math.min(b.length,100)) );
        try {
            String debug = new String(b, "UTF-8");
        } catch (UnsupportedEncodingException e1) {
            //
        }
        try {
            getObjectInput(b).readObject();
        } catch (Exception e1) {
            // debug hook
        }
        FSTUtil.<RuntimeException>rethrow(e);
    }
    return null;
}

`

It should not use 'System.out.println' to output message to the console.

I suggest that to use Log system or make a RuntimeException wrapper to contain the error message.

RuedigerMoeller commented 7 years ago

agreed ;)

RuedigerMoeller commented 7 years ago

fixed with 2.51 (contribution of cakofony)

yuanhaoliang commented 7 years ago

there is still the same in 2.52 version.

RuedigerMoeller commented 7 years ago

@yuanhaoliang could you provide a pull request resolving this without adding a logging framework using FSTLogger Api/Wrapper (part of fst) ?

RuedigerMoeller commented 6 years ago

has been fixed by @cakofony