Example usage for java.lang.reflect InvocationTargetException printStackTrace

List of usage examples for java.lang.reflect InvocationTargetException printStackTrace

Introduction

In this page you can find the example usage for java.lang.reflect InvocationTargetException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:io.fluo.api.config.FluoConfigurationTest.java

@Test
public void testIAE() {
    FluoConfiguration config = new FluoConfiguration();
    String[] positiveIntMethods = { "setLoaderQueueSize", "setLoaderThreads", "setOracleInstances",
            "setOracleMaxMemory", "setOracleNumCores", "setWorkerInstances", "setWorkerMaxMemory",
            "setWorkerNumCores", "setWorkerThreads", "setZookeeperTimeout" };
    for (String methodName : positiveIntMethods) {
        try {//from  w  w  w . j a  v a 2  s .co m
            config.getClass().getMethod(methodName, int.class).invoke(config, -5);
            Assert.fail();
        } catch (InvocationTargetException e) {
            if (!(e.getCause() instanceof IllegalArgumentException)) {
                Assert.fail();
            }
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail();
        }
    }
    String[] nonEmptyMethods = { "setAccumuloInstance", "setAccumuloTable", "setAccumuloUser",
            "setAccumuloZookeepers", "setAdminClass", "setClientClass", "setMetricsYamlBase64", "setMiniClass",
            "setMiniDataDir", "setInstanceZookeepers" };
    for (String methodName : nonEmptyMethods) {
        try {
            config.getClass().getMethod(methodName, String.class).invoke(config, "");
            Assert.fail();
        } catch (InvocationTargetException e) {
            if (!(e.getCause() instanceof IllegalArgumentException)) {
                Assert.fail();
            }
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail();
        }
    }
}

From source file:ReservationData.java

public boolean performFinish() {
    if (getDialogSettings() != null) {
        getDialogSettings().put(KEY_CUSTOMER_NAME, data.customerName);
        getDialogSettings().put(KEY_CUSTOMER_PHONE, data.customerPhone);
        getDialogSettings().put(KEY_CUSTOMER_EMAIL, data.customerEmail);
        getDialogSettings().put(KEY_CUSTOMER_ADDRESS, data.customerAddress);
        try {// ww  w  . j  a v  a2s. c  om
            // Saves the dialog settings into the specified file. 
            getDialogSettings().save(DIALOG_SETTING_FILE);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }

    try {
        // puts the data into a database ...
        getContainer().run(true, true, new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Store data", 100);
                monitor.worked(40);

                // store data here ...
                System.out.println(data);

                Thread.sleep(2000);
                monitor.done();
            }
        });
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    return true;
}

From source file:opendial.DialogueSystem.java

/**
 * Attaches the module to the dialogue system.
 * /*  w w  w  .ja va 2  s  . co  m*/
 * @param module the module class to instantiate
 */
