Displaying differences for changeset
 
display as  

src/java/m/sci/V1_3.java

@@ -102,6 +102,7 @@
                 double r2sci_er = 0.0;
 
                 File[] dummy = new File[0]; // the client function should check for null array.
+                JSONObject syncRequest = JSONUtils.clone(getRequest());
                 if (JSONUtils.checkKeyExistsB(getParamMap(), KEY_LENGTH)
                         && JSONUtils.checkKeyExistsB(getParamMap(), KEY_STEEPNESS)) {
                     // do a r2 call >>>
@@ -113,14 +114,16 @@
                     req_results.put(RES_SLOPE_DELIVERY);
                     req_results.put(RES_SLOPE_T_VALUE);
                     req_results.put(RES_SLOPE_DEGRAD);
-                    getRequest().getJSONObject(KEY_METAINFO).put(KEY_REQUEST_RESULTS, req_results);
-                    getRequest().getJSONObject(KEY_METAINFO).put(KEY_MODE, SYNC);
+                    syncRequest.getJSONObject(KEY_METAINFO).put(KEY_MODE, SYNC);
+                    syncRequest.getJSONObject(KEY_METAINFO).put(KEY_REQUEST_RESULTS, req_results);
                     //LOG.info("This is the request =) : "+getRequest().toString());
                     //String url = Config.getString("codebase.url", "bad")+"/csip-erosion/m/rusle2/1.2";
                     //LOG.info(url);
                     LOG.info("STARTING RUSLE2");
+                    LOG.info("R2 Request" + syncRequest);
                     //JSONObject r2Response = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/rusle2/1.2", getRequest(), dummy);
-                    JSONObject r2Response = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/rusle2/1.3", getRequest());
+                    JSONObject r2Response = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/rusle2/1.3", syncRequest);
+                    LOG.info("R2 Response "+ syncRequest);
 
                     Map<String, JSONObject> r2Results = JSONUtils.preprocess(r2Response.getJSONArray(KEY_RESULT));
 
@@ -148,20 +151,20 @@
 
                     LOG.info("The soil is: " + wepsSoil.toString());
                     //getParamMap().put(WEPS_KEY_SOIL, wepsSoil);
-                    getRequest().getJSONArray(KEY_PARAMETER).put(wepsSoil);
+                    syncRequest.getJSONArray(KEY_PARAMETER).put(wepsSoil);
                 }
                 if (!JSONUtils.checkKeyExistsB(getParamMap(), WEPS_KEY_MANAGEMENT)) {
 
                     JSONObject lmodweps = (JSONObject) JSONUtils.getJSONArrayParam(getParamMap(), KEY_MGMTS).get(0);
                     JSONObject lmodwepsobj = JSONUtils.data(WEPS_KEY_MANAGEMENT, lmodweps);
                     //getParamMap().put(WEPS_KEY_MANAGEMENT, lmodwepsobj);
-                    getRequest().getJSONArray(KEY_PARAMETER).put(lmodwepsobj);
+                    syncRequest.getJSONArray(KEY_PARAMETER).put(lmodwepsobj);
                 }
 
                 LOG.info("Trying to invoke WEPS for SCI");
 
                 //JSONObject wepsResponse = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/weps/1.2", getRequest(), dummy);
-                JSONObject wepsResponse = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/weps/1.3", getRequest());
+                JSONObject wepsResponse = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/weps/1.3", syncRequest);
                 
 
                 Map<String, JSONObject> wepsResults = JSONUtils.preprocess(wepsResponse.getJSONArray(KEY_RESULT));