Add ability to pass CharSequence instead of forcing String for context variable.
java.lang.String is immutable and cannot be overwritten by user. When passing sensitive data as context variable String remains in memory until GC removes it. CharSequence allows user to provide his own implementation and overwrite data as needed.
This commit is contained in:
@@ -384,9 +384,9 @@ public class Template {
|
||||
|
||||
abstract void visit (Mustache.Visitor visitor);
|
||||
|
||||
protected static void write (Writer out, String data) {
|
||||
protected static void write (Writer out, CharSequence data) {
|
||||
try {
|
||||
out.write(data);
|
||||
out.append(data);
|
||||
} catch (IOException ioe) {
|
||||
throw new MustacheException(ioe);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user