Skip to content
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

Merged
merged 1 commit into from
Dec 30, 2020
Merged

Minor Improvements #127

merged 1 commit into from
Dec 30, 2020

Conversation

arturobernalg
Copy link
Member

  • Add final
  • Unnecessary semicolon ''
  • Use StandardCharsets
  • Fix javadoc

@coveralls
Copy link

coveralls commented Dec 18, 2020

Coverage Status

Coverage decreased (-0.002%) to 98.454% when pulling 1682795 on arturobernalg:feature/minor_improvement into 8e953c0 on apache:master.

@@ -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
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"scape"?

Copy link
Member Author

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
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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."

Copy link
Member Author

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];
Copy link
Member

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.

Copy link
Member Author

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)) {
Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

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
@garydgregory garydgregory changed the title Minor Improvement Minor Improvements Dec 30, 2020
@garydgregory garydgregory merged commit d580c90 into apache:master Dec 30, 2020
asfgit pushed a commit that referenced this pull request Dec 30, 2020
@arturobernalg arturobernalg deleted the feature/minor_improvement branch January 24, 2021 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants