You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/02/23 16:23:25 UTC
[GitHub] [maven-shared-utils] elharo opened a new pull request #10: fix a
number of small warnings and formatting issues
elharo opened a new pull request #10: fix a number of small warnings and formatting issues
URL: https://github.com/apache/maven-shared-utils/pull/10
@Tibor17
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] rfscholte commented on a change in pull
request #10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
rfscholte 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_r396001077
##########
File path: src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
##########
@@ -128,33 +127,37 @@ public void givenASingleQuoteMarkInArgument_whenExecutingCode_thenExitCode0Retur
}
@Test
- public void givenASingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkIsNotEscaped() throws Exception
+ public void givenASingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkIsNotEscaped()
+ throws Exception
{
final String command = "echo \"let's go\"";
- final String[] expected = new String[]{"echo", "let's go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let's go" };
+ assertCmdLineArgs( expected, command );
}
@Test
- public void givenAnEscapedDoubleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped() throws Exception
+ public void givenAnEscapedDoubleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped()
+ throws Exception
{
final String command = "echo \"let\\\"s go\"";
- final String[] expected = new String[]{"echo", "let\\\"s go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let\\\"s go" };
+ assertCmdLineArgs( expected, command );
}
@Test
- public void givenAnEscapedSingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped() throws Exception
+ public void givenAnEscapedSingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped()
+ throws Exception
{
final String command = "echo \"let\\\'s go\"";
- final String[] expected = new String[]{"echo", "let\\\'s go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let\\\'s go" };
Review comment:
this commit is now just about code formatting, so I'm fine with this change
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] Tibor17 commented on a change in pull request
#10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
Tibor17 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_r383140634
##########
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:
Having two local variables with the same reference is not necessary. It is the flow design:
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#useDelimiter(java.util.regex.Pattern)
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] rfscholte commented on a change in pull
request #10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
rfscholte 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_r396011336
##########
File path: src/test/java/org/apache/maven/shared/utils/io/SymlinkTestSetup.java
##########
@@ -36,18 +37,18 @@ public static File createStandardSymlinkTestDir( File root )
srcDir.mkdirs();
File target = new File( srcDir, "targetDir" );
target.mkdirs();
- write( new File( target, "targetFile.txt" ), "a regular File payload" );
+ write( new File( target, "targetFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
File aRegularDir = new File( srcDir, "aRegularDir" );
aRegularDir.mkdirs();
- write( new File( aRegularDir, "aRegularFile.txt" ), "a regular File payload" );
+ write( new File( aRegularDir, "aRegularFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
File dirOnTheOutside = new File( root, "dirOnTheOutside" );
dirOnTheOutside.mkdirs();
- write( new File( dirOnTheOutside, "FileInDirOnTheOutside.txt" ), "a file in dir on the outside" );
- write( new File( root, "onTheOutside.txt" ), "A file on the outside" );
- write( new File( srcDir, "fileR.txt" ), "FileR payload" );
- write( new File( srcDir, "fileW.txt" ), "FileW payload" );
- write( new File( srcDir, "fileX.txt" ), "FileX payload" );
+ write( new File( dirOnTheOutside, "FileInDirOnTheOutside.txt" ), "a file in dir on the outside", StandardCharsets.UTF_8 );
Review comment:
Ah, I see, so leave it like 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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] Tibor17 commented on a change in pull request
#10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
Tibor17 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_r383159654
##########
File path: src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
##########
@@ -128,33 +127,37 @@ public void givenASingleQuoteMarkInArgument_whenExecutingCode_thenExitCode0Retur
}
@Test
- public void givenASingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkIsNotEscaped() throws Exception
+ public void givenASingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkIsNotEscaped()
+ throws Exception
{
final String command = "echo \"let's go\"";
- final String[] expected = new String[]{"echo", "let's go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let's go" };
+ assertCmdLineArgs( expected, command );
}
@Test
- public void givenAnEscapedDoubleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped() throws Exception
+ public void givenAnEscapedDoubleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped()
+ throws Exception
{
final String command = "echo \"let\\\"s go\"";
- final String[] expected = new String[]{"echo", "let\\\"s go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let\\\"s go" };
+ assertCmdLineArgs( expected, command );
}
@Test
- public void givenAnEscapedSingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped() throws Exception
+ public void givenAnEscapedSingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped()
+ throws Exception
{
final String command = "echo \"let\\\'s go\"";
- final String[] expected = new String[]{"echo", "let\\\'s go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let\\\'s go" };
Review comment:
Why people use `final` in such trivial cases?
I understand the reason to use it due to anonymous classes or immutable objects.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] elharo merged pull request #10: fix a number
of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
elharo merged pull request #10: fix a number of small warnings and formatting issues
URL: https://github.com/apache/maven-shared-utils/pull/10
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] rfscholte commented on a change in pull
request #10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
rfscholte 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_r396001551
##########
File path: src/test/java/org/apache/maven/shared/utils/io/SymlinkTestSetup.java
##########
@@ -36,18 +37,18 @@ public static File createStandardSymlinkTestDir( File root )
srcDir.mkdirs();
File target = new File( srcDir, "targetDir" );
target.mkdirs();
- write( new File( target, "targetFile.txt" ), "a regular File payload" );
+ write( new File( target, "targetFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
File aRegularDir = new File( srcDir, "aRegularDir" );
aRegularDir.mkdirs();
- write( new File( aRegularDir, "aRegularFile.txt" ), "a regular File payload" );
+ write( new File( aRegularDir, "aRegularFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
File dirOnTheOutside = new File( root, "dirOnTheOutside" );
dirOnTheOutside.mkdirs();
- write( new File( dirOnTheOutside, "FileInDirOnTheOutside.txt" ), "a file in dir on the outside" );
- write( new File( root, "onTheOutside.txt" ), "A file on the outside" );
- write( new File( srcDir, "fileR.txt" ), "FileR payload" );
- write( new File( srcDir, "fileW.txt" ), "FileW payload" );
- write( new File( srcDir, "fileX.txt" ), "FileX payload" );
+ write( new File( dirOnTheOutside, "FileInDirOnTheOutside.txt" ), "a file in dir on the outside", StandardCharsets.UTF_8 );
Review comment:
Looking at this, if you need to change the method call anyway, I'd rewrite it using https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#write-java.nio.file.Path-java.lang.Iterable-java.nio.file.OpenOption...-
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] rfscholte commented on issue #10: fix a number
of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
rfscholte commented on issue #10: fix a number of small warnings and formatting issues
URL: https://github.com/apache/maven-shared-utils/pull/10#issuecomment-602056345
which branch at https://builds.apache.org/job/maven-box/job/maven-shared-utils/ ?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] elharo commented on a change in pull request
#10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] rfscholte commented on a change in pull
request #10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
rfscholte 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_r396001319
##########
File path: src/test/java/org/apache/maven/shared/utils/io/SymlinkTestSetup.java
##########
@@ -36,18 +37,18 @@ public static File createStandardSymlinkTestDir( File root )
srcDir.mkdirs();
File target = new File( srcDir, "targetDir" );
target.mkdirs();
- write( new File( target, "targetFile.txt" ), "a regular File payload" );
+ write( new File( target, "targetFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
Review comment:
In general I prefer static imports for methods. For a constant like this I like to include the classname.
It is a matter of taste, I'm fine with this change.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] Tibor17 commented on a change in pull request
#10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
Tibor17 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_r383158682
##########
File path: src/test/java/org/apache/maven/shared/utils/io/SymlinkTestSetup.java
##########
@@ -36,18 +37,18 @@ public static File createStandardSymlinkTestDir( File root )
srcDir.mkdirs();
File target = new File( srcDir, "targetDir" );
target.mkdirs();
- write( new File( target, "targetFile.txt" ), "a regular File payload" );
+ write( new File( target, "targetFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
Review comment:
I like using static imports because here in this example the line would be short in GH without breaking to new line.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] elharo commented on a change in pull request
#10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
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_r386473859
##########
File path: src/test/java/org/apache/maven/shared/utils/io/SymlinkTestSetup.java
##########
@@ -36,18 +37,18 @@ public static File createStandardSymlinkTestDir( File root )
srcDir.mkdirs();
File target = new File( srcDir, "targetDir" );
target.mkdirs();
- write( new File( target, "targetFile.txt" ), "a regular File payload" );
+ write( new File( target, "targetFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
Review comment:
It's still within Maven's (rather large) 120 character column standard. I like to know where my constants are coming from. This isn't the only UTF_8 constant floating around in Javaland.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] elharo commented on a change in pull request
#10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
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_r383223309
##########
File path: src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
##########
@@ -128,33 +127,37 @@ public void givenASingleQuoteMarkInArgument_whenExecutingCode_thenExitCode0Retur
}
@Test
- public void givenASingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkIsNotEscaped() throws Exception
+ public void givenASingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkIsNotEscaped()
+ throws Exception
{
final String command = "echo \"let's go\"";
- final String[] expected = new String[]{"echo", "let's go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let's go" };
+ assertCmdLineArgs( expected, command );
}
@Test
- public void givenAnEscapedDoubleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped() throws Exception
+ public void givenAnEscapedDoubleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped()
+ throws Exception
{
final String command = "echo \"let\\\"s go\"";
- final String[] expected = new String[]{"echo", "let\\\"s go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let\\\"s go" };
+ assertCmdLineArgs( expected, command );
}
@Test
- public void givenAnEscapedSingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped() throws Exception
+ public void givenAnEscapedSingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped()
+ throws Exception
{
final String command = "echo \"let\\\'s go\"";
- final String[] expected = new String[]{"echo", "let\\\'s go"};
- assertCmdLineArgs(expected, command);
+ final String[] expected = new String[] { "echo", "let\\\'s go" };
Review comment:
The world seems split on this one. I personally avoid final on local variables except where it's required, mostly because that's my employer's style; but in Maven I've been trying to leave `final` in place where it already exists to avoid excess churn.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] elharo commented on a change in pull request
#10: fix a number of small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
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_r396002620
##########
File path: src/test/java/org/apache/maven/shared/utils/io/SymlinkTestSetup.java
##########
@@ -36,18 +37,18 @@ public static File createStandardSymlinkTestDir( File root )
srcDir.mkdirs();
File target = new File( srcDir, "targetDir" );
target.mkdirs();
- write( new File( target, "targetFile.txt" ), "a regular File payload" );
+ write( new File( target, "targetFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
File aRegularDir = new File( srcDir, "aRegularDir" );
aRegularDir.mkdirs();
- write( new File( aRegularDir, "aRegularFile.txt" ), "a regular File payload" );
+ write( new File( aRegularDir, "aRegularFile.txt" ), "a regular File payload", StandardCharsets.UTF_8 );
File dirOnTheOutside = new File( root, "dirOnTheOutside" );
dirOnTheOutside.mkdirs();
- write( new File( dirOnTheOutside, "FileInDirOnTheOutside.txt" ), "a file in dir on the outside" );
- write( new File( root, "onTheOutside.txt" ), "A file on the outside" );
- write( new File( srcDir, "fileR.txt" ), "FileR payload" );
- write( new File( srcDir, "fileW.txt" ), "FileW payload" );
- write( new File( srcDir, "fileX.txt" ), "FileX payload" );
+ write( new File( dirOnTheOutside, "FileInDirOnTheOutside.txt" ), "a file in dir on the outside", StandardCharsets.UTF_8 );
Review comment:
That method's new in Java 1.8, and we want to support Java 1.7.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [maven-shared-utils] elharo commented on issue #10: fix a number of
small warnings and formatting issues
Posted by GitBox <gi...@apache.org>.
elharo commented on issue #10: fix a number of small warnings and formatting issues
URL: https://github.com/apache/maven-shared-utils/pull/10#issuecomment-602058421
https://builds.apache.org/job/maven-box/job/maven-shared-utils/job/xml2/
On Sat, Mar 21, 2020 at 10:54 AM Robert Scholte <no...@github.com>
wrote:
> which branch at
> https://builds.apache.org/job/maven-box/job/maven-shared-utils/ ?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/maven-shared-utils/pull/10#issuecomment-602056345>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAHVP2EQ5QGW4MRUUEVFQV3RITILBANCNFSM4KZ34H3A>
> .
>
--
Elliotte Rusty Harold
elharo@macfaq.com
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services