You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Patrick Li (JIRA)" <ji...@apache.org> on 2017/10/25 01:00:00 UTC
[jira] [Created] (SQOOP-3244) Raise Exception "JSONObject cannot be
cast to JSONArray" during parsing connector information
Patrick Li created SQOOP-3244:
---------------------------------
Summary: Raise Exception "JSONObject cannot be cast to JSONArray" during parsing connector information
Key: SQOOP-3244
URL: https://issues.apache.org/jira/browse/SQOOP-3244
Project: Sqoop
Issue Type: Bug
Components: sqoop2-api
Affects Versions: 1.99.7
Environment: Java client API is used; JRE8; MacOS
Reporter: Patrick Li
Priority: Blocker
The code is as below:
Class: package org.apache.sqoop.json.ConnectorBean
Method: private MConnector restoreConnector(Object obj)
code with bug: line in red
cause: The object with name "link-config" is a JSON object, not a JSON array. It should be:
ConfigInputSerialization.restoreConfigList((JSONArray)object.get("link-config").get("configs")
!attachment-name.jpg|thumbnail!
private MConnector restoreConnector(Object obj) {
JSONObject object = (JSONObject)obj;
long connectorId = ((Long)object.get("id")).longValue();
String uniqueName = (String)object.get("name");
String className = (String)object.get("class");
String version = (String)object.get("version");
List<MConfig> linkConfigs = {color:red}ConfigInputSerialization.restoreConfigList((JSONArray)object.get("link-config"));{color}
JSONObject jobConfigJson = (JSONObject)object.get("job-config");
JSONArray fromJobConfigJson = (JSONArray)jobConfigJson.get(Direction.FROM.name());
JSONArray toJobConfigJson = (JSONArray)jobConfigJson.get(Direction.TO.name());
MFromConfig fromConfig = null;
MToConfig toConfig = null;
List toJobConfig;
if (fromJobConfigJson != null) {
toJobConfig = ConfigInputSerialization.restoreConfigList(fromJobConfigJson);
fromConfig = new MFromConfig(toJobConfig);
}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)