public static UserGroupInformation getCurrentUser() { try { return UserGroupInformation.getCurrentUser(); } catch( IOException exception ) { throw new CascadingException( "unable to get current user", exception ); } }
protected void setAutoCommit( Connection connection ) { try { connection.setAutoCommit( false ); } catch( SQLException exception ) { throw new CascadingException( "unable to set auto commit", exception ); } }
public static UserGroupInformation getCurrentUser() { try { return UserGroupInformation.getCurrentUser(); } catch( IOException exception ) { throw new CascadingException( "unable to get current user", exception ); } }
public static Class<?> loadClass( String typeString ) { try { return Thread.currentThread().getContextClassLoader().loadClass( typeString ); } catch( ClassNotFoundException exception ) { throw new CascadingException( "unable to load class: " + typeString, exception ); } }
protected static <C extends Configuration> C callCopyConstructor( Class type, Configuration parent ) { try { Constructor<C> constructor = type.getConstructor( parent.getClass() ); return constructor.newInstance( parent ); } catch( NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException exception ) { throw new CascadingException( "unable to create copy of: " + type ); } }
public static Object invokeConstructor( String className, Object[] parameters, Class[] parameterTypes ) { try { Class type = Util.class.getClassLoader().loadClass( className ); return invokeConstructor( type, parameters, parameterTypes ); } catch( ClassNotFoundException exception ) { throw new CascadingException( "unable to load class: " + className, exception ); } }
public static <T> T newInstance( String className, Object... parameters ) { try { Class<T> type = (Class<T>) Util.class.getClassLoader().loadClass( className ); return newInstance( type, parameters ); } catch( ClassNotFoundException exception ) { throw new CascadingException( "unable to load class: " + className, exception ); } }
private void setSchemeUsing( Fields fields ) { try { setScheme( schemeClass.getConstructor( Fields.class ).newInstance( fields ) ); } catch( Exception exception ) { throw new CascadingException( "unable to create specified scheme: " + schemeClass.getName(), exception ); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { throw new CascadingException( "testing" ); } }
private Date parse( String value ) { try { return getDateFormat().parse( value ); } catch( ParseException exception ) { throw new CascadingException( "unable to parse value: " + value + " with format: " + dateFormatString ); } }
private UserPayload getPayload( Configuration conf ) { try { return TezUtils.createUserPayloadFromConf( conf ); } catch( IOException exception ) { throw new CascadingException( exception ); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { throw new CascadingException( "testing" ); } }
private void setSchemeUsing( Fields fields ) { try { setScheme( schemeClass.getConstructor( Fields.class ).newInstance( fields ) ); } catch( Exception exception ) { throw new CascadingException( "unable to create specified scheme: " + schemeClass.getName(), exception ); } }
public static Object invokeStaticMethod( ClassLoader loader, String typeString, String methodName, Object[] parameters, Class[] parameterTypes ) { try { Class type = loader.loadClass( typeString ); return invokeStaticMethod( type, methodName, parameters, parameterTypes ); } catch( ClassNotFoundException exception ) { throw new CascadingException( "unable to load class: " + typeString, exception ); } }
private UserPayload getPayload( Configuration conf ) { try { return TezUtils.createUserPayloadFromConf( conf ); } catch( IOException exception ) { throw new CascadingException( exception ); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { throw new CascadingException( "testing" ); } }
OldOutputCollector( LogicalOutput logicalOutput ) { this.logicalOutput = logicalOutput; try { this.output = (KeyValueWriter) logicalOutput.getWriter(); } catch( Exception exception ) { throw new CascadingException( "unable to get writer", exception ); } }
@Override public TaskStatus getVertexChild( String taskID ) throws TezException { String format = "%s/%s/%s?fields=%s"; String url = String.format( format, baseUri, TEZ_TASK_ID, taskID, FILTER_BY_FIELDS ); JSONObject jsonRoot = getJsonRootEntity( url ); if( jsonRoot == null ) throw new CascadingException( "failed to get vertex task status from timeline server, for id: " + taskID ); return parseTaskStatus( jsonRoot ); }
@Override public TaskStatus getVertexChild( String taskID ) throws TezException { String format = "%s/%s/%s?fields=%s"; String url = String.format( format, baseUri, TEZ_TASK_ID, taskID, FILTER_BY_FIELDS ); JSONObject jsonRoot = getJsonRootEntity( url ); if( jsonRoot == null ) throw new CascadingException( "failed to get vertex task status from timeline server, for id: " + taskID ); return parseTaskStatus( jsonRoot ); }
@Test public void testStringify() { Throwable top = new CascadingException( "test message", new NullPointerException( "had an npe" ) ); assertNotNull( TraceUtil.stringifyStackTrace( top, "|", true, -1 ) ); assertTrue( !TraceUtil.stringifyStackTrace( top, "|", true, -1 ).contains( "\t" ) ); assertTrue( TraceUtil.stringifyStackTrace( top, "|", false, -1 ).contains( "\t" ) ); assertNull( TraceUtil.stringifyStackTrace( top, "|", true, 0 ) ); assertEquals( 1, TraceUtil.stringifyStackTrace( top, "|", true, 1 ).split( "\\|" ).length ); assertEquals( 2, TraceUtil.stringifyStackTrace( top, "|", true, 2 ).split( "\\|" ).length ); } }