Replaces json lib.

cusax-fix
Damian Minkov 13 years ago
parent e2ef092f63
commit 4f3d81f0cc

@ -55,7 +55,7 @@
<classpathentry kind="lib" path="lib/installer-exclude/joscar-protocol.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jsch-0.1.36.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jsocks-klea.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/json-20090723.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/json-simple-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/junit.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/laf-widget.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/lcrypto-jdk16-143.jar"/>

@ -2340,11 +2340,8 @@ javax.swing.event, javax.swing.border"/>
<jar compress="true" destfile="${bundles.dest}/json.jar"
filesetmanifest="merge">
<zipfileset src="${lib.noinst}/json-20090723.jar" prefix=""/>
<zipfileset src="${lib.noinst}/json-simple-1.1.1.jar" prefix=""/>
<manifest>
<attribute name="Export-Package" value="org.json"/>
<attribute name="Bundle-Name" value="Json"/>
<attribute name="Bundle-Description" value="Json library."/>
<attribute name="System-Bundle" value="yes"/>
</manifest>
</jar>

@ -116,7 +116,7 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>src</package-root>
<classpath mode="compile">lib/felix.jar:lib/jdic-all.jar:lib/bundle/commons-logging.jar:lib/bundle/junit.jar:lib/bundle/log4j.jar:lib/installer-exclude/aclibico-2.1.jar:lib/installer-exclude/apache-ant-1.7.0.jar:lib/installer-exclude/dhcp4java-1.00.jar:lib/installer-exclude/dict4j.jar:lib/installer-exclude/dnsjava.jar:lib/installer-exclude/fmj.jar:lib/installer-exclude/forms-1.2.1.jar:lib/installer-exclude/gdata-client-1.0.jar:lib/installer-exclude/gdata-client-meta-1.0.jar:lib/installer-exclude/gdata-contacts-3.0.jar:lib/installer-exclude/gdata-contacts-meta-3.0.jar:lib/installer-exclude/gdata-core-1.0.jar:lib/installer-exclude/google-collect-1.0-rc1.jar:lib/installer-exclude/hexdump-0.2.jar:lib/installer-exclude/httpclient-4.1.2.jar:lib/installer-exclude/httpcore-4.1.2.jar:lib/installer-exclude/httpmime-4.1.2.jar:lib/installer-exclude/ice4j.jar:lib/installer-exclude/jain-sdp.jar:lib/installer-exclude/jain-sip-api.jar:lib/installer-exclude/jain-sip-ri.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/jdom.jar:lib/installer-exclude/jfontchooser-1.0.5.jar:lib/installer-exclude/jmdns.jar:lib/installer-exclude/jml-1.0b5.jar:lib/installer-exclude/jmyspell-core.jar:lib/installer-exclude/jna.jar:lib/installer-exclude/jnsapi.jar:lib/installer-exclude/joscar-client.jar:lib/installer-exclude/joscar-common.jar:lib/installer-exclude/joscar-protocol.jar:lib/installer-exclude/jsch-0.1.36.jar:lib/installer-exclude/jsocks-klea.jar:lib/installer-exclude/json-20090723.jar:lib/installer-exclude/jspeex.jar:lib/installer-exclude/junit.jar:lib/installer-exclude/laf-widget.jar:lib/installer-exclude/lcrypto-jdk16-143.jar:lib/installer-exclude/libdbus-java-2.7.jar:lib/installer-exclude/libjitsi.jar:lib/installer-exclude/log4j-1.2.8.jar:lib/installer-exclude/lti-civil-no_s_w_t.jar:lib/installer-exclude/mac_widgets-0.9.5.jar:lib/installer-exclude/nist-sdp-1.0.jar:lib/installer-exclude/otr4j.jar:lib/installer-exclude/pircbot.jar:lib/installer-exclude/profiler4j-1.0-beta3-SC.jar:lib/installer-exclude/rome-0.9.jar:lib/installer-exclude/sdes4j.jar:lib/installer-exclude/smack.jar:lib/installer-exclude/smackx.jar:lib/installer-exclude/swing-worker-1.2.jar:lib/installer-exclude/transparency.jar:lib/installer-exclude/unix-0.5.jar:lib/installer-exclude/weupnp-0.1.2-SNAPSHOT.jar:lib/installer-exclude/ymsg_network_v0_67.jar:lib/installer-exclude/zrtp4j-light.jar:lib/os-specific/linux/jdic_stub.jar:lib/os-specific/mac/growl4j.jar:lib/os-specific/mac/jdic_stub.jar:lib/os-specific/mac/OrangeExtensions.jar:lib/os-specific/mac/installer-exclude/dock.jar:lib/os-specific/solaris/jdic_stub.jar:lib/os-specific/windows/jdic_stub.jar:lib/os-specific/windows/installer-exclude/jna-platform-win32.jar</classpath>
<classpath mode="compile">lib/felix.jar:lib/jdic-all.jar:lib/bundle/commons-logging.jar:lib/bundle/junit.jar:lib/bundle/log4j.jar:lib/installer-exclude/aclibico-2.1.jar:lib/installer-exclude/apache-ant-1.7.0.jar:lib/installer-exclude/dhcp4java-1.00.jar:lib/installer-exclude/dict4j.jar:lib/installer-exclude/dnsjava.jar:lib/installer-exclude/fmj.jar:lib/installer-exclude/forms-1.2.1.jar:lib/installer-exclude/gdata-client-1.0.jar:lib/installer-exclude/gdata-client-meta-1.0.jar:lib/installer-exclude/gdata-contacts-3.0.jar:lib/installer-exclude/gdata-contacts-meta-3.0.jar:lib/installer-exclude/gdata-core-1.0.jar:lib/installer-exclude/google-collect-1.0-rc1.jar:lib/installer-exclude/hexdump-0.2.jar:lib/installer-exclude/httpclient-4.1.2.jar:lib/installer-exclude/httpcore-4.1.2.jar:lib/installer-exclude/httpmime-4.1.2.jar:lib/installer-exclude/ice4j.jar:lib/installer-exclude/jain-sdp.jar:lib/installer-exclude/jain-sip-api.jar:lib/installer-exclude/jain-sip-ri.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/jdom.jar:lib/installer-exclude/jfontchooser-1.0.5.jar:lib/installer-exclude/jmdns.jar:lib/installer-exclude/jml-1.0b5.jar:lib/installer-exclude/jmyspell-core.jar:lib/installer-exclude/jna.jar:lib/installer-exclude/jnsapi.jar:lib/installer-exclude/joscar-client.jar:lib/installer-exclude/joscar-common.jar:lib/installer-exclude/joscar-protocol.jar:lib/installer-exclude/jsch-0.1.36.jar:lib/installer-exclude/jsocks-klea.jar:lib/installer-exclude/json-simple-1.1.1.jar:lib/installer-exclude/jspeex.jar:lib/installer-exclude/junit.jar:lib/installer-exclude/laf-widget.jar:lib/installer-exclude/lcrypto-jdk16-143.jar:lib/installer-exclude/libdbus-java-2.7.jar:lib/installer-exclude/libjitsi.jar:lib/installer-exclude/log4j-1.2.8.jar:lib/installer-exclude/lti-civil-no_s_w_t.jar:lib/installer-exclude/mac_widgets-0.9.5.jar:lib/installer-exclude/nist-sdp-1.0.jar:lib/installer-exclude/otr4j.jar:lib/installer-exclude/pircbot.jar:lib/installer-exclude/profiler4j-1.0-beta3-SC.jar:lib/installer-exclude/rome-0.9.jar:lib/installer-exclude/sdes4j.jar:lib/installer-exclude/smack.jar:lib/installer-exclude/smackx.jar:lib/installer-exclude/swing-worker-1.2.jar:lib/installer-exclude/transparency.jar:lib/installer-exclude/unix-0.5.jar:lib/installer-exclude/weupnp-0.1.2-SNAPSHOT.jar:lib/installer-exclude/ymsg_network_v0_67.jar:lib/installer-exclude/zrtp4j-light.jar:lib/os-specific/linux/jdic_stub.jar:lib/os-specific/mac/growl4j.jar:lib/os-specific/mac/jdic_stub.jar:lib/os-specific/mac/OrangeExtensions.jar:lib/os-specific/mac/installer-exclude/dock.jar:lib/os-specific/solaris/jdic_stub.jar:lib/os-specific/windows/jdic_stub.jar:lib/os-specific/windows/installer-exclude/jna-platform-win32.jar</classpath>
<built-to>classes</built-to>
<source-level>1.5</source-level>
</compilation-unit>

