<commit_before>package org.mule.tooling.esb.launcher.configuration.archive;


import com.intellij.execution.ExecutionException;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.CompilerModuleExtension;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.FilenameFilter;

public class MuleAppMavenHandler implements MuleAppHandler
{

    @NotNull
    @Override
    public File getMuleApp(final Module module) throws ExecutionException
    {
        final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
        final VirtualFile moduleFile = module.getModuleFile();
        if (compilerModuleExtension != null && moduleFile != null)
        {
            //Refresh file system
            module.getModuleFile().refresh(false, true);
            VirtualFile compilerOutputPath = compilerModuleExtension.getCompilerOutputPath();
            if (compilerOutputPath == null)
            {
                compilerOutputPath = moduleFile.findChild("target");
            }
            if (compilerOutputPath != null && compilerOutputPath.getParent() != null)
            {
                final File outputDir = new File(compilerOutputPath.getParent().getCanonicalPath());
                File applicationZip = null;
                final File[] zips = outputDir.listFiles(new FilenameFilter()
                {
                    @Override
                    public boolean accept(File dir, String name)
                    {
                        return name.endsWith("zip");
                    }
                });
                if (zips.length > 0)
                {
                    applicationZip = zips[0];
                }
                if (applicationZip == null)
                {
                    throw new ExecutionException("Unable to create application. Application was not found at " + compilerOutputPath.getParent().getCanonicalPath());
                }
                return applicationZip;
            }
            else
            {
                throw new ExecutionException("Unable to create application. No output path was found.");
            }
        }
        else
        {
            throw new ExecutionException("Unable to create application. No module found.");
        }
    }
<commit_msg>Fix for issue #72<commit_after>package org.mule.tooling.esb.launcher.configuration.archive;


import com.intellij.execution.ExecutionException;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.CompilerModuleExtension;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.FilenameFilter;

public class MuleAppMavenHandler implements MuleAppHandler
{

    @NotNull
    @Override
    public File getMuleApp(final Module module) throws ExecutionException
    {
        String outputPath = null;
        final File outputDir;

        final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
        final VirtualFile moduleFile = module.getModuleFile();
        if (compilerModuleExtension != null && moduleFile != null)
        {
            //Refresh file system
            module.getModuleFile().refresh(false, true);
            VirtualFile compilerOutputPath = compilerModuleExtension.getCompilerOutputPath();

            if (compilerOutputPath != null && compilerOutputPath.getParent() != null) {
                outputPath = compilerOutputPath.getParent().getCanonicalPath();
                outputDir = new File(outputPath);
            } else {
                outputPath = module.getModuleFile().getParent().getCanonicalPath() + File.separator + "target";
                outputDir = new File(module.getModuleFile().getParent().getCanonicalPath(), "target");
            }

            File applicationZip = null;
            final File[] zips = outputDir.listFiles(new FilenameFilter()
            {
                @Override
                public boolean accept(File dir, String name)
                {
                    return name.endsWith("zip");
                }
            });
            if (zips.length > 0)
            {
                applicationZip = zips[0];
            }
            if (applicationZip == null)
            {
                throw new ExecutionException("Unable to create application. Application was not found at " + outputPath);
            }
            return applicationZip;
//            }
//            else
//            {
//                throw new ExecutionException("Unable to create application. No output path was found.");
//            }
        }
        else
        {
            throw new ExecutionException("Unable to create application. No module found.");
        }
    }

{'fraction_non_alphanumeric': 0.08461696446909016, 'fraction_numerical': 0.0012322858903265558, 'mean_word_length': 1.9586877278250303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5112619', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1123, 'n_words': 267}