| Chunk |
|---|
| Conflicting content |
|---|
*/ package gov.in.bloomington.georeporter.models; <<<<<<< HEAD import gov.in.bloomington.georeporter.util.Open311Parser; import gov.in.bloomington.georeporter.util.Open311XmlParser; import java.io.File; ======= import gov.in.bloomington.georeporter.util.Media; import java.io.ByteArrayOutputStream; >>>>>>> 6d667e57552f99b35eb07cd0d033b75ff4bc1c60 import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; |
| Solution content |
|---|
*/ package gov.in.bloomington.georeporter.models; import gov.in.bloomington.georeporter.util.Open311Parser; import gov.in.bloomington.georeporter.util.Media; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; |
| File |
|---|
| Open311.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
* pair to the POST for each value.
/**
* POST new service request data to the endpoint
}
*/
public static JSONObject getServiceDefinition(String service_code) {
try {
<<<<<<< HEAD
Open311Parser mParser= new Open311Parser(mFormat);
return mParser.parseServiceDefinition(loadStringFromUrl(getServiceDefinitionUrl(service_code)));
//return new JSONObject(loadStringFromUrl(getServiceDefinitionUrl(service_code)));
=======
return new JSONObject(loadStringFromUrl(getServiceDefinitionUrl(service_code)));
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
*
* The JSONObject should come from ServiceRequest.post_data
*
* In the JSON data:
* All the keys should already be named correctly. Attribute keys will
* already be in the form of "attribute[code]".
* Most attributes will just contain single values entered by the user;
* however, MultiValueList attributes will be an array of the chosen values
* We will need to iterate over MultiValueList values and add a seperate
*
* Media attributes will contain the URI to the image file.
*
* @param data JSON representation of user input
* @return
* JSONObject
*/
public static JSONArray postServiceRequest(ServiceRequest sr, Context context) {
HttpPost request = new HttpPost(mBaseUrl + "/requests.json");
JSONArray response = null;
try {
if (sr.post_data.has(Open311.MEDIA)) {
request.setEntity(prepareMultipartEntity(sr, context));
}
else {
request.setEntity(prepareUrlEncodedEntity(sr));
}
HttpResponse r = getClient().execute(request);
String rs = EntityUtils.toString(r.getEntity());
Log.i("Open311", rs);
response = new JSONArray(rs);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
>>>>>>> 6d667e57552f99b35eb07cd0d033b75ff4bc1c60
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace(); |
| Solution content |
|---|
*/
public static JSONObject getServiceDefinition(String service_code) {
try {
Open311Parser mParser= new Open311Parser(mFormat);
return mParser.parseServiceDefinition(loadStringFromUrl(getServiceDefinitionUrl(service_code)));
//For testing
//JSONObject jo = mParser.parseServiceDefinition(loadXmlServiceDefinition());
//Log.i("service definition" , jo.toString());
//return jo;
//return mParser.parseServiceDefinition(loadXmlServiceDefinition());
//return mParser.parseServiceDefinition(loadStringFromUrl(getServiceDefinitionUrl(service_code)));
//return new JSONObject(loadStringFromUrl(getServiceDefinitionUrl(service_code)));
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/**
* POST new service request data to the endpoint
*
* The JSONObject should come from ServiceRequest.post_data
*
* In the JSON data:
* All the keys should already be named correctly. Attribute keys will
* already be in the form of "attribute[code]".
* Most attributes will just contain single values entered by the user;
* however, MultiValueList attributes will be an array of the chosen values
* We will need to iterate over MultiValueList values and add a seperate
* pair to the POST for each value.
*
* Media attributes will contain the URI to the image file.
*
* @param data JSON representation of user input
* @return
* JSONObject
*/
public static JSONArray postServiceRequest(ServiceRequest sr, Context context) {
HttpPost request = new HttpPost(mBaseUrl + "/requests." + mFormat);
JSONArray response = null;
try {
if (sr.post_data.has(Open311.MEDIA)) {
request.setEntity(prepareMultipartEntity(sr, context));
}
else {
request.setEntity(prepareUrlEncodedEntity(sr));
}
HttpResponse r = getClient().execute(request);
String rs = EntityUtils.toString(r.getEntity());
Log.i("Open311", rs);
Open311Parser mParser= new Open311Parser(mFormat);
response = mParser.parseRequests(rs);
//response = new JSONArray(rs);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace(); |
| File |
|---|
| Open311.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Catch clause |
| Comment |
| If statement |
| Method invocation |
| Method signature |
| Return statement |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
<<<<<<< HEAD
} catch (IOException e) {
=======
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
>>>>>>> 6d667e57552f99b35eb07cd0d033b75ff4bc1c60
// TODO Auto-generated catch block
e.printStackTrace();
} |
| Solution content |
|---|
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} |
| File |
|---|
| Open311.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Catch clause |
| Chunk |
|---|
| Conflicting content |
|---|
e.printStackTrace();
}
}
<<<<<<< HEAD
HttpPost request = new HttpPost(mBaseUrl + "/requests." + mFormat);
JSONArray response = null;
try {
request.setEntity(new UrlEncodedFormEntity(pairs));
HttpResponse r = getClient().execute(request);
String str = EntityUtils.toString(r.getEntity());
Log.i("Open311 EntityUtils.toString", str);
Open311Parser oparser= new Open311Parser(mFormat);
response = oparser.parseRequests(str);
//response = new JSONArray(EntityUtils.toString(r.getEntity()));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return response;
=======
return post;
>>>>>>> 6d667e57552f99b35eb07cd0d033b75ff4bc1c60
}
/** |
| Solution content |
|---|
e.printStackTrace();
}
}
return post;
}
/** |
| File |
|---|
| Open311.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Return statement |
| Try statement |
| Variable |