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

Peter Bacsko updated OOZIE-2845:
--------------------------------
    Description: 
In different places, we use the following reflection-based code to reset a 
variable inside {{HiveConf.java}}

{code}
    public static void resetHiveConfStaticVariables() throws Exception {
        // HiveConf initializes location of hive-site.xml in static block.
        // So this is needed so that tests like TestHiveMain that create 
hive-site.xml don't fail.
        Field declaredField = HiveConf.class.getDeclaredField("hiveSiteURL");
        declaredField.setAccessible(true);
        declaredField.set(null, 
HiveConf.class.getClassLoader().getResource("hive-site.xml"));
    }
{code}

Note that HiveConf has supported setting {{hiveSiteURL}} for a long time. Even 
version 0.13.0 has the static setter method:

https://github.com/apache/hive/blob/branch-0.13/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java#L1493-L1495

Therefore reflection-based solution should be modified.

  was:
In different places, we use the following reflection-based code, to reset a 
variable inside {{HiveConf.java}}

{code}
    public static void resetHiveConfStaticVariables() throws Exception {
        // HiveConf initializes location of hive-site.xml in static block.
        // So this is needed so that tests like TestHiveMain that create 
hive-site.xml don't fail.
        Field declaredField = HiveConf.class.getDeclaredField("hiveSiteURL");
        declaredField.setAccessible(true);
        declaredField.set(null, 
HiveConf.class.getClassLoader().getResource("hive-site.xml"));
    }
{code}

Note that HiveConf has supported setting {{hiveSiteURL}} for a long time. Even 
version 0.13.0 has the static setter method:

https://github.com/apache/hive/blob/branch-0.13/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java#L1493-L1495

Therefore reflection-based solution should be modified.


> Replace reflection-based code which sets variable in HiveConf
> -------------------------------------------------------------
>
>                 Key: OOZIE-2845
>                 URL: https://issues.apache.org/jira/browse/OOZIE-2845
>             Project: Oozie
>          Issue Type: Improvement
>          Components: core
>            Reporter: Peter Bacsko
>            Assignee: Peter Bacsko
>
> In different places, we use the following reflection-based code to reset a 
> variable inside {{HiveConf.java}}
> {code}
>     public static void resetHiveConfStaticVariables() throws Exception {
>         // HiveConf initializes location of hive-site.xml in static block.
>         // So this is needed so that tests like TestHiveMain that create 
> hive-site.xml don't fail.
>         Field declaredField = HiveConf.class.getDeclaredField("hiveSiteURL");
>         declaredField.setAccessible(true);
>         declaredField.set(null, 
> HiveConf.class.getClassLoader().getResource("hive-site.xml"));
>     }
> {code}
> Note that HiveConf has supported setting {{hiveSiteURL}} for a long time. 
> Even version 0.13.0 has the static setter method:
> https://github.com/apache/hive/blob/branch-0.13/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java#L1493-L1495
> Therefore reflection-based solution should be modified.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to