當前位置: 首頁>>代碼示例>>Java>>正文


Java JSONException.getMessage方法代碼示例

本文整理匯總了Java中org.json.JSONException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java JSONException.getMessage方法的具體用法?Java JSONException.getMessage怎麽用?Java JSONException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.json.JSONException的用法示例。


在下文中一共展示了JSONException.getMessage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: LocationConfig

import org.json.JSONException; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public LocationConfig(String jsonCountries) throws ConfigurationException {
  if (jsonCountries == null || jsonCountries.isEmpty()) {
    throw new ConfigurationException("Null or empty JSON string");
  }
  try {
    JSONObject json = new JSONObject(jsonCountries);
    Iterator<String> codes = json.keys();
    while (codes.hasNext()) {
      String key = codes.next();
      cmap.put(key, json.getString(key));
    }
  } catch (JSONException e) {
    throw new ConfigurationException(e.getMessage());
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:17,代碼來源:LocationConfig.java

示例2: toJsonString

import org.json.JSONException; //導入方法依賴的package包/類
public String toJsonString() throws ConfigurationException {
  String str = null;
  if (cmap == null || cmap.isEmpty()) {
    return null;
  }
  try {
    JSONObject json = new JSONObject();
    Iterator<String> it = cmap.keySet().iterator();
    while (it.hasNext()) {
      String code = it.next();
      json.put(code, cmap.get(code));
    }
    str = json.toString();
  } catch (JSONException e) {
    throw new ConfigurationException(e.getMessage());
  }
  return str;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:19,代碼來源:CurrencyConfig.java

示例3: parse

import org.json.JSONException; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void parse(String currencySpec) throws ConfigurationException {
  if (currencySpec == null || currencySpec.isEmpty()) {
    throw new ConfigurationException("Invalid currency specification");
  }
  try {
    JSONObject json = new JSONObject(currencySpec);
    Iterator<String> keys = json.keys();
    while (keys.hasNext()) {
      String code = keys.next();
      String name = json.getString(code);
      if (name != null && !name.isEmpty()) {
        cmap.put(code, name);
        reversemap.put(name, code);
      }
    }
  } catch (JSONException e) {
    throw new ConfigurationException(e.getMessage());
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:21,代碼來源:CurrencyConfig.java

示例4: put

import org.json.JSONException; //導入方法依賴的package包/類
public GfJsonObject put(String key, Map<?, ?> value) throws GfJsonException {
  try {
    jsonObject.put(key, value);
  } catch (JSONException e) {
    throw new GfJsonException(e.getMessage());
  }
  return this;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:9,代碼來源:GfJsonObject.java

示例5: toJSONString

import org.json.JSONException; //導入方法依賴的package包/類
/**
 * Get the JSON String representation of this object
 */
public String toJSONString() throws ProtocolException {
  String jsonString = null;
  try {
    if ("01".equals(this.version)) {
      jsonString = toJSONObject01().toString();
    } else {
      throw new ProtocolException("Unsupported version: " + this.version);
    }
  } catch (JSONException e) {
    throw new ProtocolException(e.getMessage());
  }
  return jsonString;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:17,代碼來源:GetOrdersOutput.java

示例6: toJSONString

import org.json.JSONException; //導入方法依賴的package包/類
public String toJSONString() throws ProtocolException {
  String jsonString = null;
  try {
    jsonString = toJSONObject().toString();
  } catch (JSONException e) {
    throw new ProtocolException(e.getMessage());
  }

  return jsonString;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:11,代碼來源:UpdateInventoryOutput.java

示例7: getBody

import org.json.JSONException; //導入方法依賴的package包/類
@Override
public JSONObject getBody(String text) throws ServiceException {
    try {
        return new JsonObject(text);
    }
    catch (JSONException ex) {
        throw new ServiceException(Status.BAD_REQUEST, ex.getMessage());
    }
}
 
開發者ID:limberest,項目名稱:limberest,代碼行數:10,代碼來源:JsonRestService.java

示例8: addJsonDefinitions

import org.json.JSONException; //導入方法依賴的package包/類
/**
 * Loads and adds block definition from a JSON array string. These definitions will replace
 * existing definitions, if the type names conflict.
 *
 * @param jsonString The InputStream containing the JSON block definitions.
 *
 * @return A count of definitions added.
 * @throws IOException If there is a fundamental problem with the input.
 * @throws BlockLoadingException If the definition is malformed.
 */
public int addJsonDefinitions(String jsonString) throws IOException, BlockLoadingException {
    // Parse JSON first, avoiding side effects (partially added file) in the case of an error.
    List<BlockDefinition> defs;
    int arrayIndex = 0;  // definition index
    try {
        JSONArray jsonArray = new JSONArray(jsonString);
        defs = new ArrayList<>(jsonArray.length());
        for (arrayIndex = 0; arrayIndex < jsonArray.length(); arrayIndex++) {
            JSONObject jsonDef = jsonArray.getJSONObject(arrayIndex);
            defs.add(new BlockDefinition(jsonDef));
        }
    } catch (JSONException e) {
        String msg = "Block definition #" + arrayIndex + ": " + e.getMessage();
        throw new BlockLoadingException(msg, e);
    }

    // Attempt to add each definition, catching redefinition errors.
    int blockAddedCount = 0;
    for (arrayIndex = 0; arrayIndex < defs.size(); ++arrayIndex) {
        BlockDefinition def = defs.get(arrayIndex);
        String typeName = def.getTypeName();

        // Replace prior definition with warning, mimicking web behavior.
        if (removeDefinition(typeName)) {
            Log.w(TAG, "Block definition #" + arrayIndex +
                    " in JSON array replaces prior definition of \"" + typeName + "\".");
        }
        addDefinition(def);
        blockAddedCount++;
    }

    return blockAddedCount;
}
 
開發者ID:Axe-Ishmael,項目名稱:Blockly,代碼行數:44,代碼來源:BlockFactory.java

示例9: toJson

import org.json.JSONException; //導入方法依賴的package包/類
public String toJson() throws ProtocolException {
  String jsonString = null;
  try {
    jsonString = toJSONObject().toString();
    // jsonString = gson.toJson(toJSONObject());
  } catch (JSONException e) {
    throw new ProtocolException(e.getMessage());
  }

  return jsonString;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:12,代碼來源:AuthenticateOutput.java

示例10: b

import org.json.JSONException; //導入方法依賴的package包/類
public final JSONArray b() {
    JSONArray jSONArray = new JSONArray();
    try {
        jSONArray.put(new JSONObject(toString()));
        return jSONArray;
    } catch (JSONException e) {
        a.class.getSimpleName();
        e.getMessage();
        z.e();
        return null;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:a.java

示例11: SMSConfig

import org.json.JSONException; //導入方法依賴的package包/類
public SMSConfig(String jsonString) throws ConfigurationException {
  try {
    JSONObject jsonSMSConfig = new JSONObject(jsonString);
    countryConfig = jsonSMSConfig.getJSONObject(COUNTRY_CONFIG);
    providers = jsonSMSConfig.getJSONObject(PROVIDERS);
  } catch (JSONException e) {
    throw new ConfigurationException(e.getMessage());
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:10,代碼來源:SMSConfig.java

示例12: toJSONString

import org.json.JSONException; //導入方法依賴的package包/類
/**
 * Convert to JSON String
 */
public String toJSONString() throws ProtocolException {
  String jsonString = null;
  try {
    jsonString = toJSONObject().toString();
  } catch (JSONException e) {
    throw new ProtocolException(e.getMessage());
  }
  return jsonString;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:13,代碼來源:AggTransDataOutput.java

示例13: toJSONString

import org.json.JSONException; //導入方法依賴的package包/類
public String toJSONString() throws ProtocolException {
  String jsonString = null;
  try {
    jsonString = toJSONObject().toString();
  } catch (JSONException e) {
    throw new ProtocolException(e.getMessage());
  }
  return jsonString;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:10,代碼來源:GetTransactionsOutput.java

示例14: Permissions

import org.json.JSONException; //導入方法依賴的package包/類
public Permissions(String jsonString) throws ConfigurationException {
  try {
    prsJson = new JSONObject(jsonString);
  } catch (JSONException e) {
    throw new ConfigurationException(e.getMessage());
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:8,代碼來源:Permissions.java

示例15: putOnce

import org.json.JSONException; //導入方法依賴的package包/類
/**
 * 
 * @param key
 * @param value
 * @return this GfJsonObject
 * @throws GfJsonException if the key is a duplicate
 */
public GfJsonObject putOnce(String key, Object value) throws GfJsonException {
  try {
    jsonObject.putOnce(key, value);
  } catch (JSONException e) {
    throw new GfJsonException(e.getMessage());
  }
  return this;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:16,代碼來源:GfJsonObject.java


注:本文中的org.json.JSONException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。