-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor Improvements #127
Minor Improvements #127
Conversation
arturobernalg
commented
Dec 18, 2020
- Add final
- Unnecessary semicolon ''
- Use StandardCharsets
- Fix javadoc
@@ -572,7 +572,7 @@ public void testGetOneLine() throws IOException { | |||
/** | |||
* Tests reusing a parser to process new string records one at a time as they are being discovered. See [CSV-110]. | |||
* | |||
* @throws IOException | |||
* @throws Exception Any exception can be thrown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not match the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
@@ -1629,6 +1629,7 @@ private CharSequence trim(final CharSequence charSequence) { | |||
* Verifies the consistency of the parameters and throws an IllegalArgumentException if necessary. | |||
* | |||
* @throws IllegalArgumentException | |||
* thrown if the delimiter is a scape character |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"scape"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed. What do you thing?=
@@ -572,7 +572,7 @@ public void testGetOneLine() throws IOException { | |||
/** | |||
* Tests reusing a parser to process new string records one at a time as they are being discovered. See [CSV-110]. | |||
* | |||
* @throws IOException | |||
* @throws IOException If something goes wrong |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well use the "standard" comment here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry Garry, but What is the standard comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturobernalg
The JRE uses "if an I/O error occurs." but I prefer "Thrown when an I/O error occurs."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, got it. changed
@@ -64,7 +64,7 @@ | |||
private static int max = 11; // skip first test | |||
|
|||
private static int num = 0; // number of elapsed times recorded | |||
private static long[] elapsedTimes = new long[max]; | |||
private static final long[] elapsedTimes = new long[max]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constants are usually in uppercase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true. changed
@@ -135,7 +136,7 @@ public void testCSVUrl(final File testFile) throws Exception { | |||
|
|||
// Now parse the file and compare against the expected results | |||
final URL resource = ClassLoader.getSystemResource("org/apache/commons/csv/CSVFileParser/" + split[0]); | |||
try (final CSVParser parser = CSVParser.parse(resource, Charset.forName("UTF-8"), format)) { | |||
try (final CSVParser parser = CSVParser.parse(resource, StandardCharsets.UTF_8, format)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one :-)
@@ -1628,7 +1628,8 @@ private CharSequence trim(final CharSequence charSequence) { | |||
/** | |||
* Verifies the consistency of the parameters and throws an IllegalArgumentException if necessary. | |||
* | |||
* @throws IllegalArgumentException | |||
* @throws IllegalArgumentException If something goes wrong |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @arturobernalg
This change does not help anyone, and it's confusing when the line above tells you when the exception would be thrown. I've updated git master for this Javadoc. Please rebase on master. TY.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Got it. Changed
@@ -427,7 +427,7 @@ public void testExcelFormat2() throws Exception { | |||
/** | |||
* Tests an exported Excel worksheet with a header row and rows that have more columns than the headers | |||
* | |||
* @throws Exception | |||
* @throws Exception Any exception can be thrown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not helpful. Tests like this one can throw Exception
as a convention instead of throwing a potentially long list of exceptions which are not useful and just clutter up the method signatures. So either we should not have a Javadoc tag or if we have one, it should carry proper and useful documentation. In this case, I think that there is nothing interesting to say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, got it. Reverted
* Add final * Unnecessary semicolon '' * Use StandardCharsets * Fix javadoc