Permalink
Browse files

Clean up some whitespace, fix some bugs:

- Fix a problem parsing the document title if there isn't a space after the semicolon
- Fix a problem downloading files that was caused by not properly closing the write handle
  • Loading branch information...
1 parent c538794 commit afb8e4d021c7499aa37e1e829abda65ceeaf340c @matburt committed Apr 10, 2011
@@ -141,12 +141,12 @@ public String getNodePath(Node baseNode) {
public void parse(Node fileNode, BufferedReader breader)
{
- Pattern editTitlePattern =
+ Pattern editTitlePattern =
Pattern.compile("F\\((edit:.*?)\\) \\[\\[(.*?)\\]\\[(.*?)\\]\\]");
try
{
this.todos = appdb.getTodos();
-
+
String thisLine;
Stack<Node> nodeStack = new Stack();
Pattern propertiesLine = Pattern.compile("^\\s*:[A-Z]+:");
@@ -165,7 +165,8 @@ public void parse(Node fileNode, BufferedReader breader)
if (thisLine.charAt(0) == '#') {
if (thisLine.indexOf("#+TITLE:") != -1) {
fileNode.altNodeTitle = thisLine.substring(
- thisLine.indexOf("#+TITLE: ") + 9);
+ thisLine.indexOf("#+TITLE:") + 8).trim();
+
}
}
for (int idx = 0; idx < thisLine.length(); idx++) {
@@ -273,7 +274,7 @@ else if (thisLine.indexOf("DEADLINE:") != -1 ||
for (;nodeDepth > 0; nodeDepth--) {
nodeStack.pop();
}
- fileNode.parsed = true;
+ fileNode.parsed = true;
breader.close();
}
catch (IOException e) {
@@ -50,13 +50,14 @@ public void fetchAndSaveOrgFile(String orgPath, String destPath) throws Reportab
writer.write(baf, 0, actual);
actual = reader.read(baf, 0, BUFFER_SIZE);
}
+ writer.close();
}
catch (java.io.IOException e) {
throw new ReportableError(
r.getString(R.string.error_file_write,
orgPath),
e);
-
+
}
}

0 comments on commit afb8e4d

Please sign in to comment.