elharo commented on code in PR #248: URL: https://github.com/apache/maven-archetype/pull/248#discussion_r1885681195
########## archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java: ########## @@ -1632,6 +1634,38 @@ private FileSet getUnpackagedFileSet( return createFileSet(excludes, false, filtered, group, includes, defaultEncoding); } + private String getFileCharsetEncoding(File detectedFile, String defaultEncoding) { + FileInputStream fileInputStream = null; + BufferedInputStream is = null; + try { + fileInputStream = new FileInputStream(detectedFile); + is = new BufferedInputStream(fileInputStream); + CharsetDetector detector = new CharsetDetector(); + detector.setText(is); + CharsetMatch match = detector.detect(); + return match.getName().toUpperCase(Locale.ENGLISH); + } catch (IOException e) { Review Comment: This is going the wrong way. Use try with resources ########## archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java: ########## @@ -1632,6 +1634,38 @@ private FileSet getUnpackagedFileSet( return createFileSet(excludes, false, filtered, group, includes, defaultEncoding); } + private String getFileCharsetEncoding(File detectedFile, String defaultEncoding) { + FileInputStream fileInputStream = null; + BufferedInputStream is = null; + try { Review Comment: try (InputStream in = new BufferedInputStream(new FileInputStream(...))) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org