Skip to content

Conversation

@vfraga
Copy link
Collaborator

@vfraga vfraga commented Mar 14, 2022

In order to avoid too many PRs, I've addressed all comments that had small fixes (1 to 10 lines of code) in a single PR.

Changes:

  • Suppress Spotbugs errors (They weren't showing up before moving plugin to flight-jdbc-driver module only).
  • Moved changes in java/pom.xml to java/flight/flight-jdbc-driver/pom.xml. [link]
  • Added some missing exception messages. [link 1] [link 2]
  • Documented Holder classes (used in the Accessors). [link]
  • Changed timeZone == null behavior to use UTC instead of system default. [link]
  • Changed BitVector getObjectClass() to Boolean.class. [link]
  • Changed URL acceptance error messages. [link 1] [link 2]
  • Changed ArrowFlightJdbcDriver#createVersion() to not use break. [link]
  • Add suppressed exceptions for allocator.close() in ArrowFlightConnection. [link]
  • Removed ExceptionTemplateThrower class to a private method. [link]
  • Refactored FlightStreamQueueTest to use ErrorCollector properly. [link]

@vfraga vfraga added the enhancement New feature or request label Mar 14, 2022
@vfraga vfraga self-assigned this Mar 14, 2022
Copy link
Owner

Choose a reason for hiding this comment

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

Why this annotation? What was the error that FindBugs reported?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

EI: May expose internal representation by returning reference to mutable object (EI_EXPOSE_REP)
Returning a reference to a mutable object value stored in one of the object's fields exposes the internal representation of the object. If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Returning a new copy of the object is better approach in many situations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

EI2: May expose internal representation by incorporating reference to mutable object (EI_EXPOSE_REP2)
This code stores a reference to an externally mutable object into the internal representation of the object. If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Storing a copy of the object is better approach in many situations.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to return a mutable reference to the properties though?
Should we instead of exposing the Properties object itself, add getProperty() function? Should we return an immutable view over the Properties?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was able to make it work with copies of Properties, and with ChildAllocators for some BufferAllocators. But the rest still apply (for vectors).

@vfraga vfraga force-pushed the ratification-comments-round-1-small branch from 2d734ea to c39619c Compare March 14, 2022 14:55
@vfraga vfraga requested a review from rafael-telles March 14, 2022 15:20
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we sure this dependency doesn't show up elsewhere? If it does, let's put it in dependency management.

Copy link
Collaborator Author

@vfraga vfraga Mar 16, 2022

Choose a reason for hiding this comment

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

It isn't used. All dependencies were added here are only for flight-jdbc-driver.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This must be used elsewhere in the project. Let's make sure we use dependencyManagement appropriately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm overriding the version.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this necessary? Should we update the version generally instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It added ErrorCollector.checkThrows and assertThrows: https://github.com/junit-team/junit4/blob/HEAD/doc/ReleaseNotes4.13.md

Copy link
Collaborator

@jduo jduo Mar 22, 2022

Choose a reason for hiding this comment

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

Do you think we can express the test using the older JUnit API? I'm not sure if it's a good idea to have different components use different versions of JUnit. We should either universally update the JUnit version or universally use the older versions.

Do we have inconsistent versions of JUnit elsewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right. JUnit 4 is only defined in java/pom.xml to keep running older tests; which also makes me think about maybe starting using JUnit 5 in the future? Not sure about what the implications where when the project started.
I made a simple assertThrows based on JUnit's, which made building with 4.12 possible again.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a more appropriate package for this annotation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All SpotBugs/FindBugs annotations are from this package: https://spotbugs.readthedocs.io/en/latest/annotations.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We solved by using an XML filter instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

getResourceAsStream returns null if the path isn't found. Suggest we throw something more helpful if we get that (this will probably be an NPE)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Copy link
Collaborator

@jduo jduo Mar 14, 2022

Choose a reason for hiding this comment

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

In these two error messages, can we also mention the expected format for the URI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@vfraga vfraga force-pushed the ratification-comments-round-1-small branch from 4c93d34 to 8118dee Compare March 21, 2022 21:45
Copy link
Owner

Choose a reason for hiding this comment

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

Lets remove all @SupressFBWarnings annotations and declare suppresions on a separate .xml file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@vfraga vfraga force-pushed the ratification-comments-round-1-small branch from 672c28f to f7e2857 Compare March 22, 2022 16:39
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't this happen automatically because it's a ClassRule?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right. Removed it.

@vfraga vfraga force-pushed the ratification-comments-round-1-small branch from 13d4e76 to 2d00d23 Compare March 23, 2022 13:24
@vfraga vfraga force-pushed the ratification-comments-round-1-small branch from 2d00d23 to b4afb45 Compare March 23, 2022 17:13
@vfraga vfraga merged commit b72e65c into flight-jdbc-driver Mar 23, 2022
vfraga added a commit that referenced this pull request Mar 29, 2022
* Address all ratification comments with small fixes

* Small fixes

* Revert small changes

* Add more exception messages

* Remove ExceptionTemplateThrower

* Change UnsupportedOperationException to SQLException

* Address all ratification comments with small fixes

* Fix failing tests

* Address to James' review

* Removed some suppressions by creating newChildAllocators

* Fix CONNECTION_STRING_EXPECTED

* nit on CONNECTION_STRING_EXPECTED

* Address more review comments

* nit on holder comment

* Remove FindBugs annotations

* Fix rebase issues

* Downgraded JUnit version back to what is defined in java/pom.xml

* Remove JUnit 5 usage

* Fix import order

* Format rebased commit

* nit: add final
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants