private void validateFileContentMatches(File outputFile, String newFileContents) throws IOException { byte[] currentFileBytes = Files.readAllBytes(outputFile.toPath()); String currentFileContents = new String(currentFileBytes, StandardCharsets.UTF_8); String currentContentForComparison = codeComparisonTransformer.apply(currentFileContents); String newContentForComparison = codeComparisonTransformer.apply(newFileContents); if (!StringUtils.equals(currentContentForComparison, newContentForComparison)) { throw new IllegalStateException("Attempted to clobber existing file (" + outputFile + ") with a new file that has " + "different content. This may indicate forgetting to clean up old generated files " + "before running the generator?\n" + "Existing file: \n" + currentContentForComparison + "\n\n" + "New file: \n" + newContentForComparison); } } }
private void validateFileContentMatches(File outputFile, String newFileContents) throws IOException { byte[] currentFileBytes = Files.readAllBytes(outputFile.toPath()); String currentFileContents = new String(currentFileBytes, StandardCharsets.UTF_8); String currentContentForComparison = codeComparisonTransformer.apply(currentFileContents); String newContentForComparison = codeComparisonTransformer.apply(newFileContents); if (!StringUtils.equals(currentContentForComparison, newContentForComparison)) { throw new IllegalStateException("Attempted to clobber existing file (" + outputFile + ") with a new file that has " + "different content. This may indicate forgetting to clean up old generated files " + "before running the generator?\n" + "Existing file: \n" + currentContentForComparison + "\n\n" + "New file: \n" + newContentForComparison); } } }
private void validateFileContentMatches(File outputFile, String newFileContents) throws IOException { byte[] currentFileBytes = Files.readAllBytes(outputFile.toPath()); String currentFileContents = new String(currentFileBytes, StandardCharsets.UTF_8); String currentContentForComparison = codeComparisonTransformer.apply(currentFileContents); String newContentForComparison = codeComparisonTransformer.apply(newFileContents); if (!StringUtils.equals(currentContentForComparison, newContentForComparison)) { throw new IllegalStateException("Attempted to clobber existing file (" + outputFile + ") with a new file that has " + "different content. This may indicate forgetting to clean up old generated files " + "before running the generator?\n" + "Existing file: \n" + currentContentForComparison + "\n\n" + "New file: \n" + newContentForComparison); } } }
private void validateFileContentMatches(File outputFile, String newFileContents) throws IOException { byte[] currentFileBytes = Files.readAllBytes(outputFile.toPath()); String currentFileContents = new String(currentFileBytes, StandardCharsets.UTF_8); String currentContentForComparison = codeComparisonTransformer.apply(currentFileContents); String newContentForComparison = codeComparisonTransformer.apply(newFileContents); if (!StringUtils.equals(currentContentForComparison, newContentForComparison)) { throw new IllegalStateException("Attempted to clobber existing file (" + outputFile + ") with a new file that has " + "different content. This may indicate forgetting to clean up old generated files " + "before running the generator?\n" + "Existing file: \n" + currentContentForComparison + "\n\n" + "New file: \n" + newContentForComparison); } } }