public <T extends Module> void attachModule(Class<T> module) {
    try {
        Constructor<T> constructor = module.getConstructor(DialogueSystem.class);
        attachModule(constructor.newInstance(this));
        recordComment("Module " + module.getSimpleName() + " successfully attached");
    } catch (InvocationTargetException e) {
        log.warning("cannot attach module: " + e.getTargetException());
        e.printStackTrace();
        recordComment("cannot attach module: " + e.getTargetException());
    } catch (Exception e) {
        log.warning("cannot attach module of class " + module.getCanonicalName() + ": " + e);
    }
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.datastore.BlueprintsPersistenceBackendFactory.java

@Override
public BlueprintsPersistenceBackend createPersistentBackend(File file, Map<?, ?> options)
        throws InvalidDataStoreException {
    BlueprintsPersistenceBackend graphDB = null;
    PropertiesConfiguration neoConfig = null;
    PropertiesConfiguration configuration = null;
    try {/*from  ww w  .  ja  va  2 s.  co m*/
        // Try to load previous configurations
        Path path = Paths.get(file.getAbsolutePath()).resolve(CONFIG_FILE);
        try {
            configuration = new PropertiesConfiguration(path.toFile());
        } catch (ConfigurationException e) {
            throw new InvalidDataStoreException(e);
        }
        // Initialize value if the config file has just been created
        if (!configuration.containsKey(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE)) {
            configuration.setProperty(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE,
                    BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE_DEFAULT);
        } else if (options.containsKey(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE)) {
            // The file already existed, check that the issued options
            // are not conflictive
            String savedGraphType = configuration
                    .getString(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE);
            String issuedGraphType = options.get(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE)
                    .toString();
            if (!savedGraphType.equals(issuedGraphType)) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, "Unable to create graph as type " + issuedGraphType
                        + ", expected graph type was " + savedGraphType + ")");
                throw new InvalidDataStoreException("Unable to create graph as type " + issuedGraphType
                        + ", expected graph type was " + savedGraphType + ")");
            }
        }

        // Copy the options to the configuration
        for (Entry<?, ?> e : options.entrySet()) {
            configuration.setProperty(e.getKey().toString(), e.getValue().toString());
        }

        // Check we have a valid graph type, it is needed to get the
        // graph name
        String graphType = configuration.getString(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE);
        if (graphType == null) {
            throw new InvalidDataStoreException("Graph type is undefined for " + file.getAbsolutePath());
        }

        String[] segments = graphType.split("\\.");
        if (segments.length >= 2) {
            String graphName = segments[segments.length - 2];
            String upperCaseGraphName = Character.toUpperCase(graphName.charAt(0)) + graphName.substring(1);
            String configClassQualifiedName = MessageFormat.format(
                    "fr.inria.atlanmod.neoemf.graph.blueprints.{0}.config.Blueprints{1}Config", graphName,
                    upperCaseGraphName);
            try {
                ClassLoader classLoader = BlueprintsPersistenceBackendFactory.class.getClassLoader();
                Class<?> configClass = classLoader.loadClass(configClassQualifiedName);
                Field configClassInstanceField = configClass.getField("eINSTANCE");
                AbstractBlueprintsConfig configClassInstance = (AbstractBlueprintsConfig) configClassInstanceField
                        .get(configClass);
                Method configMethod = configClass.getMethod("putDefaultConfiguration", Configuration.class,
                        File.class);
                configMethod.invoke(configClassInstance, configuration, file);
                Method setGlobalSettingsMethod = configClass.getMethod("setGlobalSettings");
                setGlobalSettingsMethod.invoke(configClassInstance);
            } catch (ClassNotFoundException e1) {
                NeoLogger.log(NeoLogger.SEVERITY_WARNING,
                        "Unable to find the configuration class " + configClassQualifiedName);
                e1.printStackTrace();
            } catch (NoSuchFieldException e2) {
                NeoLogger.log(NeoLogger.SEVERITY_WARNING,
                        MessageFormat.format(
                                "Unable to find the static field eINSTANCE in class Blueprints{0}Config",
                                upperCaseGraphName));
                e2.printStackTrace();
            } catch (NoSuchMethodException e3) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR,
                        MessageFormat.format(
                                "Unable to find configuration methods in class Blueprints{0}Config",
                                upperCaseGraphName));
                e3.printStackTrace();
            } catch (InvocationTargetException e4) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, MessageFormat.format(
                        "An error occured during the exection of a configuration method", upperCaseGraphName));
                e4.printStackTrace();
            } catch (IllegalAccessException e5) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, MessageFormat.format(
                        "An error occured during the exection of a configuration method", upperCaseGraphName));
                e5.printStackTrace();
            }
        } else {
            NeoLogger.log(NeoLogger.SEVERITY_WARNING, "Unable to compute graph type name from " + graphType);
        }

        Graph baseGraph = null;
        try {
            baseGraph = GraphFactory.open(configuration);
        } catch (RuntimeException e) {
            throw new InvalidDataStoreException(e);
        }
        if (baseGraph instanceof KeyIndexableGraph) {
            graphDB = new BlueprintsPersistenceBackend((KeyIndexableGraph) baseGraph);
        } else {
            NeoLogger.log(NeoLogger.SEVERITY_ERROR,
                    "Graph type " + file.getAbsolutePath() + " does not support Key Indices");
            throw new InvalidDataStoreException(
                    "Graph type " + file.getAbsolutePath() + " does not support Key Indices");
        }
        // Save the neoconfig file
        Path neoConfigPath = Paths.get(file.getAbsolutePath()).resolve(NEO_CONFIG_FILE);
        try {
            neoConfig = new PropertiesConfiguration(neoConfigPath.toFile());
        } catch (ConfigurationException e) {
            throw new InvalidDataStoreException(e);
        }
        if (!neoConfig.containsKey(BACKEND_PROPERTY)) {
            neoConfig.setProperty(BACKEND_PROPERTY, BLUEPRINTS_BACKEND);
        }
    } finally {
        if (configuration != null) {
            try {
                configuration.save();
            } catch (ConfigurationException e) {
                // Unable to save configuration, supposedly it's a minor error,
                // so we log it without rising an exception
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, e);
            }
        }
        if (neoConfig != null) {
            try {
                neoConfig.save();
            } catch (ConfigurationException e) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, e);
            }
        }
    }
    return graphDB;
}

