소스 검색

!49 修复Byte[]类型参数死循环的问题
Merge pull request !49 from 周艺峰/master

若依 5 년 전
부모
커밋
2b7bb59d12
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java

+ 11 - 1
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java

@@ -797,7 +797,17 @@ public class Convert
797 797
         }
798 798
         else if (obj instanceof byte[] || obj instanceof Byte[])
799 799
         {
800
-            return str((Byte[]) obj, charset);
800
+            if (obj instanceof byte[]){
801
+                return str((byte[]) obj, charset);
802
+            } else {
803
+                Byte[] bytes = (Byte[])obj;
804
+                int length = bytes.length;
805
+                byte[] dest = new byte[length];
806
+                for (int i = 0; i < length; i++) {
807
+                    dest[i] = bytes[i];
808
+                }
809
+            return str (dest,charset);
810
+            }
801 811
         }
802 812
         else if (obj instanceof ByteBuffer)
803 813
         {