// get real class name
final String className = cc.className();
cfs.setExpectedClassName(className);
} catch (IOException ex) {
//@olsen: support for I18N
throw new UserException(
getI18N("enhancer.io_error_while_reading_stream"),//NOI18N
ex);
} catch (ClassFormatError ex) {
//@olsen: support for I18N
throw new UserException(
getI18N("enhancer.class_format_error"),//NOI18N
ex);
}
// enhance class
econtrol.modifyClasses();
if (env.errorCount() > 0) {
// retrieve error messages
env.getErrorWriter ().flush ();
/*
final String str = errString.getBuffer().toString();
// reset env's error writer
errString = new StringWriter();
err = new PrintWriter(errString, true);
env.setErrorWriter(err);
*/
//@olsen: support for I18N
throw new UserException(env.getLastErrorMessage ());
}
// write class
boolean changed = (cc.updated() && cc.filterRequired());
try {
if (changed)
{
env.message("writing enhanced class " + cc.userClassName()//NOI18N
+ " to output stream");//NOI18N
}
else
{
env.message("no changes on class " + cc.userClassName());
}
outByteCode.setClassName (cc.userClassName ());
final DataOutputStream dos = new DataOutputStream(outByteCode.getStream ());
cf.write(dos);
dos.flush();
} catch (IOException ex) {
//@olsen: support for I18N
throw new UserException(
getI18N("enhancer.io_error_while_writing_stream"),//NOI18N
ex);
}
return changed;
}