Skip to content

Commit

Permalink
Rewrite QBasicConnection.open() and QBasicConnection.close() methods …
Browse files Browse the repository at this point in the history
…to use QBasicConnection.isConnected() instead of null check
  • Loading branch information
maciejlach committed Sep 1, 2014
1 parent 6618aad commit ae2799d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/exxeleron/qjava/QBasicConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public QBasicConnection(final String host, final int port, final String username
* {@inheritDoc}
*/
public void open() throws IOException, QException {
if ( connection == null ) {
if ( !isConnected() ) {
if ( host != null ) {
initSocket();
initialize();
Expand Down Expand Up @@ -127,7 +127,7 @@ private void initialize() throws IOException, QException {
* {@inheritDoc}
*/
public void close() throws IOException {
if ( connection != null ) {
if ( isConnected() ) {
connection.close();
connection = null;
}
Expand Down

0 comments on commit ae2799d

Please sign in to comment.