buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckPythonTasks.java
changeset 628 7c4a911dc066
parent 588 c7c26511138f
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    16  */
    16  */
    17 package com.nokia.helium.antlint.ant.types;
    17 package com.nokia.helium.antlint.ant.types;
    18 
    18 
    19 import java.io.File;
    19 import java.io.File;
    20 import java.io.FileOutputStream;
    20 import java.io.FileOutputStream;
       
    21 import java.io.IOException;
    21 import java.io.PrintWriter;
    22 import java.io.PrintWriter;
    22 import java.util.ArrayList;
    23 import java.util.ArrayList;
    23 import java.util.List;
    24 import java.util.List;
    24 import java.io.IOException;
       
    25 
    25 
    26 import org.apache.tools.ant.BuildException;
    26 import org.apache.tools.ant.BuildException;
    27 import org.dom4j.Document;
    27 import org.dom4j.Document;
    28 import org.dom4j.DocumentException;
    28 import org.dom4j.DocumentException;
    29 import org.dom4j.Element;
    29 import org.dom4j.Element;
    91             File file = new File(heliumpath + File.separator + "python"
    91             File file = new File(heliumpath + File.separator + "python"
    92                     + File.separator + "target" + name + ".py");
    92                     + File.separator + "target" + name + ".py");
    93             PrintWriter output = new PrintWriter(new FileOutputStream(file));
    93             PrintWriter output = new PrintWriter(new FileOutputStream(file));
    94             if (!text.equals("")) {
    94             if (!text.equals("")) {
    95                 output.write("def abc():");
    95                 output.write("def abc():");
    96                 for (String line : text.split("\n"))
    96                 for (String line : text.split("\n")) {
    97                     output.write("    " + line + "\n");
    97                     output.write("    " + line + "\n");
       
    98                 }
    98             }
    99             }
    99             output.close();
   100             output.close();
   100         } catch (IOException e) {
   101         } catch (IOException e) {
   101             throw new BuildException(
   102             throw new BuildException(
   102                     "IOException:Not able to write python file " + name + ".py");
   103                     "IOException:Not able to write python file " + name + ".py");