0
Ich Pars einige XML-Dateien mit XStream-Bibliotheken. Das Ergebnis ist eine Karte für jede Datei. Wenn ich debugge, ist die Ergebniskarte, was ich suchte, aber wenn ich zur nächsten Zeile gehe, ändert sich der Wert der Karte aus heiterem Himmel! Es geht jedoch nicht für die nächste Runde in der "for" -Schleife, es enthält die Informationen der nächsten Datei. Was kann das verursachen?Wie ändert sich der Wert von 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"
}
}
}
}
Dank. IntelliJ wurde abgestürzt. Mein Problem wurde gelöst. – Behnaz