elharo commented on a change in pull request #10: fix a number of small
warnings and formatting issues
URL: https://github.com/apache/maven-shared-utils/pull/10#discussion_r383222606
##########
File path: src/test/java/org/apache/maven/shared/utils/ExpandTest.java
##########
@@ -326,11 +326,11 @@ private void verifyExpandedFileAndContent( File
targetDir, String expectedConten
assertNotNull( expandedFile );
- java.util.Scanner scanner = new java.util.Scanner( expandedFile
).useDelimiter( "\n" );
- String text = scanner.next();
-
- assertThat( "expanded file content must match"
- , text
- , is( expectedContent ) );
+ try (Scanner base = new Scanner( expandedFile );
+ Scanner scanner = base.useDelimiter( "\n" ) )
Review comment:
This was an interesting corner case I'd not encountered before and it took a
while to figure out. It cures a warning about failure to close the first
scanner in try-with-resources block. Though looking at it now I see another way
to approach this.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services