From 0e0a664286bf78b81ef2682cf82326fd6ebaf8fb Mon Sep 17 00:00:00 2001 From: liujing <82839618@qq.com> Date: Thu, 23 Mar 2017 16:33:18 +0800 Subject: [PATCH] =?UTF-8?q?properties=20=E6=94=AF=E6=8C=81list=20=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DisconfStoreFileProcessorImpl.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/disconf-client/src/main/java/com/baidu/disconf/client/store/processor/impl/DisconfStoreFileProcessorImpl.java b/disconf-client/src/main/java/com/baidu/disconf/client/store/processor/impl/DisconfStoreFileProcessorImpl.java index 2eed72c01..7a7fb688e 100644 --- a/disconf-client/src/main/java/com/baidu/disconf/client/store/processor/impl/DisconfStoreFileProcessorImpl.java +++ b/disconf-client/src/main/java/com/baidu/disconf/client/store/processor/impl/DisconfStoreFileProcessorImpl.java @@ -203,9 +203,26 @@ public void inject2Store(String fileName, DisconfValue disconfValue) { Object object = disconfValue.getFileData().get(fileItem); if (object == null) { - LOGGER.error("cannot find {} to be injected. file content is: {}", fileItem, - disconfValue.getFileData().toString()); - continue; + //bug fix by liujing if list map set condition + + Map map = disconfValue.getFileData(); + int jcount = 0; + for(Map.Entry entry : map.entrySet()){ + String key = entry.getKey(); + if(key != null && key.startsWith(fileItem)){ + if(jcount==0){ + object = new ArrayList(); + } + ((List)object).add(entry.getValue()); + jcount++; + } + } + + if(object==null){ + LOGGER.error("cannot find {} to be injected. file content is: {}", fileItem, + disconfValue.getFileData().toString()); + continue; + } } // 根据类型设置值