From 986aa62ed00bee39363bab41b4eeb8259d446efd Mon Sep 17 00:00:00 2001
From: ludc <ludc@vci-tech.com>
Date: 星期四, 16 一月 2025 18:20:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/Service/OQService/src/com/vci/server/query/parsers/Parser.java |   49 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/Source/Service/OQService/src/com/vci/server/query/parsers/Parser.java b/Source/Service/OQService/src/com/vci/server/query/parsers/Parser.java
index 4253388..9d8d07c 100644
--- a/Source/Service/OQService/src/com/vci/server/query/parsers/Parser.java
+++ b/Source/Service/OQService/src/com/vci/server/query/parsers/Parser.java
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
@@ -1082,32 +1083,46 @@
 			arExtAttr.add("CURRENTUSER.ID=" + vcii.userID);
 			arExtAttr.add("CURRENTUSER.NAME=" + vcii.userName);
 			arExtAttr.add("CURRENTUSER.SECRETGRADE=" + vcii.secretGrade);
-			if (vcii.groupNames.length > 0)
+			if (vcii.groupNames != null && vcii.groupNames.length > 0)
 				arExtAttr.add("CURRENTUSER.GROUPNUM=" + vcii.groupNames[0]);
 		}
 		
-		arExtAttr.addAll(Arrays.asList(extAttribs));
-		extAttribs = arExtAttr.toArray(new String[0]);
+		if (extAttribs != null)
+			Collections.addAll(arExtAttr, extAttribs);
+//		extAttribs = arExtAttr.toArray(new String[0]);
 
-		value.users = users;
-		value.roles = getStringFormArray(roleNames);
-		if(groupNames.length > 0){
+		if (users != null)
+			value.users = users;
+		else
+			value.users = "";
+		
+		if (roleNames != null)
+			value.roles = String.join(",", roleNames);
+		else
+			value.roles = "";
+		
+		if(groupNames != null && groupNames.length > 0){
 			value.userGroups = groupNames[0];
 		}
-		value.paramValues = getStringFormArray(extAttribs);
+		value.paramValues = String.join(",", arExtAttr);
 		return value;
 	}
 	
-	private String getStringFormArray(String[] array){
-		StringBuilder sb = new StringBuilder();
-		for (int i = 0; i < array.length; i++) {
-			sb.append(array[i]);
-			if(i != array.length - 1){
-				sb.append(",");
-			}
-		}
-		return sb.toString();
-	}
+//	private String getStringFormArray(Collection<String> array){
+//		if (array == null)
+//			return "";
+//		
+//		return String.join(",", array);
+//		
+////		StringBuilder sb = new StringBuilder();
+////		for (int i = 0; i < array.size(); i++) {
+////			sb.append(array.);
+////			if(i != array.length - 1){
+////				sb.append(",");
+////			}
+////		}
+////		return sb.toString();
+//	}
 	
 	/**
 	 * 鑾峰彇鎺掑簭鏉′欢

--
Gitblit v1.9.3