@Test public void createAnyInstanceOldPackageName() throws Exception { RequestContext metaData = mock(RequestContext.class); String className = "com.pivotal.pxf.Lucy"; try { Utilities.createAnyInstance(RequestContext.class, className, metaData); fail("creating an instance should fail because the class doesn't exist in classpath"); } catch (Exception e) { assertEquals(e.getClass(), Exception.class); assertEquals( e.getMessage(), "Class " + className + " does not appear in classpath. " + "Plugins provided by PXF must start with \"org.greenplum.pxf\""); } }
public static Object createAnyInstance(Class<?> confClass, String className, RequestContext metaData) throws Exception { Class<?> cls; try { cls = Class.forName(className); } catch (ClassNotFoundException e) { if (className.startsWith("com.pivotal.pxf")) { throw new Exception( "Class " + className + " does not appear in classpath. " + "Plugins provided by PXF must start with \"org.greenplum.pxf\"", e.getCause()); } else { throw e; } } Constructor<?> con = cls.getConstructor(confClass); return instantiate(con, metaData); }
Utilities { public static Object createAnyInstance(Class<?> confClass, String className, RequestContext metaData) throws Exception { Class<?> cls; try { cls = Class.forName(className); } catch (ClassNotFoundException e) { if (className.startsWith("com.pivotal.pxf")) { throw new Exception( "Class " + className + " does not appear in classpath. " + "Plugins provided by PXF must start with \"org.greenplum.pxf\"", e.getCause()); } else { throw e; } } Constructor<?> con = cls.getConstructor(confClass); return instantiate(con, metaData); } }
Utilities { public static Object createAnyInstance(Class<?> confClass, String className, RequestContext metaData) throws Exception { Class<?> cls; try { cls = Class.forName(className); } catch (ClassNotFoundException e) { if (className.startsWith("com.pivotal.pxf")) { throw new Exception( "Class " + className + " does not appear in classpath. " + "Plugins provided by PXF must start with \"org.greenplum.pxf\"", e.getCause()); } else { throw e; } } Constructor<?> con = cls.getConstructor(confClass); return instantiate(con, metaData); }  }
Utilities { public static Object createAnyInstance(Class<?> confClass, String className, RequestContext metaData) throws Exception { Class<?> cls; try { cls = Class.forName(className); } catch (ClassNotFoundException e) { if (className.startsWith("com.pivotal.pxf")) { throw new Exception( "Class " + className + " does not appear in classpath. " + "Plugins provided by PXF must start with \"org.greenplum.pxf\"", e.getCause()); } else { throw e; } } Constructor<?> con = cls.getConstructor(confClass); return instantiate(con, metaData); }  static byte[] parseBase64(String encoded, String paramName); static boolean isValidDirectoryName(String name); static boolean isValidRestrictedDirectoryName(String name); static Object createAnyInstance(Class<?> confClass,
                                           String className, RequestContext metaData); static Object createAnyInstance(String className); static void byteArrayToOctalString(byte[] bytes, StringBuilder sb); static String maskNonPrintables(String input); static FragmentMetadata parseFragmentMetadata(RequestContext context); static boolean aggregateOptimizationsSupported(RequestContext requestContext); static boolean implementsInterface(String className, Class<?> iface); static boolean isFragmenterCacheEnabled(); static String absoluteDataPath(String dataSource); static boolean isSecurityEnabled(Configuration configuration); static String rightTrimWhiteSpace(String s); static String getHost(String uri); }
Utilities { public static Object createAnyInstance(Class<?> confClass, String className, RequestContext metaData) throws Exception { Class<?> cls; try { cls = Class.forName(className); } catch (ClassNotFoundException e) { if (className.startsWith("com.pivotal.pxf")) { throw new Exception( "Class " + className + " does not appear in classpath. " + "Plugins provided by PXF must start with \"org.greenplum.pxf\"", e.getCause()); } else { throw e; } } Constructor<?> con = cls.getConstructor(confClass); return instantiate(con, metaData); }  static byte[] parseBase64(String encoded, String paramName); static boolean isValidDirectoryName(String name); static boolean isValidRestrictedDirectoryName(String name); static Object createAnyInstance(Class<?> confClass,
                                           String className, RequestContext metaData); static Object createAnyInstance(String className); static void byteArrayToOctalString(byte[] bytes, StringBuilder sb); static String maskNonPrintables(String input); static FragmentMetadata parseFragmentMetadata(RequestContext context); static boolean aggregateOptimizationsSupported(RequestContext requestContext); static boolean implementsInterface(String className, Class<?> iface); static boolean isFragmenterCacheEnabled(); static String absoluteDataPath(String dataSource); static boolean isSecurityEnabled(Configuration configuration); static String rightTrimWhiteSpace(String s); static String getHost(String uri); static final Pattern SCHEME_PATTERN; static final Pattern NON_HOSTNAME_CHARACTERS; }