From 59dfb4f4e1b11a18cd409ba058b6f57d084351d1 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Thu, 15 Jun 2023 17:02:34 +0300 Subject: [PATCH] tbel: refactoring prepareBytesToNumber --- .../main/java/org/thingsboard/script/api/tbel/TbUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java index d275466b95..dec4ff6f15 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java @@ -467,13 +467,11 @@ public class TbUtils { if ((offset + length) > data.length) { throw new IllegalArgumentException("Default length is always " + length + " bytes. Offset: " + offset + " and Length: " + length + " is out of bounds for array with length: " + data.length + "!"); } - byte[] bytesToNumber = new byte[length]; byte[] dataBytesArray = Arrays.copyOfRange(data, offset, (offset+length)); if (!bigEndian) { ArrayUtils.reverse(dataBytesArray); } - System.arraycopy(dataBytesArray, 0, bytesToNumber, 0, length); - return bytesToNumber; + return dataBytesArray; } public static String bytesToHex(ExecutionArrayList bytesList) {