@@ -205,19 +205,19 @@ private void performEnhancement() {
205205 }
206206
207207 private void enhanceClass (File classFile ) {
208- getLog ().debug ("Trying to enhance class file: " + classFile );
208+ getLog ().debug (TRYING_TO_ENHANCE_CLASS_FILE . formatted ( classFile ) );
209209 try {
210210 byte [] newBytes = enhancer .enhance (
211211 determineClassName (classFile ),
212212 Files .readAllBytes (classFile .toPath ()));
213213 if (newBytes != null ) {
214214 writeByteCodeToFile (newBytes , classFile );
215- getLog ().info ("Succesfully enhanced class file: " + classFile );
215+ getLog ().info (SUCCESFULLY_ENHANCED_CLASS_FILE . formatted ( classFile ) );
216216 } else {
217- getLog ().info ("Skipping file: " + classFile );
217+ getLog ().info (SKIPPING_FILE . formatted ( classFile ) );
218218 }
219219 } catch (EnhancementException | IOException e ) {
220- getLog ().error ("An exception occurred while trying to class file: " + classFile , e );;
220+ getLog ().error (ERROR_WHILE_ENHANCING_CLASS_FILE . formatted ( classFile ) , e );;
221221 }
222222 }
223223
@@ -261,6 +261,8 @@ private boolean clearFile(File file) {
261261
262262 // info messages
263263 static final String SUCCESFULLY_CLEARED_FILE = "Succesfully cleared the contents of file: %s" ;
264+ static final String SUCCESFULLY_ENHANCED_CLASS_FILE = "Succesfully enhanced class file: %s" ;
265+ static final String SKIPPING_FILE = "Skipping file: %s" ;
264266
265267 // warning messages
266268 static final String PROBLEM_CLEARING_FILE = "Problem clearing file for writing out enhancements [ %s ]" ;
@@ -270,11 +272,13 @@ private boolean clearFile(File file) {
270272 static final String UNABLE_TO_DELETE_FILE = "Unable to delete file: %s" ;
271273 static final String ERROR_WRITING_BYTES_TO_FILE = "Error writing bytes to file : %s" ;
272274 static final String ERROR_OPENING_FILE_FOR_WRITING = "Error opening file for writing : %s" ;
275+ static final String ERROR_WHILE_ENHANCING_CLASS_FILE = "An exception occurred while trying to class file: %s" ;
273276
274277 // debug messages
275278 static final String TRYING_TO_CLEAR_FILE = "Trying to clear the contents of file: %s" ;
276279 static final String AMOUNT_BYTES_WRITTEN_TO_FILE = "%s bytes were succesfully written to file: %s" ;
277280 static final String WRITING_BYTE_CODE_TO_FILE = "Writing byte code to file: %s" ;
278281 static final String DETERMINE_CLASS_NAME_FOR_FILE = "Determining class name for file: %s" ;
282+ static final String TRYING_TO_ENHANCE_CLASS_FILE = "Trying to enhance class file: %s" ;
279283
280284}
0 commit comments