diff options
author | Bilal Alsharifi <bilal.alsharifi@gmail.com> | 2020-09-15 09:30:36 -0400 |
---|---|---|
committer | Bilal Alsharifi <bilal.alsharifi@gmail.com> | 2020-09-15 09:30:36 -0400 |
commit | 2eb205aa120283664d0db252ce105ebfeaeba3be (patch) | |
tree | 9728b3661e0e4bddfbaeb35729abd381fc1c4d71 /javaSE | |
parent | 1080ec2448622a570ca70e66745b5548da3c8b20 (diff) | |
parent | 1840db0b1271775cde8ead685185f5bd20b8d92f (diff) | |
download | sdl_android-2eb205aa120283664d0db252ce105ebfeaeba3be.tar.gz |
Merge branch 'develop' into feature/rename_sdl_connectionfeature/rename_sdl_connection
Diffstat (limited to 'javaSE')
11 files changed, 22 insertions, 23 deletions
diff --git a/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java b/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java index dc1ce2457..0f67efe0b 100644 --- a/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java +++ b/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java @@ -37,17 +37,17 @@ import com.smartdevicelink.util.DebugTool; public class Main { private static final String TAG = "Main"; - static Thread thread = null, mainThread; - static Object LOCK; + private static Thread thread = null; + private static Thread mainThread; + private static final Object LOCK = new Object(); - static SdlService sdlService; + private static SdlService sdlService; public static void main(String[] args) { //Enable DebugTool DebugTool.enableDebugTool(); mainThread = Thread.currentThread(); - LOCK = new Object(); startSdlService(); while(!mainThread.isInterrupted()) { @@ -68,7 +68,7 @@ public class Main { } } - static SdlService.SdlServiceCallback serviceCallback = new SdlService.SdlServiceCallback() { + private static final SdlService.SdlServiceCallback serviceCallback = new SdlService.SdlServiceCallback() { @Override public void onEnd() { if (thread != null) { diff --git a/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java b/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java index 03c65f0f6..a9d81b766 100644 --- a/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java +++ b/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java @@ -79,7 +79,7 @@ public class SdlService { private SdlManager sdlManager = null; private List<ChoiceCell> choiceCellList; - private SdlServiceCallback callback; + private final SdlServiceCallback callback; public SdlService(BaseTransportConfig config, SdlServiceCallback callback){ this.callback = callback; @@ -173,7 +173,7 @@ public class SdlService { }; - HashMap<FunctionID,OnRPCNotificationListener> notificationListenerHashMap = new HashMap<FunctionID,OnRPCNotificationListener>(); + HashMap<FunctionID,OnRPCNotificationListener> notificationListenerHashMap = new HashMap<>(); notificationListenerHashMap.put(FunctionID.ON_HMI_STATUS, new OnRPCNotificationListener() { @Override public void onNotified(RPCNotification notification) { diff --git a/javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java b/javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java index cdd20b404..30037bad6 100644 --- a/javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java +++ b/javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java @@ -75,7 +75,7 @@ public class BsonEncoder { } /** - * Goes thorugh the map and ensures that all the values included are supported by SDL. If they are not of a supported + * Goes through the map and ensures that all the values included are supported by SDL. If they are not of a supported * value it is removed from the map * @param map the map to be sanitized * @return a sanitized HashMap with non-supported object type removes diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java index ff2d90bea..09a495355 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java @@ -127,9 +127,9 @@ public class SdlManager extends BaseSdlManager { private void notifyDevListener(String info) { if (managerListener != null) { if (getState() == BaseSubManager.ERROR) { - managerListener.onError((SdlManager) this, info, null); + managerListener.onError(this, info, null); } else { - managerListener.onStart((SdlManager) this); + managerListener.onStart(this); } } } @@ -158,7 +158,7 @@ public class SdlManager extends BaseSdlManager { } if (managerListener != null) { - managerListener.onDestroy((SdlManager) this); + managerListener.onDestroy(this); managerListener = null; } diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java index 3cd8d16d5..eee60bd69 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java @@ -112,7 +112,7 @@ public class SdlArtwork extends SdlFile implements Cloneable{ @Override - public void setType(FileType fileType) { + public void setType(@NonNull FileType fileType) { if(fileType == null || fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG) || fileType.equals(FileType.GRAPHIC_BMP)){ super.setType(fileType); diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java index bb1c170d4..1e75395d8 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java @@ -39,6 +39,7 @@ import com.smartdevicelink.proxy.rpc.enums.StaticIconName; import java.net.URI; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import java.util.Arrays; /** * A class representing data to be uploaded to core @@ -154,7 +155,7 @@ public class SdlFile{ /** * Gets the location of the file - * @return + * @return represents the path of the file */ public String getFilePath(){ return this.filePath; @@ -317,7 +318,7 @@ public class SdlFile{ result += ((getName() == null) ? 0 : Integer.rotateLeft(getName().hashCode(), 1)); result += ((getURI() == null) ? 0 : Integer.rotateLeft(getURI().hashCode(), 2)); result += ((getFilePath() == null) ? 0 : Integer.rotateLeft(getFilePath().hashCode(), 3)); - result += ((getFileData() == null) ? 0 : Integer.rotateLeft(getFileData().hashCode(), 4)); + result += ((getFileData() == null) ? 0 : Integer.rotateLeft(Arrays.hashCode(getFileData()), 4)); result += ((getType() == null) ? 0 : Integer.rotateLeft(getType().hashCode(), 5)); result += Integer.rotateLeft(Boolean.valueOf(isStaticIcon()).hashCode(), 6); result += Integer.rotateLeft(Boolean.valueOf(isPersistent()).hashCode(), 7); diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java index 188641c6d..64cd728ca 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java @@ -42,7 +42,6 @@ import com.smartdevicelink.transport.TransportManager; @SuppressWarnings("WeakerAccess") @RestrictTo(RestrictTo.Scope.LIBRARY) public class SdlProtocol extends SdlProtocolBase { - private static final String TAG ="SdlProtocol"; public SdlProtocol( ISdlProtocol iSdlProtocol, BaseTransportConfig config) { super(iSdlProtocol, config); diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java index 1004de5ad..ee08f19de 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java @@ -41,7 +41,6 @@ import com.smartdevicelink.util.DebugTool; import java.util.Collections; import java.util.List; -@SuppressWarnings("unused") public class TransportManager extends TransportManagerBase{ private static final String TAG = "TransportManager"; diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java index 213652fb0..65037f6b8 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java @@ -47,8 +47,8 @@ import java.nio.ByteBuffer; public class WebSocketServer extends org.java_websocket.server.WebSocketServer implements TransportInterface{ private static final String TAG = "WebSocketServer"; - TransportCallback callback; - WebSocketServerConfig config; + final TransportCallback callback; + final WebSocketServerConfig config; WebSocket webSocket; SdlPsm psm; @@ -88,7 +88,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i @Override public void write(SdlPacket packet){ - //DebugTool.logInfo(TAG, "Atttempt to write packet " + packet); + //DebugTool.logInfo(TAG, "Attempt to write packet " + packet); if(packet != null && this.webSocket != null && this.webSocket.isOpen()) { diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java index 23e0b25c1..316375bf3 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java @@ -39,10 +39,10 @@ public class WebSocketServerConfig extends BaseTransportConfig{ final int port, connectionLostTimeout; SSLConfig sslConfig; /** - * Default constructor for WebsocketConfig + * Default constructor for WebSocketConfig * @param port the port this web socket should listen on * @param connectionLostTimeout the timeout for a connection lost, default would be 60 seconds. If a value less than - * 0 is used, then the websocket will wait indefinitely. + * 0 is used, then the web socket will wait indefinitely. */ public WebSocketServerConfig(int port, int connectionLostTimeout){ this.port = port; diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java index 4df93b3d6..4bcb9ca8d 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java @@ -63,7 +63,7 @@ public class SSLWebSocketFactoryGenerator { private static final String SUNX509 = "SunX509"; public static WebSocketServerFactory generateWebSocketServer(SSLConfig config){ - SSLContext context = null; + SSLContext context; switch (config.getSslCertificateType()){ case SSLConfig.JKS: context = getSSLContextFromJKS(config); @@ -97,7 +97,7 @@ public class SSLWebSocketFactoryGenerator { TrustManagerFactory tmf = TrustManagerFactory.getInstance(SUNX509); tmf.init(ks); - SSLContext sslContext = null; + SSLContext sslContext; sslContext = SSLContext.getInstance(TLS); sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); return sslContext; |