当前位置: 首页>>代码示例>>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;未经允许,请勿转载。