4
0
mirror of https://github.com/cwinfo/envayasms.git synced 2025-07-13 01:36:27 +00:00

fix bug where outgoing sms would be cut off if they contain xml entities

This commit is contained in:
Jesse Young
2011-09-24 18:47:05 -07:00
parent 6384942c57
commit 986b50f0a8
6 changed files with 19 additions and 15 deletions

View File

@ -20,17 +20,13 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.FormBodyPart;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.envaya.sms.App;
import org.envaya.sms.Base64Coder;
import org.envaya.sms.OutgoingMessage;
@ -202,8 +198,15 @@ public class HttpTask extends AsyncTask<String, Void, HttpResponse> {
sms.setServerId(serverId.equals("") ? null : serverId);
Node firstChild = smsElement.getFirstChild();
sms.setMessageBody(firstChild != null ? firstChild.getNodeValue(): "");
StringBuilder messageBody = new StringBuilder();
NodeList childNodes = smsElement.getChildNodes();
int numChildren = childNodes.getLength();
for (int j = 0; j < numChildren; j++)
{
messageBody.append(childNodes.item(j).getNodeValue());
}
sms.setMessageBody(messageBody.toString());
messages.add(sms);
}