From source file:it.cnr.icar.eric.server.security.authorization.RegistryAttributeFinderModule.java

/**
 * Handles attributes as defined ebRIM for Any RegistryObject.
 * Used by subject, resource and action attributes handling methods.
 *//*www.  ja  v  a 2  s.  c o  m*/
EvaluationResult handleRegistryObjectAttribute(Object obj, Stack<?> attributeStack, URI type,
        EvaluationCtx context) {
    EvaluationResult evaluationResult = null;
    try {
        String attr = (String) attributeStack.pop();
        ServerRequestContext requestContext = AuthorizationServiceImpl.getRequestContext(context);
        log.trace("handleRegistryObjectAttribute: obj=" + obj.toString() + " attrubute = " + attr);

        if (requestContext != null && obj != null) {
            @SuppressWarnings("unused")
            RegistryRequestType registryRequest = requestContext.getCurrentRegistryRequest();

            //Now invoke a get method to get the value for attribute being sought
            Class<? extends Object> clazz = obj.getClass();
            @SuppressWarnings("unused")
            String clazzName = clazz.getName();
            PropertyDescriptor propDesc = new PropertyDescriptor(attr, clazz, getReadMethodName(attr), null);
            Method method = propDesc.getReadMethod();
            Object attrValObj = method.invoke(obj, (java.lang.Object[]) null);

            if (attrValObj instanceof Collection) {
                HashSet<AttributeValue> attrValueObjectIds = new HashSet<AttributeValue>();
                Iterator<?> iter = ((Collection<?>) attrValObj).iterator();
                while (iter.hasNext()) {
                    //??Dangerous assumption that Collection is a Collection of IdentifiableTypes
                    String attrValueObjectId = ((IdentifiableType) iter.next()).getId();
                    attrValueObjectIds.add(makeAttribute(attrValueObjectId, type));
                }
                evaluationResult = makeBag(attrValueObjectIds, type);
            } else {
                //See if more pointer chasing needs to be done or (!attributeStack.empty()) 
                if (!attributeStack.empty()) {
                    String id = (String) attrValObj;
                    RegistryObjectType ro = AuthorizationServiceImpl.getInstance()
                            .getRegistryObject(requestContext, id, false);
                    if (ro == null) {
                        throw new ObjectNotFoundException(id, "RegistryObject");
                    }
                    evaluationResult = handleRegistryObjectAttribute(ro, attributeStack, type, context);
                } else {
                    AttributeValue attrVal = makeAttribute(attrValObj, type);
                    evaluationResult = makeBag(attrVal, type);
                }
            }
        }
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (IntrospectionException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (ParseException e) {
        e.printStackTrace();
    } catch (ParsingException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    } catch (RegistryException e) {
        e.printStackTrace();
    }

    return evaluationResult;
}

From source file:org.kuali.kra.budget.calculator.QueryList.java

/** returns the field value in the base bean for the specified field.
 * @param fieldName fieldname whose value has to be got.
 * @param baseBean Bean containing the field.
 * @return value of the field.//from  w  ww. ja v a 2 s. c  o m
 */
private Object getFieldValue(String fieldName, Object baseBean) {
    Field field = null;
    Method method = null;
    Class dataClass = baseBean.getClass();
    Object value = null;

    try {
        field = dataClass.getDeclaredField(fieldName);
        if (!field.isAccessible()) {
            throw new NoSuchFieldException();
        }
    } catch (NoSuchFieldException noSuchFieldException) {
        try {
            String methodName = "get" + (fieldName.charAt(0) + "").toUpperCase() + fieldName.substring(1);
            method = dataClass.getMethod(methodName, null);
        } catch (NoSuchMethodException noSuchMethodException) {
            noSuchMethodException.printStackTrace();
        }
    }

    try {
        if (field != null && field.isAccessible()) {
            value = field.get(baseBean);
        } else {
            value = method.invoke(baseBean, null);
        }
    } catch (IllegalAccessException illegalAccessException) {
        illegalAccessException.printStackTrace();
    } catch (InvocationTargetException invocationTargetException) {
        invocationTargetException.printStackTrace();
    }
    return value;
}

From source file:org.kalypso.ui.rrm.internal.conversion.to12_02.CalcCasesConverter.java

@Override
protected void doExecute(final IProgressMonitor monitor) throws InterruptedException {
    try {//from   w  ww.j  a  v a  2 s. c  o  m
        /* Monitor. */
        final SubMonitor progress = SubMonitor.convert(monitor, Messages.getString("CalcCasesConverter_1"), //$NON-NLS-1$
                101);

        /* Find all calc cases. */
        final CalcCaseConvertWalker walker = new CalcCaseConvertWalker(m_globalData.getSourceDir());
        final File[] calcCases = walker.execute();

        /* Monitor. */
        ProgressUtilities.worked(progress, 1);
        progress.setWorkRemaining(calcCases.length);

        /* Convert all calc cases into scenarios. */
        for (int i = 0; i < calcCases.length; i++) {
            /* Monitor. */
            progress.subTask(String.format(Messages.getString("CalcCasesConverter_2"), calcCases[i].getName(), //$NON-NLS-1$
                    i + 1, calcCases.length));

            /* Determine the directories. */
            final File sourceDir = calcCases[i];
            final File targetDir = determineTargetDir(sourceDir);

            try {
                /* Convert the calc case to a scenario. */
                final CalcCaseConverter calcCaseConverter = new CalcCaseConverter(sourceDir, targetDir,
                        m_globalData);
                final IStatus status = calcCaseConverter.execute(progress.newChild(1));
                getLog().add(status);
            } catch (final CoreException ce) {
                final IStatus status = ce.getStatus();
                if (status.matches(IStatus.CANCEL))
                    throw new InterruptedException(Messages.getString("CalcCasesConverter_3")); //$NON-NLS-1$

                getLog().add(status);
            } catch (final InvocationTargetException e) {
                getLog().add(IStatus.ERROR, Messages.getString("CalcCasesConverter_4"), e.getTargetException(), //$NON-NLS-1$
                        calcCases[i].getName());
            } catch (final Throwable e) {
                getLog().add(IStatus.ERROR, Messages.getString("CalcCasesConverter_4"), e, //$NON-NLS-1$
                        calcCases[i].getName());
            }
        }
    } catch (final IOException e) {
        e.printStackTrace();
        getLog().add(IStatus.ERROR, Messages.getString("CalcCasesConverter_5"), e); //$NON-NLS-1$
    }
}

From source file:org.kuali.kra.budget.calculator.QueryList.java

/** calculates the sum of the field in this QueryList.
 * @param fieldName field of bean whose sum has to be calculated.
 * @param arg argument for the getter method of field if it takes any argumnt,
 * else can be null./*from w  w w.  ja va2 s. c o m*/
 * @param value value for the argument, else can be null.
 * @return returns sum.
 */
public double sum(String fieldName, Class arg, Object value) {
    if (size() == 0) {
        return 0;
    }

    Object current;
    Field field = null;
    Method method = null;
    Class dataClass = get(0).getClass();
    double sum = 0;

    try {
        field = dataClass.getDeclaredField(fieldName);

        Class fieldClass = field.getType();
        if (!(fieldClass.equals(Integer.class) || fieldClass.equals(Long.class)
                || fieldClass.equals(Double.class) || fieldClass.equals(Float.class)
                || fieldClass.equals(BigDecimal.class) || fieldClass.equals(BigInteger.class)
                || fieldClass.equals(BudgetDecimal.class) || fieldClass.equals(KualiDecimal.class)
                || fieldClass.equals(int.class) || fieldClass.equals(long.class)
                || fieldClass.equals(float.class) || fieldClass.equals(double.class))) {
            throw new UnsupportedOperationException("Data Type not numeric");
        }

        if (!field.isAccessible()) {
            throw new NoSuchFieldException();
        }
    } catch (NoSuchFieldException noSuchFieldException) {
        try {
            String methodName = "get" + (fieldName.charAt(0) + "").toUpperCase() + fieldName.substring(1);
            if (arg != null) {
                Class args[] = { arg };
                method = dataClass.getMethod(methodName, args);
            } else {
                method = dataClass.getMethod(methodName, null);
            }
        } catch (NoSuchMethodException noSuchMethodException) {
            noSuchMethodException.printStackTrace();
        }
    }

    for (int index = 0; index < size(); index++) {
        current = get(index);

        try {
            if (field != null && field.isAccessible()) {
                sum = sum + Double.parseDouble(((Comparable) field.get(current)).toString());
            } else {
                Comparable dataValue;
                if (value != null) {
                    Object values[] = { value };
                    dataValue = (Comparable) method.invoke(current, values);
                } else {
                    dataValue = (Comparable) method.invoke(current, null);
                }
                if (dataValue != null) {
                    sum += Double.parseDouble(dataValue.toString());
                }

            }
        } catch (IllegalAccessException illegalAccessException) {
            illegalAccessException.printStackTrace();
        } catch (InvocationTargetException invocationTargetException) {
            invocationTargetException.printStackTrace();
        }
    }
    return sum;
}

From source file:org.Microsoft.Telemetry.IntermediateHistoryStore.java

@Override
protected void serviceInit(Configuration conf) throws Exception {

    try {//from w ww  . ja v a2 s  .  c  om

        //Method m = originalStorage.getClass().getDeclaredMethod("serviceInit", Configuration.class);
        Method m = originalStorage.getClass().getMethod("serviceInit", Configuration.class);
        m.setAccessible(true);
        m.invoke(originalStorage, (Object) conf);

    } catch (NoSuchMethodException noSuchMethodException) {

        LOG.error(PATTERN_LOG_ERROR + "no Such Method Exception :", noSuchMethodException);
        noSuchMethodException.printStackTrace();

    } catch (SecurityException securityException) {

        LOG.error(PATTERN_LOG_ERROR + "Security Exception :", securityException);
        securityException.printStackTrace();

    } catch (IllegalAccessException illegalAccessException) {

        LOG.error(PATTERN_LOG_ERROR + "Illegal Access Exception :", illegalAccessException);
        illegalAccessException.printStackTrace();

    } catch (IllegalArgumentException illegalArgumentException) {

        LOG.error(PATTERN_LOG_ERROR + "Illegal Argument Exception :", illegalArgumentException);
        illegalArgumentException.printStackTrace();

    } catch (InvocationTargetException invocationTargetException) {

        Throwable cause = invocationTargetException.getCause();
        LOG.error(PATTERN_LOG_ERROR + "Invocation Target Exception failed because of:" + cause.getMessage(),
                invocationTargetException);
        invocationTargetException.printStackTrace();

    }
}

From source file:org.apache.axis2.tool.codegen.eclipse.CodeGenWizard.java

/**
 * The worker method, generates the code itself.
 *//*from   w w w  . j a  v a 2s.  co m*/
private void doFinishWSDL2Java() {
    WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
        protected void execute(IProgressMonitor monitor)
                throws CoreException, InvocationTargetException, InterruptedException {
            if (monitor == null) {
                monitor = new NullProgressMonitor();
            }

            /*
             * "3" is the total amount of steps, see below monitor.worked(amount)
             */
            monitor.beginTask(CodegenWizardPlugin.getResourceString("generator.generating"), 3);

            try {
                /*
                 * TODO: Introduce a progress monitor interface for CodeGenerationEngine.
                 * Since this monitor here doesn't make much sense, we
                 * should either remove the progress monitor from the CodeGenWizard,
                 * or give a (custom) progress monitor to the generate() method, so
                 * we will be informed by Axis2 about the progress of code generation.  
                 */
                WSDL2JavaGenerator generator = new WSDL2JavaGenerator();
                monitor.subTask(CodegenWizardPlugin.getResourceString("generator.readingWOM"));
                AxisService service = generator.getAxisService(wsdlSelectionPage.getFileName());
                monitor.worked(1);

                //The generate all fix (Axis2-1862)
                boolean isServerside, isServiceXML, isGenerateServerSideInterface = false;
                if (optionsPage.getGenerateAll()) {
                    isServerside = true;
                    isServiceXML = true;
                    isGenerateServerSideInterface = true;
                } else {
                    isServerside = optionsPage.isServerside();
                    isServiceXML = optionsPage.isServerXML();
                    isGenerateServerSideInterface = optionsPage.getGenerateServerSideInterface();
                }
                Map optionsMap = generator.fillOptionMap(optionsPage.isAsyncOnlyOn(),
                        optionsPage.isSyncOnlyOn(), isServerside, isServiceXML,
                        optionsPage.isGenerateTestCase(), optionsPage.getGenerateAll(),
                        optionsPage.getServiceName(), optionsPage.getPortName(),
                        optionsPage.getDatabinderName(), wsdlSelectionPage.getFileName(),
                        optionsPage.getPackageName(), optionsPage.getSelectedLanguage(),
                        outputPage.getOutputLocation(), optionsPage.getNs2PkgMapping(),
                        isGenerateServerSideInterface, optionsPage.getAdvanceOptions());

                //Fix for the CodeGenConfiguration Contructor Change
                //CodeGenConfiguration codegenConfig = new CodeGenConfiguration(service, optionsMap);
                CodeGenConfiguration codegenConfig = new CodeGenConfiguration(optionsMap);
                codegenConfig.addAxisService(service);

                //set the wsdl definision for codegen config for skeleton generarion.
                WSDLPropertyReader reader = new WSDLPropertyReader();
                reader.readWSDL(wsdlSelectionPage.getFileName());
                Definition wsdlDefinition = reader.getWsdlDefinition();
                codegenConfig.setWsdlDefinition(wsdlDefinition);

                //set the baseURI
                codegenConfig.setBaseURI(generator.getBaseUri(wsdlSelectionPage.getFileName()));
                monitor.worked(1);

                monitor.subTask(CodegenWizardPlugin.getResourceString("generator.generating"));

                new CodeGenerationEngine(codegenConfig).generate();

                //TODO refresh the eclipse project space to show the generated files

                //Add the codegen libs that are coming with the plugin to the project lib that has been created
                if (outputPage.getAxis2PluginLibCopyCheckBoxSelection()) {
                    String eclipseHome = System.getProperty("user.dir");
                    String pluginLibLocation = eclipseHome + File.separator + UIConstants.PLUGINS
                            + File.separator + UIConstants.AXIS_CODEGEN_PLUGIN_FOLDER + File.separator
                            + UIConstants.LIB;
                    addLibsToProjectLib(pluginLibLocation, outputPage.getOutputLocation());
                }

                //Also another requirement arises 
                //If the codegen project was newly buided project or else the eclipse
                //project intended to save this generated code does not have the required libs
                //to compile the generated code. We need to add the relevent libs to a lib directory 
                //of the <code>outputPage.getOutputLocation()</code>

                //Add the libraries on the plugin lib directory to the created project lib
                if (outputPage.getAxisLibCopyCheckBoxSelection() && outputPage.oktoLoadLibs()) {
                    //                    String libDirectory = outputPage.getAxisHomeLocation()+File.separator+
                    //                                      UIConstants.TARGET+File.separator+UIConstants.LIB;
                    String libDirectory = outputPage.getAxisJarsLocation();
                    addLibsToProjectLib(libDirectory, outputPage.getOutputLocation());
                }

                //This will Create a jar file from the codegen results and add to the output 
                //locations lib directory
                if (outputPage.getCreateJarCheckBoxSelection()) {
                    IWorkspace workspace = ResourcesPlugin.getWorkspace();
                    String tempCodegenLocation = workspace.getRoot().getLocation().toString() + File.separator
                            + "codegen";
                    String tempProjectSrcLocation = tempCodegenLocation + File.separator + "codegen_temp_src_"
                            + System.currentTimeMillis();
                    String tempProjectClassLocation = tempCodegenLocation + File.separator
                            + "codegen_temp_class_" + System.currentTimeMillis();
                    File tempCodegenFile = new File(tempCodegenLocation);
                    File tempSrcFile = new File(tempProjectSrcLocation);
                    File tempClassFile = new File(tempProjectClassLocation);
                    tempCodegenFile.mkdir();
                    tempSrcFile.mkdir();
                    tempClassFile.mkdir();
                    copyDirectory(new File(outputPage.getOutputLocation()), tempSrcFile);
                    //Compile the source to another directory 
                    SrcCompiler srcCompileTool = new SrcCompiler();
                    srcCompileTool.compileSource(tempClassFile, tempProjectSrcLocation);
                    //create the jar file and add that to the lib directory
                    String projectLib = outputPage.getOutputLocation() + File.separator + "lib";
                    JarFileWriter jarFileWriter = new JarFileWriter();
                    String jarFileName = "CodegenResults.jar";
                    if (!outputPage.getJarFilename().equals("")) {
                        jarFileName = outputPage.getJarFilename();
                    }
                    outputPage.setJarFileName(jarFileName);
                    jarFileWriter.writeJarFile(new File(projectLib), jarFileName, tempClassFile);

                    //Delete the temp folders
                    deleteDir(tempCodegenFile);

                }

                monitor.worked(1);
            } catch (Exception e) {
                ///////////////////////////////
                e.printStackTrace();
                ///////////////////////////// 
                throw new InterruptedException(e.getMessage());
            }

            monitor.done();
        }
    };

    /*
     * Start the generation as new Workbench Operation, so the user
     * can see the progress and, if needed, can stop the operation.
     */
    try {
        getContainer().run(false, true, op);
    } catch (InvocationTargetException e1) {
        /////////////////////////
        e1.printStackTrace();
        ////////////////////////
        throw new RuntimeException(e1);
    } catch (InterruptedException e1) {
        throw new RuntimeException(e1);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}