
package novoda.lib.sqliteprovider.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;

/**
 * Parsing .sql files and get single statements suitable for insertion.
 */
public class SQLFile {

    private BufferedReader reader;

    private List<String> statements;

    private boolean inComment = false;

    public void parse(Reader in) throws IOException {
        reader = new BufferedReader(in);
        statements = new ArrayList<String>();
        String line = null;
        while ((line = reader.readLine()) != null) {
            line.trim();
            if (line.length() == 0) {
                continue;
            }
            if (line.startsWith("--"))
                continue;

            if (line.startsWith("/*")) {
                inComment = true;
                continue;
            }

            if (line.endsWith("*/") && inComment == true) {
                inComment = false;
                continue;
            }

            if (inComment == true)
                continue;

            statements.add(line);
        }
        reader.close();
    }

    public List<String> getStatements() {
        return statements;
    }

    public static List<String> statementsFrom(Reader reader) throws IOException {
        SQLFile file = new SQLFile();
        file.parse(reader);
        return file.getStatements();
    }

    public static List<String> statementsFrom(File sqlfile) throws IOException {
        FileReader reader = new FileReader(sqlfile);
        SQLFile file = new SQLFile();
        file.parse(reader);
        return file.getStatements();
    }
}

@@ -54,121 +54,9 @@
 .io.
-BufferedReader;%0Aimport java.io.File;%0Aimport java.io.FileReader;%0Aimport java.io.IOException;%0Aimport java.io.Reader
+*
 ;%0Aim
@@ -556,16 +556,23 @@
         
+ line =
  line.tr

Fix for line trimming so it is actually in use