Fixed redundand null comparison, possible null pointer dereference, volatile usage and dead variables
@@ -126,7 +126,7 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
private final Map<Integer, OLiveQueryClientListener> liveQueryListener = new ConcurrentHashMap<>();
private volatile OStorageRemotePushThread pushThread;
private final OrientDBRemote context;
- private volatile int nextServerToConnect = 0;
+ private int nextServerToConnect = 0;
public OStorageRemote(final String iURL, OrientDBRemote context, final String iMode, ORemoteConnectionManager connectionManager,
OrientDBConfig config) throws IOException {
@@ -779,7 +779,7 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
Boolean result = null;
if (response != null)
result = response.getResult();
- return result;
+ return result != null ? result : false;
}
@Override
@@ -1007,7 +1007,7 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
public void closeQuery(ODatabaseDocumentRemote database, String queryId) {
unstickToSession();
OCloseQueryRequest request = new OCloseQueryRequest(queryId);
- OCloseQueryResponse response = networkOperation(request, "Error closing query: " + queryId);
+ networkOperation(request, "Error closing query: " + queryId);
}
public void fetchNextPage(ODatabaseDocumentRemote database, ORemoteResultSet rs) {
@@ -1736,13 +1736,13 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
}
switch (strategy) {
case STICKY:
- url = session != null ? session.getServerUrl() : null;
+ url = session.getServerUrl();
if (url == null)
url = getServerURFromList(false, session);
break;
case ROUND_ROBIN_CONNECT:
- if (iIsConnectOperation || session == null) {
+ if (iIsConnectOperation) {
url = getNextConnectUrl(session);
} else {
url = session.getServerUrl();
@@ -2106,7 +2106,7 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
public void unsubscribeLive(ODatabaseDocumentRemote database, int monitorId) {
OUnsubscribeRequest request = new OUnsubscribeRequest(new OUnsubscribeLiveQueryRequest(monitorId));
- OUnsubscribeResponse response = networkOperation(request, "Error on unsubscribe of live query");
+ networkOperation(request, "Error on unsubscribe of live query");
}
public void registerLiveListener(int monitorId, OLiveQueryClientListener listener) {
