Address all JDBC ratification comments with small fixes #1#14
Address all JDBC ratification comments with small fixes #1#14vfraga merged 21 commits intoflight-jdbc-driverfrom
Conversation
There was a problem hiding this comment.
Why this annotation? What was the error that FindBugs reported?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I was able to make it work with copies of Properties, and with ChildAllocators for some BufferAllocators. But the rest still apply (for vectors).
.../org/apache/arrow/driver/jdbc/accessor/impl/numeric/ArrowFlightJdbcFloat4VectorAccessor.java
Outdated
Show resolved
Hide resolved
2d734ea to
c39619c
Compare
There was a problem hiding this comment.
Are we sure this dependency doesn't show up elsewhere? If it does, let's put it in dependency management.
There was a problem hiding this comment.
It isn't used. All dependencies were added here are only for flight-jdbc-driver.
There was a problem hiding this comment.
This must be used elsewhere in the project. Let's make sure we use dependencyManagement appropriately.
There was a problem hiding this comment.
I'm overriding the version.
There was a problem hiding this comment.
Why is this necessary? Should we update the version generally instead?
There was a problem hiding this comment.
It added ErrorCollector.checkThrows and assertThrows: https://github.com/junit-team/junit4/blob/HEAD/doc/ReleaseNotes4.13.md
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Is there a more appropriate package for this annotation?
There was a problem hiding this comment.
All SpotBugs/FindBugs annotations are from this package: https://spotbugs.readthedocs.io/en/latest/annotations.html
There was a problem hiding this comment.
We solved by using an XML filter instead.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
In these two error messages, can we also mention the expected format for the URI?
4c93d34 to
8118dee
Compare
There was a problem hiding this comment.
Lets remove all @SupressFBWarnings annotations and declare suppresions on a separate .xml file
672c28f to
f7e2857
Compare
There was a problem hiding this comment.
Doesn't this happen automatically because it's a ClassRule?
There was a problem hiding this comment.
You're right. Removed it.
13d4e76 to
2d00d23
Compare
2d00d23 to
b4afb45
Compare
* 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
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:
java/pom.xmltojava/flight/flight-jdbc-driver/pom.xml. [link]timeZone == nullbehavior to use UTC instead of system default. [link]getObjectClass()toBoolean.class. [link]ArrowFlightJdbcDriver#createVersion()to not usebreak. [link]allocator.close()in ArrowFlightConnection. [link]