@Override public Pipe[] getPrevious() { // returns the semantically equivalent to Pipe#previous to simplify logic in the planner // SubAssemblies are really aliases for their tails if( tails == null ) throw new IllegalStateException( TraceUtil.formatRawTrace( this, "setTails must be called after the sub-assembly is assembled" ) ); return Arrays.copyOf( tails, tails.length ); } }
/** * Constructor OperatorException creates a new OperatorException instance. * * @param pipe of type Pipe * @param string of type String */ public OperatorException( Pipe pipe, String string ) { super( TraceUtil.formatTrace( pipe, string ) ); }
@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 ); } }
String stackClassName = stackTraceElement.getClassName(); boolean atApiBoundary = atApiBoundary( stackTraceElement.toString() ); apiCall = String.format( "new %s()", getSimpleClassName( apiCallElement.getClassName() ) ); else apiCall = String.format( "%s()", method );
@Test public void testApiBoundary() { final String regex = "cascading\\.TraceTest\\.sampleApi.*"; TraceUtil.registerApiBoundary( regex ); try { Pipe pipe1 = sampleApi(); assertEqualsTrace( "sampleApi() @ cascading.TraceTest.testApiBoundary(TraceTest.java", pipe1.getTrace() ); } finally { TraceUtil.unregisterApiBoundary( regex ); } Pipe pipe2 = sampleApi(); assertEqualsTrace( "cascading.TraceTest.sampleApi(TraceTest.java", pipe2.getTrace() ); }
private String trace = TraceUtil.captureDebugTrace( this ); // see TraceUtil.setTrace() to override
String message = "union of steps have " + missing.size() + " fewer elements than parent assembly: " + registryName + ", missing: [" + formatTraces( missing, ", " ) + "]"; throw new PlannerException( message, assembly ); String message = "union of nodes have " + missing.size() + " fewer elements than parent step: " + registryName + ", missing: [" + formatTraces( missing, ", " ) + "]"; throw new PlannerException( message, step ); String message = "union of pipelines have " + missing.size() + " fewer elements than parent node: " + registryName + ", missing: [" + formatTraces( missing, ", " ) + "]"; throw new PlannerException( message, node );
private TupleEntry getDiagnostics( Throwable throwable ) { if( !recordAnyDiagnostics ) return TupleEntry.NULL; Tuple diagnostics = new Tuple(); if( recordElementTrace ) diagnostics.add( elementTrace ); if( recordThrowableMessage ) diagnostics.add( throwable.getMessage() ); if( recordThrowableStackTrace ) diagnostics.add( TraceUtil.stringifyStackTrace( throwable, stackTraceLineDelimiter, stackTraceTrimLine, -1 ) ); diagnosticEntry.setTuple( diagnostics ); return diagnosticEntry; }
public static String formatTrace( final Pipe pipe, String message ) { return formatTrace( pipe, message, new TraceFormatter() { @Override public String format( String trace ) { return "[" + Util.truncate( pipe.getName(), 25 ) + "][" + trace + "]"; } } ); }
/** * Method getTailNames returns the tailNames of this SubAssembly object. * * @return the tailNames (type String[]) of this SubAssembly object. */ public String[] getTailNames() { if( tails == null ) throw new IllegalStateException( TraceUtil.formatRawTrace( this, "setTails must be called in the constructor" ) ); if( names != null ) return names; names = new String[ tails.length ]; for( int i = 0; i < tails.length; i++ ) names[ i ] = tails[ i ].getName(); return names; }
public static String formatTrace( final Tap tap, String message ) { return formatTrace( tap, message, new TraceFormatter() { @Override public String format( String trace ) { return "[" + Util.truncate( tap.toString(), 25 ) + "][" + trace + "]"; } } ); }
/** * Constructor PlannerException creates a new PlannerException instance. * * @param flowElement of type FlowElement * @param message of type String * @param throwable of type Throwable */ public PlannerException( FlowElement flowElement, String message, Throwable throwable ) { super( TraceUtil.formatTrace( flowElement, message ), throwable ); }
public ElementGraphException( Tap tap, String message ) { this( (FlowElement) tap, TraceUtil.formatTrace( tap, message ) ); }
/** * Constructor PlannerException creates a new PlannerException instance. * * @param flowElement of type FlowElement * @param message of type String */ public PlannerException( FlowElement flowElement, String message ) { super( TraceUtil.formatTrace( flowElement, message ) ); }
public static String formatTrace( final Scheme scheme, String message ) { return formatTrace( scheme, message, new TraceFormatter() { @Override public String format( String trace ) { return "[" + Util.truncate( scheme.toString(), 25 ) + "][" + trace + "]"; } } ); }
/** * Constructor OperatorException creates a new OperatorException instance. * * @param pipe of type Pipe * @param string of type String * @param throwable of type Throwable */ public OperatorException( Pipe pipe, String string, Throwable throwable ) { super( TraceUtil.formatTrace( pipe, string ), throwable ); }
/** * Constructor PlannerException creates a new PlannerException instance. * * @param flowElement of type FlowElement * @param message of type String * @param throwable of type Throwable * @param elementGraph of type ElementGraph */ public PlannerException( FlowElement flowElement, String message, Throwable throwable, ElementGraph elementGraph ) { super( TraceUtil.formatTrace( flowElement, message ), throwable ); this.elementGraph = elementGraph; }
public ElementGraphException( Pipe pipe, String message ) { this( (FlowElement) pipe, TraceUtil.formatTrace( pipe, message ) ); }
/** * Method formatRawTrace does not include the pipe name * * @param pipe of type Pipe * @param message of type String * @return String */ public static String formatRawTrace( Pipe pipe, String message ) { return formatTrace( pipe, message, new TraceFormatter() { @Override public String format( String trace ) { return "[" + trace + "]"; } } ); }
public static String formatTrace( FlowElement flowElement, String message ) { if( flowElement == null ) return message; if( flowElement instanceof Pipe ) return formatTrace( (Pipe) flowElement, message ); if( flowElement instanceof Tap ) return formatTrace( (Tap) flowElement, message ); throw new UnsupportedOperationException( "cannot format type: " + flowElement.getClass().getName() ); }