buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/PythonTask.java
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
parent 587 85df38eb4012
permissions -rw-r--r--
helium_11.0.0-e00f171ca185
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
/*
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
 * All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
 *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
 * Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
 *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
 * Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
 *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
 * Description: 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
 *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
 */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
package com.nokia.helium.core.ant.taskdefs;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
import java.io.File;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
import java.io.FileWriter;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
import java.io.IOException;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
import java.io.PrintWriter;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
import org.apache.tools.ant.BuildException;
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    26
import org.apache.tools.ant.Project;
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
import org.apache.tools.ant.Task;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
import org.apache.tools.ant.taskdefs.ExecTask;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
import org.apache.tools.ant.types.Commandline;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    30
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
/**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
 * Embed python code in ant, generates temporary python file and executes it.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
 * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
 * <pre>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
 * Usage: &lt;hlm:python&gt;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
 *                .
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
 *                .  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
 *                .
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
 *        &lt;/hlm:python&gt;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
 * </pre>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
 * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
 * @ant.task name="python" category="Core"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
 */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
public class PythonTask extends Task {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
    private String iText;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
    private String outputProperty;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
    private String resultProperty;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
    private File script;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
    private File dir;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
    private File output;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
    private boolean iFailonerror;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
     * Sets the property name whose value should be set to the output of the
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
     * process.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
     * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
     * @param propertyname
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
     *            name of property.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
     * @ant.not-required
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
    public void setOutputProperty(String propertyname) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
        outputProperty = propertyname;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
     * Sets the name of a property in which the return code of the command
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
     * should be stored. Only of interest if failonerror=false.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
     * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
     * @param propertyname
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
     *            name of property.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
     * @ant.not-required .
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
    public void setResultProperty(String propertyname) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
        resultProperty = propertyname;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
     * Add python statements to execute.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
     * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    82
     * @param text
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
     *            is the python statement to execute
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
     * @ant.required If no script.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
    public void addText(String text) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    87
        iText = getProject().replaceProperties(text);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    88
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
     * Set the name of the python script to execute.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    92
     * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    93
     * @param scriptname
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    94
     *            name of the script to set.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
     * @ant.required If no text.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
    public void setScript(File scriptname) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
        script = scriptname;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    99
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
     * Fail if the command exits with a non-zero return code.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   103
     * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   104
     * @param failonerror
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   105
     *            if true fail the command on non-zero return code.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
     * @ant.not-required Default is no.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   107
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
    public void setFailonerror(boolean failonerror) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   109
        iFailonerror = failonerror;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   110
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   111
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   113
     * File the output of the process is redirected to. If error is not
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   114
     * redirected, it too will appear in the output.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
     * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
     * @param outputname
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   117
     *            name of a file to which output should be sent.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
     * @ant.not-required
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
    public void setOutput(File outputname) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
        output = outputname;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   122
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   123
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   124
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   125
     * Set the working directory of the process.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   126
     * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   127
     * @param dirname
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   128
     *            the working directory of the process.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   129
     * @ant.not-required
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   130
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   131
    public void setDir(File dirname) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   132
        dir = dirname;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   133
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   134
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   135
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   136
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   137
     * Method executes current task.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   138
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   139
    public void execute() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   140
        if (script != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   141
            if (!script.exists()) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   142
                throw new BuildException("Could not find " + script);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   143
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   144
            // Run the Python script
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   145
            ExecTask execTask = new ExecTask();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   146
            execTask.setProject(getProject());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   147
            execTask.setTaskName(getTaskName());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   148
            execTask.setExecutable("python");
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   149
            execTask.setFailonerror(true);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   150
            execTask.createArg().setFile(script);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   151
            execTask.setOutputproperty(outputProperty);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   152
            execTask.setResultProperty(resultProperty);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   153
            execTask.setDir(dir);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   154
            execTask.setOutput(output);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   155
            try {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   156
                execTask.execute();
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   157
            } catch (BuildException ex) {
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   158
                if (iFailonerror) {
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   159
                    throw new BuildException(ex.getMessage(), ex);
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   160
                } else {
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   161
                    log(ex.getMessage(), Project.MSG_ERR);
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   162
                }
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   163
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   164
        } else if (iText != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   165
            // Write the content of the script using Echo task
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   166
            File tempfile = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   167
            try {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   168
                // Create a temporary file to contain the script
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   169
                tempfile = File.createTempFile("helium", null);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   170
                PrintWriter out = new PrintWriter(new FileWriter(tempfile));
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   171
                out.write(iText);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   172
                out.close();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   173
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   174
                // Run the temporary Python script
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   175
                ExecTask execTask = new ExecTask();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   176
                execTask.setProject(getProject());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   177
                execTask.setTaskName(getTaskName());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   178
                execTask.setExecutable("python");
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   179
                execTask.setFailonerror(iFailonerror);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   180
                Commandline.Argument scriptArg = execTask.createArg();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   181
                scriptArg.setValue(tempfile.getAbsolutePath());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   182
                execTask.setOutputproperty(outputProperty);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   183
                execTask.setResultProperty(resultProperty);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   184
                execTask.setDir(dir);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   185
                execTask.setOutput(output);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   186
                execTask.execute();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   187
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   188
                // Delete temporary script file
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   189
                boolean fileDeleted = tempfile.delete();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   190
                if (!fileDeleted && iFailonerror) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   191
                    throw new BuildException("Could not delete script file!");
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   192
                }
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   193
            } catch (IOException ex) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   194
                if (iFailonerror) {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   195
                    throw new BuildException(ex.getMessage(), ex);
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   196
                }
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   197
                log("Error while running python task: " + ex.getMessage(), Project.MSG_ERR);
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   198
            } finally {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   199
                // make sure we delete the file anyway
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   200
                if (tempfile != null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   201
                    tempfile.delete();
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   202
                }
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   203
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   204
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   205
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   206
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   207
}