package org.jboss.loom.ex;

import java.util.LinkedList;
import java.util.List;

/**
 *  @author Ondrej Zizka, ozizka at redhat.com
 */
public class MigrationExceptions extends MigrationException {

    protected List<Exception> exs = new LinkedList();


    public MigrationExceptions( String message, List<Exception> list ) {
        super( message );
        this.exs = list;
    }


    @Override
    public String getMessage() {
        StringBuilder sb = new StringBuilder( super.getMessage() );
        for( Exception ex : exs ) {
            sb.append("\n  ").append( ex.getClass().getSimpleName() ).append(": ").append( ex.getMessage() );
        }
        return sb.toString();
    }

    public List<Exception> getExs() {
        return exs;
    }

}// class

@@ -753,16 +753,516 @@
 %0A    %7D%0A%0A
+    %0A%0A    /**%0A     *  Shorthand method to handle one or multiple exceptions, if they occur, at the end of a method.%0A     */%0A    public static void wrapExceptions( List%3CException%3E problems, String msg ) throws MigrationException %7B%0A        if( !problems.isEmpty() ) %7B%0A            if( problems.size() == 1 ) %7B%0A                throw new MigrationException( msg, problems.get( 0 ) );%0A            %7D else %7B%0A                throw new MigrationExceptions( msg, problems );%0A            %7D%0A        %7D%0A    %7D%0A%0A    %0A
 %7D// clas

Add MigrationExceptions.wrapExceptions()