sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Li (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (SQOOP-3244) Raise Exception "JSONObject cannot be cast to JSONArray" during parsing connector information
Date Wed, 25 Oct 2017 01:10:00 GMT

     [ https://issues.apache.org/jira/browse/SQOOP-3244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Patrick Li resolved SQOOP-3244.
-------------------------------
    Resolution: Not A Problem

It's caused by inconsistent client api version and server version

> 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
>              Labels: easyfix
>         Attachments: sqoop_client_api.png
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> 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")
> !sqoop_client_api.png!
>  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)

Mime
View raw message