2016-10-15 11 views
0

XStreamライブラリを使用していくつかのxmlファイルを解析します。結果はすべてのファイルのマップです。私がデバッグするとき、結果マップは私が探していたものですが、私が次の行に行くと、マップの値が青から変わります!しかし、それは "for"ループの次のラウンドには向かないが、次のファイルの情報を含んでいる。何が原因でしょうか?HashMapの値はどのように変更されますか?

public class Debug { 
public String path = "E:\\Projects\\svn\\FANRPProduction\\WMS\\src\\main\\resources\\wms\\bpmn\\bp"; 
public XStream xStream; 
public Map<String, List<CallActivity>> bpTpMap; 

public void findBPandTP() throws IOException { 
    File root = new File(path); 
    File[] xmlFiles = FindAllXMLFiles.recursive(root); 

    bpTpMap=new HashMap<String, List<CallActivity>>(); 
    for (File xml : xmlFiles) { 
     if (xml != null) { 
      xStream = new XStream(new StaxDriver()); 
      xStream.alias("definitions", CallActivity.class); 
      xStream.registerConverter(new CallActivityConverter()); 
      bpTpMap = (Map) xStream.fromXML(xml);//Here I get correct information. For example "WMS_RBP_OutgoingWeighing" 
      List<String> bpList = new ArrayList<String>(bpTpMap.keySet()); //Here I see the name of the next file in the path in bpTpMap, which is "WMS_BP_WeighingConfiguration" 
     } 
    } 
} 

}

答えて

0

私は次のようにデバッグするために、あなたをお勧めします:

bpTpMap = (Map) xStream.fromXML(xml);//Here I get correct information. For example "WMS_RBP_OutgoingWeighing" 

System.out.println(bpTpMap.size()); 
Set<String> setOfKeys = bpTpMap.keySet(); 
System.out.println("Initial value of keys:"+bpTpMap);//Here you would see any extra values if the map has it 
+0

感謝。 IntelliJがクラッシュしました。私の問題は解決されました。 – Behnaz

関連する問題