Repository: incubator-freemarker Updated Branches: refs/heads/3 fd23c6444 -> 92db58918
(Change log update) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/af3053fa Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/af3053fa Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/af3053fa Branch: refs/heads/3 Commit: af3053faf02337b9ae61e5e7d0cac88d4c3355f8 Parents: fd23c64 Author: ddekany <[email protected]> Authored: Fri Jul 7 02:14:56 2017 +0200 Committer: ddekany <[email protected]> Committed: Fri Jul 7 02:14:56 2017 +0200 ---------------------------------------------------------------------- FM3-CHANGE-LOG.txt | 2 +- .../freemarker/converter/ConversionMarkers.java | 76 ++++++++++++++++++++ .../converter/ConversionWarnReceiver.java | 44 ------------ .../converter/LoggingWarnReceiver.java | 44 ------------ 4 files changed, 77 insertions(+), 89 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/af3053fa/FM3-CHANGE-LOG.txt ---------------------------------------------------------------------- diff --git a/FM3-CHANGE-LOG.txt b/FM3-CHANGE-LOG.txt index 6bea140..93a8669 100644 --- a/FM3-CHANGE-LOG.txt +++ b/FM3-CHANGE-LOG.txt @@ -22,7 +22,7 @@ the FreeMarer 3 changelog here: - Increased version number to 3.0.0 (nightly aka. SNAPSHOT) - Removed legacy extensions: rhyno, jython, xml (not to be confused with dom), jdom, ant. -- Removed JSP 2.0 support (2.1 and Servlet 2.5 is the minimum for now, but maybe it will be 2.2 and Servlet 3.0 later). +- Servlet 3.0 and JSP 2.2 and is the minimum requirement now (if Serlvet/JSP features are used at all). - Removed freemarker.ext.log, our log abstraction layer from the old times when there was no clear winner on this field. Added org.slf4j:slf4j-api as required dependency instead. - Log categories are now simply the full qualified class name of the logging classes. There are no predefined log http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/af3053fa/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConversionMarkers.java ---------------------------------------------------------------------- diff --git a/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConversionMarkers.java b/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConversionMarkers.java new file mode 100644 index 0000000..dbfe939 --- /dev/null +++ b/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConversionMarkers.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.freemarker.converter; + +import java.util.ArrayList; +import java.util.List; + +/** + * Receives source code markings with positions. + */ +public class ConversionMarkerReceiver { + + private final List<Entry> sourceFileMarkers = new ArrayList<>(); + private final List<Entry> destinationFileMarkers = new ArrayList<>(); + + /** + * @param row + * 1-based column in the source file + * @param col + * 1-based row in the source file + * @param message + * Not {@code null} + */ + public void warnInSource(int row, int col, String message); + + /** + * Similar to {@link #warnInSource(int, int, String)}, but adds a tipInOutput instead of a warning message. + */ + public void tipInOutput(int row, int col, String message); + + public enum Type { + WARN, TIP + } + + public class Entry { + private final int row; + private final int column; + private final String message; + + public Entry(int row, int column, String message) { + this.row = row; + this.column = column; + this.message = message; + } + + public int getRow() { + return row; + } + + public int getColumn() { + return column; + } + + public String getMessage() { + return message; + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/af3053fa/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConversionWarnReceiver.java ---------------------------------------------------------------------- diff --git a/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConversionWarnReceiver.java b/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConversionWarnReceiver.java deleted file mode 100644 index f959908..0000000 --- a/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConversionWarnReceiver.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.freemarker.converter; - -import java.io.File; - -public interface ConversionWarnReceiver { - - /** - * Set the file to which the subsequent {@link #warn} calls will refer to. - * @param sourceFile - */ - void setSourceFile(File sourceFile); - - /** - * @param row - * 1-based column in the source file - * @param col - * 1-based row in the source file - * @param message - * Not {@code null} - * - * @throws IllegalStateException - * If no file was set with {@link #setSourceFile(File)} - */ - void warn(int row, int col, String message); -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/af3053fa/freemarker-converter/src/main/java/org/apache/freemarker/converter/LoggingWarnReceiver.java ---------------------------------------------------------------------- diff --git a/freemarker-converter/src/main/java/org/apache/freemarker/converter/LoggingWarnReceiver.java b/freemarker-converter/src/main/java/org/apache/freemarker/converter/LoggingWarnReceiver.java deleted file mode 100644 index b2a2aa9..0000000 --- a/freemarker-converter/src/main/java/org/apache/freemarker/converter/LoggingWarnReceiver.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.freemarker.converter; - -import java.io.File; - -import org.apache.freemarker.core.util._NullArgumentException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LoggingWarnReceiver implements ConversionWarnReceiver { - - private File sourceFile; - - private static final Logger LOG = LoggerFactory.getLogger(LoggingWarnReceiver.class); - - @Override - public void setSourceFile(File sourceFile) { - this.sourceFile = sourceFile; - } - - @Override - public void warn(int row, int col, String message) { - _NullArgumentException.check("message", message); - LOG.warn("{}:{}:{}: {}", sourceFile, row, col, message); - } -}
