Repository: incubator-freemarker Updated Branches: refs/heads/3 ce9ab30f2 -> bc35fa237
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java index 86b7511..43cdf72 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java @@ -118,16 +118,16 @@ public interface ProcessingConfiguration { * default system time zone of the JDBC client, not just on the content of the database. (This used to be the * default behavior of ORM-s, like Hibernate, too.) * - * <li>The value of the {@code time_zone} FreeMarker configuration setting sets the time zone used for the + * <li>The value of the {@code timeZone} FreeMarker configuration setting sets the time zone used for the * template output. For example, when a web page visitor has a preferred time zone, the web application framework * may calls {@link Environment#setTimeZone(TimeZone)} with that time zone. Thus, the visitor will * see {@link java.sql.Timestamp java.sql.Timestamp} and plain {@link java.util.Date java.util.Date} values as * they look in his own time zone. While * this is desirable for those types, as they meant to represent physical points on the time line, this is not - * necessarily desirable for date-only and time-only values. When {@code sql_date_and_time_time_zone} is - * {@code null}, {@code time_zone} is used for rendering all kind of date/time/dateTime values, including + * necessarily desirable for date-only and time-only values. When {@code sqlDateAndTimeTimeZone} is + * {@code null}, {@code timeZone} is used for rendering all kind of date/time/dateTime values, including * {@link java.sql.Date java.sql.Date} and {@link java.sql.Time java.sql.Time}, and then if, for example, - * {@code time_zone} is GMT+00:00, the + * {@code timeZone} is GMT+00:00, the * values from the earlier examples will be shown as 2014-07-11 (one day off) and 09:57:00 (2 hours off). While * those are the time zone correct renderings, those values are probably meant to be shown "as is". * @@ -183,7 +183,7 @@ public interface ProcessingConfiguration { /** * A {@link Map} that associates {@link TemplateNumberFormatFactory}-es to names, which then can be referred by the - * {@link #getNumberFormat() number_format} setting with values starting with <code>@<i>name</i></code>. The keys in + * {@link #getNumberFormat() numberFormat} setting with values starting with <code>@<i>name</i></code>. The keys in * the {@link Map} should start with an UNICODE letter, and should only contain UNICODE letters and digits (not * {@code _}), otherwise accessing the custom format from templates can be difficult or impossible. The * {@link Configuration}-level default of this setting is an empty {@link Map}. @@ -304,14 +304,14 @@ public interface ProcessingConfiguration { * and {@link java.sql.Time java.sql.Time}, and for {@code "iso"} date values. * * <li><p>Time zone options:<br> - * {@code u} = Use UTC instead of what the {@code time_zone} setting suggests. However, + * {@code u} = Use UTC instead of what the {@code timeZone} setting suggests. However, * {@link java.sql.Date java.sql.Date} and {@link java.sql.Time java.sql.Time} aren't affected * by this (see {@link #getSQLDateAndTimeTimeZone()} to understand why)<br> - * {@code fu} = "Force UTC", that is, use UTC instead of what the {@code time_zone} or the - * {@code sql_date_and_time_time_zone} setting suggests. This also effects + * {@code fu} = "Force UTC", that is, use UTC instead of what the {@code timeZone} or the + * {@code sqlDateAndTimeTimeZone} setting suggests. This also effects * {@link java.sql.Date java.sql.Date} and {@link java.sql.Time java.sql.Time} values<br> - * Neither = Use the time zone suggested by the {@code time_zone} or the - * {@code sql_date_and_time_time_zone} configuration setting ({@link #getTimeZone()} and + * Neither = Use the time zone suggested by the {@code timeZone} or the + * {@code sqlDateAndTimeTimeZone} configuration setting ({@link #getTimeZone()} and * {@link #getSQLDateAndTimeTimeZone()}). * </ul> * @@ -364,8 +364,8 @@ public interface ProcessingConfiguration { /** * A {@link Map} that associates {@link TemplateDateFormatFactory}-es to names, which then can be referred by the - * {@link #getDateFormat() date_format}/{@link #getDateFormat() date_format }/{@link #getDateTimeFormat() - * datetime_format} settings with values starting with <code>@<i>name</i></code>. The keys in the {@link Map} should + * {@link #getDateFormat() dateFormat}/{@link #getDateFormat() dateFormat }/{@link #getDateTimeFormat() + * dateTimeFormat} settings with values starting with <code>@<i>name</i></code>. The keys in the {@link Map} should * start with an UNICODE letter, and should only contain UNICODE letters and digits (not {@code _}), otherwise * accessing the custom format from templates can be difficult or impossible. The {@link Configuration}-level * default of this setting is an empty {@link Map}. http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java index 43e2902..5ea4517 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java @@ -123,7 +123,6 @@ public class Template implements ProcessingConfiguration, CustomStateScope { private Charset actualSourceEncoding; private TagSyntax actualTagSyntax; - private NamingConvention actualNamingConvention; // Custom state: private final Object customStateMapLock = new Object(); private final ConcurrentHashMap<CustomStateKey, Object> customStateMap = new ConcurrentHashMap<>(0); @@ -286,7 +285,7 @@ public class Template implements ProcessingConfiguration, CustomStateScope { _NullArgumentException.check("configuration", configuration); this.cfg = configuration; this.tCfg = templateConfiguration; - this.parsingConfiguration = tCfg != null ? new TemplateParsingConfigurationWithFallback(cfg, tCfg) : cfg; + this.parsingConfiguration = tCfg != null ? new ParsingConfigurationWithFallback(cfg, tCfg) : cfg; this.lookupName = lookupName; this.sourceName = sourceName; @@ -319,7 +318,6 @@ public class Template implements ProcessingConfiguration, CustomStateScope { rootElement = null; } actualTagSyntax = parser._getLastTagSyntax(); - actualNamingConvention = parser._getLastNamingConvention(); } catch (TokenMgrError exc) { // TokenMgrError VS ParseException is not an interesting difference for the user, so we just convert it // to ParseException @@ -685,22 +683,11 @@ public class Template implements ProcessingConfiguration, CustomStateScope { } /** - * Returns the naming convention the parser has chosen for this template. If it could be determined, it's - * {@link NamingConvention#LEGACY} or {@link NamingConvention#CAMEL_CASE}. If it - * couldn't be determined (like because there no identifier that's part of the template language was used where - * the naming convention matters), this returns whatever the default is in the current configuration, so it's maybe - * {@link TagSyntax#AUTO_DETECT}. - */ - public NamingConvention getActualNamingConvention() { - return actualNamingConvention; - } - - /** * Returns the output format (see {@link Configuration#getOutputFormat()}) used for this template. * The output format of a template can come from various places, in order of increasing priority: * {@link Configuration#getOutputFormat()}, {@link ParsingConfiguration#getOutputFormat()} (which is usually * provided by {@link Configuration#getTemplateConfigurations()}) and the {@code #ftl} header's - * {@code output_format} option in the template. + * {@code outputFormat} option in the template. */ public OutputFormat getOutputFormat() { return outputFormat; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateBooleanFormat.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateBooleanFormat.java b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateBooleanFormat.java index 52f753d..240b81e 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateBooleanFormat.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateBooleanFormat.java @@ -66,7 +66,7 @@ final class TemplateBooleanFormat extends TemplateValueFormat { * Returns the string to which {@code true} is converted to for human audience, or {@code null} if automatic * coercion to string is not allowed. The default value is {@code null}. * - * <p>This value is deduced from the {@code "boolean_format"} setting. + * <p>This value is deduced from the {@code "booleanFormat"} setting. * Confusingly, for backward compatibility (at least until 2.4) that defaults to {@code "true,false"}, yet this * defaults to {@code null}. That's so because {@code "true,false"} is treated exceptionally, as that default is a * historical mistake in FreeMarker, since it targets computer language output, not human writing. Thus it's http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java index 17583e5..3e77e2c 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java @@ -83,7 +83,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur private final TemplateLanguage templateLanguage; private final TagSyntax tagSyntax; - private final NamingConvention namingConvention; private final Boolean whitespaceStripping; private final AutoEscapingPolicy autoEscapingPolicy; private final Boolean recognizeStandardFileExtensions; @@ -125,7 +124,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur templateLanguage = builder.isTemplateLanguageSet() ? builder.getTemplateLanguage() : null; tagSyntax = builder.isTagSyntaxSet() ? builder.getTagSyntax() : null; - namingConvention = builder.isNamingConventionSet() ? builder.getNamingConvention() : null; whitespaceStripping = builder.isWhitespaceStrippingSet() ? builder.getWhitespaceStripping() : null; autoEscapingPolicy = builder.isAutoEscapingPolicySet() ? builder.getAutoEscapingPolicy() : null; recognizeStandardFileExtensions = builder.isRecognizeStandardFileExtensionsSet() ? builder.getRecognizeStandardFileExtensions() : null; @@ -161,19 +159,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur } @Override - public NamingConvention getNamingConvention() { - if (!isNamingConventionSet()) { - throw new CoreSettingValueNotSetException("namingConvention"); - } - return namingConvention; - } - - @Override - public boolean isNamingConventionSet() { - return namingConvention != null; - } - - @Override public boolean getWhitespaceStripping() { if (!isWhitespaceStrippingSet()) { throw new CoreSettingValueNotSetException("whitespaceStripping"); @@ -274,6 +259,11 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur } @Override + public boolean isIncompatibleImprovementsSet() { + return false; + } + + @Override public Locale getLocale() { if (!isLocaleSet()) { throw new CoreSettingValueNotSetException("locale"); @@ -811,9 +801,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur if (tc.isLocaleSet()) { setLocale(tc.getLocale()); } - if (tc.isNamingConventionSet()) { - setNamingConvention(tc.getNamingConvention()); - } if (tc.isNewBuiltinClassResolverSet()) { setNewBuiltinClassResolver(tc.getNewBuiltinClassResolver()); } @@ -895,6 +882,11 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur } @Override + public boolean isIncompatibleImprovementsSet() { + return false; + } + + @Override protected TagSyntax getDefaultTagSyntax() { throw new CoreSettingValueNotSetException("tagSyntax"); } @@ -905,11 +897,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur } @Override - protected NamingConvention getDefaultNamingConvention() { - throw new CoreSettingValueNotSetException("namingConvention"); - } - - @Override protected boolean getDefaultWhitespaceStripping() { throw new CoreSettingValueNotSetException("whitespaceStripping"); } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java index 4e5e0b7..477cbf6 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateExceptionHandler.java @@ -26,7 +26,7 @@ import java.io.Writer; import org.apache.freemarker.core.util._StringUtil; /** - * Used for the {@code template_exception_handler} configuration setting; + * Used for the {@code templateExceptionHandler} configuration setting; * see {@link MutableProcessingConfiguration#setTemplateExceptionHandler(TemplateExceptionHandler)} for more. */ public interface TemplateExceptionHandler { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateParsingConfigurationWithFallback.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateParsingConfigurationWithFallback.java b/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateParsingConfigurationWithFallback.java deleted file mode 100644 index 30414a7..0000000 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/TemplateParsingConfigurationWithFallback.java +++ /dev/null @@ -1,146 +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.core; - -import java.nio.charset.Charset; - -import org.apache.freemarker.core.arithmetic.ArithmeticEngine; -import org.apache.freemarker.core.outputformat.OutputFormat; - -/** - * Adds {@link Configuration} fallback to the {@link ParsingConfiguration} part of a {@link TemplateConfiguration}. - */ -final class TemplateParsingConfigurationWithFallback implements ParsingConfiguration { - - private final Configuration cfg; - private final TemplateConfiguration tCfg; - - TemplateParsingConfigurationWithFallback(Configuration cfg, TemplateConfiguration tCfg) { - this.cfg = cfg; - this.tCfg = tCfg; - } - - @Override - public TemplateLanguage getTemplateLanguage() { - return tCfg.isTemplateLanguageSet() ? tCfg.getTemplateLanguage() : cfg.getTemplateLanguage(); - } - - @Override - public boolean isTemplateLanguageSet() { - return true; - } - - @Override - public TagSyntax getTagSyntax() { - return tCfg.isTagSyntaxSet() ? tCfg.getTagSyntax() : cfg.getTagSyntax(); - } - - @Override - public boolean isTagSyntaxSet() { - return true; - } - - @Override - public NamingConvention getNamingConvention() { - return tCfg.isNamingConventionSet() ? tCfg.getNamingConvention() : cfg.getNamingConvention(); - } - - @Override - public boolean isNamingConventionSet() { - return true; - } - - @Override - public boolean getWhitespaceStripping() { - return tCfg.isWhitespaceStrippingSet() ? tCfg.getWhitespaceStripping() : cfg.getWhitespaceStripping(); - } - - @Override - public boolean isWhitespaceStrippingSet() { - return true; - } - - @Override - public ArithmeticEngine getArithmeticEngine() { - return tCfg.isArithmeticEngineSet() ? tCfg.getArithmeticEngine() : cfg.getArithmeticEngine(); - } - - @Override - public boolean isArithmeticEngineSet() { - return true; - } - - @Override - public AutoEscapingPolicy getAutoEscapingPolicy() { - return tCfg.isAutoEscapingPolicySet() ? tCfg.getAutoEscapingPolicy() : cfg.getAutoEscapingPolicy(); - } - - @Override - public boolean isAutoEscapingPolicySet() { - return true; - } - - @Override - public OutputFormat getOutputFormat() { - return tCfg.isOutputFormatSet() ? tCfg.getOutputFormat() : cfg.getOutputFormat(); - } - - @Override - public boolean isOutputFormatSet() { - return true; - } - - @Override - public boolean getRecognizeStandardFileExtensions() { - return tCfg.isRecognizeStandardFileExtensionsSet() ? tCfg.getRecognizeStandardFileExtensions() - : cfg.getRecognizeStandardFileExtensions(); - } - - @Override - public boolean isRecognizeStandardFileExtensionsSet() { - return true; - } - - @Override - public Version getIncompatibleImprovements() { - // This can be only set on the Configuration-level - return cfg.getIncompatibleImprovements(); - } - - @Override - public int getTabSize() { - return tCfg.isTabSizeSet() ? tCfg.getTabSize() : cfg.getTabSize(); - } - - @Override - public boolean isTabSizeSet() { - return true; - } - - @Override - public Charset getSourceEncoding() { - return tCfg.isSourceEncodingSet() ? tCfg.getSourceEncoding() : cfg.getSourceEncoding(); - } - - @Override - public boolean isSourceEncodingSet() { - return true; - } -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/_ObjectBuilderSettingEvaluator.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/_ObjectBuilderSettingEvaluator.java b/freemarker-core/src/main/java/org/apache/freemarker/core/_ObjectBuilderSettingEvaluator.java index 3ebada9..3ff249a 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/_ObjectBuilderSettingEvaluator.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/_ObjectBuilderSettingEvaluator.java @@ -699,9 +699,8 @@ public class _ObjectBuilderSettingEvaluator { } // For accessing static fields: - addWithSimpleName(SHORTHANDS, Configuration.class); // [FM3] Won't be needed + addWithSimpleName(SHORTHANDS, Configuration.class); // [FM3] Won't be needed? addWithSimpleName(SHORTHANDS, TagSyntax.class); - addWithSimpleName(SHORTHANDS, NamingConvention.class); } String fullClassName = SHORTHANDS.get(className); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java index ae5c531..d891190 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java @@ -41,7 +41,7 @@ import org.apache.freemarker.core.util._ClassUtil; class SimpleMethod { static final String MARKUP_OUTPUT_TO_STRING_TIP - = "A markup output value can be converted to markup string like value?markup_string. " + = "A markup output value can be converted to markup string like value?markupString. " + "But consider if the Java method whose argument it will be can handle markup strings properly."; private final Member member; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java index 0d018eb..debc42d 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateResolver.java @@ -31,7 +31,7 @@ import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateResolver; import org.apache.freemarker.core.util._NullArgumentException; /** - * This class allows user to fully implement the template lookup, loading and caching logic, + * This class allows users to fully implement the template lookup, loading and caching logic, * in case the standard mechanism (a {@link DefaultTemplateResolver} combined with all the {@link Configuration} * settings like {@link Configuration#getTemplateLoader() templateLoader}, * {@link Configuration#getTemplateConfigurations() templateConfigurations}, etc.) is not flexible enough. @@ -45,8 +45,9 @@ import org.apache.freemarker.core.util._NullArgumentException; * settings, which should be reflected by the return value of the {@code supportsXxxSetting} methods (like * {@link #supportsTemplateLoaderSetting()}). (Note that there's no {@code supportsXxxSetting} method for * {@link Configuration#getTemplateLanguage() templateLanguage} and {@link Configuration#getSourceEncoding() - * sourceEncoding} and these settings are always exposed.) {@link TemplateResolverDependencies} will also expose the - * {@link TemplateResolverDependencies#parse} method, which is used to create a {@link Template} from its source code. + * sourceEncoding}, as the must always be supported and are always exposed.) {@link TemplateResolverDependencies} + * will also expose the {@link TemplateResolverDependencies#parse} method, which is used to create a {@link Template} + * from its source code in the later {@link #getTemplate(String, Locale, Serializable)} calls. */ public abstract class TemplateResolver { @@ -213,7 +214,7 @@ public abstract class TemplateResolver { * {@link Configuration} constructor will throw an exception to tell the user that the {@code templateLoader} * setting is not supported by this {@link TemplateResolver} class. Some may feel tempted to return {@code true} * to avoid such error, but consider that as the user has explicitly set this setting, they certainly expect it - * have an effect, and will be frustrated when its ignored. + * have an effect, and will be frustrated when it doesn't have any. */ public abstract boolean supportsTemplateLoaderSetting(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/util/FTLUtil.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/FTLUtil.java b/freemarker-core/src/main/java/org/apache/freemarker/core/util/FTLUtil.java index 2f94c85..84d1c19 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/FTLUtil.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/FTLUtil.java @@ -793,7 +793,7 @@ public final class FTLUtil { if (Environment.Namespace.class.isAssignableFrom(cl)) { appendTypeName(sb, typeNamesAppended, "namespace"); } else if (TemplateHashModelEx.class.isAssignableFrom(cl)) { - appendTypeName(sb, typeNamesAppended, "extended_hash"); + appendTypeName(sb, typeNamesAppended, "extendedHash"); } else if (TemplateHashModel.class.isAssignableFrom(cl)) { appendTypeName(sb, typeNamesAppended, "hash"); } @@ -815,11 +815,11 @@ public final class FTLUtil { } if (TemplateMarkupOutputModel.class.isAssignableFrom(cl)) { - appendTypeName(sb, typeNamesAppended, "markup_output"); + appendTypeName(sb, typeNamesAppended, "markupOutput"); } if (sb.length() == initalLength) { - appendTypeName(sb, typeNamesAppended, "misc_template_model"); + appendTypeName(sb, typeNamesAppended, "miscTemplateModel"); } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SortedArraySet.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SortedArraySet.java b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SortedArraySet.java index e60d08d..788fed7 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SortedArraySet.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_SortedArraySet.java @@ -28,7 +28,7 @@ public class _SortedArraySet<E> extends _UnmodifiableSet<E> { private final E[] array; - public _SortedArraySet(E[] array) { + public _SortedArraySet(E... array) { this.array = array; } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtil.java ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtil.java b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtil.java index 98c9f84..08d7870 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtil.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtil.java @@ -30,7 +30,6 @@ import java.util.StringTokenizer; import java.util.regex.Pattern; import org.apache.freemarker.core.Environment; -import org.apache.freemarker.core.NamingConvention; import org.apache.freemarker.core.Template; import org.apache.freemarker.core.Version; @@ -771,7 +770,7 @@ public class _StringUtil { * touching pieces that were escaped with this, no character sequence can occur that closes the * JavaScript/JSON string literal, or has a meaning in HTML/XML that causes the HTML script section to be closed. * (If, however, the escaped section is preceded by or followed by strings from other sources, this can't be - * guaranteed in some rare cases. Like <tt>x = "</${a?js_string}"</tt> might closes the "script" + * guaranteed in some rare cases. Like <tt>x = "</${a?jsString}"</tt> might closes the "script" * element if {@code a} is {@code "script>"}.) * * The escaped characters are: @@ -1574,24 +1573,6 @@ public class _StringUtil { } } - /** - * @return {@link NamingConvention#CAMEL_CASE}, or {@link NamingConvention#LEGACY} - * or, {@link NamingConvention#AUTO_DETECT} when undecidable. - */ - public static NamingConvention getIdentifierNamingConvention(String name) { - final int ln = name.length(); - for (int i = 0; i < ln; i++) { - final char c = name.charAt(i); - if (c == '_') { - return NamingConvention.LEGACY; - } - if (_StringUtil.isUpperUSASCII(c)) { - return NamingConvention.CAMEL_CASE; - } - } - return NamingConvention.AUTO_DETECT; - } - // [2.4] Won't be needed anymore /** * A deliberately very inflexible camel case to underscored converter; it must not convert improper camel case http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/javacc/FTL.jj ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/javacc/FTL.jj b/freemarker-core/src/main/javacc/FTL.jj index 6b7893c..c289b74 100644 --- a/freemarker-core/src/main/javacc/FTL.jj +++ b/freemarker-core/src/main/javacc/FTL.jj @@ -155,9 +155,6 @@ public class FMParser { throw new BugException("Unsupported tagSyntax: " + tagSyntax); } - token_source.initialNamingConvention = pCfg.getNamingConvention(); - token_source.namingConvention = token_source.initialNamingConvention; - this.stripWhitespace = pCfg.getWhitespaceStripping(); // If this is a Template under construction, we do the below. @@ -169,9 +166,6 @@ public class FMParser { } void setupStringLiteralMode(FMParserTokenManager parentTokenSource, OutputFormat outputFormat) { - token_source.initialNamingConvention = parentTokenSource.initialNamingConvention; - token_source.namingConvention = parentTokenSource.namingConvention; - token_source.namingConventionEstabilisher = parentTokenSource.namingConventionEstabilisher; token_source.SwitchTo(NODIRECTIVE); this.outputFormat = outputFormat; @@ -179,8 +173,7 @@ public class FMParser { } void tearDownStringLiteralMode(FMParserTokenManager parentTokenSource) { - parentTokenSource.namingConvention = token_source.namingConvention; - parentTokenSource.namingConventionEstabilisher = token_source.namingConventionEstabilisher; + // Nothing to do ATM } private OutputFormat getFormatFromStdFileExt() { @@ -248,15 +241,6 @@ public class FMParser { public TagSyntax _getLastTagSyntax() { return token_source.squBracTagSyntax ? TagSyntax.SQUARE_BRACKET : TagSyntax.ANGLE_BRACKET; } - - /** - * Don't use it, unless you are developing FreeMarker itself. - * The naming convention used by this template; if it couldn't be detected so far, it will be the most probable one. - * This could be used for formatting error messages, but not for anything serious. - */ - public NamingConvention _getLastNamingConvention() { - return token_source.namingConvention; - } /** * Throw an exception if the expression passed in is a String Literal @@ -470,11 +454,12 @@ TOKEN_MGR_DECLS: + "so maybe you need to upgrade FreeMarker.)"; /** - * The noparseTag is set when we enter a block of text that the parser more or less ignores. These are <noparse> and + * The noParseTag is set when we enter a block of text that the parser more or less ignores. These are <#noParse> + a nd * <#-- ... --->. This variable tells us what the closing tag should be, and when we hit that, we resume parsing. - * Note that with this scheme, <noparse> tags and comments cannot nest recursively. + * Note that with this scheme, <#noParse> tags and comments cannot nest recursively. */ - String noparseTag; + String noParseTag; /** * Keeps track of how deeply nested we have the hash literals. This is necessary since we need to be able to @@ -490,9 +475,6 @@ TOKEN_MGR_DECLS: autodetectTagSyntax, directiveSyntaxEstablished, inInvocation; - NamingConvention initialNamingConvention; - NamingConvention namingConvention; - Token namingConventionEstabilisher; int incompatibleImprovements; void setParser(FMParser parser) { @@ -503,7 +485,7 @@ TOKEN_MGR_DECLS: * This method handles tag syntax ('<' VS '['), and also participates in naming convention detection. * If you update this logic, take a look at the UNKNOWN_DIRECTIVE token too. */ - private void handleTagSyntaxAndSwitch(Token tok, NamingConvention tokenNamingConvention, int newLexState) { + private void handleTagSyntaxAndSwitch(Token tok, int newLexState) { final String image = tok.image; char firstChar = image.charAt(0); @@ -517,70 +499,9 @@ TOKEN_MGR_DECLS: directiveSyntaxEstablished = true; - checkNamingConvention(tok, tokenNamingConvention); - SwitchTo(newLexState); } - /** - * Used for tags whose name isn't affected by naming convention. - */ - private void handleTagSyntaxAndSwitch(Token tok, int newLexState) { - handleTagSyntaxAndSwitch(tok, NamingConvention.AUTO_DETECT, newLexState); - } - - void checkNamingConvention(Token tok) { - checkNamingConvention(tok, _StringUtil.getIdentifierNamingConvention(tok.image)); - } - - void checkNamingConvention(Token tok, NamingConvention tokenNamingConvention) { - if (tokenNamingConvention != NamingConvention.AUTO_DETECT) { - if (namingConvention == NamingConvention.AUTO_DETECT) { - namingConvention = tokenNamingConvention; - namingConventionEstabilisher = tok; - } else if (namingConvention != tokenNamingConvention) { - throw newNameConventionMismatchException(tok); - } - } - } - - private TokenMgrError newNameConventionMismatchException(Token tok) { - return new TokenMgrError( - "Naming convention mismatch. " - + "Identifiers that are part of the template language (not the user specified ones) " - + (initialNamingConvention == NamingConvention.AUTO_DETECT - ? "must consistently use the same naming convention within the same template. This template uses " - : "must use the configured naming convention, which is the ") - + (namingConvention == NamingConvention.CAMEL_CASE - ? "camel case naming convention (like: exampleName) " - : (namingConvention == NamingConvention.LEGACY - ? "legacy naming convention (directive (tag) names are like examplename, " - + "everything else is like example_name) " - : "??? (internal error)" - )) - + (namingConventionEstabilisher != null - ? "estabilished by auto-detection at " - + MessageUtil.formatPosition( - namingConventionEstabilisher.beginLine, namingConventionEstabilisher.beginColumn) - + " by token " + _StringUtil.jQuote(namingConventionEstabilisher.image.trim()) - : "") - + ", but the problematic token, " + _StringUtil.jQuote(tok.image.trim()) - + ", uses a different convention.", - TokenMgrError.LEXICAL_ERROR, - tok.beginLine, tok.beginColumn, tok.endLine, tok.endColumn); - } - - /** - * Detects the naming convention used, both in start- and end-tag tokens. - * - * @param charIdxInName - * The index of the deciding character relatively to the first letter of the name. - */ - private static NamingConvention getTagNamingConvention(Token tok, int charIdxInName) { - return _StringUtil.isUpperUSASCII(getTagNameCharAt(tok, charIdxInName)) - ? NamingConvention.CAMEL_CASE : NamingConvention.LEGACY; - } - static char getTagNameCharAt(Token tok, int charIdxInName) { final String image = tok.image; @@ -739,8 +660,8 @@ TOKEN: | <IF : <START_TAG> "if" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } | - <ELSE_IF : <START_TAG> "else" ("i" | "I") "f" <BLANK>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), FM_EXPRESSION); + <ELSE_IF : <START_TAG> "elseIf" <BLANK>> { + handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } | <LIST : <START_TAG> "list" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } @@ -775,26 +696,25 @@ TOKEN: | <SETTING : <START_TAG> "setting" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } | - <OUTPUTFORMAT : <START_TAG> "output" ("f"|"F") "ormat" <BLANK>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), FM_EXPRESSION); + <OUTPUTFORMAT : <START_TAG> "outputFormat" <BLANK>> { + handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } | - <AUTOESC : <START_TAG> "auto" ("e"|"E") "sc" <CLOSE_TAG1>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT); + <AUTOESC : <START_TAG> "autoEsc" <CLOSE_TAG1>> { + handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | - <NOAUTOESC : <START_TAG> "no" ("autoe"|"AutoE") "sc" <CLOSE_TAG1>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT); + <NOAUTOESC : <START_TAG> "noAutoEsc" <CLOSE_TAG1>> { + handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | <COMPRESS : <START_TAG> "compress" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | - <TERSE_COMMENT : ("<" | "[") "#--" > { noparseTag = "-->"; handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); } + <TERSE_COMMENT : ("<" | "[") "#--" > { noParseTag = "-->"; handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); } | - <NOPARSE: <START_TAG> "no" ("p" | "P") "arse" <CLOSE_TAG1>> { - NamingConvention tagNamingConvention = getTagNamingConvention(matchedToken, 2); - handleTagSyntaxAndSwitch(matchedToken, tagNamingConvention, NO_PARSE); - noparseTag = tagNamingConvention == NamingConvention.CAMEL_CASE ? "noParse" : "noparse"; + <NOPARSE: <START_TAG> "noParse" <CLOSE_TAG1>> { + handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); + noParseTag = "noParse"; } | <END_IF : <END_TAG> "if" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } @@ -817,16 +737,16 @@ TOKEN: | <END_MACRO : <END_TAG> "macro" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | - <END_OUTPUTFORMAT : <END_TAG> "output" ("f" | "F") "ormat" <CLOSE_TAG1>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), DEFAULT); + <END_OUTPUTFORMAT : <END_TAG> "outputFormat" <CLOSE_TAG1>> { + handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | - <END_AUTOESC : <END_TAG> "auto" ("e" | "E") "sc" <CLOSE_TAG1>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT); + <END_AUTOESC : <END_TAG> "autoEsc" <CLOSE_TAG1>> { + handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | <END_NOAUTOESC : <END_TAG> "no" ("autoe"|"AutoE") "sc" <CLOSE_TAG1>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT); + handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | <END_COMPRESS : <END_TAG> "compress" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } @@ -867,12 +787,12 @@ TOKEN: | <END_ESCAPE : <END_TAG> "escape" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | - <NOESCAPE : <START_TAG> "no" ("e" | "E") "scape" <CLOSE_TAG1>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT); + <NOESCAPE : <START_TAG> "noEscape" <CLOSE_TAG1>> { + handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | - <END_NOESCAPE : <END_TAG> "no" ("e" | "E") "scape" <CLOSE_TAG1>> { - handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT); + <END_NOESCAPE : <END_TAG> "noEscape" <CLOSE_TAG1>> { + handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } | <UNIFIED_CALL : "<@" | "[@" > { unifiedCall(matchedToken); } @@ -908,7 +828,7 @@ TOKEN: // doesn't match any directive starter tokens, because that token requires whitespace after the // name as it should be followed by parameters. For now we work this around so we don't report // unknown directive: - if (ASTDirective.ALL_BUILT_IN_DIRECTIVE_NAMES.contains(dn)) { + if (ASTDirective.BUILT_IN_DIRECTIVE_NAMES.contains(dn)) { throw new TokenMgrError( "#" + dn + " is an existing directive, but the tag is malformed. " + " (See FreeMarker Manual / Directive Reference.)", @@ -922,9 +842,9 @@ TOKEN: tip = "Use #assign or #local or #global, depending on the intented scope " + "(#assign is template-scope). " + PLANNED_DIRECTIVE_HINT; } else if (dn.equals("else_if") || dn.equals("elif")) { - tip = "Use #elseif."; + tip = "Use #elseIf."; } else if (dn.equals("no_escape")) { - tip = "Use #noescape instead."; + tip = "Use #noEscape instead."; } else if (dn.equals("method")) { tip = "Use #function instead."; } else if (dn.equals("head") || dn.equals("template") || dn.equals("fm")) { @@ -1351,7 +1271,7 @@ TOKEN: { <TERSE_COMMENT_END : "-->" | "--]"> { - if (noparseTag.equals("-->")) { + if (noParseTag.equals("-->")) { boolean squareBracket = matchedToken.image.endsWith("]"); if ((squBracTagSyntax && squareBracket) || (!squBracTagSyntax && !squareBracket)) { matchedToken.image = matchedToken.image + ";"; @@ -1369,7 +1289,7 @@ TOKEN: > { StringTokenizer st = new StringTokenizer(image.toString(), " \t\n\r<>[]/#", false); - if (st.nextToken().equals(noparseTag)) { + if (st.nextToken().equals(noParseTag)) { matchedToken.image = matchedToken.image + ";"; SwitchTo(DEFAULT); } @@ -1833,13 +1753,12 @@ ASTExpBuiltInVariable ASTExpBuiltInVariable() : name = <ID> { ASTExpBuiltInVariable result = null; - token_source.checkNamingConvention(name); TemplateModel parseTimeValue; String nameStr = name.image; - if (nameStr.equals(ASTExpBuiltInVariable.OUTPUT_FORMAT) || nameStr.equals(ASTExpBuiltInVariable.OUTPUT_FORMAT_CC)) { + if (nameStr.equals(ASTExpBuiltInVariable.OUTPUT_FORMAT)) { parseTimeValue = new SimpleScalar(outputFormat.getName()); - } else if (nameStr.equals(ASTExpBuiltInVariable.AUTO_ESC) || nameStr.equals(ASTExpBuiltInVariable.AUTO_ESC_CC)) { + } else if (nameStr.equals(ASTExpBuiltInVariable.AUTO_ESC)) { parseTimeValue = autoEscaping ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE; } else { parseTimeValue = null; @@ -1933,7 +1852,6 @@ ASTExpression ASTExpBuiltIn(ASTExpression lhoExp) : <BUILT_IN> t = <ID> { - token_source.checkNamingConvention(t); result = ASTExpBuiltIn.newBuiltIn(incompatibleImprovements, lhoExp, t, token_source); result.setLocation(template, lhoExp, t); @@ -2856,7 +2774,6 @@ ASTDirInclude Include() : { String attString = att.image; if (attString.equalsIgnoreCase("ignore_missing") || attString.equals("ignoreMissing")) { - token_source.checkNamingConvention(att); ignoreMissingExp = exp; } else { String correctedName = attString.equals("ignoreMissing") ? "ignore_missing" : null; @@ -3306,7 +3223,7 @@ ASTDirNoEscape NoEscape() : start = <NOESCAPE> { if (escapes.isEmpty()) { - throw new ParseException("#noescape with no matching #escape encountered.", template, start); + throw new ParseException("#noEscape with no matching #escape encountered.", template, start); } Object escape = escapes.removeFirst(); } @@ -3490,7 +3407,6 @@ ASTDirSetting Setting() : value = ASTExpression() end = LooseDirectiveEnd() { - token_source.checkNamingConvention(key); ASTDirSetting result = new ASTDirSetting(key, token_source, value, template.getConfiguration()); result.setLocation(template, start, end); return result; @@ -3623,7 +3539,7 @@ ASTStaticText WhitespaceText() : /** * Production for dealing with unparsed content, - * i.e. what is inside a comment or noparse tag. + * i.e. what is inside a comment or noParse tag. * It returns the ending token. The content * of the tag is put in buf. */ @@ -3829,8 +3745,6 @@ void HeaderElement() : <EQUALS> exp = ASTExpression() { - token_source.checkNamingConvention(key); - String ks = key.image; TemplateModel value = null; try { @@ -3872,11 +3786,11 @@ void HeaderElement() : streamToUnmarkWhenEncEstabd.mark(0); streamToUnmarkWhenEncEstabd = null; } - } else if (ks.equalsIgnoreCase("STRIP_WHITESPACE") || ks.equals("stripWhitespace")) { + } else if (ks.equals("stripWhitespace")) { this.stripWhitespace = getBoolean(exp, true); - } else if (ks.equalsIgnoreCase("STRIP_TEXT") || ks.equals("stripText")) { + } else if (ks.equals("stripText")) { this.stripText = getBoolean(exp, true); - } else if (ks.equalsIgnoreCase("auto_esc") || ks.equals("autoEsc")) { + } else if (ks.equals("autoEsc")) { if (getBoolean(exp, false)) { autoEscRequester = key; autoEscapingPolicy = AutoEscapingPolicy.ENABLE_IF_SUPPORTED; @@ -3886,7 +3800,7 @@ void HeaderElement() : recalculateAutoEscapingField(); template.setAutoEscapingPolicy(autoEscapingPolicy); - } else if (ks.equalsIgnoreCase("output_format") || ks.equals("outputFormat")) { + } else if (ks.equals("outputFormat")) { if (vs == null) { throw new ParseException("Expected a string constant for \"" + ks + "\".", exp); } @@ -3900,7 +3814,7 @@ void HeaderElement() : recalculateAutoEscapingField(); template.setOutputFormat(outputFormat); - } else if (ks.equalsIgnoreCase("ns_prefixes") || ks.equals("nsPrefixes")) { + } else if (ks.equals("nsPrefixes")) { if (!(value instanceof TemplateHashModelEx)) { throw new ParseException("Expecting a hash of prefixes to namespace URI's.", exp); } @@ -3922,7 +3836,7 @@ void HeaderElement() : } } catch (TemplateModelException tme) { } - } else if (ks.equalsIgnoreCase("custom_settings") || ks.equals("customSettings")) { + } else if (ks.equals("customSettings")) { if (!(value instanceof TemplateHashModelEx)) { throw new ParseException("Expecting a hash value for custom settings.", exp); } @@ -3944,19 +3858,31 @@ void HeaderElement() : } } else { String correctName; - if (ks.equals("charset") || ks.equals("source_encoding") || ks.equals("sourceEncoding")) { + String ksLC = ks.toLowerCase(); + if (ksLC.equals("charset") || ksLC.equals("source_encoding") + || ksLC.equals("sourcerncoding")) { correctName = "encoding"; - } else if (ks.equals("attributes")) { - correctName = token_source.namingConvention == NamingConvention.CAMEL_CASE - ? "customSettings" : "custom_settings"; - } else if (ks.equals("xmlns")) { - // [2.4] If camel case will be the default, update this - correctName - = token_source.namingConvention == NamingConvention.CAMEL_CASE - ? "nsPrefixes" : "ns_prefixes"; - } else if (ks.equals("auto_escape") || ks.equals("auto_escaping") || ks.equals("autoesc")) { - correctName = "auto_esc"; - } else if (ks.equals("autoEscape") || ks.equals("autoEscaping")) { + } else if (ksLC.equals("attributes") || ksLC.equals("customsettings") + || ksLC.equals("custom_settings") || ksLC.equals("settings")) { + correctName = "customSettings"; + } else if (ksLC.equalsIgnoreCase("strip_whitespace") + || ksLC.equalsIgnoreCase("stripwhitespace") + || ksLC.equalsIgnoreCase("remove_whitespace") + || ksLC.equalsIgnoreCase("removewhitespace")) { + correctName = "stripWhitespace"; + } else if (ksLC.equalsIgnoreCase("strip_text") || ksLC.equalsIgnoreCase("striptext") + || ksLC.equalsIgnoreCase("remove_text") || ksLC.equalsIgnoreCase("removetext")) { + correctName = "stripText"; + } else if (ksLC.equals("xmlns") || ksLC.equalsIgnoreCase("ns_prefixes") + || ksLC.equalsIgnoreCase("nsprefixes")) { + correctName = "nsPrefixes"; + } else if (ksLC.equalsIgnoreCase("output_format") + || ksLC.equalsIgnoreCase("outputformat")) { + correctName = "outputFormat"; + } else if (ksLC.equals("autoEscape") || ksLC.equals("autoEscaping") + || ksLC.equals("autoesc") + || ksLC.equals("auto_escape") || ksLC.equals("auto_escaping") + || ksLC.equalsIgnoreCase("auto_esc")) { correctName = "autoEsc"; } else { correctName = null; http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-core/src/main/misc/overloadedNumberRules/generator.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core/src/main/misc/overloadedNumberRules/generator.ftl b/freemarker-core/src/main/misc/overloadedNumberRules/generator.ftl index 2a2bfde..4a241b6 100644 --- a/freemarker-core/src/main/misc/overloadedNumberRules/generator.ftl +++ b/freemarker-core/src/main/misc/overloadedNumberRules/generator.ftl @@ -68,7 +68,7 @@ <#function toPrice cellValue, boost> <#if cellValue?starts_with("BC ")> <#local cellValue = cellValue[3..]> - <#elseif cellValue == '-' || cellValue == 'N/A'> + <#elseIf cellValue == '-' || cellValue == 'N/A'> <#return 'Integer.MAX_VALUE'> </#if> <#local cellValue = cellValue?number> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java ---------------------------------------------------------------------- diff --git a/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java b/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java index ed6d7bb..af874fa 100644 --- a/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java +++ b/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMSiblingTest.java @@ -40,7 +40,6 @@ public class DOMSiblingTest extends TemplateTest { @Test public void testBlankPreviousSibling() throws IOException, TemplateException { assertOutput("${doc.person.name?previousSibling}", "\n "); - assertOutput("${doc.person.name?previous_sibling}", "\n "); } @Test @@ -51,7 +50,6 @@ public class DOMSiblingTest extends TemplateTest { @Test public void testBlankNextSibling() throws IOException, TemplateException { assertOutput("${doc.person.name?nextSibling}", "\n "); - assertOutput("${doc.person.name?next_sibling}", "\n "); } @Test http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMTest.java ---------------------------------------------------------------------- diff --git a/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMTest.java b/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMTest.java index 0d03dbe..36f7226 100644 --- a/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMTest.java +++ b/freemarker-dom/src/test/java/org/apache/freemarker/dom/DOMTest.java @@ -50,7 +50,7 @@ public class DOMTest extends TemplateTest { addDocToDataModel("<root xmlns='http://example.com/ns1' xmlns:ns2='http://example.com/ns2'>" + "<a>A</a><ns2:b>B</ns2:b><c a1='1' ns2:a2='2'/></root>"); - String ftlHeader = "<#ftl ns_prefixes={'D':'http://example.com/ns1', 'n2':'http://example.com/ns2'}>"; + String ftlHeader = "<#ftl nsPrefixes={'D':'http://example.com/ns1', 'n2':'http://example.com/ns2'}>"; // @@markup: assertOutput("${doc.@@markup}", @@ -61,7 +61,7 @@ public class DOMTest extends TemplateTest { + "${doc.@@markup}", "<root xmlns=\"http://example.com/ns1\" xmlns:n2=\"http://example.com/ns2\">" + "<a>A</a><n2:b>B</n2:b><c a1=\"1\" n2:a2=\"2\" /></root>"); - assertOutput("<#ftl ns_prefixes={'D':'http://example.com/ns1'}>" + assertOutput("<#ftl nsPrefixes={'D':'http://example.com/ns1'}>" + "${doc.@@markup}", "<root xmlns=\"http://example.com/ns1\" xmlns:a=\"http://example.com/ns2\">" + "<a>A</a><a:b>B</a:b><c a1=\"1\" a:a2=\"2\" /></root>"); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-dom/src/test/resources/org/apache/freemarker/dom/templatesuite/testcases.xml ---------------------------------------------------------------------- diff --git a/freemarker-dom/src/test/resources/org/apache/freemarker/dom/templatesuite/testcases.xml b/freemarker-dom/src/test/resources/org/apache/freemarker/dom/templatesuite/testcases.xml index ffb42c3..5c32215 100644 --- a/freemarker-dom/src/test/resources/org/apache/freemarker/dom/templatesuite/testcases.xml +++ b/freemarker-dom/src/test/resources/org/apache/freemarker/dom/templatesuite/testcases.xml @@ -33,26 +33,26 @@ <!ELEMENT setting EMPTY> <!ATTLIST setting - auto_import CDATA #IMPLIED - source_encoding CDATA #IMPLIED + autoImports CDATA #IMPLIED + sourceEncoding CDATA #IMPLIED locale CDATA #IMPLIED - object_wrapper CDATA #IMPLIED - output_encoding CDATA #IMPLIED + objectWrapper CDATA #IMPLIED + outputEncoding CDATA #IMPLIED output_dir CDATA #IMPLIED - new_builtin_class_resolver CDATA #IMPLIED - url_escaping_charset CDATA #IMPLIED - incompatible_improvements CDATA #IMPLIED - time_zone CDATA #IMPLIED - api_builtin_enabled CDATA #IMPLIED + newBuiltinClassResolver CDATA #IMPLIED + urlEscapingCharset CDATA #IMPLIED + incompatibleImprovements CDATA #IMPLIED + timeZone CDATA #IMPLIED + apiBuiltinEnabled CDATA #IMPLIED > ]> <!-- -Note that for the incompatible_improvements setting you can specify a list of versions, for example: -<setting incompatible_improvements="min, 3.0.5, max" /> +Note that for the incompatibleImprovements setting you can specify a list of versions, for example: +<setting incompatibleImprovements="min, 3.0.5, max" /> --> <testCases> - <setting source_encoding="UTF-8" output_encoding="UTF-8" /> + <setting sourceEncoding="UTF-8" outputEncoding="UTF-8" /> <testCase name="default-xmlns" /> <testCase name="xml-fragment" /> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java index b92f2bd..181d0ab 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java @@ -125,9 +125,9 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; * Also, you can prepend it with {@code classpath:}, like in <tt>classpath:com/example/templates</tt>, to indicate that * you want to load templates from the specified package accessible through the Thread Context Class Loader of the * thread that initializes this servlet.<br> - * If {@code incompatible_improvements} is set to 2.3.22 (or higher), you can specify multiple comma separated locations + * If {@code incompatibleImprovements} is set to 2.3.22 (or higher), you can specify multiple comma separated locations * inside square brackets, like: {@code [ WEB-INF/templates, classpath:com/example/myapp/templates ]}. This internally - * creates a {@link MultiTemplateLoader}. Note again that if {@code incompatible_improvements} isn't set to at least + * creates a {@link MultiTemplateLoader}. Note again that if {@code incompatibleImprovements} isn't set to at least * 2.3.22, the initial {@code [} has no special meaning, and so this feature is unavailable.<br> * Any of the above can have a {@code ?setting(name=value, ...)} postfix to set the JavaBeans properties of the * {@link TemplateLoader} created. For example, @@ -266,7 +266,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; * <li>The following init-params are supported only for backward compatibility, and their usage is discouraged: * {@code TemplateUpdateInterval}, {@code DefaultEncoding}, {@code ObjectWrapper}, {@code TemplateExceptionHandler}. * Instead, use init-params with the setting names documented at - * {@link ExtendableBuilder#setSetting(String, String)}, such as {@code object_wrapper}. + * {@link ExtendableBuilder#setSetting(String, String)}, such as {@code objectWrapper}. * * <li><strong>Any other init-params</strong> will be interpreted as {@link Configuration}-level FreeMarker setting. See * the possible names and values at {@link ExtendableBuilder#setSetting(String, String)}. Note that @@ -312,11 +312,11 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; * <li>If the template contains parsing errors, it will log it with error level, then the servlet throws * {@link ServletException} to the servlet container (with the proper cause exception).</li> * - * <li>If the template throws exception during its execution, and the value of the {@code template_exception_handler} + * <li>If the template throws exception during its execution, and the value of the {@code templateExceptionHandler} * init-param is {@code rethrow} (recommended), it will log it with error level and then the servlet throws * {@link ServletException} to the servlet container (with the proper cause exception). But beware, the default value of - * the {@code template_exception_handler} init-param is {@code html_debug}, which is for development only! Set it to - * {@code rethrow} for production. The {@code html_debug} (and {@code debug}) handlers will print error details to the + * the {@code templateExceptionHandler} init-param is {@code htmlDebug}, which is for development only! Set it to + * {@code rethrow} for production. The {@code htmlDebug} (and {@code debug}) handlers will print error details to the * page and then commit the HTTP response with response code 200 "OK", thus, the server wont be able roll back the * response and send back an HTTP 500 page. This is so that the template developers will see the error without digging * the logs. @@ -535,7 +535,7 @@ public class FreemarkerServlet extends HttpServlet { contentType = DEFAULT_CONTENT_TYPE; - // Process object_wrapper init-param out of order: + // Process objectWrapper init-param out of order: String objectWrapperInitParamValue = getInitParameter( Configuration.Builder.OBJECT_WRAPPER_KEY, DEPR_INITPARAM_OBJECT_WRAPPER); if (objectWrapperInitParamValue != null) { @@ -1165,7 +1165,7 @@ public class FreemarkerServlet extends HttpServlet { * interpret yourself, otherwise fall back to the super method. This method won't be called if there's not * init-param that specifies the object wrapper. * <p> - * The default implementation interprets the {@code object_wrapper} servlet init-param with + * The default implementation interprets the {@code objectWrapper} servlet init-param with * calling {@link MutableProcessingConfiguration#setSetting(String, String)}. * * @param initParamValue Not {@code null} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/basic/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/basic/WEB-INF/web.xml b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/basic/WEB-INF/web.xml index 8a5cba7..3aa634f 100644 --- a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/basic/WEB-INF/web.xml +++ b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/basic/WEB-INF/web.xml @@ -56,18 +56,18 @@ <!-- FreeMarker settings: --> <init-param> - <param-name>incompatible_improvements</param-name> + <param-name>incompatibleImprovements</param-name> <param-value>3.0.0</param-value> <!-- Recommended to set to a high value. For the details, see the Java API docs of freemarker.template.Configuration#Configuration(Version). --> </init-param> <init-param> - <param-name>template_exception_handler</param-name> - <!-- Some may prefer "html_debug" for development. --> + <param-name>templateExceptionHandler</param-name> + <!-- Some may prefer "htmlDebug" for development. --> <param-value>rethrow</param-value> </init-param> <init-param> - <param-name>template_update_delay</param-name> + <param-name>templateUpdateDelay</param-name> <param-value>0</param-value> <!-- 0 is for development only! Use higher value otherwise. --> </init-param> <init-param> @@ -79,7 +79,7 @@ <param-value>en_US</param-value> </init-param> <init-param> - <param-name>number_format</param-name> + <param-name>numberFormat</param-name> <param-value>0.##########</param-value> </init-param> @@ -92,11 +92,11 @@ <!-- Specific parts: --> <init-param> - <param-name>incompatible_improvements</param-name> + <param-name>incompatibleImprovements</param-name> <param-value>3.0.0</param-value> </init-param> <init-param> - <param-name>object_wrapper</param-name> + <param-name>objectWrapper</param-name> <param-value>DefaultObjectWrapper(3.0.0)</param-value> </init-param> @@ -114,8 +114,8 @@ <param-value>UTF-8</param-value> <!-- The encoding of the template files. --> </init-param> <init-param> - <param-name>template_exception_handler</param-name> - <!-- Some may prefer "html_debug" for development. --> + <param-name>templateExceptionHandler</param-name> + <!-- Some may prefer "htmlDebug" for development. --> <param-value>rethrow</param-value> </init-param> </servlet> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/config/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/config/WEB-INF/web.xml b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/config/WEB-INF/web.xml index d092395..7a4ad23 100644 --- a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/config/WEB-INF/web.xml +++ b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/config/WEB-INF/web.xml @@ -89,7 +89,7 @@ <servlet-name>freemarker-assertDefaultsFreemarkerServlet</servlet-name> <servlet-class>org.apache.freemarker.servlet.jsp.RealServletContainertTest$AssertDefaultsFreemarkerServlet</servlet-class> <init-param> - <param-name>incompatible_improvements</param-name> + <param-name>incompatibleImprovements</param-name> <param-value>3.0.0</param-value> </init-param> </servlet> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/errors/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/errors/WEB-INF/web.xml b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/errors/WEB-INF/web.xml index 1df86c3..1ec62fb 100644 --- a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/errors/WEB-INF/web.xml +++ b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/errors/WEB-INF/web.xml @@ -43,8 +43,8 @@ <!-- This is the default anyway: <init-param> - <param-name>template_exception_handler</param-name> - <param-value>html_debug</param-value> + <param-name>templateExceptionHandler</param-name> + <param-value>htmlDebug</param-value> </init-param> --> @@ -61,7 +61,7 @@ </init-param> <init-param> - <param-name>template_exception_handler</param-name> + <param-name>templateExceptionHandler</param-name> <param-value>rethrow</param-value> </init-param> @@ -82,7 +82,7 @@ </init-param> <init-param> - <param-name>template_exception_handler</param-name> + <param-name>templateExceptionHandler</param-name> <param-value>rethrow</param-value> </init-param> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/multipleLoaders/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/multipleLoaders/WEB-INF/web.xml b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/multipleLoaders/WEB-INF/web.xml index cc3df47..37978c1 100644 --- a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/multipleLoaders/WEB-INF/web.xml +++ b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/multipleLoaders/WEB-INF/web.xml @@ -42,12 +42,12 @@ <param-value>[ WEB-INF/templates, classpath:org/apache/freemarker/servlet/jsp/templates ]</param-value> </init-param> <init-param> - <param-name>incompatible_improvements</param-name> + <param-name>incompatibleImprovements</param-name> <param-value>3.0.0</param-value> </init-param> <init-param> - <param-name>template_exception_handler</param-name> - <!-- Some may prefer "html_debug" for development. --> + <param-name>templateExceptionHandler</param-name> + <!-- Some may prefer "htmlDebug" for development. --> <param-value>rethrow</param-value> </init-param> <init-param> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/tldDiscovery/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/tldDiscovery/WEB-INF/web.xml b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/tldDiscovery/WEB-INF/web.xml index fe82825..bb64b8c 100644 --- a/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/tldDiscovery/WEB-INF/web.xml +++ b/freemarker-servlet/src/test/resources/org/apache/freemarker/servlet/jsp/webapps/tldDiscovery/WEB-INF/web.xml @@ -58,16 +58,16 @@ <!-- FreeMarker settings: --> <init-param> - <param-name>incompatible_improvements</param-name> + <param-name>incompatibleImprovements</param-name> <param-value>3.0.0</param-value> </init-param> <init-param> - <param-name>template_exception_handler</param-name> - <!-- Some may prefer "html_debug" for development. --> + <param-name>templateExceptionHandler</param-name> + <!-- Some may prefer "htmlDebug" for development. --> <param-value>rethrow</param-value> </init-param> <init-param> - <param-name>template_update_delay</param-name> + <param-name>templateUpdateDelay</param-name> <param-value>0</param-value> <!-- 0 is for development only! Use higher value otherwise. --> </init-param> <init-param> @@ -79,7 +79,7 @@ <param-value>en_US</param-value> </init-param> <init-param> - <param-name>number_format</param-name> + <param-name>numberFormat</param-name> <param-value>0.##########</param-value> </init-param> @@ -112,16 +112,16 @@ <!-- FreeMarker settings: --> <init-param> - <param-name>incompatible_improvements</param-name> + <param-name>incompatibleImprovements</param-name> <param-value>3.0.0</param-value> </init-param> <init-param> - <param-name>template_exception_handler</param-name> - <!-- Some may prefer "html_debug" for development. --> + <param-name>templateExceptionHandler</param-name> + <!-- Some may prefer "htmlDebug" for development. --> <param-value>rethrow</param-value> </init-param> <init-param> - <param-name>template_update_delay</param-name> + <param-name>templateUpdateDelay</param-name> <param-value>0</param-value> <!-- 0 is for development only! Use higher value otherwise. --> </init-param> <init-param> @@ -133,7 +133,7 @@ <param-value>en_US</param-value> </init-param> <init-param> - <param-name>number_format</param-name> + <param-name>numberFormat</param-name> <param-value>0.##########</param-value> </init-param> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java ---------------------------------------------------------------------- diff --git a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java index 010664b..c071e8f 100644 --- a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java +++ b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java @@ -18,9 +18,7 @@ */ package org.apache.freemarker.spring; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import java.nio.charset.Charset; import java.util.HashMap; @@ -31,7 +29,6 @@ import org.apache.freemarker.core.AutoEscapingPolicy; import org.apache.freemarker.core.Configuration; import org.apache.freemarker.core.Configuration.ExtendableBuilder; import org.apache.freemarker.core.MutableParsingAndProcessingConfiguration; -import org.apache.freemarker.core.NamingConvention; import org.apache.freemarker.core.TagSyntax; import org.apache.freemarker.core.Template; import org.apache.freemarker.core.TemplateLanguage; @@ -77,7 +74,6 @@ public class ConfigurationFactoryBeanTest { settings.setProperty(MutableParsingAndProcessingConfiguration.RECOGNIZE_STANDARD_FILE_EXTENSIONS_KEY, "true"); settings.setProperty(MutableParsingAndProcessingConfiguration.TEMPLATE_LANGUAGE_KEY, "FTL"); settings.setProperty(MutableParsingAndProcessingConfiguration.TAG_SYNTAX_KEY, "squareBracket"); - settings.setProperty(MutableParsingAndProcessingConfiguration.NAMING_CONVENTION_KEY, "camelCase"); settings.setProperty(MutableParsingAndProcessingConfiguration.TAB_SIZE_KEY, "4"); settings.setProperty(ExtendableBuilder.OBJECT_WRAPPER_KEY, "restricted"); @@ -100,10 +96,10 @@ public class ConfigurationFactoryBeanTest { // <property name="incompatibleImprovements" value="3.0.0" /> // <property name="settings"> // <props> - // <prop key="source_encoding">UTF-8</prop> - // <prop key="whitespace_stripping">true</prop> + // <prop key="sourceEncoding">UTF-8</prop> + // <prop key="whitespaceStripping">true</prop> // <!-- SNIP --> - // <prop key="template_cache_storage">strong:20, soft:250</prop> + // <prop key="templateCacheStorage">strong:20, soft:250</prop> // </props> // </property> // <property name="sharedVariables"> @@ -154,7 +150,6 @@ public class ConfigurationFactoryBeanTest { assertTrue(config.isRecognizeStandardFileExtensionsSet()); assertEquals(TemplateLanguage.FTL, config.getTemplateLanguage()); assertEquals(TagSyntax.SQUARE_BRACKET, config.getTagSyntax()); - assertEquals(NamingConvention.CAMEL_CASE, config.getNamingConvention()); assertEquals(4, config.getTabSize()); assertTrue(config.getObjectWrapper() instanceof RestrictedObjectWrapper); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestCase.java ---------------------------------------------------------------------- diff --git a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestCase.java b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestCase.java index e7b9dad..9c6db39 100644 --- a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestCase.java +++ b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestCase.java @@ -96,7 +96,7 @@ class TemplateTestCase extends FileTestCase { } void setSetting(String param, String value) throws IOException { - if ("auto_import".equals(param)) { + if ("autoImports".equals(param)) { StringTokenizer st = new StringTokenizer(value); if (!st.hasMoreTokens()) fail("Expecting libname"); String libname = st.nextToken(); @@ -106,7 +106,7 @@ class TemplateTestCase extends FileTestCase { if (!st.hasMoreTokens()) fail("Expecting alias after 'as' in autoimport"); String alias = st.nextToken(); confB.setAutoImports(ImmutableMap.of(alias, libname)); - } else if ("source_encoding".equals(param)) { + } else if ("sourceEncoding".equals(param)) { confB.setSourceEncoding(Charset.forName(value)); // INCOMPATIBLE_IMPROVEMENTS is a list here, and was already set in the constructor. } else if (!Configuration.ExtendableBuilder.INCOMPATIBLE_IMPROVEMENTS_KEY.equals(param)) { http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/51dba882/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TestUtil.java ---------------------------------------------------------------------- diff --git a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TestUtil.java b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TestUtil.java index c196e1b..13b03ec 100644 --- a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TestUtil.java +++ b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TestUtil.java @@ -189,7 +189,7 @@ public final class TestUtil { } public static String removeFTLCopyrightComment(String ftl) { - if (ftl.contains("<#ftl ns_prefixes = {\"D\" : \"http://example.com/eBook\"}>")) { + if (ftl.contains("<#ftl nsPrefixes = {\"D\" : \"http://example.com/eBook\"}>")) { System.out.println(); }
