001    package railo.transformer.cfml.evaluator.impl;
002    
003    import railo.runtime.exp.TemplateException;
004    import railo.transformer.util.CFMLString;
005    
006    public final class ProcessingDirectiveException extends TemplateException {
007    
008            private String charset;
009            private boolean writeLog;
010    
011            public ProcessingDirectiveException(CFMLString cfml, String charset, boolean writeLog) {
012                    super(cfml, createMessage(cfml,charset,writeLog));
013                    this.charset=charset;
014                    this.writeLog=writeLog;
015            }
016    
017            private static String createMessage(CFMLString cfml, String charset,boolean writeLog) {
018                    StringBuffer msg=new StringBuffer();
019                    if(!(cfml.getCharset()+"").equalsIgnoreCase(charset))
020                            msg.append("change charset from ["+cfml.getCharset()+"] to ["+charset+"].");
021                    
022                    if(cfml.getWriteLog()!=writeLog)
023                            msg.append("change writelog from ["+cfml.getWriteLog()+"] to ["+writeLog+"].");
024                    
025                    return msg.toString();
026            }
027    
028            public String getCharset() {
029                    return charset;
030            }
031    
032            public boolean getWriteLog() {
033                    return writeLog;
034            }
035    
036    }