private void doRun ( GadgetType type, boolean test, boolean verbose, boolean throwEx, EscapeType escape, String[] gadgetArgs )
            throws Exception, IOException {
        T marshal;
        try {
            System.setSecurityManager(new SideEffectSecurityManager());
            Object o = createObject(type, expandArguments(gadgetArgs));
            if ( o instanceof byte[] || o instanceof String ) {
                // already marshalled by delegate
                @SuppressWarnings ( "unchecked" )
                T alreadyMarshalled = (T) o;
                marshal = alreadyMarshalled;
            }
            else {
                marshal = marshal(o);
            }
        }
        finally {
            System.setSecurityManager(null);
        }

        if ( !test || verbose ) {
            System.err.println();
            writeOutput(marshal, escape);
        }

        if ( test ) {
            System.err.println();
            System.err.println("Running gadget " + type + ":");
            test(marshal, throwEx);
        }
    }
@param type
@param test
@param escape
@param gadgetArgs
@throws Exception
@throws IOException
src/main/java/marshalsec/MarshallerBase.java