You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Peter Vary (JIRA)" <ji...@apache.org> on 2017/08/08 09:15:00 UTC
[jira] [Commented] (HIVE-15225) QueryPlan.getJSONValue should code
against empty string values
[ https://issues.apache.org/jira/browse/HIVE-15225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118090#comment-16118090 ]
Peter Vary commented on HIVE-15225:
-----------------------------------
Thanks for the catch!
Is there any easy way to add a test case?
Thanks,
Peter
> QueryPlan.getJSONValue should code against empty string values
> --------------------------------------------------------------
>
> Key: HIVE-15225
> URL: https://issues.apache.org/jira/browse/HIVE-15225
> Project: Hive
> Issue Type: Bug
> Reporter: Yibing Shi
> Assignee: Yibing Shi
> Attachments: HIVE-15225.1.patch
>
>
> The current {{QueryPlan.getJSONValue}} implementation is as below:
> {code}
> public String getJSONValue(Object value) {
> String v = "null";
> if (value != null) {
> v = value.toString();
> if (v.charAt(0) != '[' && v.charAt(0) != '{') {
> v = "\"" + v + "\"";
> }
> }
> return v;
> }
> {code}
> When {{value.toString()}} returns an empty string, a StringIndexOutOfRangeException would be thrown out when "v.charAt(0)" is evaluated.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)