Question on HashMap

HashMap results = new HashMap();

StringBuffer requestInformation = new StringBuffer();

requestInformation.append( request.getRequestURL().toString());

requestInformation.append( " SOAPAction : "+request.getHeader("SOAPAction")+ " : ");

if (AppServerInfo.getCurrentServerInfo() != null) {

requestInformation.append(" Request Handled By Server At : IP Address : "+ AppServerInfo.getCurrentServerInfo().getBindAddress().trim() );

requestInformation.append(" and Port # "+ AppServerInfo.getCurrentServerInfo().getListenPort() );

}

results.put("RequestInformation", requestInformation.toString() );

try {

results = xpathMiner.mineData(requestMessage); // returns HashMap

}

catch (XpathMinerException e) {

loggingDataBean.setErrorType(LoggingDataBean.TECHNICAL);

loggingDataBean.appendErrorMessage(StringTools.getStackTraceFromException(e));

LOG.warn("Error mining data.", e);

}

**********************************************************

In the above code ;

results.put("RequestInformation", requestInformation.toString() );

results has a key value pair , whil forwarding to the next line

results = xpathMiner.mineData(requestMessage);

which returns a HashMap and is stored in results,

My questions here is when compiling the second line results is no more having the earlier value of RequestInformation, It only has the new set of values returned by the method

xpathMiner.mineData(requestMessage);// this returns a HashMap.

How can i Make sure the the old RequestInformation values are in the HashMap

[1654 byte] By [ur_my_pala] at [2007-11-26 17:30:40]
# 1

Eh? This:

> results = xpathMiner.mineData(requestMessage);

assigns the result of the method to the variable results. Whatever you assigned beforehand will be gone. This is Java basics!

You might want to loop over the entries returned in the map from mineData and add each key-value pair to your results map.

stefan.schulza at 2007-7-8 23:58:36 > top of Java-index,Core,Core APIs...
# 2
Not quite sure if the following is helpful. You may useresults.putAll(xpathMiner.mineData(requestMessage));This will add all entries from the returned HashMap to results. See the API documentation for details.OleVV
OleVVa at 2007-7-8 23:58:36 > top of Java-index,Core,Core APIs...