Description
In different places, we use the following reflection-based code to reset a variable inside HiveConf.java
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")); }
Note that HiveConf has supported setting hiveSiteURL for a long time. Even version 0.13.0 has the static setter method:
Therefore reflection-based solution should be modified.