Minor cleanups of the JDBC code#4441
Conversation
Signed-off-by: Andres Taylor <antaylor@squareup.com>
|
@harshit-gangal if you have time to look this over, it would be much appreciated |
harshit-gangal
left a comment
There was a problem hiding this comment.
Reviewed 1 of 12 files at r1.
Reviewable status: 1 of 12 files reviewed, 2 unresolved discussions (waiting on @systay and @sougou)
java/jdbc/src/main/java/io/vitess/jdbc/VitessConnection.java, line 486 at r1 (raw file):
Quoted 13 lines of code…
* @throws SQLException */ public boolean isClosed() throws SQLException { return this.closed; } * * @param name - Property Name * @return Property Value * @throws SQLException */ public String getClientInfo(String name) throws SQLException { return null;
This is the signature of the method implemented from Connection interface.
As of now, they are not throwing SQLException. But, any reason for doing this?
java/jdbc/src/test/java/io/vitess/jdbc/ConnectionPropertiesTest.java, line 36 at r1 (raw file):
import static io.vitess.util.Constants.DEFAULT_INCLUDED_FIELDS; import static io.vitess.util.Constants.DEFAULT_TABLET_TYPE; import static org.junit.Assert.*;
explicitly import the classes.
systay
left a comment
There was a problem hiding this comment.
Reviewable status: 1 of 12 files reviewed, 2 unresolved discussions (waiting on @harshit-gangal, @systay, and @sougou)
java/jdbc/src/main/java/io/vitess/jdbc/VitessConnection.java, line 486 at r1 (raw file):
Previously, harshit-gangal wrote…
* @throws SQLException */ public boolean isClosed() throws SQLException { return this.closed; } * * @param name - Property Name * @return Property Value * @throws SQLException */ public String getClientInfo(String name) throws SQLException { return null;This is the signature of the method implemented from Connection interface.
As of now, they are not throwing SQLException. But, any reason for doing this?
When implementing interfaces, it's allowable to throw less than the interface declares, not more. I just feel like it's always is better to minimize the surface exposed when possible. If you want, I can keep the throws declarations as is instead.
harshit-gangal
left a comment
There was a problem hiding this comment.
Reviewable status: 1 of 12 files reviewed, 2 unresolved discussions (waiting on @systay and @sougou)
java/jdbc/src/main/java/io/vitess/jdbc/VitessConnection.java, line 486 at r1 (raw file):
Previously, systay (Andres Taylor) wrote…
When implementing interfaces, it's allowable to throw less than the interface declares, not more. I just feel like it's always is better to minimize the surface exposed when possible. If you want, I can keep the
throwsdeclarations as is instead.
I am good with removing exceptions from method signature which are not throwing those exceptions.
harshit-gangal
left a comment
There was a problem hiding this comment.
Reviewed 11 of 12 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @systay and @sougou)
java/jdbc/src/test/java/io/vitess/jdbc/VitessConnectionTest.java, line 40 at r1 (raw file):
import static org.junit.Assert.*; import static org.mockito.Mockito.*;
explicitly import the classes / methods.
java/jdbc/src/test/java/io/vitess/jdbc/VitessStatementTest.java, line 48 at r1 (raw file):
import static org.junit.Assert.*; import static org.mockito.Matchers.*; import static org.mockito.Mockito.verify;
explicitly import the classes / methods.
Signed-off-by: Andres Taylor <antaylor@squareup.com>
|
@mpawliszyn: please review. |
Signed-off-by: Andres Taylor antaylor@squareup.com
This change is