1
0
Эх сурвалжийг харах

Fixed a potential NullPointerException when UDP client tries to send an SECCDiscoveryReq message although the getLinkLocalAddress method of the class shared.utils.MiscUtils doesn't find a valid network interface according to the name found in the EVCCConfig.properties file.

Marc Mültin 5 жил өмнө
parent
commit
ebd66e446e

+ 7 - 8
RISE-V2G-EVCC/src/main/java/com/v2gclarity/risev2g/evcc/session/V2GCommunicationSessionHandlerEVCC.java

@@ -79,9 +79,12 @@ public class V2GCommunicationSessionHandlerEVCC implements Observer {
 	}
 	
 	
-	private boolean initialize() {
+	private void initialize() {
 		UDPClient udpClient = UDPClient.getInstance();
-		udpClient.initialize();
+		if (!udpClient.initialize()) {
+			logger.fatal("UDP client cannot be initialized, ISO 15118 communication cannot continue");
+			return;
+		};
 		
 		byte[] udpResponse = null;
 		SECCDiscoveryRes seccDiscoveryRes = null;
@@ -105,12 +108,8 @@ public class V2GCommunicationSessionHandlerEVCC implements Observer {
 			}
 		}
 		
-		/*
-		 * Establish a new V2GCommunicationSessionEVCC if SECCDiscoveryRes was successful and initiate
-		 * the respective TCP client connection
-		 */
-		if (startNewSession(seccDiscoveryRes)) return true;
-		else return false;
+		// SECCDiscoveryRes was successful, establish a new V2GCommunicationSessionEVCC and initiate the respective TCP client connection
+		startNewSession(seccDiscoveryRes);
 	}