modules/ballerina-core/src/main/java/org/ballerinalang/services/ErrorHandlerUtils.java
private static void populateStackOverflowTrace(StringBuilder sb, Stack<StackFrame> stack, int stackStartIndex) {
        for (int i = stack.size() - 1; i >= stack.size() - STACK_TRACE_LIMIT; i--) {
            CallableUnitInfo frameInfo = stack.get(i).getNodeInfo();
            String pkgName = (frameInfo.getPackage() != null) ? frameInfo.getPackage() + ":" : "";
            sb.append("\t at " + pkgName + frameInfo.getName() + getNodeLocation(frameInfo)
                    + "\n");
        }
        sb.append("\t ...\n\t ...\n");
        for (int i = STACK_TRACE_LIMIT + stackStartIndex - 1; i >= stackStartIndex; i--) {
            CallableUnitInfo frameInfo = stack.get(i).getNodeInfo();
            String pkgName = (frameInfo.getPackage() != null) ? frameInfo.getPackage() + ":" : "";
            sb.append("\t at " + pkgName + frameInfo.getName() + getNodeLocation(frameInfo)
                    + "\n");
        }
    }
/**
     * Populate the stack trace of a stack overflow error.
     *
     * @param sb    String buffer to populate the stack trace
     * @param stack Current stack
     */
Populate the stack trace of a stack overflow error.
@param sb    String buffer to populate the stack trace
@param stack Current stack
Populate the stack trace of a stack overflow error . @param sb String buffer to populate the stack trace @param stack Current stack
private static void populateStackOverflowTrace(StringBuilder sb, Stack<StackFrame> stack, int stackStartIndex) {
        for (int i = stack.size() - 1; i >= stack.size() - STACK_TRACE_LIMIT; i--) {
            CallableUnitInfo frameInfo = stack.get(i).getNodeInfo();
            String pkgName = (frameInfo.getPackage() != null) ? frameInfo.getPackage() + ":" : "";
            sb.append("\t at " + pkgName + frameInfo.getName() + getNodeLocation(frameInfo)
                    + "\n");
        }
        sb.append("\t ...\n\t ...\n");
        for (int i = STACK_TRACE_LIMIT + stackStartIndex - 1; i >= stackStartIndex; i--) {
            CallableUnitInfo frameInfo = stack.get(i).getNodeInfo();
            String pkgName = (frameInfo.getPackage() != null) ? frameInfo.getPackage() + ":" : "";
            sb.append("\t at " + pkgName + frameInfo.getName() + getNodeLocation(frameInfo)
                    + "\n");
        }
    }
private static void populateStackOverflowTrace ( StringBuilder sb , Stack < StackFrame > stack , int stackStartIndex ) { for ( int i = stack . size ( ) - 1 ; i >= stack . size ( ) - STACK_TRACE_LIMIT ; i -- ) { CallableUnitInfo frameInfo = stack . get ( i ) . getNodeInfo ( ) ; String pkgName = ( frameInfo . getPackage ( ) != null ) ? frameInfo . getPackage ( ) + ":" : "" ; sb . append ( "\t at " + pkgName + frameInfo . getName ( ) + getNodeLocation ( frameInfo ) + "\n" ) ; } sb . append ( "\t ...\n\t ...\n" ) ; for ( int i = STACK_TRACE_LIMIT + stackStartIndex - 1 ; i >= stackStartIndex ; i -- ) { CallableUnitInfo frameInfo = stack . get ( i ) . getNodeInfo ( ) ; String pkgName = ( frameInfo . getPackage ( ) != null ) ? frameInfo . getPackage ( ) + ":" : "" ; sb . append ( "\t at " + pkgName + frameInfo . getName ( ) + getNodeLocation ( frameInfo ) + "\n" ) ; } }
Populate the stack trace of a stack overflow error.
Populate the stack trace of a stack overflow error .