NHN Cloud Meetup 編集部
			NHN Cloudの技術ナレッジやお得なイベント情報を発信していきます			
		2015.11.30
1,333

at java.lang.Throwable.fillInStackTrace(Throwable.java:-1) at java.lang.Throwable.fillInStackTrace(Throwable.java:782) - locked <0x6c> (a sun.misc.CEStreamExhausted) at java.lang.Throwable.<init>(Throwable.java:250) at java.lang.Exception.<init>(Exception.java:54) at java.io.IOException.<init>(IOException.java:47) at sun.misc.CEStreamExhausted.<init>(CEStreamExhausted.java:30) at sun.misc.BASE64Decoder.decodeAtom(BASE64Decoder.java:117) at sun.misc.CharacterDecoder.decodeBuffer(CharacterDecoder.java:163) at sun.misc.CharacterDecoder.decodeBuffer(CharacterDecoder.java:194)
解決策
@Override 
public synchronized Throwable fillInStackTrace() {
  return this;
}
public class CustomException extends RuntimeException {
    public static final CustomException INVALID_NICKNAME = new CustomException(ResponseType.INVALID_NICKNAME);
    public static final CustomException INVALID_PARAMETER = new CustomException(ResponseType.INVALID_PARAMETER);
    public static final CustomException INVALID_TOKEN = new CustomException(ResponseType.INVALID_TOKEN);
    //省略
}
if (StringUtils.isBlank(parameter)) {
    throw WebtoonCoreException.INVALID_PARAMETER;
}
exceptionとともにloggingも適切に使用するとパフォーマンスの面で役立つことでしょう。