@ -55,7 +55,7 @@ Import-Package: apple.awt,
org.bouncycastle.crypto.params,
org.bouncycastle.crypto.prng,
org.ice4j.socket,
org.json,
org.json.simple,
org.osgi.framework,
org.w3c.dom,
org.xml.sax,

@ -61,7 +61,7 @@ Import-Package: apple.awt,
org.jitsi.util,
org.jitsi.util.event,
org.jitsi.util.swing,
org.json,
org.json.simple,
org.osgi.framework,
org.w3c.dom,
org.xml.sax,

@ -22,7 +22,7 @@
import net.java.sip.communicator.util.Logger;
import org.jitsi.util.*;
import org.json.*;
import org.json.simple.*;
/**
* Xivo server stored contact list. Currently no modifications are possible.
@ -250,9 +250,9 @@ public void run()
if(logger.isTraceEnabled())
logger.trace("Read from server:" + line);
handle(new JSONObject(line));
handle((JSONObject)JSONValue.parseWithException(line));
}
catch(JSONException ex)
catch(Throwable ex)
{
logger.error("Error parsing object:" + line, ex);
}
@ -471,21 +471,21 @@ public boolean isAccountImageSupported()
*/
private void handle(JSONObject incomingObject)
{
if(!incomingObject.has("class"))
if(!incomingObject.containsKey("class"))
return;
try
{
String classField = incomingObject.getString("class");
String classField = (String)incomingObject.get("class");
if (classField.equals("loginko"))
{
showError(null, null,
"Unauthorized. Cannot login: " +
incomingObject.getString("errorstring"));
incomingObject.get("errorstring"));
logger.error("Error login: " +
incomingObject.getString("errorstring"));
incomingObject.get("errorstring"));
destroy();
@ -508,22 +508,22 @@ else if (classField.equals("login_id_ok"))
password = accountID.getAccountPropertyString(XIVO_PASSWORD);
}
if(!authorize(incomingObject.getString("sessionid"), password))
if(!authorize((String)incomingObject.get("sessionid"), password))
logger.error("Error login authorization!");
return;
}
else if (classField.equals("login_pass_ok"))
{
if(!sendCapas(incomingObject.getJSONArray("capalist")))
if(!sendCapas((JSONArray)incomingObject.get("capalist")))
logger.error("Error send capas!");
return;
}
else if (classField.equals("login_capas_ok"))
{
if(!sendFeatures(incomingObject.getString("astid"),
incomingObject.getString("xivo_userid")))
if(!sendFeatures((String)incomingObject.get("astid"),
(String)incomingObject.get("xivo_userid")))
logger.error("Problem send features get!");
return;
@ -563,27 +563,29 @@ else if (classField.equals("disconn"))
* @param username the username.
* @return is command successful.
*/
@SuppressWarnings("unchecked")
private boolean login(String username)
{
if(connection == null || username == null)
return false;
JSONObject obj = new JSONObject();
try
{
obj.accumulate("class","login_id");
obj.accumulate("company", "Jitsi");
obj.put("class","login_id");
obj.put("company", "Jitsi");
String os = "x11";
if(OSUtils.IS_WINDOWS)
os = "win";
else if(OSUtils.IS_MAC)
os = "mac";
obj.accumulate("ident", username + "@" + os);
obj.put("ident", username + "@" + os);
obj.accumulate("userid", username);
obj.accumulate("version", "9999");
obj.accumulate("xivoversion", "1.1");
obj.put("userid", username);
obj.put("version", "9999");
obj.put("xivoversion", "1.1");
return send(obj);
}
@ -600,6 +602,7 @@ else if(OSUtils.IS_MAC)
* @param password the password to authorize.
* @return is command successful.
*/
@SuppressWarnings("unchecked")
private boolean authorize(String sessionId, String password)
{
if(connection == null || sessionId == null || password == null)
@ -608,8 +611,8 @@ private boolean authorize(String sessionId, String password)
JSONObject obj = new JSONObject();
try
{
obj.accumulate("class","login_pass");
obj.accumulate("hashedpassword",
obj.put("class","login_pass");
obj.put("hashedpassword",
Sha1Crypto.encode(sessionId + ":" + password));
return send(obj);
@ -626,20 +629,21 @@ private boolean authorize(String sessionId, String password)
* @param capalistParam param from previous command.
* @return is command successful.
*/
@SuppressWarnings("unchecked")
private boolean sendCapas(JSONArray capalistParam)
{
if(connection == null
|| capalistParam == null || capalistParam.length() < 1)
|| capalistParam == null || capalistParam.isEmpty())
return false;
JSONObject obj = new JSONObject();
try
{
obj.accumulate("class", "login_capas");
obj.accumulate("capaid", capalistParam.getString(0));
obj.accumulate("lastconnwins", "false");
obj.accumulate("loginkind", "agent");
obj.accumulate("state", "");
obj.put("class", "login_capas");
obj.put("capaid", capalistParam.get(0));
obj.put("lastconnwins", "false");
obj.put("loginkind", "agent");
obj.put("state", "");
return send(obj);
}
@ -656,6 +660,7 @@ private boolean sendCapas(JSONArray capalistParam)
* @param xivoUserId param from previous command.
* @return is command successful.
*/
@SuppressWarnings("unchecked")
private boolean sendFeatures(String astid, String xivoUserId)
{
if(connection == null || astid == null || xivoUserId == null)
@ -664,8 +669,8 @@ private boolean sendFeatures(String astid, String xivoUserId)
JSONObject obj = new JSONObject();
try
{
obj.accumulate("class","featuresget");
obj.accumulate("userid", astid + "/" + xivoUserId);
obj.put("class","featuresget");
obj.put("userid", astid + "/" + xivoUserId);
return send(obj);
}
@ -680,13 +685,14 @@ private boolean sendFeatures(String astid, String xivoUserId)
* Sends command to retrieve phones list.
* @return is command successful.
*/
@SuppressWarnings("unchecked")
private boolean getPhoneList()
{
JSONObject obj = new JSONObject();
try
{
obj.accumulate("class", "phones");
obj.accumulate("function", "getlist");
obj.put("class", "phones");
obj.put("function", "getlist");
return send(obj);
}
@ -722,20 +728,20 @@ private void phonesRecieved(JSONObject objReceived)
{
try
{
if(!objReceived.getString("function").equals("sendlist")
|| !objReceived.has("payload"))
if(!objReceived.get("function").equals("sendlist")
|| !objReceived.containsKey("payload"))
return;
JSONObject payload = objReceived.getJSONObject("payload");
Iterator iter = payload.keys();
JSONObject payload = (JSONObject)objReceived.get("payload");
Iterator iter = payload.keySet().iterator();
List<JSONObject> phoneList = new ArrayList<JSONObject>();
while(iter.hasNext())
{
JSONObject obj = (JSONObject)payload.get((String) iter.next());
Iterator phonesIter = obj.keys();
JSONObject obj = (JSONObject)payload.get(iter.next());
Iterator phonesIter = obj.keySet().iterator();
while(phonesIter.hasNext())
phoneList.add(
(JSONObject)obj.get((String)phonesIter.next()));
(JSONObject)obj.get(phonesIter.next()));
}
@ -744,10 +750,10 @@ private void phonesRecieved(JSONObject objReceived)
try
{
// don't handle non sip phones
if(!phone.getString("tech").equalsIgnoreCase("sip"))
if(!((String)phone.get("tech")).equalsIgnoreCase("sip"))
continue;
String groupName = phone.getString("context");
String groupName = (String)phone.get("context");
ContactGroupSipImpl parentGroup =
findGroupByName(groupName);
@ -763,7 +769,7 @@ private void phonesRecieved(JSONObject objReceived)
ServerStoredGroupEvent.GROUP_CREATED_EVENT);
}
String number = phone.getString("number");
String number = (String)phone.get("number");
Address address =
sipProvider.parseAddressString(number);
@ -776,8 +782,8 @@ private void phonesRecieved(JSONObject objReceived)
{
contact = new ContactSipImpl(address, sipProvider);
contact.setDisplayName(
phone.getString("firstname") + " "
+ phone.getString("lastname"));
phone.get("firstname") + " "
+ phone.get("lastname"));
contact.setResolved(true);
parentGroup.addContact(contact);
@ -786,8 +792,8 @@ private void phonesRecieved(JSONObject objReceived)
else
{
contact.setDisplayName(
phone.getString("firstname") + " "
+ phone.getString("lastname"));
phone.get("firstname") + " "
+ phone.get("lastname"));
contact.setResolved(true);
fireContactResolved(parentGroup, contact);

@ -66,7 +66,7 @@ Import-Package: ch.imvs.sdes4j.srtp,
org.jitsi.service.version,
org.jitsi.util,
org.jitsi.util.xml,
org.json,
org.json.simple,
org.osgi.framework,
org.w3c.dom,
org.xml.sax

@ -11,7 +11,7 @@
import net.java.sip.communicator.service.replacement.*;
import net.java.sip.communicator.util.*;
import org.json.*;
import org.json.simple.*;
/**
* Implements the {@link ReplacementService} to provide previews for Blip.tv
@ -78,18 +78,19 @@ public String getReplacement(String sourceString)
holder += inputLine;
in.close();
JSONObject wrapper = new JSONObject(holder);
JSONObject wrapper = (JSONObject)JSONValue
.parseWithException(holder);
String thumbUrl = wrapper.getString("thumbnail_url");
String thumbUrl = (String)wrapper.get("thumbnail_url");
if (thumbUrl != null)
{
return thumbUrl;
}
}
catch (Exception e)
catch (Throwable e)
{
e.printStackTrace();
logger.error("Error parsing", e);
}
return sourceString;

@ -10,4 +10,4 @@ Import-Package: org.osgi.framework,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
org.apache.http,
org.json
org.json.simple

@ -12,7 +12,7 @@
import net.java.sip.communicator.service.replacement.*;
import net.java.sip.communicator.util.*;
import org.json.*;
import org.json.simple.*;
/**
* Implements the {@link ReplacementService} to provide previews for Flickr
@ -99,16 +99,17 @@ public String getReplacement(String sourceString)
holder = inputLine;
in.close();
JSONObject wrapper = new JSONObject(holder);
JSONObject wrapper = (JSONObject)JSONValue
.parseWithException(holder);
if (wrapper.getString("stat").equals("ok"))
if (wrapper.get("stat").equals("ok"))
{
JSONObject result = wrapper.getJSONObject("photo");
if (!(result.length() == 0))
JSONObject result = (JSONObject)wrapper.get("photo");
if (!(result.isEmpty()))
{
String farmID = result.getString("farm");
String serverID = result.getString("server");
String secret = result.getString("secret");
String farmID = (String)result.get("farm");
String serverID = (String)result.get("server");
String secret = (String)result.get("secret");
thumbUrl =
"http://farm" + farmID + ".static.flickr.com/"
@ -117,9 +118,9 @@ public String getReplacement(String sourceString)
}
}
}
catch(Exception e)
catch(Throwable e)
{
e.printStackTrace();
logger.error("Error parsing", e);
}
}

@ -10,4 +10,4 @@ Import-Package: org.osgi.framework,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
org.apache.http,
org.json
org.json.simple

@ -11,7 +11,7 @@
import net.java.sip.communicator.service.replacement.*;
import net.java.sip.communicator.util.*;
import org.json.*;
import org.json.simple.*;
/**
* Implements the {@link ReplacementService} to provide previews for Hulu links.
@ -76,18 +76,19 @@ public String getReplacement(String sourceString)
holder = inputLine;
in.close();
JSONObject wrapper = new JSONObject(holder);
JSONObject wrapper = (JSONObject)JSONValue
.parseWithException(holder);
String thumbUrl = wrapper.getString("thumbnail_url");
String thumbUrl = (String)wrapper.get("thumbnail_url");
if (thumbUrl != null)
{
return thumbUrl;
}
}
catch (Exception e)
catch (Throwable e)
{
e.printStackTrace();
logger.error("Error parsing", e);
}
return sourceString;

@ -10,4 +10,4 @@ Import-Package: org.osgi.framework,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
org.apache.http,
org.json
org.json.simple

@ -12,7 +12,7 @@
import net.java.sip.communicator.service.replacement.*;
import net.java.sip.communicator.util.*;
import org.json.*;
import org.json.simple.*;
/**
* Implements the {@link ReplacementService} to provide previews for Vimeo
@ -88,17 +88,19 @@ public String getReplacement(String sourceString)
holder = inputLine;
in.close();
JSONArray result = new JSONArray(holder);
JSONArray result = (JSONArray)JSONValue
.parseWithException(holder);
if (!(result.length() == 0))
if (!(result.isEmpty()))
{
thumbUrl
= result.getJSONObject(0).getString("thumbnail_medium");
= (String)((JSONObject)result.get(0))
.get("thumbnail_medium");
}
}
catch (Exception e)
catch (Throwable e)
{
e.printStackTrace();
logger.error("Error parsing", e);
}
}

@ -10,4 +10,4 @@ Import-Package: org.osgi.framework,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
org.apache.http,
org.json
org.json.simple

@ -11,7 +11,7 @@
import net.java.sip.communicator.service.replacement.*;
import net.java.sip.communicator.util.*;
import org.json.*;
import org.json.simple.*;
/**
* Implements the {@link ReplacementService} to provide previews for Youtube
@ -76,18 +76,19 @@ public String getReplacement(String sourceString)
holder = inputLine;
in.close();
JSONObject wrapper = new JSONObject(holder);
JSONObject wrapper = (JSONObject)JSONValue
.parseWithException(holder);
String thumbUrl = wrapper.getString("thumbnail_url");
String thumbUrl = (String)wrapper.get("thumbnail_url");
if (thumbUrl != null)
{
return thumbUrl;
}
}
catch (Exception e)
catch (Throwable e)
{
e.printStackTrace();
logger.error("Error parsing", e);
}
return sourceString;

@ -10,4 +10,4 @@ Import-Package: org.osgi.framework,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
org.apache.http,
org.json
org.json.simple

@ -19,7 +19,7 @@
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.json.*;
import org.json.simple.*;
/**
* @author Yana Stamcheva
@ -281,8 +281,9 @@ private NewAccount parseHttpResponse(String response)
NewAccount newAccount = null;
try
{
JSONObject jsonObject = new JSONObject(response);
boolean isSuccess = jsonObject.getBoolean("success");
JSONObject jsonObject = (JSONObject)JSONValue
.parseWithException(response);
boolean isSuccess = (Boolean)jsonObject.get("success");
if (isSuccess)
{
@ -294,10 +295,10 @@ private NewAccount parseHttpResponse(String response)
}
else
{
showErrorMessage(jsonObject.getString("error_message"));
showErrorMessage((String)jsonObject.get("error_message"));
}
}
catch (JSONException e1)
catch (Throwable e1)
{
if (logger.isInfoEnabled())
logger.info("Failed Json parsing.", e1);

@ -24,7 +24,7 @@ Import-Package: org.osgi.framework,
javax.xml.parsers,
org.w3c.dom,
org.xml.sax,
org.json,
org.json.simple,
javax.swing,
javax.swing.event,
javax.swing.table,

@ -19,7 +19,7 @@
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.json.*;
import org.json.simple.*;
/**
* @author Yana Stamcheva
@ -304,18 +304,19 @@ private NewAccount parseHttpResponse(String response)
NewAccount newAccount = null;
try
{
JSONObject jsonObject = new JSONObject(response);
boolean isSuccess = jsonObject.getBoolean("success");
JSONObject jsonObject = (JSONObject)JSONValue
.parseWithException(response);
boolean isSuccess = (Boolean)jsonObject.get("success");
if (isSuccess)
{
newAccount = new NewAccount(
jsonObject.getString("sip_address"),
(String)jsonObject.get("sip_address"),
passField.getPassword(),
null,
jsonObject.getString("outbound_proxy"));
(String)jsonObject.get("outbound_proxy"));
String xcapRoot = jsonObject.getString("xcap_root");
String xcapRoot = (String)jsonObject.get("xcap_root");
// as sip2sip adds @sip2sip.info at the end of the
// xcap_uri but doesn't report it in resullt after
@ -340,10 +341,10 @@ private NewAccount parseHttpResponse(String response)
}
else
{
showErrorMessage(jsonObject.getString("error_message"));
showErrorMessage((String)jsonObject.get("error_message"));
}
}
catch (JSONException e1)
catch (Throwable e1)
{
if (logger.isInfoEnabled())
logger.info("Failed Json parsing.", e1);

@ -17,14 +17,14 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol.icqconstants,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
net.java.sip.communicator.util.swing,
net.java.sip.communicator.plugin.sipaccregwizz,
javax.naming,
javax.naming.directory,
javax.xml.parsers,
org.w3c.dom,
org.xml.sax,
org.json,
org.xml.sax,
org.json.simple,
javax.swing,
javax.swing.event,
javax.swing.table,

Loading…
Cancel
Save