浏览代码

Merge branch 'master' of https://github.com/V2GClarity/RISE-V2G

Marc Mültin 6 年之前
父节点
当前提交
7d7cbf9cad

+ 2 - 1
RISE-V2G-Shared/src/main/java/com/v2gclarity/risev2g/shared/misc/V2GTPMessage.java

@@ -23,6 +23,7 @@
  *******************************************************************************/
  *******************************************************************************/
 package com.v2gclarity.risev2g.shared.misc;
 package com.v2gclarity.risev2g.shared.misc;
 
 
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Arrays;
 
 
@@ -154,7 +155,7 @@ public class V2GTPMessage {
 		
 		
 		// Sets the messageBuffers's position in order for the .get() message to work without 
 		// Sets the messageBuffers's position in order for the .get() message to work without 
 		// throwing a BufferUnderflowException
 		// throwing a BufferUnderflowException
-		messageBuffer.position(0);
+		((Buffer)messageBuffer).position(0);
 		
 		
 		messageBuffer.get(this.message);
 		messageBuffer.get(this.message);
 
 

+ 6 - 5
RISE-V2G-Shared/src/main/java/com/v2gclarity/risev2g/shared/utils/ByteUtils.java

@@ -27,6 +27,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.OutputStream;
 import java.nio.BufferOverflowException;
 import java.nio.BufferOverflowException;
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.ByteBuffer;
 
 
 import javax.xml.bind.DatatypeConverter;
 import javax.xml.bind.DatatypeConverter;
@@ -174,11 +175,11 @@ public final class ByteUtils {
 		 * Response only holds 2 bytes. Thus, we must account for this and guarantee the Big Endian 
 		 * Response only holds 2 bytes. Thus, we must account for this and guarantee the Big Endian 
 		 * byte order.
 		 * byte order.
 		 */
 		 */
-		bb.position(4 - byteArray.length);
+		((Buffer)bb).position(4 - byteArray.length);
 		bb.put(byteArray);
 		bb.put(byteArray);
 		
 		
 		// Setting the current position to 0, otherwise getInt() would throw a BufferUnderflowException
 		// Setting the current position to 0, otherwise getInt() would throw a BufferUnderflowException
-		bb.position(0);
+		((Buffer)bb).position(0);
 		
 		
 		return bb.getInt();
 		return bb.getInt();
 	}
 	}
@@ -195,7 +196,7 @@ public final class ByteUtils {
 			
 			
 		// In case the provided byte array is smaller than 8 bytes (e.g. int has 4 bytes), take care that they are placed at the right-most position
 		// In case the provided byte array is smaller than 8 bytes (e.g. int has 4 bytes), take care that they are placed at the right-most position
 		if (byteArray.length < 8) {
 		if (byteArray.length < 8) {
-			bb.position(8-byteArray.length);
+			((Buffer)bb).position(8-byteArray.length);
 			bb.put(byteArray);
 			bb.put(byteArray);
 		} else {
 		} else {
 			try {
 			try {
@@ -204,13 +205,13 @@ public final class ByteUtils {
 				getLogger().warn("Byte array length is too big (" + byteArray.length + " bytes) to be converted " +
 				getLogger().warn("Byte array length is too big (" + byteArray.length + " bytes) to be converted " +
 								 "into a long value. Only the right-most 8 bytes (least significant bytes " +
 								 "into a long value. Only the right-most 8 bytes (least significant bytes " +
 								 "according to Big Endian) are used.", e);
 								 "according to Big Endian) are used.", e);
-				bb.position(0);
+				((Buffer)bb).position(0);
 				bb.put(byteArray, byteArray.length - 8, byteArray.length);
 				bb.put(byteArray, byteArray.length - 8, byteArray.length);
 			}
 			}
 		}
 		}
 		
 		
 		// Setting the current position to 0, otherwise getLong() would throw a BufferUnderflowException
 		// Setting the current position to 0, otherwise getLong() would throw a BufferUnderflowException
-		bb.position(0);
+		((Buffer)bb).position(0);
 		
 		
 		return bb.getLong();
 		return bb.getLong();
 	}
 	}

+ 2 - 1
RISE-V2G-Shared/src/main/java/com/v2gclarity/risev2g/shared/v2gMessages/SECCDiscoveryRes.java

@@ -23,6 +23,7 @@
  *******************************************************************************/
  *******************************************************************************/
 package com.v2gclarity.risev2g.shared.v2gMessages;
 package com.v2gclarity.risev2g.shared.v2gMessages;
 
 
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Arrays;
 
 
@@ -94,7 +95,7 @@ public class SECCDiscoveryRes {
 		
 		
 		// Sets the messageBuffers's position in order for the .get() message to work without 
 		// Sets the messageBuffers's position in order for the .get() message to work without 
 		// throwing a BufferUnderflowException
 		// throwing a BufferUnderflowException
-		payloadBuffer.position(0);
+		((Buffer)payloadBuffer).position(0);
 		
 		
 		payloadBuffer.get(payload);
 		payloadBuffer.get(payload);