Skip to content

Commit

Permalink
Autoformatter: avoid code being left in buf
Browse files Browse the repository at this point in the history
  • Loading branch information
GKFX committed Jun 4, 2014
1 parent b33b047 commit d624259
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/src/processing/mode/java/AutoFormat.java
Expand Up @@ -688,15 +688,10 @@ else if (forFlag) {
}
} // end switch
} // end while not EOF

if (buf.length() > 0) writeIndentedLine();

final String formatted = result.toString();
if (!formatted.replaceAll("[\\s\\*/]","")
.equals(source.replaceAll("[\\s\\*/]",""))) {
// Double-check - this thing's so buggy it might be best to have one.
throw new RuntimeException("The autoformatter did something funny. Please" +
"copy and paste your sketch into a new issue on GitHub. \n" +
"https://github.com/processing/processing/issues/new");
}
return formatted.equals(cleanText) ? source : formatted;
}
}

0 comments on commit d624259

Please sign in to comment.