Search in sources :

Example 1 with MemoryMapError

use of net.praqma.jenkins.memorymap.util.MemoryMapError in project memory-map-plugin by Praqma.

the class MemoryMapRecorder method perform.

@Override
public void perform(@Nonnull Run<?, ?> build, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException {
    PrintStream out = listener.getLogger();
    HashMap<String, MemoryMapConfigMemory> config;
    Plugin plug = Jenkins.getActiveInstance().getPlugin("memory-map");
    if (plug != null)
        out.println("Memory Map Plugin version " + plug.getWrapper().getVersion());
    try {
        config = workspace.act(new MemoryMapConfigFileParserDelegate(getChosenParsers()));
        config = workspace.act(new MemoryMapMapParserDelegate(getChosenParsers(), config));
    } catch (IOException ex) {
        // Catch all known errors (By using a marker interface)
        if (ex instanceof MemoryMapError) {
            out.println(ex.getMessage());
        } else {
            out.println("Unspecified error. Writing trace to log");
            logger.log(Level.SEVERE, "Abnormal plugin execution, trace written to log", ex);
            throw new AbortException(String.format("Unspecified error. Please review error message.%nPlease install the logging plugin to record the standard java logger output stream." + "%nThe plugin is described here: https://wiki.jenkins-ci.org/display/JENKINS/Logging+plugin and requires core 1.483  "));
        }
        return;
    }
    out.println("Printing configuration");
    if (config != null) {
        out.println();
        out.println(config.toString());
    }
    MemoryMapBuildAction buildAction = new MemoryMapBuildAction(build, config);
    buildAction.setRecorder(this);
    buildAction.setMemoryMapConfigs(config);
    buildAction.setChosenParsers(getChosenParsers());
    build.addAction(buildAction);
}
Also used : PrintStream(java.io.PrintStream) MemoryMapError(net.praqma.jenkins.memorymap.util.MemoryMapError) MemoryMapConfigMemory(net.praqma.jenkins.memorymap.result.MemoryMapConfigMemory) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1 MemoryMapConfigMemory (net.praqma.jenkins.memorymap.result.MemoryMapConfigMemory)1 MemoryMapError (net.praqma.jenkins.memorymap.util.MemoryMapError)1