You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2019/07/12 22:37:35 UTC
[freemarker] branch master updated: Deleted most content from
master branch to prevent confusion. Modifed README to point to the right
direction.
This is an automated email from the ASF dual-hosted git repository.
ddekany pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/freemarker.git
The following commit(s) were added to refs/heads/master by this push:
new 6339274 Deleted most content from master branch to prevent confusion. Modifed README to point to the right direction.
6339274 is described below
commit 633927443f2f6abbca98a8340503412467ae2211
Author: ddekany <dd...@apache.org>
AuthorDate: Sat Jul 13 00:36:55 2019 +0200
Deleted most content from master branch to prevent confusion. Modifed README to point to the right direction.
---
.classpath | 60 -
.project | 41 -
.settings/edu.umd.cs.findbugs.core.prefs | 143 -
.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs | 4 -
.settings/org.eclipse.core.resources.prefs | 2 -
.settings/org.eclipse.core.runtime.prefs | 2 -
.settings/org.eclipse.jdt.core.prefs | 409 -
.settings/org.eclipse.jdt.ui.prefs | 71 -
.settings/org.eclipse.ltk.core.refactoring.prefs | 2 -
README | 147 +-
build.properties.sample | 23 -
build.xml | 1099 -
codestyle.xml | 313 -
ivy.xml | 194 -
ivysettings.xml | 54 -
osgi.bnd | 64 -
src/dist/bin/NOTICE | 56 -
src/dist/bin/documentation/index.html | 67 -
src/main/java/freemarker/cache/AndMatcher.java | 45 -
.../freemarker/cache/ByteArrayTemplateLoader.java | 151 -
src/main/java/freemarker/cache/CacheStorage.java | 37 -
.../freemarker/cache/CacheStorageWithGetSize.java | 36 -
.../java/freemarker/cache/ClassTemplateLoader.java | 219 -
.../freemarker/cache/ConcurrentCacheStorage.java | 35 -
.../ConditionalTemplateConfigurationFactory.java | 76 -
.../freemarker/cache/FileExtensionMatcher.java | 85 -
.../java/freemarker/cache/FileNameGlobMatcher.java | 86 -
.../java/freemarker/cache/FileTemplateLoader.java | 350 -
.../FirstMatchTemplateConfigurationFactory.java | 118 -
.../freemarker/cache/GetLastModifiedException.java | 41 -
.../cache/MergingTemplateConfigurationFactory.java | 78 -
.../java/freemarker/cache/MruCacheStorage.java | 322 -
.../java/freemarker/cache/MultiTemplateLoader.java | 203 -
src/main/java/freemarker/cache/NotMatcher.java | 41 -
.../java/freemarker/cache/NullCacheStorage.java | 66 -
src/main/java/freemarker/cache/OrMatcher.java | 45 -
.../java/freemarker/cache/PathGlobMatcher.java | 100 -
.../java/freemarker/cache/PathRegexMatcher.java | 54 -
.../java/freemarker/cache/SoftCacheStorage.java | 141 -
.../freemarker/cache/StatefulTemplateLoader.java | 35 -
.../freemarker/cache/StringTemplateLoader.java | 176 -
.../java/freemarker/cache/StrongCacheStorage.java | 67 -
src/main/java/freemarker/cache/TemplateCache.java | 1016 -
.../cache/TemplateConfigurationFactory.java | 91 -
.../TemplateConfigurationFactoryException.java | 36 -
src/main/java/freemarker/cache/TemplateLoader.java | 159 -
.../java/freemarker/cache/TemplateLoaderUtils.java | 38 -
.../freemarker/cache/TemplateLookupContext.java | 107 -
.../freemarker/cache/TemplateLookupResult.java | 137 -
.../freemarker/cache/TemplateLookupStrategy.java | 115 -
.../java/freemarker/cache/TemplateNameFormat.java | 432 -
.../freemarker/cache/TemplateSourceMatcher.java | 30 -
.../java/freemarker/cache/URLTemplateLoader.java | 119 -
.../java/freemarker/cache/URLTemplateSource.java | 144 -
.../freemarker/cache/WebappTemplateLoader.java | 221 -
src/main/java/freemarker/cache/_CacheAPI.java | 40 -
src/main/java/freemarker/cache/package.html | 30 -
.../core/APINotSupportedTemplateException.java | 76 -
.../java/freemarker/core/AddConcatExpression.java | 284 -
.../AliasTargetTemplateValueFormatException.java | 36 -
.../core/AliasTemplateDateFormatFactory.java | 91 -
.../core/AliasTemplateNumberFormatFactory.java | 90 -
src/main/java/freemarker/core/AndExpression.java | 81 -
.../java/freemarker/core/ArithmeticEngine.java | 550 -
.../java/freemarker/core/ArithmeticExpression.java | 129 -
src/main/java/freemarker/core/Assignment.java | 295 -
.../freemarker/core/AssignmentInstruction.java | 117 -
src/main/java/freemarker/core/AttemptBlock.java | 89 -
src/main/java/freemarker/core/AutoEscBlock.java | 79 -
.../BackwardCompatibleTemplateNumberFormat.java | 30 -
src/main/java/freemarker/core/BlockAssignment.java | 183 -
src/main/java/freemarker/core/BodyInstruction.java | 158 -
.../java/freemarker/core/BooleanExpression.java | 32 -
src/main/java/freemarker/core/BooleanLiteral.java | 88 -
src/main/java/freemarker/core/BoundCallable.java | 155 -
.../java/freemarker/core/BoundedRangeModel.java | 69 -
.../java/freemarker/core/BreakInstruction.java | 70 -
src/main/java/freemarker/core/BugException.java | 52 -
src/main/java/freemarker/core/BuiltIn.java | 488 -
.../core/BuiltInBannedWhenAutoEscaping.java | 27 -
src/main/java/freemarker/core/BuiltInForDate.java | 57 -
.../java/freemarker/core/BuiltInForHashEx.java | 56 -
.../freemarker/core/BuiltInForLegacyEscaping.java | 48 -
.../freemarker/core/BuiltInForLoopVariable.java | 49 -
.../freemarker/core/BuiltInForMarkupOutput.java | 40 -
src/main/java/freemarker/core/BuiltInForNode.java | 40 -
.../java/freemarker/core/BuiltInForNumber.java | 36 -
.../java/freemarker/core/BuiltInForSequence.java | 39 -
.../java/freemarker/core/BuiltInForString.java | 37 -
.../core/BuiltInWithParseTimeParameters.java | 109 -
.../java/freemarker/core/BuiltInsForDates.java | 214 -
.../java/freemarker/core/BuiltInsForHashes.java | 58 -
.../freemarker/core/BuiltInsForLoopVariables.java | 156 -
.../freemarker/core/BuiltInsForMarkupOutputs.java | 40 -
.../freemarker/core/BuiltInsForMultipleTypes.java | 747 -
.../java/freemarker/core/BuiltInsForNodes.java | 140 -
.../java/freemarker/core/BuiltInsForNumbers.java | 320 -
.../core/BuiltInsForOutputFormatRelated.java | 83 -
.../java/freemarker/core/BuiltInsForSequences.java | 836 -
.../freemarker/core/BuiltInsForStringsBasic.java | 684 -
.../core/BuiltInsForStringsEncoding.java | 201 -
.../freemarker/core/BuiltInsForStringsMisc.java | 121 -
.../freemarker/core/BuiltInsForStringsRegexp.java | 305 -
.../core/BuiltInsWithParseTimeParameters.java | 158 -
src/main/java/freemarker/core/BuiltinVariable.java | 307 -
src/main/java/freemarker/core/CSSOutputFormat.java | 52 -
...CallPlaceCustomDataInitializationException.java | 33 -
.../freemarker/core/CallableInvocationContext.java | 154 -
src/main/java/freemarker/core/Case.java | 91 -
.../freemarker/core/CollectionAndSequence.java | 104 -
.../core/CombinedMarkupOutputFormat.java | 106 -
src/main/java/freemarker/core/Comment.java | 91 -
.../freemarker/core/CommonMarkupOutputFormat.java | 124 -
.../core/CommonTemplateMarkupOutputModel.java | 63 -
.../java/freemarker/core/ComparisonExpression.java | 104 -
src/main/java/freemarker/core/CompressedBlock.java | 86 -
.../java/freemarker/core/ConditionalBlock.java | 114 -
src/main/java/freemarker/core/Configurable.java | 2711 --
src/main/java/freemarker/core/CustomAttribute.java | 264 -
src/main/java/freemarker/core/DebugBreak.java | 94 -
.../java/freemarker/core/DefaultToExpression.java | 138 -
.../java/freemarker/core/DirectiveCallPlace.java | 137 -
src/main/java/freemarker/core/DollarVariable.java | 149 -
src/main/java/freemarker/core/Dot.java | 96 -
src/main/java/freemarker/core/DynamicKeyName.java | 306 -
src/main/java/freemarker/core/ElseOfList.java | 77 -
src/main/java/freemarker/core/Environment.java | 2833 --
src/main/java/freemarker/core/EscapeBlock.java | 111 -
src/main/java/freemarker/core/EvalUtil.java | 566 -
.../java/freemarker/core/ExistenceBuiltins.java | 132 -
.../java/freemarker/core/ExistsExpression.java | 90 -
src/main/java/freemarker/core/Expression.java | 219 -
.../core/ExtendedDecimalFormatParser.java | 523 -
.../java/freemarker/core/FallbackInstruction.java | 69 -
.../java/freemarker/core/FlushInstruction.java | 65 -
src/main/java/freemarker/core/FreeMarkerTree.java | 117 -
.../java/freemarker/core/HTMLOutputFormat.java | 75 -
src/main/java/freemarker/core/HashLiteral.java | 205 -
src/main/java/freemarker/core/ICIChainMember.java | 41 -
.../freemarker/core/ISOLikeTemplateDateFormat.java | 262 -
.../core/ISOLikeTemplateDateFormatFactory.java | 52 -
.../freemarker/core/ISOTemplateDateFormat.java | 87 -
.../core/ISOTemplateDateFormatFactory.java | 43 -
src/main/java/freemarker/core/Identifier.java | 105 -
src/main/java/freemarker/core/IfBlock.java | 109 -
src/main/java/freemarker/core/Include.java | 259 -
src/main/java/freemarker/core/Interpolation.java | 48 -
src/main/java/freemarker/core/Interpret.java | 156 -
.../core/InvalidFormatParametersException.java | 37 -
.../core/InvalidFormatStringException.java | 37 -
.../freemarker/core/InvalidReferenceException.java | 169 -
src/main/java/freemarker/core/Items.java | 95 -
src/main/java/freemarker/core/IteratorBlock.java | 341 -
.../java/freemarker/core/JSONOutputFormat.java | 52 -
.../freemarker/core/JavaScriptOutputFormat.java | 53 -
.../freemarker/core/JavaTemplateDateFormat.java | 72 -
.../core/JavaTemplateDateFormatFactory.java | 173 -
.../freemarker/core/JavaTemplateNumberFormat.java | 66 -
.../core/JavaTemplateNumberFormatFactory.java | 120 -
src/main/java/freemarker/core/LibraryLoad.java | 132 -
.../java/freemarker/core/ListElseContainer.java | 87 -
src/main/java/freemarker/core/ListLiteral.java | 198 -
.../core/ListableRightUnboundedRangeModel.java | 93 -
src/main/java/freemarker/core/LocalContext.java | 38 -
.../java/freemarker/core/LocalContextStack.java | 57 -
src/main/java/freemarker/core/Macro.java | 52 -
.../java/freemarker/core/MarkupOutputFormat.java | 120 -
.../core/MarkupOutputFormatBoundBuiltIn.java | 46 -
src/main/java/freemarker/core/MessageUtil.java | 353 -
src/main/java/freemarker/core/MethodCall.java | 150 -
src/main/java/freemarker/core/MiscUtil.java | 68 -
src/main/java/freemarker/core/MixedContent.java | 118 -
.../core/NestedContentNotSupportedException.java | 68 -
src/main/java/freemarker/core/NewBI.java | 84 -
src/main/java/freemarker/core/NoAutoEscBlock.java | 79 -
src/main/java/freemarker/core/NoEscapeBlock.java | 79 -
.../java/freemarker/core/NonBooleanException.java | 62 -
.../java/freemarker/core/NonDateException.java | 58 -
.../freemarker/core/NonExtendedHashException.java | 62 -
.../java/freemarker/core/NonHashException.java | 64 -
.../core/NonListableRightUnboundedRangeModel.java | 39 -
.../freemarker/core/NonMarkupOutputException.java | 63 -
.../java/freemarker/core/NonMethodException.java | 64 -
.../freemarker/core/NonNamespaceException.java | 63 -
.../java/freemarker/core/NonNodeException.java | 64 -
.../freemarker/core/NonNumericalException.java | 74 -
.../java/freemarker/core/NonSequenceException.java | 64 -
.../core/NonSequenceOrCollectionException.java | 68 -
.../java/freemarker/core/NonStringException.java | 74 -
.../core/NonStringOrTemplateOutputException.java | 77 -
.../core/NonUserDefinedDirectiveLikeException.java | 67 -
src/main/java/freemarker/core/NotExpression.java | 75 -
src/main/java/freemarker/core/NumberLiteral.java | 93 -
src/main/java/freemarker/core/NumericalOutput.java | 173 -
.../core/OptInTemplateClassResolver.java | 157 -
src/main/java/freemarker/core/OrExpression.java | 81 -
src/main/java/freemarker/core/OutputFormat.java | 84 -
.../java/freemarker/core/OutputFormatBlock.java | 87 -
.../freemarker/core/OutputFormatBoundBuiltIn.java | 48 -
src/main/java/freemarker/core/ParameterRole.java | 93 -
.../freemarker/core/ParentheticalExpression.java | 86 -
src/main/java/freemarker/core/ParseException.java | 613 -
.../java/freemarker/core/ParserConfiguration.java | 78 -
.../core/ParsingNotSupportedException.java | 37 -
.../freemarker/core/PlainTextOutputFormat.java | 56 -
src/main/java/freemarker/core/PropertySetting.java | 175 -
src/main/java/freemarker/core/RTFOutputFormat.java | 75 -
src/main/java/freemarker/core/Range.java | 122 -
src/main/java/freemarker/core/RangeModel.java | 58 -
src/main/java/freemarker/core/RecoveryBlock.java | 74 -
src/main/java/freemarker/core/RecurseNode.java | 132 -
src/main/java/freemarker/core/RegexpHelper.java | 206 -
.../java/freemarker/core/ReturnInstruction.java | 93 -
.../freemarker/core/RightUnboundedRangeModel.java | 48 -
src/main/java/freemarker/core/Sep.java | 90 -
src/main/java/freemarker/core/SpecialBuiltIn.java | 27 -
src/main/java/freemarker/core/StopException.java | 66 -
src/main/java/freemarker/core/StopInstruction.java | 83 -
.../java/freemarker/core/StringArraySequence.java | 58 -
src/main/java/freemarker/core/StringLiteral.java | 200 -
src/main/java/freemarker/core/SwitchBlock.java | 132 -
.../freemarker/core/TemplateClassResolver.java | 106 -
.../core/TemplateCombinedMarkupOutputModel.java | 50 -
.../freemarker/core/TemplateConfiguration.java | 578 -
.../java/freemarker/core/TemplateDateFormat.java | 108 -
.../freemarker/core/TemplateDateFormatFactory.java | 92 -
src/main/java/freemarker/core/TemplateElement.java | 509 -
.../core/TemplateElementArrayBuilder.java | 102 -
.../freemarker/core/TemplateElementsToVisit.java | 48 -
.../java/freemarker/core/TemplateFormatUtil.java | 76 -
.../freemarker/core/TemplateHTMLOutputModel.java | 40 -
.../freemarker/core/TemplateMarkupOutputModel.java | 49 -
.../java/freemarker/core/TemplateNumberFormat.java | 90 -
.../core/TemplateNumberFormatFactory.java | 64 -
src/main/java/freemarker/core/TemplateObject.java | 274 -
.../freemarker/core/TemplatePostProcessor.java | 34 -
.../core/TemplatePostProcessorException.java | 35 -
.../freemarker/core/TemplateRTFOutputModel.java | 40 -
.../java/freemarker/core/TemplateValueFormat.java | 33 -
.../core/TemplateValueFormatException.java | 37 -
.../core/TemplateValueFormatFactory.java | 28 -
.../freemarker/core/TemplateXHTMLOutputModel.java | 40 -
.../freemarker/core/TemplateXMLOutputModel.java | 40 -
src/main/java/freemarker/core/TextBlock.java | 406 -
...adInterruptionSupportTemplatePostProcessor.java | 141 -
src/main/java/freemarker/core/TokenMgrError.java | 276 -
src/main/java/freemarker/core/TransformBlock.java | 168 -
src/main/java/freemarker/core/TrimInstruction.java | 110 -
.../freemarker/core/UnaryPlusMinusExpression.java | 106 -
src/main/java/freemarker/core/UnboundCallable.java | 240 -
src/main/java/freemarker/core/UnboundTemplate.java | 602 -
.../core/UndefinedCustomFormatException.java | 34 -
.../freemarker/core/UndefinedOutputFormat.java | 57 -
.../freemarker/core/UnexpectedTypeException.java | 110 -
.../core/UnformattableValueException.java | 41 -
src/main/java/freemarker/core/UnifiedCall.java | 346 -
...nownDateTypeFormattingUnsupportedException.java | 35 -
...UnknownDateTypeParsingUnsupportedException.java | 36 -
.../freemarker/core/UnparsableValueException.java | 38 -
.../core/UnregisteredOutputFormatException.java | 34 -
src/main/java/freemarker/core/VisitNode.java | 128 -
.../java/freemarker/core/XHTMLOutputFormat.java | 75 -
src/main/java/freemarker/core/XMLOutputFormat.java | 75 -
.../java/freemarker/core/XSTemplateDateFormat.java | 91 -
.../core/XSTemplateDateFormatFactory.java | 43 -
.../java/freemarker/core/_2_4_OrLaterMarker.java | 28 -
.../java/freemarker/core/_ArrayEnumeration.java | 49 -
src/main/java/freemarker/core/_ArrayIterator.java | 51 -
src/main/java/freemarker/core/_CoreAPI.java | 509 -
.../java/freemarker/core/_CoreLocaleUtils.java | 45 -
.../java/freemarker/core/_CoreStringUtils.java | 125 -
src/main/java/freemarker/core/_DelayedAOrAn.java | 35 -
.../core/_DelayedConversionToString.java | 52 -
.../core/_DelayedFTLTypeDescription.java | 37 -
.../freemarker/core/_DelayedGetCanonicalForm.java | 39 -
.../java/freemarker/core/_DelayedGetMessage.java | 35 -
.../core/_DelayedGetMessageWithoutStackTop.java | 36 -
src/main/java/freemarker/core/_DelayedJQuote.java | 36 -
.../freemarker/core/_DelayedJoinWithComma.java | 48 -
src/main/java/freemarker/core/_DelayedOrdinal.java | 47 -
.../freemarker/core/_DelayedShortClassName.java | 35 -
.../java/freemarker/core/_DelayedToString.java | 37 -
.../freemarker/core/_ErrorDescriptionBuilder.java | 354 -
src/main/java/freemarker/core/_Java6.java | 35 -
src/main/java/freemarker/core/_Java6Impl.java | 45 -
src/main/java/freemarker/core/_JavaVersions.java | 77 -
.../freemarker/core/_MiscTemplateException.java | 126 -
.../_ObjectBuilderSettingEvaluationException.java | 46 -
.../core/_ObjectBuilderSettingEvaluator.java | 1117 -
.../_ParserConfigurationWithInheritedFormat.java | 74 -
.../core/_SettingEvaluationEnvironment.java | 62 -
src/main/java/freemarker/core/_SortedArraySet.java | 80 -
.../freemarker/core/_TemplateModelException.java | 133 -
.../java/freemarker/core/_TimeZoneBuilder.java | 43 -
..._UnexpectedTypeErrorExplainerTemplateModel.java | 36 -
.../freemarker/core/_UnmodifiableCompositeSet.java | 95 -
.../java/freemarker/core/_UnmodifiableSet.java | 47 -
src/main/java/freemarker/core/package.html | 26 -
src/main/java/freemarker/debug/Breakpoint.java | 82 -
src/main/java/freemarker/debug/DebugModel.java | 105 -
.../java/freemarker/debug/DebuggedEnvironment.java | 56 -
src/main/java/freemarker/debug/Debugger.java | 95 -
src/main/java/freemarker/debug/DebuggerClient.java | 140 -
.../java/freemarker/debug/DebuggerListener.java | 36 -
.../debug/EnvironmentSuspendedEvent.java | 67 -
.../java/freemarker/debug/impl/DebuggerServer.java | 124 -
.../freemarker/debug/impl/DebuggerService.java | 93 -
.../freemarker/debug/impl/RmiDebugModelImpl.java | 152 -
.../debug/impl/RmiDebuggedEnvironmentImpl.java | 334 -
.../freemarker/debug/impl/RmiDebuggerImpl.java | 81 -
.../debug/impl/RmiDebuggerListenerImpl.java | 64 -
.../freemarker/debug/impl/RmiDebuggerService.java | 396 -
src/main/java/freemarker/debug/package.html | 27 -
.../java/freemarker/ext/ant/FreemarkerXmlTask.java | 629 -
.../java/freemarker/ext/ant/JythonAntTask.java | 92 -
.../ext/ant/UnlinkedJythonOperations.java | 39 -
.../ext/ant/UnlinkedJythonOperationsImpl.java | 59 -
src/main/java/freemarker/ext/ant/package.html | 27 -
src/main/java/freemarker/ext/beans/APIModel.java | 45 -
.../java/freemarker/ext/beans/ArgumentTypes.java | 736 -
src/main/java/freemarker/ext/beans/ArrayModel.java | 120 -
src/main/java/freemarker/ext/beans/BeanModel.java | 374 -
.../java/freemarker/ext/beans/BeansModelCache.java | 74 -
.../java/freemarker/ext/beans/BeansWrapper.java | 1805 -
.../freemarker/ext/beans/BeansWrapperBuilder.java | 154 -
.../ext/beans/BeansWrapperConfiguration.java | 234 -
.../ext/beans/BeansWrapperSingletonHolder.java | 33 -
.../java/freemarker/ext/beans/BooleanModel.java | 39 -
.../ext/beans/CallableMemberDescriptor.java | 56 -
.../freemarker/ext/beans/CharacterOrString.java | 45 -
.../ext/beans/ClassBasedModelFactory.java | 146 -
.../freemarker/ext/beans/ClassChangeNotifier.java | 32 -
.../freemarker/ext/beans/ClassIntrospector.java | 816 -
.../ext/beans/ClassIntrospectorBuilder.java | 199 -
.../freemarker/ext/beans/CollectionAdapter.java | 84 -
.../java/freemarker/ext/beans/CollectionModel.java | 107 -
src/main/java/freemarker/ext/beans/DateModel.java | 77 -
.../ext/beans/EmptyCallableMemberDescriptor.java | 35 -
.../ext/beans/EmptyMemberAndArguments.java | 93 -
.../freemarker/ext/beans/EnumerationModel.java | 105 -
.../java/freemarker/ext/beans/HashAdapter.java | 173 -
.../ext/beans/InvalidPropertyException.java | 34 -
.../java/freemarker/ext/beans/IteratorModel.java | 109 -
.../ext/beans/JRebelClassChangeNotifier.java | 56 -
src/main/java/freemarker/ext/beans/MapModel.java | 119 -
.../beans/MaybeEmptyCallableMemberDescriptor.java | 25 -
.../ext/beans/MaybeEmptyMemberAndArguments.java | 22 -
.../freemarker/ext/beans/MemberAndArguments.java | 64 -
.../ext/beans/MethodAppearanceFineTuner.java | 95 -
.../java/freemarker/ext/beans/MethodSorter.java | 32 -
.../beans/NonPrimitiveArrayBackedReadOnlyList.java | 42 -
.../java/freemarker/ext/beans/NumberModel.java | 59 -
.../ext/beans/OverloadedFixArgsMethods.java | 103 -
.../freemarker/ext/beans/OverloadedMethods.java | 276 -
.../ext/beans/OverloadedMethodsModel.java | 80 -
.../ext/beans/OverloadedMethodsSubset.java | 427 -
.../freemarker/ext/beans/OverloadedNumberUtil.java | 1288 -
.../ext/beans/OverloadedVarArgsMethods.java | 251 -
.../ext/beans/PrimtiveArrayBackedReadOnlyList.java | 47 -
.../beans/ReflectionCallableMemberDescriptor.java | 95 -
.../freemarker/ext/beans/ResourceBundleModel.java | 189 -
.../java/freemarker/ext/beans/SequenceAdapter.java | 67 -
src/main/java/freemarker/ext/beans/SetAdapter.java | 32 -
.../java/freemarker/ext/beans/SimpleMapModel.java | 117 -
.../java/freemarker/ext/beans/SimpleMethod.java | 175 -
.../freemarker/ext/beans/SimpleMethodModel.java | 130 -
.../freemarker/ext/beans/SingletonCustomizer.java | 51 -
.../java/freemarker/ext/beans/StaticModel.java | 170 -
.../java/freemarker/ext/beans/StaticModels.java | 43 -
.../java/freemarker/ext/beans/StringModel.java | 62 -
src/main/java/freemarker/ext/beans/TypeFlags.java | 130 -
.../java/freemarker/ext/beans/UnsafeMethods.java | 114 -
src/main/java/freemarker/ext/beans/_BeansAPI.java | 216 -
.../java/freemarker/ext/beans/_EnumModels.java | 54 -
.../java/freemarker/ext/beans/_MethodUtil.java | 294 -
src/main/java/freemarker/ext/beans/package.html | 40 -
.../freemarker/ext/dom/AttributeNodeModel.java | 67 -
.../freemarker/ext/dom/CharacterDataNodeModel.java | 44 -
.../java/freemarker/ext/dom/DocumentModel.java | 76 -
.../java/freemarker/ext/dom/DocumentTypeModel.java | 55 -
src/main/java/freemarker/ext/dom/ElementModel.java | 187 -
.../java/freemarker/ext/dom/JaxenXPathSupport.java | 228 -
.../java/freemarker/ext/dom/NodeListModel.java | 212 -
src/main/java/freemarker/ext/dom/NodeModel.java | 690 -
.../java/freemarker/ext/dom/NodeOutputter.java | 259 -
src/main/java/freemarker/ext/dom/PINodeModel.java | 43 -
.../ext/dom/SunInternalXalanXPathSupport.java | 145 -
src/main/java/freemarker/ext/dom/XPathSupport.java | 27 -
.../java/freemarker/ext/dom/XalanXPathSupport.java | 159 -
src/main/java/freemarker/ext/dom/package.html | 31 -
.../java/freemarker/ext/jdom/NodeListModel.java | 1174 -
src/main/java/freemarker/ext/jdom/package.html | 29 -
.../java/freemarker/ext/jsp/EventForwarding.java | 191 -
.../ext/jsp/FreeMarkerJspApplicationContext.java | 163 -
.../freemarker/ext/jsp/FreeMarkerJspFactory.java | 63 -
.../freemarker/ext/jsp/FreeMarkerJspFactory2.java | 29 -
.../freemarker/ext/jsp/FreeMarkerJspFactory21.java | 51 -
.../freemarker/ext/jsp/FreeMarkerPageContext.java | 492 -
.../java/freemarker/ext/jsp/FreemarkerTag.java | 129 -
.../java/freemarker/ext/jsp/JspContextModel.java | 54 -
.../java/freemarker/ext/jsp/JspTagModelBase.java | 167 -
.../java/freemarker/ext/jsp/JspWriterAdapter.java | 188 -
.../freemarker/ext/jsp/PageContextFactory.java | 71 -
.../ext/jsp/SimpleTagDirectiveModel.java | 108 -
.../java/freemarker/ext/jsp/TagTransformModel.java | 411 -
.../java/freemarker/ext/jsp/TaglibFactory.java | 2011 -
.../java/freemarker/ext/jsp/TaglibMethodUtil.java | 117 -
.../ext/jsp/_FreeMarkerPageContext2.java | 92 -
.../ext/jsp/_FreeMarkerPageContext21.java | 119 -
src/main/java/freemarker/ext/jsp/package.html | 29 -
.../freemarker/ext/jython/JythonHashModel.java | 113 -
.../java/freemarker/ext/jython/JythonModel.java | 176 -
.../freemarker/ext/jython/JythonModelCache.java | 101 -
.../freemarker/ext/jython/JythonNumberModel.java | 69 -
.../freemarker/ext/jython/JythonSequenceModel.java | 90 -
.../ext/jython/JythonVersionAdapter.java | 48 -
.../ext/jython/JythonVersionAdapterHolder.java | 74 -
.../java/freemarker/ext/jython/JythonWrapper.java | 276 -
.../ext/jython/_Jython20And21VersionAdapter.java | 45 -
.../ext/jython/_Jython22VersionAdapter.java | 45 -
.../ext/jython/_Jython25VersionAdapter.java | 48 -
src/main/java/freemarker/ext/jython/package.html | 37 -
src/main/java/freemarker/ext/package.html | 25 -
.../freemarker/ext/rhino/RhinoFunctionModel.java | 57 -
.../freemarker/ext/rhino/RhinoScriptableModel.java | 136 -
.../java/freemarker/ext/rhino/RhinoWrapper.java | 87 -
src/main/java/freemarker/ext/rhino/package.html | 28 -
.../ext/servlet/AllHttpScopesHashModel.java | 114 -
.../freemarker/ext/servlet/FreemarkerServlet.java | 1678 -
.../ext/servlet/HttpRequestHashModel.java | 106 -
.../servlet/HttpRequestParametersHashModel.java | 95 -
.../ext/servlet/HttpSessionHashModel.java | 111 -
.../java/freemarker/ext/servlet/IncludePage.java | 253 -
.../freemarker/ext/servlet/InitParamParser.java | 266 -
.../ext/servlet/ServletContextHashModel.java | 72 -
src/main/java/freemarker/ext/servlet/package.html | 25 -
.../java/freemarker/ext/util/IdentityHashMap.java | 838 -
src/main/java/freemarker/ext/util/ModelCache.java | 141 -
.../java/freemarker/ext/util/ModelFactory.java | 34 -
.../freemarker/ext/util/WrapperTemplateModel.java | 35 -
src/main/java/freemarker/ext/util/package.html | 23 -
src/main/java/freemarker/ext/xml/Namespaces.java | 85 -
src/main/java/freemarker/ext/xml/Navigator.java | 276 -
.../java/freemarker/ext/xml/NodeListModel.java | 554 -
src/main/java/freemarker/ext/xml/NodeOperator.java | 28 -
.../java/freemarker/ext/xml/_Dom4jNavigator.java | 246 -
.../java/freemarker/ext/xml/_DomNavigator.java | 331 -
.../java/freemarker/ext/xml/_JaxenNamespaces.java | 29 -
.../java/freemarker/ext/xml/_JdomNavigator.java | 346 -
src/main/java/freemarker/ext/xml/package.html | 28 -
.../log/CommonsLoggingLoggerFactory.java | 109 -
src/main/java/freemarker/log/Logger.java | 580 -
src/main/java/freemarker/log/LoggerFactory.java | 24 -
.../java/freemarker/log/SLF4JLoggerFactory.java | 205 -
.../java/freemarker/log/_AvalonLoggerFactory.java | 107 -
.../log/_CommonsLoggingLoggerFactory.java | 28 -
.../java/freemarker/log/_JULLoggerFactory.java | 107 -
.../java/freemarker/log/_Log4jLoggerFactory.java | 107 -
.../java/freemarker/log/_Log4jOverSLF4JTester.java | 43 -
.../java/freemarker/log/_NullLoggerFactory.java | 93 -
.../java/freemarker/log/_SLF4JLoggerFactory.java | 29 -
src/main/java/freemarker/log/package.html | 27 -
.../freemarker/template/AdapterTemplateModel.java | 49 -
.../java/freemarker/template/Configuration.java | 3233 --
.../freemarker/template/DefaultArrayAdapter.java | 339 -
.../template/DefaultIteratorAdapter.java | 116 -
.../freemarker/template/DefaultListAdapter.java | 134 -
.../freemarker/template/DefaultMapAdapter.java | 149 -
.../template/DefaultNonListCollectionAdapter.java | 135 -
.../freemarker/template/DefaultObjectWrapper.java | 365 -
.../template/DefaultObjectWrapperBuilder.java | 80 -
.../DefaultObjectWrapperConfiguration.java | 81 -
src/main/java/freemarker/template/EmptyMap.java | 90 -
.../template/FalseTemplateBooleanModel.java | 35 -
.../freemarker/template/GeneralPurposeNothing.java | 80 -
.../java/freemarker/template/LocalizedString.java | 54 -
.../template/MalformedTemplateNameException.java | 56 -
.../java/freemarker/template/ObjectWrapper.java | 99 -
.../template/ObjectWrapperAndUnwrapper.java | 92 -
.../template/ResourceBundleLocalizedString.java | 54 -
.../template/SerializableTemplateBooleanModel.java | 24 -
.../java/freemarker/template/SimpleCollection.java | 150 -
src/main/java/freemarker/template/SimpleDate.java | 79 -
src/main/java/freemarker/template/SimpleHash.java | 407 -
src/main/java/freemarker/template/SimpleList.java | 42 -
.../java/freemarker/template/SimpleNumber.java | 74 -
.../freemarker/template/SimpleObjectWrapper.java | 65 -
.../java/freemarker/template/SimpleScalar.java | 70 -
.../java/freemarker/template/SimpleSequence.java | 299 -
src/main/java/freemarker/template/Template.java | 811 -
.../freemarker/template/TemplateBooleanModel.java | 47 -
.../template/TemplateCollectionModel.java | 48 -
.../template/TemplateCollectionModelEx.java | 57 -
.../freemarker/template/TemplateDateModel.java | 75 -
.../freemarker/template/TemplateDirectiveBody.java | 43 -
.../template/TemplateDirectiveModel.java | 68 -
.../freemarker/template/TemplateException.java | 675 -
.../template/TemplateExceptionHandler.java | 152 -
.../freemarker/template/TemplateHashModel.java | 41 -
.../freemarker/template/TemplateHashModelEx.java | 49 -
.../freemarker/template/TemplateMethodModel.java | 60 -
.../freemarker/template/TemplateMethodModelEx.java | 53 -
.../java/freemarker/template/TemplateModel.java | 54 -
.../freemarker/template/TemplateModelAdapter.java | 34 -
.../template/TemplateModelException.java | 110 -
.../freemarker/template/TemplateModelIterator.java | 39 -
.../template/TemplateModelListSequence.java | 52 -
.../template/TemplateModelWithAPISupport.java | 41 -
.../freemarker/template/TemplateNodeModel.java | 78 -
.../template/TemplateNotFoundException.java | 61 -
.../freemarker/template/TemplateNumberModel.java | 42 -
.../freemarker/template/TemplateScalarModel.java | 44 -
.../freemarker/template/TemplateSequenceModel.java | 48 -
.../template/TemplateTransformModel.java | 54 -
.../java/freemarker/template/TransformControl.java | 99 -
.../template/TrueTemplateBooleanModel.java | 35 -
src/main/java/freemarker/template/Version.java | 297 -
.../freemarker/template/WrappingTemplateModel.java | 115 -
.../java/freemarker/template/_TemplateAPI.java | 155 -
src/main/java/freemarker/template/package.html | 27 -
.../freemarker/template/utility/CaptureOutput.java | 146 -
.../freemarker/template/utility/ClassUtil.java | 380 -
.../template/utility/CollectionUtils.java | 41 -
.../freemarker/template/utility/Collections12.java | 48 -
.../freemarker/template/utility/Constants.java | 122 -
.../freemarker/template/utility/DOMNodeModel.java | 268 -
.../java/freemarker/template/utility/DateUtil.java | 911 -
.../freemarker/template/utility/DeepUnwrap.java | 162 -
.../java/freemarker/template/utility/Execute.java | 104 -
.../freemarker/template/utility/HtmlEscape.java | 107 -
.../freemarker/template/utility/JythonRuntime.java | 74 -
.../template/utility/NormalizeNewlines.java | 113 -
.../template/utility/NullArgumentException.java | 59 -
.../freemarker/template/utility/NullWriter.java | 90 -
.../freemarker/template/utility/NumberUtil.java | 170 -
.../template/utility/ObjectConstructor.java | 57 -
.../freemarker/template/utility/ObjectFactory.java | 31 -
.../utility/ObjectWrapperWithAPISupport.java | 51 -
.../freemarker/template/utility/OptimizerUtil.java | 97 -
.../template/utility/RichObjectWrapper.java | 37 -
.../template/utility/SecurityUtilities.java | 77 -
.../template/utility/StandardCompress.java | 237 -
.../freemarker/template/utility/StringUtil.java | 2161 --
.../freemarker/template/utility/ToCanonical.java | 80 -
.../utility/UndeclaredThrowableException.java | 43 -
.../utility/UnrecognizedTimeZoneException.java | 38 -
.../utility/UnsupportedNumberClassException.java | 38 -
.../template/utility/WriteProtectable.java | 37 -
.../freemarker/template/utility/XmlEscape.java | 90 -
.../java/freemarker/template/utility/package.html | 25 -
src/main/javacc/FTL.jj | 4254 --
.../freemarker/adhoc/IdentifierCharGenerator.java | 547 -
src/main/misc/overloadedNumberRules/README.txt | 34 -
src/main/misc/overloadedNumberRules/config.fmpp | 73 -
src/main/misc/overloadedNumberRules/generator.ftl | 80 -
src/main/misc/overloadedNumberRules/prices.ods | Bin 17855 -> 0 bytes
.../freemarker/ext/beans/unsafeMethods.properties | 98 -
.../resources/freemarker/ext/jsp/web-app_2_2.dtd | 581 -
.../resources/freemarker/ext/jsp/web-app_2_3.dtd | 1003 -
.../freemarker/ext/jsp/web-jsptaglibrary_1_1.dtd | 207 -
.../freemarker/ext/jsp/web-jsptaglibrary_1_2.dtd | 478 -
src/main/resources/freemarker/version.properties | 103 -
src/manual/change-log-2.4.txt | 65 -
src/manual/en_US/book.xml | 38458 -------------------
src/manual/en_US/docgen-help/editors-readme.txt | 124 -
src/manual/en_US/docgen-misc/copyrightComment.txt | 16 -
src/manual/en_US/docgen-misc/googleAnalytics.html | 14 -
.../figures/model2sketch_with_alpha.png | Bin 61463 -> 0 bytes
.../docgen-originals/figures/odg-convert-howto.txt | 43 -
.../en_US/docgen-originals/figures/overview.odg | Bin 11939 -> 0 bytes
.../docgen-originals/figures/tree_with_alpha.png | Bin 10304 -> 0 bytes
src/manual/en_US/docgen.cjson | 130 -
src/manual/en_US/favicon.png | Bin 1291 -> 0 bytes
src/manual/en_US/figures/model2sketch.png | Bin 21425 -> 0 bytes
src/manual/en_US/figures/overview.png | Bin 11837 -> 0 bytes
src/manual/en_US/figures/tree.png | Bin 4699 -> 0 bytes
src/manual/en_US/logo.png | Bin 10134 -> 0 bytes
src/manual/zh_CN/placeholder.txt | 24 -
.../freemarker/cache/FileTemplateLoaderTest.java | 121 -
.../java/freemarker/cache/TemplateCacheTest.java | 433 -
.../cache/TemplateConfigurationFactoryTest.java | 230 -
.../freemarker/cache/TemplateNameFormatTest.java | 328 -
.../cache/TemplateSourceMatcherTest.java | 188 -
.../freemarker/core/ASTBasedErrorMessagesTest.java | 80 -
src/test/java/freemarker/core/ASTPrinter.java | 439 -
src/test/java/freemarker/core/ASTTest.java | 98 -
.../core/AppMetaTemplateDateFormatFactory.java | 121 -
.../core/BaseNTemplateNumberFormatFactory.java | 121 -
.../java/freemarker/core/BreakPlacementTest.java | 68 -
src/test/java/freemarker/core/CamelCaseTest.java | 512 -
.../java/freemarker/core/CanonicalFormTest.java | 70 -
.../freemarker/core/CoercionToTextualTest.java | 137 -
.../core/CombinedMarkupOutputFormatTest.java | 193 -
.../java/freemarker/core/ConfigurableTest.java | 178 -
.../java/freemarker/core/CoreLocaleUtilsTest.java | 72 -
.../CustomAttributeInUnboundTemplatesTest.java | 62 -
.../freemarker/core/CustomHTMLOutputFormat.java | 71 -
.../freemarker/core/CustomTemplateHTMLModel.java | 32 -
src/test/java/freemarker/core/DateFormatTest.java | 457 -
.../freemarker/core/DirectiveCallPlaceTest.java | 248 -
.../java/freemarker/core/DummyOutputFormat.java | 64 -
.../java/freemarker/core/EncodingOverrideTest.java | 70 -
.../core/EnvironmentCustomStateTest.java | 50 -
.../core/EnvironmentGetTemplateVariantsTest.java | 249 -
.../EpochMillisDivTemplateDateFormatFactory.java | 94 -
.../core/EpochMillisTemplateDateFormatFactory.java | 85 -
.../freemarker/core/ExtendedDecimalFormatTest.java | 341 -
.../core/HTMLISOTemplateDateFormatFactory.java | 104 -
.../java/freemarker/core/HTMLOutputFormatTest.java | 186 -
.../java/freemarker/core/HeaderParsingTest.java | 65 -
.../core/HexTemplateNumberFormatFactory.java | 71 -
.../java/freemarker/core/IncludeAndImportTest.java | 99 -
.../core/InterpretAndEvalTemplateNameTest.java | 71 -
.../core/InterpretSettingInheritanceTest.java | 96 -
.../java/freemarker/core/IteratorIssuesTest.java | 148 -
.../java/freemarker/core/ListValidationsTest.java | 111 -
...LocAndTZSensitiveTemplateDateFormatFactory.java | 89 -
...LocaleSensitiveTemplateNumberFormatFactory.java | 72 -
.../freemarker/core/MiscErrorMessagesTest.java | 48 -
.../java/freemarker/core/NumberFormatTest.java | 331 -
.../freemarker/core/ObjectBuilderSettingsTest.java | 1516 -
.../core/OptInTemplateClassResolverTest.java | 215 -
.../java/freemarker/core/OutputFormatTest.java | 1045 -
.../ParseTimeParameterBIErrorMessagesTest.java | 47 -
.../freemarker/core/ParsingErrorMessagesTest.java | 119 -
.../core/PrintfGTemplateNumberFormatFactory.java | 131 -
.../java/freemarker/core/RTFOutputFormatTest.java | 129 -
src/test/java/freemarker/core/SQLTimeZoneTest.java | 362 -
.../freemarker/core/SeldomEscapedOutputFormat.java | 70 -
.../java/freemarker/core/SettingDirectiveTest.java | 40 -
.../java/freemarker/core/SpecialVariableTest.java | 102 -
.../core/StringLiteralInterpolationTest.java | 129 -
.../freemarker/core/TagSyntaxVariationsTest.java | 234 -
.../freemarker/core/TemplatGetEncodingTest.java | 85 -
.../freemarker/core/TemplateConfigurationTest.java | 846 -
...TemplateConfigurationWithTemplateCacheTest.java | 325 -
.../freemarker/core/TemplateDummyOutputModel.java | 32 -
.../freemarker/core/TemplateLevelSettings.java | 115 -
.../core/TemplateNameSpecialVariablesTest.java | 212 -
.../core/TemplateSeldomEscapedOutputModel.java | 32 -
.../core/TheadInterruptingSupportTest.java | 162 -
.../freemarker/core/TypeErrorMessagesTest.java | 106 -
.../java/freemarker/core/UnclosedCommentTest.java | 68 -
.../freemarker/core/WhitespaceStrippingTest.java | 71 -
.../freemarker/core/XHTMLOutputFormatTest.java | 60 -
.../java/freemarker/core/XMLOutputFormatTest.java | 60 -
.../freemarker/core/subpkg/PackageVisibleAll.java | 26 -
.../core/subpkg/PackageVisibleAllWithBuilder.java | 26 -
.../PackageVisibleAllWithBuilderBuilder.java | 28 -
.../PackageVisibleWithPublicConstructor.java | 27 -
.../java/freemarker/core/subpkg/PublicAll.java | 24 -
.../core/subpkg/PublicWithMixedConstructors.java | 38 -
.../PublicWithPackageVisibleConstructor.java | 26 -
.../beans/AbstractParallelIntrospectionTest.java | 123 -
.../ext/beans/AlphabeticalMethodSorter.java | 47 -
.../ext/beans/BeansAPINewInstanceTest.java | 133 -
.../freemarker/ext/beans/BeansWrapperBasics.java | 63 -
.../ext/beans/BeansWrapperCachesTest.java | 98 -
.../ext/beans/BeansWrapperDesc2003020.java | 30 -
.../ext/beans/BeansWrapperDesc2003021.java | 30 -
.../ext/beans/BeansWrapperInc2003020.java | 30 -
.../ext/beans/BeansWrapperInc2003021.java | 30 -
.../freemarker/ext/beans/BeansWrapperMiscTest.java | 57 -
.../ext/beans/BeansWrapperReadOnlyTest.java | 93 -
.../ext/beans/BeansWrapperSingletonsTest.java | 795 -
.../ext/beans/BeansWrapperWithShortedMethods.java | 39 -
.../CommonSupertypeForUnwrappingHintTest.java | 180 -
.../ext/beans/DefaultObjectWrapperDesc2003020.java | 30 -
.../ext/beans/DefaultObjectWrapperDesc2003021.java | 30 -
.../ext/beans/DefaultObjectWrapperDesc2003022.java | 30 -
.../ext/beans/DefaultObjectWrapperInc2003020.java | 30 -
.../ext/beans/DefaultObjectWrapperInc2003021.java | 30 -
.../ext/beans/DefaultObjectWrapperInc2003022.java | 30 -
.../DefaultObjectWrapperWithSortedMethods.java | 40 -
.../java/freemarker/ext/beans/EnumModelsTest.java | 85 -
.../freemarker/ext/beans/ErrorMessagesTest.java | 173 -
.../ext/beans/FineTuneMethodAppearanceTest.java | 101 -
.../beans/GetlessMethodsAsPropertyGettersRule.java | 69 -
.../freemarker/ext/beans/IsApplicableTest.java | 171 -
.../ext/beans/IsMoreSpecificParameterTypeTest.java | 98 -
.../ext/beans/Java7MembersOnlyBeansWrapper.java | 101 -
.../ext/beans/ManyObjectsOfDifferentClasses.java | 249 -
.../ext/beans/ManyStaticsOfDifferentClasses.java | 236 -
.../ext/beans/MiscNumericalOperationsTest.java | 120 -
.../java/freemarker/ext/beans/ModelCacheTest.java | 66 -
.../ext/beans/OverloadedNumberUtilTest.java | 585 -
.../ext/beans/ParameterListPreferabilityTest.java | 444 -
.../ext/beans/PrallelObjectIntrospectionTest.java | 43 -
.../ext/beans/PrallelStaticIntrospectionTest.java | 47 -
.../java/freemarker/ext/beans/RationalNumber.java | 90 -
.../freemarker/ext/beans/StaticModelsTest.java | 91 -
.../java/freemarker/ext/beans/TypeFlagsTest.java | 657 -
src/test/java/freemarker/ext/dom/DOMTest.java | 110 -
.../ext/jsp/JspTestFreemarkerServlet.java | 50 -
...spTestFreemarkerServletWithDefaultOverride.java | 47 -
.../ext/jsp/RealServletContainertTest.java | 489 -
.../java/freemarker/ext/jsp/TLDParsingTest.java | 137 -
.../freemarker/ext/jsp/TaglibMethodUtilTest.java | 107 -
.../jsp/taglibmembers/AttributeAccessorTag.java | 68 -
.../ext/jsp/taglibmembers/AttributeInfoTag.java | 59 -
.../ext/jsp/taglibmembers/EnclosingClass.java | 32 -
.../ext/jsp/taglibmembers/GetAndSetTag.java | 66 -
.../ext/jsp/taglibmembers/TestFunctions.java | 79 -
.../ext/jsp/taglibmembers/TestSimpleTag.java | 54 -
.../ext/jsp/taglibmembers/TestSimpleTag2.java | 32 -
.../ext/jsp/taglibmembers/TestSimpleTag3.java | 32 -
.../freemarker/ext/jsp/taglibmembers/TestTag.java | 98 -
.../freemarker/ext/jsp/taglibmembers/TestTag2.java | 50 -
.../freemarker/ext/jsp/taglibmembers/TestTag3.java | 50 -
.../ext/servlet/FreemarkerServletTest.java | 605 -
.../ext/servlet/InitParamParserTest.java | 169 -
.../freemarker/manual/AutoEscapingExample.java | 65 -
.../manual/ConfigureOutputFormatExamples.java | 117 -
.../freemarker/manual/CustomFormatsExample.java | 91 -
src/test/java/freemarker/manual/ExamplesTest.java | 60 -
.../freemarker/manual/GettingStartedExample.java | 67 -
src/test/java/freemarker/manual/Product.java | 49 -
.../manual/TemplateConfigurationExamples.java | 186 -
.../UnitAwareTemplateNumberFormatFactory.java | 80 -
.../manual/UnitAwareTemplateNumberModel.java | 43 -
.../template/ActualNamingConvetionTest.java | 65 -
.../freemarker/template/ActualTagSyntaxTest.java | 66 -
.../freemarker/template/ConfigurationTest.java | 1713 -
.../freemarker/template/CustomAttributeTest.java | 277 -
.../template/DefaultObjectWrapperTest.java | 1050 -
.../java/freemarker/template/ExceptionTest.java | 117 -
.../template/IncudeFromNamelessTest.java | 56 -
.../template/JavaCCExceptionAsEOFFixTest.java | 125 -
.../template/MistakenlyPublicImportAPIsTest.java | 102 -
.../template/MistakenlyPublicMacroAPIsTest.java | 137 -
.../freemarker/template/MockServletContext.java | 132 -
.../freemarker/template/NullConfigurationTest.java | 34 -
.../template/SimpleObjetWrapperTest.java | 103 -
.../template/StaticObjectWrappersTest.java | 36 -
.../template/TemplateConstructorsTest.java | 112 -
.../template/TemplateLanguageVersionTest.java | 63 -
.../template/TemplateLookupStrategyTest.java | 643 -
.../template/TemplateNotFoundMessageTest.java | 207 -
src/test/java/freemarker/template/VersionTest.java | 227 -
.../freemarker/template/utility/DateUtilTest.java | 1084 -
.../template/utility/NumberUtilTest.java | 215 -
.../template/utility/StringUtilTest.java | 429 -
.../CopyrightCommentRemoverTemplateLoader.java | 63 -
.../freemarker/test/MonitoredTemplateLoader.java | 46 -
src/test/java/freemarker/test/TemplateTest.java | 303 -
src/test/java/freemarker/test/TestUtil.java | 115 -
src/test/java/freemarker/test/TreeView.java | 70 -
.../java/freemarker/test/hamcerst/Matchers.java | 34 -
.../test/hamcerst/StringContainsIgnoringCase.java | 47 -
src/test/java/freemarker/test/package.html | 28 -
.../test/servlet/DefaultModel2TesterAction.java | 91 -
.../java/freemarker/test/servlet/Model2Action.java | 37 -
.../test/servlet/Model2TesterServlet.java | 138 -
.../freemarker/test/servlet/WebAppTestCase.java | 303 -
src/test/java/freemarker/test/servlet/web.xml | 101 -
.../test/templatesuite/TemplateTestCase.java | 562 -
.../test/templatesuite/TemplateTestSuite.java | 301 -
.../templatesuite/models/AllTemplateModels.java | 113 -
.../test/templatesuite/models/BeanTestClass.java | 89 -
.../templatesuite/models/BeanTestInterface.java | 25 -
.../templatesuite/models/BeanTestSuperclass.java | 30 -
.../models/BooleanAndScalarModel.java | 38 -
.../models/BooleanAndStringTemplateModel.java | 36 -
.../test/templatesuite/models/BooleanHash1.java | 56 -
.../test/templatesuite/models/BooleanHash2.java | 48 -
.../test/templatesuite/models/BooleanList1.java | 86 -
.../test/templatesuite/models/BooleanList2.java | 49 -
.../models/BooleanVsStringMethods.java | 40 -
.../test/templatesuite/models/EnumTestClass.java | 34 -
.../test/templatesuite/models/ExceptionModel.java | 38 -
.../templatesuite/models/HashAndScalarModel.java | 75 -
.../test/templatesuite/models/JavaObjectInfo.java | 35 -
.../test/templatesuite/models/LegacyList.java | 73 -
.../test/templatesuite/models/Listables.java | 97 -
.../test/templatesuite/models/MultiModel1.java | 106 -
.../test/templatesuite/models/MultiModel2.java | 61 -
.../test/templatesuite/models/MultiModel3.java | 66 -
.../test/templatesuite/models/MultiModel4.java | 67 -
.../test/templatesuite/models/MultiModel5.java | 74 -
.../test/templatesuite/models/NewTestModel.java | 51 -
.../test/templatesuite/models/NewTestModel2.java | 51 -
.../templatesuite/models/NumberAndStringModel.java | 45 -
.../models/OverloadedConstructor.java | 45 -
.../templatesuite/models/OverloadedMethods.java | 191 -
.../templatesuite/models/OverloadedMethods2.java | 1098 -
.../templatesuite/models/SimpleTestMethod.java | 48 -
.../templatesuite/models/TransformHashWrapper.java | 72 -
.../models/TransformMethodWrapper1.java | 48 -
.../models/TransformMethodWrapper2.java | 63 -
.../test/templatesuite/models/TransformModel1.java | 174 -
.../test/templatesuite/models/VarArgTestModel.java | 63 -
.../freemarker/test/templatesuite/package.html | 42 -
.../freemarker/test/utility/AssertDirective.java | 72 -
.../test/utility/AssertEqualsDirective.java | 90 -
.../test/utility/AssertFailsDirective.java | 151 -
.../AssertationFailedInTemplateException.java | 46 -
.../test/utility/BadParameterTypeException.java | 60 -
.../java/freemarker/test/utility/FileTestCase.java | 186 -
src/test/java/freemarker/test/utility/Helpers.java | 164 -
.../utility/MissingRequiredParameterException.java | 51 -
.../freemarker/test/utility/NoOutputDirective.java | 49 -
.../test/utility/ParameterException.java | 54 -
.../utility/UnsupportedParameterException.java | 50 -
src/test/resources/META-INF/malformed.tld | 31 -
.../META-INF/tldDiscovery MetaInfTldSources-1.tld | 31 -
src/test/resources/freemarker/cache/test.ftl | 19 -
src/test/resources/freemarker/core/ast-1.ast | 187 -
src/test/resources/freemarker/core/ast-1.ftl | 29 -
.../resources/freemarker/core/ast-assignments.ast | 172 -
.../resources/freemarker/core/ast-assignments.ftl | 29 -
.../resources/freemarker/core/ast-builtins.ast | 59 -
.../resources/freemarker/core/ast-builtins.ftl | 23 -
.../resources/freemarker/core/ast-locations.ast | 155 -
.../resources/freemarker/core/ast-locations.ftl | 36 -
.../core/ast-mixedcontentsimplifications.ast | 38 -
.../core/ast-mixedcontentsimplifications.ftl | 26 -
.../core/ast-multipleignoredchildren.ast | 30 -
.../core/ast-multipleignoredchildren.ftl | 33 -
.../freemarker/core/ast-nestedignoredchildren.ast | 20 -
.../freemarker/core/ast-nestedignoredchildren.ftl | 19 -
src/test/resources/freemarker/core/ast-range.ast | 281 -
src/test/resources/freemarker/core/ast-range.ftl | 47 -
.../freemarker/core/ast-strlitinterpolation.ast | 82 -
.../freemarker/core/ast-strlitinterpolation.ftl | 25 -
.../freemarker/core/ast-whitespacestripping.ast | 70 -
.../freemarker/core/ast-whitespacestripping.ftl | 40 -
.../resources/freemarker/core/cano-assignments.ftl | 35 -
.../freemarker/core/cano-assignments.ftl.out | 34 -
.../resources/freemarker/core/cano-builtins.ftl | 23 -
.../freemarker/core/cano-builtins.ftl.out | 23 -
.../freemarker/core/cano-identifier-escaping.ftl | 76 -
.../core/cano-identifier-escaping.ftl.out | 44 -
src/test/resources/freemarker/core/cano-macros.ftl | 29 -
.../resources/freemarker/core/cano-macros.ftl.out | 28 -
.../freemarker/core/cano-strlitinterpolation.ftl | 19 -
.../core/cano-strlitinterpolation.ftl.out | 19 -
.../core/encodingOverride-ISO-8859-1.ftl | 20 -
.../freemarker/core/encodingOverride-UTF-8.ftl | 20 -
.../freemarker/ext/jsp/TLDParsingTest.tld | 89 -
.../ext/jsp/templates/classpath-test.ftl | 19 -
.../ext/jsp/tldDiscovery-ClassPathTlds-1.tld | 31 -
.../ext/jsp/tldDiscovery-ClassPathTlds-2.tld | 31 -
.../ext/jsp/webapps/basic/WEB-INF/el-functions.tld | 84 -
.../basic/WEB-INF/expected/attributes-2.3.0.txt | 68 -
.../WEB-INF/expected/attributes-2.3.22-future.txt | 73 -
.../webapps/basic/WEB-INF/expected/attributes.txt | 73 -
.../webapps/basic/WEB-INF/expected/customTags1.txt | 106 -
.../ext/jsp/webapps/basic/WEB-INF/test.tld | 75 -
.../ext/jsp/webapps/basic/WEB-INF/web.xml | 172 -
.../ext/jsp/webapps/basic/attributes.ftl | 90 -
.../ext/jsp/webapps/basic/customELFunctions1.ftl | 30 -
.../ext/jsp/webapps/basic/customELFunctions1.jsp | 31 -
.../ext/jsp/webapps/basic/customTags1.ftl | 59 -
.../ext/jsp/webapps/basic/trivial-jstl-@Ignore.ftl | 48 -
.../freemarker/ext/jsp/webapps/basic/trivial.ftl | 37 -
.../freemarker/ext/jsp/webapps/basic/trivial.jsp | 45 -
.../webapps/config/WEB-INF/classes/sub/test.ftl | 19 -
.../jsp/webapps/config/WEB-INF/classes/test.ftl | 19 -
.../WEB-INF/lib/WebappLocalFreemarkerServlet.jar | Bin 936 -> 0 bytes
.../jsp/webapps/config/WEB-INF/lib/templates.jar | Bin 1018 -> 0 bytes
.../jsp/webapps/config/WEB-INF/templates/test.ftl | 19 -
.../ext/jsp/webapps/config/WEB-INF/web.xml | 113 -
.../freemarker/ext/jsp/webapps/config/test.ftl | 19 -
.../ext/jsp/webapps/errors/WEB-INF/web.xml | 92 -
.../ext/jsp/webapps/errors/failing-parsetime.ftlnv | 20 -
.../ext/jsp/webapps/errors/failing-parsetime.jsp | 19 -
.../ext/jsp/webapps/errors/failing-runtime.ftl | 26 -
.../ext/jsp/webapps/errors/failing-runtime.jsp | 23 -
.../ext/jsp/webapps/errors/not-failing.ftl | 19 -
.../multipleLoaders/WEB-INF/templates/test.ftl | 19 -
.../jsp/webapps/multipleLoaders/WEB-INF/web.xml | 83 -
.../WEB-INF/expected/subdir/test-rel.txt | 20 -
.../WEB-INF/expected/test-noClasspath.txt | 32 -
.../tldDiscovery/WEB-INF/expected/test1.txt | 73 -
.../webapps/tldDiscovery/WEB-INF/fmtesttag 2.tld | 32 -
.../webapps/tldDiscovery/WEB-INF/fmtesttag4.tld | 32 -
.../tldDiscovery/WEB-INF/lib/taglib-foo.jar | Bin 1221 -> 0 bytes
.../WEB-INF/subdir-with-tld/fmtesttag3.tld | 32 -
.../jsp/webapps/tldDiscovery/WEB-INF/taglib 2.jar | Bin 1179 -> 0 bytes
.../ext/jsp/webapps/tldDiscovery/WEB-INF/web.xml | 179 -
.../tldDiscovery/not-auto-scanned/fmtesttag.tld | 40 -
.../jsp/webapps/tldDiscovery/subdir/test-rel.ftl | 20 -
.../jsp/webapps/tldDiscovery/test-noClasspath.ftl | 32 -
.../ext/jsp/webapps/tldDiscovery/test1.ftl | 55 -
.../manual/AutoEscapingExample-capture.ftlh | 21 -
.../manual/AutoEscapingExample-capture.ftlh.out | 20 -
.../manual/AutoEscapingExample-convert.ftlh | 27 -
.../manual/AutoEscapingExample-convert.ftlh.out | 25 -
.../manual/AutoEscapingExample-convert2.ftl | 25 -
.../manual/AutoEscapingExample-convert2.ftl.out | 21 -
.../manual/AutoEscapingExample-infoBox.ftlh | 26 -
.../manual/AutoEscapingExample-infoBox.ftlh.out | 25 -
.../manual/AutoEscapingExample-markup.ftlh | 28 -
.../manual/AutoEscapingExample-markup.ftlh.out | 26 -
.../manual/AutoEscapingExample-stringConcat.ftlh | 19 -
.../AutoEscapingExample-stringConcat.ftlh.out | 19 -
.../manual/AutoEscapingExample-stringLiteral.ftlh | 21 -
.../AutoEscapingExample-stringLiteral.ftlh.out | 20 -
.../manual/AutoEscapingExample-stringLiteral2.ftlh | 25 -
.../AutoEscapingExample-stringLiteral2.ftlh.out | 21 -
.../ConfigureOutputFormatExamples1.properties | 21 -
.../ConfigureOutputFormatExamples2.properties | 31 -
.../manual/CustomFormatsExample-alias1.ftlh | 22 -
.../manual/CustomFormatsExample-alias1.ftlh.out | 22 -
.../manual/CustomFormatsExample-alias2.ftlh | 19 -
.../manual/CustomFormatsExample-alias2.ftlh.out | 19 -
.../manual/CustomFormatsExample-modelAware.ftlh | 20 -
.../CustomFormatsExample-modelAware.ftlh.out | 20 -
.../TemplateConfigurationExamples1.properties | 25 -
.../TemplateConfigurationExamples2.properties | 32 -
.../TemplateConfigurationExamples3.properties | 47 -
src/test/resources/freemarker/manual/test.ftlh | 28 -
.../template/SimpleObjectWrapperTest.java | 72 -
.../resources/freemarker/template/toCache1.ftl | 19 -
.../resources/freemarker/template/toCache2.ftl | 19 -
.../test/templatesuite/expected/arithmetic.txt | 46 -
.../test/templatesuite/expected/bean-maps.txt | 115 -
.../test/templatesuite/expected/beans.txt | 56 -
.../templatesuite/expected/boolean-formatting.txt | 32 -
.../test/templatesuite/expected/boolean.txt | 102 -
.../templatesuite/expected/charset-in-header.txt | 26 -
.../templatesuite/expected/classic-compatible.txt | 41 -
.../test/templatesuite/expected/comment.txt | 34 -
.../test/templatesuite/expected/comparisons.txt | 93 -
.../test/templatesuite/expected/compress.txt | 40 -
.../templatesuite/expected/dateformat-java.txt | 55 -
.../test/templatesuite/expected/default-xmlns.txt | 25 -
.../test/templatesuite/expected/default.txt | 26 -
.../expected/encoding-builtins-ici-2.3.20.txt | 44 -
.../templatesuite/expected/encoding-builtins.txt | 44 -
.../test/templatesuite/expected/escapes.txt | 49 -
.../test/templatesuite/expected/exception.txt | 43 -
.../test/templatesuite/expected/exception2.txt | 47 -
.../test/templatesuite/expected/exception3.txt | 21 -
.../test/templatesuite/expected/exthash.txt | 76 -
.../test/templatesuite/expected/hashconcat.txt | 138 -
.../test/templatesuite/expected/hashliteral.txt | 74 -
.../test/templatesuite/expected/helloworld.txt | 31 -
.../templatesuite/expected/identifier-escaping.txt | 57 -
.../expected/identifier-non-ascii.txt | 19 -
.../freemarker/test/templatesuite/expected/if.txt | 104 -
.../test/templatesuite/expected/import.txt | 40 -
.../test/templatesuite/expected/include.txt | 80 -
.../test/templatesuite/expected/include2.txt | 44 -
.../test/templatesuite/expected/interpret.txt | 23 -
.../test/templatesuite/expected/iterators.txt | 86 -
.../test/templatesuite/expected/lastcharacter.txt | 31 -
.../test/templatesuite/expected/list-bis.txt | 51 -
.../test/templatesuite/expected/list.txt | 51 -
.../test/templatesuite/expected/list2.txt | 211 -
.../test/templatesuite/expected/list3.txt | 57 -
.../test/templatesuite/expected/listliteral.txt | 75 -
.../test/templatesuite/expected/localization.txt | 32 -
.../test/templatesuite/expected/logging.txt | 27 -
.../test/templatesuite/expected/loopvariable.txt | 54 -
.../test/templatesuite/expected/macros-return.txt | 23 -
.../test/templatesuite/expected/macros.txt | 67 -
.../test/templatesuite/expected/macros2.txt | 22 -
.../test/templatesuite/expected/multimodels.txt | 93 -
.../test/templatesuite/expected/nested.txt | 25 -
.../templatesuite/expected/new-allowsnothing.txt | 19 -
.../templatesuite/expected/new-defaultresolver.txt | 20 -
.../test/templatesuite/expected/new-optin.txt | 32 -
.../test/templatesuite/expected/new-safer.txt | 20 -
.../templatesuite/expected/new-unrestricted.txt | 20 -
.../test/templatesuite/expected/newlines1.txt | 29 -
.../test/templatesuite/expected/newlines2.txt | 30 -
.../templatesuite/expected/non-strict-syntax.txt | 37 -
.../test/templatesuite/expected/noparse.txt | 54 -
.../test/templatesuite/expected/number-format.txt | 33 -
.../test/templatesuite/expected/number-literal.txt | 79 -
.../test/templatesuite/expected/number-to-date.txt | 31 -
.../test/templatesuite/expected/numerical-cast.txt | 462 -
.../templatesuite/expected/output-encoding1.txt | 27 -
.../templatesuite/expected/output-encoding2.txt | Bin 1976 -> 0 bytes
.../templatesuite/expected/output-encoding3.txt | 26 -
.../test/templatesuite/expected/precedence.txt | 48 -
.../test/templatesuite/expected/recover.txt | 26 -
.../test/templatesuite/expected/root.txt | 44 -
.../templatesuite/expected/sequence-builtins.txt | 397 -
.../test/templatesuite/expected/specialvars.txt | 25 -
.../test/templatesuite/expected/strictinheader.txt | 21 -
.../expected/string-builtins-regexps-matches.txt | 99 -
.../expected/string-builtins-regexps.txt | 112 -
.../templatesuite/expected/string-builtins1.txt | 112 -
.../templatesuite/expected/string-builtins2.txt | 135 -
.../templatesuite/expected/stringbimethods.txt | 29 -
.../test/templatesuite/expected/stringliteral.txt | Bin 1552 -> 0 bytes
.../test/templatesuite/expected/switch.txt | 80 -
.../test/templatesuite/expected/transforms.txt | 75 -
.../expected/type-builtins-ici-2.3.21.txt | 33 -
.../expected/type-builtins-ici-2.3.24.txt | 33 -
.../test/templatesuite/expected/type-builtins.txt | 33 -
.../test/templatesuite/expected/var-layers.txt | 37 -
.../test/templatesuite/expected/varargs.txt | 44 -
.../test/templatesuite/expected/variables.txt | 62 -
.../templatesuite/expected/whitespace-trim.txt | 60 -
.../templatesuite/expected/wstrip-in-header.txt | 23 -
.../test/templatesuite/expected/wstripping.txt | 39 -
.../test/templatesuite/expected/xml-fragment.txt | 25 -
.../templatesuite/expected/xml-ns_prefix-scope.txt | 29 -
.../freemarker/test/templatesuite/expected/xml.txt | 65 -
.../test/templatesuite/expected/xmlns1.txt | 63 -
.../test/templatesuite/expected/xmlns3.txt | 47 -
.../test/templatesuite/expected/xmlns4.txt | 47 -
.../test/templatesuite/expected/xmlns5.txt | 26 -
.../models/BeansTestResources.properties | 19 -
.../test/templatesuite/models/defaultxmlns1.xml | 24 -
.../templatesuite/models/xml-ns_prefix-scope.xml | 26 -
.../freemarker/test/templatesuite/models/xml.xml | 31 -
.../test/templatesuite/models/xmlfragment.xml | 19 -
.../freemarker/test/templatesuite/models/xmlns.xml | 32 -
.../test/templatesuite/models/xmlns2.xml | 32 -
.../test/templatesuite/models/xmlns3.xml | 32 -
.../test/templatesuite/templates/api-builtins.ftl | 46 -
.../test/templatesuite/templates/arithmetic.ftl | 50 -
.../test/templatesuite/templates/assignments.ftl | 108 -
.../test/templatesuite/templates/bean-maps.ftl | 58 -
.../test/templatesuite/templates/beans.ftl | 60 -
.../templatesuite/templates/boolean-formatting.ftl | 83 -
.../test/templatesuite/templates/boolean.ftl | 142 -
.../templatesuite/templates/charset-in-header.ftl | 27 -
.../templates/charset-in-header_inc1.ftl | 20 -
.../templates/charset-in-header_inc2.ftl | 19 -
.../templates/classic-compatible-mode2.ftl | 26 -
.../templatesuite/templates/classic-compatible.ftl | 54 -
.../test/templatesuite/templates/comment.ftl | 51 -
.../test/templatesuite/templates/comparisons.ftl | 218 -
.../test/templatesuite/templates/compress.ftl | 59 -
.../templatesuite/templates/date-type-builtins.ftl | 47 -
.../templates/dateformat-iso-bi-common.ftl | 159 -
.../templates/dateformat-iso-bi-ici-2.3.21.ftl | 23 -
.../templatesuite/templates/dateformat-iso-bi.ftl | 23 -
.../templates/dateformat-iso-like.ftl | 155 -
.../templatesuite/templates/dateformat-java.ftl | 71 -
.../test/templatesuite/templates/dateparsing.ftl | 84 -
.../test/templatesuite/templates/default-xmlns.ftl | 28 -
.../test/templatesuite/templates/default.ftl | 34 -
.../templatesuite/templates/encoding-builtins.ftl | 52 -
.../test/templatesuite/templates/escapes.ftl | 79 -
.../test/templatesuite/templates/exception.ftl | 31 -
.../test/templatesuite/templates/exception2.ftl | 31 -
.../test/templatesuite/templates/exception3.ftl | 31 -
.../templates/existence-operators.ftl | 141 -
.../test/templatesuite/templates/exthash.ftl | 48 -
.../test/templatesuite/templates/hashconcat.ftl | 60 -
.../test/templatesuite/templates/hashliteral.ftl | 107 -
.../test/templatesuite/templates/helloworld.ftl | 30 -
.../templates/identifier-escaping.ftl | 81 -
.../templates/identifier-non-ascii.ftl | 21 -
.../freemarker/test/templatesuite/templates/if.ftl | 109 -
.../test/templatesuite/templates/import.ftl | 45 -
.../test/templatesuite/templates/import_lib.ftl | 31 -
.../test/templatesuite/templates/include.ftl | 49 -
.../templates/include2-included-encoding.ftl | 20 -
.../templatesuite/templates/include2-included.ftl | 19 -
.../test/templatesuite/templates/include2.ftl | 51 -
.../test/templatesuite/templates/included.ftl | 30 -
.../test/templatesuite/templates/interpret.ftl | 25 -
.../test/templatesuite/templates/iterators.ftl | 73 -
.../test/templatesuite/templates/lastcharacter.ftl | 31 -
.../test/templatesuite/templates/list-bis.ftl | 48 -
.../test/templatesuite/templates/list.ftl | 44 -
.../test/templatesuite/templates/list2.ftl | 90 -
.../test/templatesuite/templates/list3.ftl | 70 -
.../test/templatesuite/templates/listliteral.ftl | 84 -
.../test/templatesuite/templates/localization.ftl | 32 -
.../templatesuite/templates/localization_en.ftl | 32 -
.../templatesuite/templates/localization_en_AU.ftl | 32 -
.../test/templatesuite/templates/logging.ftl | 42 -
.../test/templatesuite/templates/loopvariable.ftl | 49 -
.../test/templatesuite/templates/macros-return.ftl | 34 -
.../test/templatesuite/templates/macros.ftl | 102 -
.../test/templatesuite/templates/macros2.ftl | 35 -
.../test/templatesuite/templates/multimodels.ftl | 84 -
.../test/templatesuite/templates/nested.ftl | 29 -
.../test/templatesuite/templates/nestedinclude.ftl | 21 -
.../templatesuite/templates/new-allowsnothing.ftl | 23 -
.../templates/new-defaultresolver.ftl | 24 -
.../test/templatesuite/templates/new-optin.ftl | 30 -
.../test/templatesuite/templates/new-safer.ftl | 24 -
.../templatesuite/templates/new-unrestricted.ftl | 20 -
.../test/templatesuite/templates/newlines1.ftl | 29 -
.../test/templatesuite/templates/newlines2.ftl | 33 -
.../templatesuite/templates/non-strict-syntax.ftl | 38 -
.../test/templatesuite/templates/noparse.ftl | 63 -
.../test/templatesuite/templates/number-format.ftl | 50 -
.../templatesuite/templates/number-literal.ftl | 133 -
.../templates/number-math-builtins.ftl | 78 -
.../templatesuite/templates/number-to-date.ftl | 35 -
.../templatesuite/templates/numerical-cast.ftl | 82 -
.../templatesuite/templates/output-encoding1.ftl | 30 -
.../templatesuite/templates/output-encoding2.ftl | 28 -
.../templatesuite/templates/output-encoding3.ftl | 28 -
.../overloaded-methods-2-bwici-2.3.20.ftl | 285 -
.../overloaded-methods-2-bwici-2.3.21.ftl | 349 -
.../templates/overloaded-methods-2-common.ftl | 89 -
.../overloaded-methods-2-desc-bwici-2.3.20.ftl | 43 -
.../overloaded-methods-2-inc-bwici-2.3.20.ftl | 47 -
.../templates/overloaded-methods-23bc.ftl | 69 -
.../test/templatesuite/templates/precedence.ftl | 61 -
.../test/templatesuite/templates/range-common.ftl | 314 -
.../templatesuite/templates/range-ici-2.3.20.ftl | 37 -
.../templatesuite/templates/range-ici-2.3.21.ftl | 50 -
.../test/templatesuite/templates/recover.ftl | 47 -
.../test/templatesuite/templates/root.ftl | 48 -
.../templatesuite/templates/sequence-builtins.ftl | 354 -
.../test/templatesuite/templates/setting.ftl | 57 -
.../templates/simplehash-char-key.ftl | 44 -
.../test/templatesuite/templates/specialvars.ftl | 39 -
.../templatesuite/templates/strictinheader.ftl | 23 -
.../templates/strictinheader_inc1.ftl | 21 -
.../templates/strictinheader_inc2.ftl | 20 -
.../templates/string-builtin-coercion.ftl | 34 -
.../templates/string-builtins-ici-2.3.19.ftl | 22 -
.../templates/string-builtins-ici-2.3.20.ftl | 21 -
.../templates/string-builtins-regexps-matches.ftl | 118 -
.../templates/string-builtins-regexps.ftl | 136 -
.../templatesuite/templates/string-builtins1.ftl | 129 -
.../templatesuite/templates/string-builtins2.ftl | 135 -
.../templatesuite/templates/string-builtins3.ftl | 225 -
.../templatesuite/templates/stringbimethods.ftl | 36 -
.../test/templatesuite/templates/stringliteral.ftl | 69 -
.../templates/subdir/include-subdir.ftl | 27 -
.../templates/subdir/include-subdir2.ftl | 19 -
.../templatesuite/templates/subdir/new-optin-2.ftl | 24 -
.../templatesuite/templates/subdir/new-optin.ftl | 26 -
.../templates/subdir/subsub/new-optin.ftl | 24 -
.../templatesuite/templates/switch-builtin.ftl | 54 -
.../test/templatesuite/templates/switch.ftl | 139 -
.../test/templatesuite/templates/then-builtin.ftl | 53 -
.../test/templatesuite/templates/transforms.ftl | 120 -
.../test/templatesuite/templates/type-builtins.ftl | 44 -
.../test/templatesuite/templates/undefined.ftl | 19 -
.../test/templatesuite/templates/url.ftl | 24 -
.../test/templatesuite/templates/var-layers.ftl | 39 -
.../test/templatesuite/templates/varargs.ftl | 45 -
.../test/templatesuite/templates/variables.ftl | 70 -
.../test/templatesuite/templates/varlayers_lib.ftl | 28 -
.../templatesuite/templates/whitespace-trim.ftl | 102 -
.../templates/wsstripinheader_inc.ftl | 22 -
.../templatesuite/templates/wstrip-in-header.ftl | 26 -
.../test/templatesuite/templates/xml-fragment.ftl | 26 -
.../templates/xml-ns_prefix-scope-lib.ftl | 23 -
.../templates/xml-ns_prefix-scope-main.ftl | 36 -
.../test/templatesuite/templates/xml.ftl | 47 -
.../test/templatesuite/templates/xmlns1.ftl | 53 -
.../test/templatesuite/templates/xmlns3.ftl | 70 -
.../test/templatesuite/templates/xmlns4.ftl | 70 -
.../test/templatesuite/templates/xmlns5.ftl | 28 -
.../freemarker/test/templatesuite/testcases.xml | 306 -
src/test/resources/logback-test.xml | 34 -
1152 files changed, 2 insertions(+), 190888 deletions(-)
diff --git a/.classpath b/.classpath
deleted file mode 100644
index 53283ee..0000000
--- a/.classpath
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry excluding="freemarker/ext/dom/SunInternalXalanXPathSupport.java|freemarker/ext/jsp/FreeMarkerJspFactory2.java|freemarker/ext/jsp/_FreeMarkerPageContext1.java|freemarker/ext/jsp/_FreeMarkerPageContext2.java|freemarker/ext/jython/_Jython20And21VersionAdapter.java|freemarker/ext/jython/_Jython22VersionAdapter.java" kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="src" path="src/test/resources"/>
- <classpathentry kind="src" path="build/generated-sources/java">
- <attributes>
- <attribute name="ignore_optional_problems" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/annotations-3.0.0.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/ant-1.6.5.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/avalon-logkit-2.0.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/com.sun.el-1.0.0.v201105211818.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/commons-logging-1.1.1.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/hamcrest-core-1.3.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/javarebel-sdk-1.2.2.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/javax.el-2.1.0.v201105211819.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/javax.servlet-2.5.0.v201103041518.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/javax.servlet.jsp-2.1.0.v201105211820.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jaxen-1.0-FCS.jar"/>
- <classpathentry kind="lib" path="D:/Temp/git_fm/freemarker-2.3-gae/ide-dependencies/jdom-1.0b8.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-continuation-7.6.16.v20140903.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-http-7.6.16.v20140903.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-io-7.6.16.v20140903.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-jsp-7.6.16.v20140903.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-security-7.6.16.v20140903.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-server-7.6.16.v20140903.jar" sourcepath="D:/Temp/git_fm/!non-git/jetty/jetty-server-7.6.16.v20140903-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-servlet-7.6.16.v20140903.jar" sourcepath="D:/Temp/git_fm/!non-git/jetty/jetty-servlet-7.6.16.v20140903-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-util-7.6.16.v20140903.jar" sourcepath="D:/Temp/git_fm/!non-git/jetty/jetty-util-7.6.16.v20140903-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-webapp-7.6.16.v20140903.jar" sourcepath="D:/Temp/git_fm/!non-git/jetty/jetty-webapp-7.6.16.v20140903-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jetty-xml-7.6.16.v20140903.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/js-1.6R1.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/jython-2.5.0.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/org.apache.jasper.glassfish-2.1.0.v201110031002.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar" sourcepath="D:/Temp/git_fm/!non-git/jetty/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/org.eclipse.jdt.core-3.7.1.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/saxpath-1.0-FCS.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/xalan-2.7.0.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/dom4j-1.3.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/logback-classic-1.1.2.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/logback-core-1.1.2.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/slf4j-api-1.7.6.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/commons-io-2.2.jar" sourcepath="D:/Temp/git_fm/!non-git/jetty/commons-io-2.2-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/guava-jdk5-17.0.jar"/>
- <classpathentry exported="true" kind="lib" path="ide-dependencies/log4j-over-slf4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/commons-beanutils-1.7.0.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/commons-collections-3.1.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/commons-lang-2.3.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/displaytag-1.2.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/jcl-over-slf4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/junit-4.12.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/hamcrest-library-1.3.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/spring-core-2.5.6.SEC03.jar"/>
- <classpathentry kind="lib" path="ide-dependencies/spring-test-2.5.6.SEC03.jar"/>
- <classpathentry kind="output" path=".bin/"/>
-</classpath>
diff --git a/.project b/.project
deleted file mode 100644
index fcff841..0000000
--- a/.project
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>FreeMarker-master</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.apache.ivyde.eclipse.ivynature</nature>
- <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
- </natures>
- <filteredResources>
- <filter>
- <id>1416528675344</id>
- <name></name>
- <type>26</type>
- <matcher>
- <id>org.eclipse.ui.ide.multiFilter</id>
- <arguments>1.0-projectRelativePath-matches-false-true-build/(?!generated-sources)[\w-]+</arguments>
- </matcher>
- </filter>
- </filteredResources>
-</projectDescription>
diff --git a/.settings/edu.umd.cs.findbugs.core.prefs b/.settings/edu.umd.cs.findbugs.core.prefs
deleted file mode 100644
index c049d3c..0000000
--- a/.settings/edu.umd.cs.findbugs.core.prefs
+++ /dev/null
@@ -1,143 +0,0 @@
-#FindBugs User Preferences
-#Sun Jul 12 16:29:44 CEST 2015
-cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud
-detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
-detectorAtomicityProblem=AtomicityProblem|true
-detectorBadAppletConstructor=BadAppletConstructor|false
-detectorBadResultSetAccess=BadResultSetAccess|true
-detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
-detectorBadUseOfReturnValue=BadUseOfReturnValue|true
-detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true
-detectorBooleanReturnNull=BooleanReturnNull|true
-detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false
-detectorCheckExpectedWarnings=CheckExpectedWarnings|false
-detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
-detectorCheckRelaxingNullnessAnnotation=CheckRelaxingNullnessAnnotation|true
-detectorCheckTypeQualifiers=CheckTypeQualifiers|true
-detectorCloneIdiom=CloneIdiom|true
-detectorComparatorIdiom=ComparatorIdiom|true
-detectorConfusedInheritance=ConfusedInheritance|true
-detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
-detectorCovariantArrayAssignment=CovariantArrayAssignment|false
-detectorCrossSiteScripting=CrossSiteScripting|true
-detectorDefaultEncodingDetector=DefaultEncodingDetector|true
-detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
-detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
-detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true
-detectorDontUseEnum=DontUseEnum|true
-detectorDroppedException=DroppedException|true
-detectorDumbMethodInvocations=DumbMethodInvocations|true
-detectorDumbMethods=DumbMethods|true
-detectorDuplicateBranches=DuplicateBranches|true
-detectorEmptyZipFileEntry=EmptyZipFileEntry|false
-detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true
-detectorExplicitSerialization=ExplicitSerialization|true
-detectorFinalizerNullsFields=FinalizerNullsFields|true
-detectorFindBadCast2=FindBadCast2|true
-detectorFindBadForLoop=FindBadForLoop|true
-detectorFindCircularDependencies=FindCircularDependencies|false
-detectorFindComparatorProblems=FindComparatorProblems|true
-detectorFindDeadLocalStores=FindDeadLocalStores|true
-detectorFindDoubleCheck=FindDoubleCheck|true
-detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true
-detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true
-detectorFindFinalizeInvocations=FindFinalizeInvocations|true
-detectorFindFloatEquality=FindFloatEquality|true
-detectorFindHEmismatch=FindHEmismatch|true
-detectorFindInconsistentSync2=FindInconsistentSync2|true
-detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true
-detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true
-detectorFindMaskedFields=FindMaskedFields|true
-detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true
-detectorFindNakedNotify=FindNakedNotify|true
-detectorFindNonShortCircuit=FindNonShortCircuit|true
-detectorFindNullDeref=FindNullDeref|true
-detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true
-detectorFindOpenStream=FindOpenStream|true
-detectorFindPuzzlers=FindPuzzlers|true
-detectorFindRefComparison=FindRefComparison|true
-detectorFindReturnRef=FindReturnRef|true
-detectorFindRoughConstants=FindRoughConstants|true
-detectorFindRunInvocations=FindRunInvocations|true
-detectorFindSelfComparison=FindSelfComparison|true
-detectorFindSelfComparison2=FindSelfComparison2|true
-detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true
-detectorFindSpinLoop=FindSpinLoop|true
-detectorFindSqlInjection=FindSqlInjection|true
-detectorFindTwoLockWait=FindTwoLockWait|true
-detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true
-detectorFindUnconditionalWait=FindUnconditionalWait|true
-detectorFindUninitializedGet=FindUninitializedGet|true
-detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true
-detectorFindUnreleasedLock=FindUnreleasedLock|true
-detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true
-detectorFindUnsyncGet=FindUnsyncGet|true
-detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true
-detectorFindUselessControlFlow=FindUselessControlFlow|true
-detectorFindUselessObjects=FindUselessObjects|true
-detectorFormatStringChecker=FormatStringChecker|true
-detectorHugeSharedStringConstants=HugeSharedStringConstants|true
-detectorIDivResultCastToDouble=IDivResultCastToDouble|true
-detectorIncompatMask=IncompatMask|true
-detectorInconsistentAnnotations=InconsistentAnnotations|true
-detectorInefficientIndexOf=InefficientIndexOf|true
-detectorInefficientInitializationInsideLoop=InefficientInitializationInsideLoop|false
-detectorInefficientMemberAccess=InefficientMemberAccess|false
-detectorInefficientToArray=InefficientToArray|true
-detectorInfiniteLoop=InfiniteLoop|true
-detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true
-detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true
-detectorInitializationChain=InitializationChain|true
-detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true
-detectorInstantiateStaticClass=InstantiateStaticClass|true
-detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true
-detectorInvalidJUnitTest=InvalidJUnitTest|true
-detectorIteratorIdioms=IteratorIdioms|true
-detectorLazyInit=LazyInit|true
-detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
-detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true
-detectorMethodReturnCheck=MethodReturnCheck|true
-detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
-detectorMutableEnum=MutableEnum|true
-detectorMutableLock=MutableLock|true
-detectorMutableStaticFields=MutableStaticFields|true
-detectorNaming=Naming|true
-detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true
-detectorNumberConstructor=NumberConstructor|true
-detectorOptionalReturnNull=OptionalReturnNull|true
-detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
-detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
-detectorPublicSemaphores=PublicSemaphores|false
-detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
-detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true
-detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
-detectorRedundantConditions=RedundantConditions|true
-detectorRedundantInterfaces=RedundantInterfaces|true
-detectorRepeatedConditionals=RepeatedConditionals|true
-detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true
-detectorSerializableIdiom=SerializableIdiom|true
-detectorStartInConstructor=StartInConstructor|true
-detectorStaticCalendarDetector=StaticCalendarDetector|true
-detectorStringConcatenation=StringConcatenation|true
-detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true
-detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true
-detectorSwitchFallthrough=SwitchFallthrough|true
-detectorSynchronizationOnSharedBuiltinConstant=SynchronizationOnSharedBuiltinConstant|true
-detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true
-detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true
-detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true
-detectorURLProblems=URLProblems|true
-detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true
-detectorUnnecessaryMath=UnnecessaryMath|true
-detectorUnreadFields=UnreadFields|true
-detectorUselessSubclassMethod=UselessSubclassMethod|false
-detectorVarArgsProblems=VarArgsProblems|true
-detectorVolatileUsage=VolatileUsage|true
-detectorWaitInLoop=WaitInLoop|true
-detectorWrongMapIterator=WrongMapIterator|true
-detectorXMLFactoryBypass=XMLFactoryBypass|true
-detector_threshold=2
-effort=default
-filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,MT_CORRECTNESS,PERFORMANCE,STYLE|false|17
-filter_settings_neg=MALICIOUS_CODE,SECURITY,EXPERIMENTAL,NOISE,I18N|
-run_at_full_build=false
diff --git a/.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs b/.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs
deleted file mode 100644
index ac3837f..0000000
--- a/.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerScariest=Error
-edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerScary=Error
-edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerTroubling=Error
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 99f26c0..0000000
--- a/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs
deleted file mode 100644
index 5a0ad22..0000000
--- a/.settings/org.eclipse.core.runtime.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-line.separator=\n
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index e0e730a..0000000
--- a/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,409 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=warning
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=ignore
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=120
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=8
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.lineSplit=120
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index abd2581..0000000
--- a/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,71 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_FreeMarker
-formatter_settings_version=12
-internal.default.compliance=default
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;org;com;
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.staticondemandthreshold=1
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=false
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.insert_inferred_type_arguments=false
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=true
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_redundant_type_arguments=false
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_anonymous_class_creation=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_lambda=true
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-sp_cleanup.use_type_arguments=false
diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs
deleted file mode 100644
index b196c64..0000000
--- a/.settings/org.eclipse.ltk.core.refactoring.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/README b/README
index 5f479a4..61fd03a 100644
--- a/README
+++ b/README
@@ -1,145 +1,2 @@
-/*
- * 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.
- */
-
-===============================================================================
-
- Apache FreeMarker {version}
-
- For the latest version or to report bugs visit:
-
- http://freemarker.org/
-
-===============================================================================
-
- DISCLAIMER
-
- Apache FreeMarker is an effort undergoing incubation at The Apache
- Software Foundation (ASF). Incubation is required of all newly accepted
- projects until a further review indicates that the infrastructure,
- communications, and decision making process have stabilized in a manner
- consistent with other successful ASF projects. While incubation status is
- not necessarily a reflection of the completeness or stability of the
- code, it does indicate that the project has yet to be fully endorsed by
- the ASF.
-
-
-What is Apache FreeMarker?
---------------------------
-
-FreeMarker is a "template engine"; a generic tool to generate text
-output (anything from HTML to auto generated source code) based on
-templates. It's a Java package, a class library for Java programmers.
-It's not an application for end-users in itself, but something that
-programmers can embed into their products. FreeMarker is designed to
-be practical for the generation of HTML Web pages, particularly by
-servlet-based applications following the MVC (Model View Controller)
-pattern.
-
-
-Licensing
----------
-
-FreeMarker is licensed under the Apache License, Version 2.0.
-
-See the LICENSE file for more details!
-
-
-Documentation
--------------
-
-Online: http://freemarker.org/docs/
-
-Offline: The full documentation is available in the binary distribution
-in the documentation/index.html directory.
-
-
-Installing
-----------
-
-If you are using Maven, just add this dependency:
-
- <!--
- Attention: Be sure nothing pulls in an old dependency with groupId
- "freemarker" (without the "org."), because then you will end up with
- two freemarker.jar-s and unpredictable behavior on runtime!
- -->
- <dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- <version>{version}</version>
- </dependency>
-
-Otherwise simply copy freemarker.jar to a location where your Java
-application's ClassLoader will find it. For example, if you are using
-FreeMarker in a web application, you probably want to put
-freemarker.jar into the WEB-INF/lib directory of your web application.
-
-FreeMarker has no required dependencies. It has several optional
-dependencies, but usually you don't have to deal with them, because if
-you are using an optional feature that's certainly because your
-application already uses the related library.
-
-
-Change log
-----------
-
-Online (for stable releases only):
-http://freemarker.org/docs/app_versions.html
-
-Offline:
-In the binary release, open documentation/index.html, and you will find the
-link.
-
-
-Building
---------
-
-First of all, if you haven't yet, download the source release, or check
-out FreeMarker from the source code repository.
-
-You need JDK 8(!), Apache Ant and Ivy to be installed. (As of this writing
-it was tested with Ant 1.8.1 and Ivy 2.3.0.)
-
-If you need to ensure compliance with certain J2SE versions, copy
-build.properties.sample into build.properties, and edit it
-accordingly.
-
-To build freemarker.jar, just issue "ant" in the project root
-directory, and it should download all dependencies automatically and
-build freemarker.jar.
-
-If later you change the dependencies in ivy.xml, or otherwise want to
-re-download some of them, it will not happen automatically anymore.
-You have to issue "ant update-deps" for that.
-
-
-Eclipse and other IDE-s
------------------------
-
-Run "ant ide-dependencies"; This will create an "ide-dependencies" library
-that contains all the jars that you have to add to the classpath in the IDE.
-Note that here we assume that you have run the build or at least
-"ant update-deps" earlier.
-
-Known issue with workaround: An old org.jaxen is included in dom4j-*.jar,
-which conflicts with jaxen-*.jar. If dom4j wins, your IDE will show some
-errors in the XML related parts. To fix that, always add dom4j-*.jar last.
-
-You could also use IvyDE instead, with configuration "IDE", but as the
-dependencies hardly ever change, it might not worth the trouble.
+Do not use this (the master) branch!
+See currently active branches here: https://freemarker.apache.org/sourcecode.html
diff --git a/build.properties.sample b/build.properties.sample
deleted file mode 100644
index c5dc8ff..0000000
--- a/build.properties.sample
+++ /dev/null
@@ -1,23 +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.
-
-# Copy this file to "build.properties" before editing!
-# These propeties should point to the rt.jar-s of the respective J2SE versions:
-boot.classpath.j2se1.5=C:/Program Files (x86)/Java/jdk1.5.0_16/jre/lib/rt.jar
-boot.classpath.j2se1.6=C:/Program Files/Java/jdk1.6.0_24/jre/lib/rt.jar
-mvnCommand=C:/Program Files (x86)/maven3/bin/mvn.bat
-gpgCommand=C:/Program Files (x86)/GNU/GnuPG/pub/gpg.exe
\ No newline at end of file
diff --git a/build.xml b/build.xml
deleted file mode 100644
index ceae505..0000000
--- a/build.xml
+++ /dev/null
@@ -1,1099 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<project basedir="." default="jar" name="freemarker"
- xmlns:ivy="antlib:org.apache.ivy.ant"
- xmlns:javacc="http://javacc.dev.java.net/"
- xmlns:docgen="http://freemarker.org/docgen"
- xmlns:bnd="http://www.aqute.biz/bnd"
- xmlns:rat="antlib:org.apache.rat.anttasks"
- xmlns:u="http://freemarker.org/util"
->
-
- <!-- ================================================================== -->
- <!-- Properties -->
- <!-- ================================================================== -->
-
- <!-- Ivy project coordinates: -->
- <property name="moduleOrg" value="org.freemarker" />
- <property name="moduleName" value="freemarker" />
- <property name="moduleBranch" value="2.3" />
-
- <!-- Will be overidden on the Continous Integration server: -->
- <property name="server.ivy.repo.root" value="${basedir}/build/dummy-server-ivy-repo" />
-
- <property file="build.properties"/>
- <condition property="has.explicit.boot.classpath.j2se1.5">
- <isset property="boot.classpath.j2se1.5"/>
- </condition>
- <condition property="has.explicit.boot.classpath.j2se1.6">
- <isset property="boot.classpath.j2se1.6"/>
- </condition>
- <condition property="has.all.explicit.boot.classpaths">
- <and>
- <isset property="has.explicit.boot.classpath.j2se1.5"/>
- <isset property="has.explicit.boot.classpath.j2se1.6"/>
- </and>
- </condition>
- <available property="atLeastJDK8" classname="java.util.function.Predicate"/>
-
- <!-- When boot.classpath.j2se* is missing, these will be the defaults: -->
- <!-- Note: Target "dist" doesn't allow using these. -->
- <property name="boot.classpath.j2se1.5" value="${sun.boot.class.path}" />
- <property name="boot.classpath.j2se1.6" value="${sun.boot.class.path}" />
-
- <!-- For checking the correctness of the boot.classpath.j2se* -->
- <available classpath="${boot.classpath.j2se1.5}"
- classname="java.util.concurrent.ConcurrentHashMap" ignoresystemclasses="true"
- property="boot.classpath.j2se1.5.correct"
- />
- <available classpath="${boot.classpath.j2se1.6}"
- classname="java.util.ServiceLoader" ignoresystemclasses="true"
- property="boot.classpath.j2se1.6.correct"
- />
-
- <!-- Set up version/timestamp filters and the version property: -->
- <tstamp>
- <format property="timestampNice" pattern="yyyy-MM-dd'T'HH:mm:ss'Z'"
- timezone="UTC" />
- <format property="timestampInVersion" pattern="yyyyMMdd'T'HHmmss'Z'"
- timezone="UTC" />
- </tstamp>
- <filter token="timestampInVersion" value="${timestampInVersion}" />
- <filter token="timestampNice" value="${timestampNice}" />
- <mkdir dir="build"/>
- <!-- Copying is needed to substitute the timestamps. -->
- <copy
- file="src/main/resources/freemarker/version.properties"
- tofile="build/version.properties.tmp"
- filtering="true"
- overwrite="true"
- />
- <property file="build/version.properties.tmp" />
- <delete file="build/version.properties.tmp" />
- <filter token="version" value="${version}" />
-
- <property name="dist.dir" value="build/dist" />
- <property name="dist.archiveBaseName" value="apache-freemarker-${version}" />
- <property name="dist.bin.dir" value="${dist.dir}/bin/${dist.archiveBaseName}" />
- <property name="dist.src.dir" value="${dist.dir}/src/${dist.archiveBaseName}-src" />
-
- <!-- ================================================================== -->
- <!-- Initialization -->
- <!-- ================================================================== -->
-
-
- <target name="clean" description="get rid of all generated files">
- <delete dir="build" />
- </target>
-
- <target name="clean-classes" description="get rid of compiled classes">
- <delete dir="build/classes" />
- <delete dir="build/test-classes" />
- <delete dir="build/coverage/classes" />
- </target>
-
- <condition property="deps.available">
- <available file=".ivy" />
- </condition>
-
- <target name="init" depends="_autoget-deps"
- description="Fetch dependencies if any are missing and create the build directory if necessary"
- >
- <mkdir dir="build"/>
- </target>
-
-
- <!-- ================================================================= -->
- <!-- Compilation -->
- <!-- ================================================================= -->
-
-
- <target name="javacc" depends="init" unless="parser.uptodate"
- description="Build the parser from its grammar file"
- >
- <ivy:cachepath conf="parser" pathid="ivy.dep" />
- <taskdef name="generate" classname="org.apache.tools.ant.taskdefs.optional.javacc.JavaCC"
- uri="http://javacc.dev.java.net/"
- classpathref="ivy.dep"
- />
-
- <property name="_javaccOutputDir"
- value="build/generated-sources/java/freemarker/core/"
- />
-
- <mkdir dir="${_javaccOutputDir}" />
- <ivy:retrieve conf="parser" pattern="build/javacc-home.tmp/[artifact].[ext]" />
- <javacc:generate
- target="src/main/javacc/FTL.jj"
- outputdirectory="${_javaccOutputDir}"
- javacchome="build/javacc-home.tmp"
- />
- <delete dir="build/javacc-home.tmp" />
-
- <replace
- file="${_javaccOutputDir}/FMParser.java"
- token="private final LookaheadSuccess"
- value="private static final LookaheadSuccess"
- />
- <replace
- file="${_javaccOutputDir}/FMParserConstants.java"
- token="public interface FMParserConstants"
- value="interface FMParserConstants"
- />
- <replace
- file="${_javaccOutputDir}/FMParserTokenManager.java"
- token="public class FMParserTokenManager"
- value="class FMParserTokenManager"
- />
- <replace
- file="${_javaccOutputDir}/Token.java"
- token="public class Token"
- value="class Token"
- />
- <replace
- file="${_javaccOutputDir}/SimpleCharStream.java"
- token="public final class SimpleCharStream"
- value="final class SimpleCharStream"
- />
- <replace
- file="${_javaccOutputDir}/FMParser.java"
- token="enum"
- value="ENUM"
- />
-
- <!-- As we have a modified version in src/main/java: -->
- <move
- file="${_javaccOutputDir}/ParseException.java"
- tofile="${_javaccOutputDir}/ParseException.java.ignore"
- />
- <move
- file="${_javaccOutputDir}/TokenMgrError.java"
- tofile="${_javaccOutputDir}/TokenMgrError.java.ignore"
- />
- </target>
-
- <target name="compile" depends="javacc">
- <fail unless="boot.classpath.j2se1.5.correct"><!--
- -->The "boot.classpath.j2se1.5" property value (${boot.classpath.j2se1.5}) <!--
- -->seems to be an incorrect boot classpath. Please fix it in <!--
- -->the <projectDir>/build.properties file, or wherever you <!--
- -->set it.<!--
- --></fail>
- <fail unless="boot.classpath.j2se1.6.correct"><!--
- -->The "boot.classpath.j2se1.6" property value (${boot.classpath.j2se1.6}) <!--
- -->seems to be an incorrect boot classpath. Please fix it in <!--
- -->the <projectDir>/build.properties file, or wherever you <!--
- -->set it.<!--
- --></fail>
- <echo level="info"><!--
- -->Using boot classpaths:<!--
- -->Java 5: ${boot.classpath.j2se1.5}; <!--
- -->Java 6: ${boot.classpath.j2se1.6}<!--
- --></echo>
-
- <mkdir dir="build/classes" />
-
- <!-- Note: the "build.base" conf doesn't include optional FreeMarker dependencies. -->
- <ivy:cachepath conf="build.base" pathid="ivy.dep" />
- <javac destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep"
- bootclasspath="${boot.classpath.j2se1.5}"
- excludes="
- freemarker/core/_Java6Impl.java,
- freemarker/ext/jsp/**,
- freemarker/ext/servlet/**,
- freemarker/cache/WebappTemplateLoader.java,
-
- freemarker/ext/jython/**,
- freemarker/template/utility/JythonRuntime.java,
- freemarker/ext/ant/**"
- >
- <src>
- <pathelement location="src/main/java" />
- <pathelement location="build/generated-sources" />
- </src>
- </javac>
-
- <ivy:cachepath conf="build.base" pathid="ivy.dep" />
- <javac srcdir="src/main/java" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep"
- bootclasspath="${boot.classpath.j2se1.6}"
- includes="freemarker/core/_Java6Impl.java"
- />
-
- <rmic
- base="build/classes" includes="freemarker/debug/impl/Rmi*Impl.class"
- classpathref="ivy.dep"
- verify="yes" stubversion="1.2"
- />
-
- <ivy:cachepath conf="build.jsp2.0" pathid="ivy.dep.jsp2.0" />
- <javac srcdir="src/main/java" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep.jsp2.0"
- bootclasspath="${boot.classpath.j2se1.5}"
- includes="
- freemarker/ext/jsp/**,
- freemarker/ext/servlet/**,
- freemarker/cache/WebappTemplateLoader.java"
- excludes="
- freemarker/ext/jsp/_FreeMarkerPageContext21.java,
- freemarker/ext/jsp/FreeMarkerJspFactory21.java,
- freemarker/ext/jsp/FreeMarkerJspApplicationContext.java"
- />
-
- <!-- There's no build.jsp2.0, as those classes are part of the common build subset. -->
-
- <ivy:cachepath conf="build.jsp2.1" pathid="ivy.dep.jsp2.1" />
- <javac srcdir="src/main/java" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep.jsp2.1"
- bootclasspath="${boot.classpath.j2se1.5}"
- includes="
- freemarker/ext/jsp/_FreeMarkerPageContext21.java,
- freemarker/ext/jsp/FreeMarkerJspFactory21.java,
- freemarker/ext/jsp/FreeMarkerJspApplicationContext.java"
- />
-
- <ivy:cachepath conf="build.jython2.0" pathid="ivy.dep.jython2.0" />
- <javac srcdir="src/main/java" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep.jython2.0"
- bootclasspath="${boot.classpath.j2se1.5}"
- includes="
- freemarker/ext/ant/**,
- freemarker/template/utility/JythonRuntime.java,
- freemarker/ext/jython/**"
- excludes="
- freemarker/ext/jython/_Jython22VersionAdapter.java,
- freemarker/ext/jython/_Jython25VersionAdapter.java"
- />
-
- <ivy:cachepath conf="build.jython2.2" pathid="ivy.dep.jython2.2" />
- <javac srcdir="src/main/java" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep.jython2.2"
- bootclasspath="${boot.classpath.j2se1.5}"
- includes="
- freemarker/ext/jython/_Jython22VersionAdapter.java"
- />
-
- <ivy:cachepath conf="build.jython2.5" pathid="ivy.dep.jython2.5" />
- <javac srcdir="src/main/java" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep.jython2.5"
- bootclasspath="${boot.classpath.j2se1.5}"
- includes="
- freemarker/ext/jython/_Jython25VersionAdapter.java"
- />
-
- <rmic base="build/classes" classpathref="ivy.dep"
- includes="src/main/java/freemarker/debug/impl/Rmi*Impl.class"
- verify="yes" stubversion="1.2"
- />
-
- <!-- We don't have this file in 2.4.X... yet?
- <copy
- file="build/classes/freemarker/core/SecureRendererImpl.class"
- tofile="build/classes/freemarker/core/SecureRendererImpl.clazz"
- />
- -->
-
- <copy toDir="build/classes">
- <fileset dir="src/main/resources"
- excludes="
- freemarker/version.properties"
- />
- </copy>
- <copy toDir="build/classes" filtering="true" overwrite="true">
- <fileset dir="src/main/resources"
- includes="
- freemarker/version.properties"
- />
- </copy>
- <copy toDir="build/classes/META-INF">
- <fileset dir="." includes="LICENSE, NOTICE, DISCLAIMER" />
- </copy>
- </target>
-
- <target name="compileTest" depends="compile">
- <mkdir dir="build/test-classes" />
-
- <ivy:cachepath conf="build.test" pathid="ivy.dep.build.test" />
- <javac srcdir="src/test/java" destdir="build/test-classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpath="build/classes"
- classpathref="ivy.dep.build.test"
- bootclasspath="${boot.classpath.j2se1.6}"
- />
- <copy toDir="build/test-classes">
- <fileset dir="src/test/resources"
- excludes=""
- />
- </copy>
- </target>
-
- <target name="jar" depends="compile">
- <ivy:cachepath pathid="ivy.dep" conf="bnd" />
- <taskdef resource="aQute/bnd/ant/taskdef.properties"
- uri="http://www.aqute.biz/bnd"
- classpathref="ivy.dep"
- />
-
- <!-- Hack: This file should be excluded, but I can't explain that to bnd. -->
- <!-- We don't have this file in 2.4.X... yet?
- <move
- file="build/classes/freemarker/core/SecureRendererImpl.class"
- tofile="build/SecureRendererImpl.class.tmp"
- preservelastmodified="true" overwrite="true"
- />
- -->
- <bnd:bnd
- files="osgi.bnd" eclipse="false"
- output="build/freemarker.jar"
- />
- <!-- Revert previous hack... -->
- <!-- We don't have this file in 2.4.X... yet?
- <move
- file="build/SecureRendererImpl.class.tmp"
- tofile="build/classes/freemarker/core/SecureRendererImpl.class"
- preservelastmodified="true" overwrite="true"
- />
- -->
- </target>
-
- <!-- ================================================================= -->
- <!-- Testing -->
- <!-- ================================================================= -->
-
- <target name="test" depends="compileTest" description="Run test cases">
- <mkdir dir="build/junit-reports" />
- <ivy:cachepath conf="run.test" pathid="ivy.dep.run.test" />
- <junit haltonfailure="on" fork="true" forkmode="once">
- <classpath>
- <pathelement path="build/test-classes" />
- <pathelement path="build/classes" />
- <path refid="ivy.dep.run.test" />
- </classpath>
- <formatter type="plain" />
- <formatter type="xml" />
- <batchtest todir="build/junit-reports">
- <fileset dir="src/test/java">
- <include name="**/*Test.java" />
- <include name="**/*TestSuite.java" />
- <exclude name="**/Abstract*.java" />
- </fileset>
- </batchtest>
- </junit>
- </target>
-
- <!-- ================================================================= -->
- <!-- Generate docs -->
- <!-- ================================================================= -->
-
- <target depends="javacc" name="_rawJavadoc">
- <!-- depends="javacc" is needed as its output is referred in the docs. -->
- <mkdir dir="build/api" />
- <delete includeEmptyDirs="yes">
- <fileset dir="build/api" includes="**/*" />
- </delete>
- <!-- javadoc with <fileset> has bugs, so we create a filtered copy: -->
- <copy todir="build/javadoc-sources">
- <fileset dir="src/main/java">
- <exclude name="**/_*.java" />
- <exclude name="**/SunInternalXalanXPathSupport.java" />
- <!-- Remove classes that are, I suppose, only accidentally public: -->
- <exclude name="**/core/LocalContext.java" />
- <exclude name="**/core/CollectionAndSequence.java" />
- <exclude name="**/core/Comment.java" />
- <exclude name="**/core/DebugBreak.java" />
- <exclude name="**/core/Expression.java" />
- <exclude name="**/core/LibraryLoad.java" />
- <exclude name="**/core/Macro.java" />
- <exclude name="**/core/ReturnInstruction.java" />
- <exclude name="**/core/StringArraySequence.java" />
- <exclude name="**/core/TemplateElement.java" />
- <exclude name="**/core/TemplateObject.java" />
- <exclude name="**/core/TextBlock.java" />
- <exclude name="**/core/ReturnInstruction.java" />
- <exclude name="**/core/TokenMgrError.java" />
- <exclude name="**/template/EmptyMap.java" />
- <exclude name="**/log/SLF4JLoggerFactory.java" />
- <exclude name="**/log/CommonsLoggingLoggerFactory.java" />
- </fileset>
- </copy>
-
- <!-- conf="IDE": as that has to contain all depedencies -->
- <ivy:cachepath conf="IDE" pathid="ivy.dep" />
- <javadoc
- sourcepath="build/javadoc-sources"
- destdir="build/api"
- doctitle="FreeMarker ${version}"
- packagenames="
- freemarker.debug, freemarker.template.*,
- freemarker.core.*, freemarker.ext.*,
- freemarker.cache.*, freemarker.log.*"
- use="true"
- version="true"
- author="true"
- windowtitle="FreeMarker ${version} API"
- classpath="build/classes"
- classpathref="ivy.dep"
- failonerror="true"
- charset="UTF-8"
- docencoding="UTF-8"
- locale="en_US"
- >
- <link href="http://docs.oracle.com/javase/8/docs/api/"/>
- </javadoc>
- <delete dir="build/javadoc-sources" />
- </target>
-
- <target name="javadoc" depends="_rawJavadoc, _fixJDK8JavadocCSS" description="Build the JavaDocs" />
-
- <target name="_fixJDK8JavadocCSS" depends="_rawJavadoc" if="atLeastJDK8">
- <property name="file" value="build/api/stylesheet.css" />
-
- <available file="${file}" property="stylesheet.available"/>
- <fail unless="stylesheet.available">CSS file not found: ${file}</fail>
- <echo>Fixing JDK 8 CSS in ${file}</echo>
-
- <!-- Tell that it's modified: -->
- <replaceregexp
- file="${file}" flags="gs" encoding="utf-8"
- match="/\* (Javadoc style sheet) \*/" replace="/\* \1 - JDK 8 usability fix regexp substitutions applied \*/"
- />
-
- <!-- Remove broken link: -->
- <replaceregexp
- file="${file}" flags="gs" encoding="utf-8"
- match="@import url\('resources/fonts/dejavu.css'\);\s*" replace=""
- />
-
- <!-- Font family fixes: -->
- <replaceregexp
- file="${file}" flags="gsi" encoding="utf-8"
- match="['"]DejaVu Sans['"]" replace="Arial"
- />
- <replaceregexp
- file="${file}" flags="gsi" encoding="utf-8"
- match="['"]DejaVu Sans Mono['"]" replace="'Courier New'"
- />
- <replaceregexp
- file="${file}" flags="gsi" encoding="utf-8"
- match="['"]DejaVu Serif['"]" replace="Arial"
- />
- <replaceregexp
- file="${file}" flags="gsi" encoding="utf-8"
- match="(?<=[\s,:])serif\b" replace="sans-serif"
- />
- <replaceregexp
- file="${file}" flags="gsi" encoding="utf-8"
- match="(?<=[\s,:])Georgia,\s*" replace=""
- />
- <replaceregexp
- file="${file}" flags="gsi" encoding="utf-8"
- match="['"]Times New Roman['"],\s*" replace=""
- />
- <replaceregexp
- file="${file}" flags="gsi" encoding="utf-8"
- match="(?<=[\s,:])Times,\s*" replace=""
- />
- <replaceregexp
- file="${file}" flags="gsi" encoding="utf-8"
- match="(?<=[\s,:])Arial\s*,\s*Arial\b" replace="Arial"
- />
-
- <!-- "Parameters:", "Returns:", "Throws:", "Since:", "See also:" etc. fixes: -->
- <property name="ddSelectorStart" value="(?:\.contentContainer\s+\.(?:details|description)|\.serializedFormContainer)\s+dl\s+dd\b.*?\{[^\}]*\b" />
- <property name="ddPropertyEnd" value="\b.+?;" />
- <!-- - Put back description (dd) indentation: -->
- <replaceregexp
- file="${file}" flags="gs" encoding="utf-8"
- match="(${ddSelectorStart})margin${ddPropertyEnd}" replace="\1margin: 5px 0 10px 20px;"
- />
- <!-- - No monospace font for the description (dd) part: -->
- <replaceregexp
- file="${file}" flags="gs" encoding="utf-8"
- match="(${ddSelectorStart})font-family${ddPropertyEnd}" replace="\1"
- />
- </target>
-
- <!-- ====================== -->
- <!-- Manual -->
- <!-- ====================== -->
-
- <macrodef name="manual" uri="http://freemarker.org/util">
- <attribute name="offline" />
- <attribute name="locale" />
- <sequential>
- <ivy:cachepath conf="manual" pathid="ivy.dep" />
- <taskdef resource="org/freemarker/docgen/antlib.properties"
- uri="http://freemarker.org/docgen"
- classpathref="ivy.dep"
- />
-
- <docgen:transform
- srcdir="src/manual/@{locale}" destdir="build/manual/@{locale}"
- offline="@{offline}"
- />
- </sequential>
- </macrodef>
-
- <target name="manualOffline" depends="init" description="Build the Manual for offline use" >
- <u:manual offline="true" locale="en_US" />
- </target>
-
- <target name="manualFreemarkerOrg" depends="init" description="Build the Manual to be upload to freemarker.org" >
- <u:manual offline="false" locale="en_US" />
- </target>
-
- <target name="manualOffline_zh_CN" depends="init" description="Build the Manual for offline use" >
- <u:manual offline="true" locale="zh_CN" />
- </target>
-
- <target name="manualFreemarkerOrg_zh_CN" depends="init" description="Build the Manual to be upload to freemarker.org" >
- <u:manual offline="false" locale="zh_CN" />
- </target>
-
-
- <!-- ====================== -->
- <!-- Distributuion building -->
- <!-- ====================== -->
-
- <target name="dist"
- description="Build the FreeMarker distribution files"
- >
- <fail
- unless="has.all.explicit.boot.classpaths"
- message="All boot.classpath properties must be set in build.properties for dist!"
- />
- <fail unless="atLeastJDK8" message="The release should be built with JDK 8+ (you may need to set JAVA_HOME)" />
- <antcall target="clean" /> <!-- To improve the reliability -->
- <antcall target="_dist" />
- </target>
-
- <target name="_dist"
- depends="jar, javadoc, manualOffline"
- >
- <delete dir="${dist.dir}" />
-
- <!-- ..................................... -->
- <!-- Binary distribution -->
- <!-- ..................................... -->
-
- <mkdir dir="${dist.bin.dir}" />
-
- <!-- Copy txt-s -->
- <copy todir="${dist.bin.dir}" includeEmptyDirs="no">
- <fileset dir="." defaultexcludes="no">
- <include name="README" />
- <include name="LICENSE" />
- <!-- NOTICE is binary-distribution-specific, and is copied later. -->
- <include name="DISCLAIMER" />
- <include name="RELEASE-NOTES" />
- </fileset>
- </copy>
- <replace
- file="${dist.bin.dir}/README"
- token="{version}"
- value="${version}"
- />
- <!-- Copy binary-distribution-specific files: -->
- <copy todir="${dist.bin.dir}/">
- <fileset dir="src/dist/bin/" />
- </copy>
-
- <!-- Copy binary -->
- <copy file="build/freemarker.jar" tofile="${dist.bin.dir}/freemarker.jar" />
-
- <!-- Copy documentation -->
- <mkdir dir="${dist.bin.dir}/documentation" />
-
- <!--
- The US English Manual is the source of any translations and thus it's the
- only one that is guaranteed to be up to date when doing the release, so we
- only pack that into it.
- -->
- <copy todir="${dist.bin.dir}/documentation/_html" includeEmptyDirs="no">
- <fileset dir="build/manual/en_US" />
- </copy>
- <copy todir="${dist.bin.dir}/documentation/_html/api" includeEmptyDirs="no">
- <fileset dir="build/api" />
- </copy>
-
- <u:packageAndSignDist
- srcDir="${dist.bin.dir}/.."
- archiveNameWithoutExt="${dist.archiveBaseName}-bin"
- />
-
- <!-- ..................................... -->
- <!-- Source distribution -->
- <!-- ..................................... -->
-
- <mkdir dir="${dist.src.dir}" />
-
- <!-- Copy txt-s -->
- <copy todir="${dist.src.dir}" includeEmptyDirs="no">
- <fileset dir="." defaultexcludes="no">
- <include name="README" />
- <include name="LICENSE" />
- <include name="NOTICE" />
- <include name="DISCLAIMER" />
- <include name="RELEASE-NOTES" />
- </fileset>
- </copy>
- <replace
- file="${dist.src.dir}/README"
- token="{version}"
- value="${version}"
- />
-
- <copy todir="${dist.src.dir}" includeEmptyDirs="no">
- <fileset dir="." defaultexcludes="no">
- <exclude name="**/*.bak" />
- <exclude name="**/*.~*" />
- <exclude name="**/*.*~" />
- <include name="src/**" />
- <include name="examples/**" />
- <include name=".settings/**" />
- <include name="*.xml" />
- <include name="*.sample" />
- <include name="*.txt" />
- <include name="osgi.bnd" />
- <include name=".classpath" />
- <include name=".project" />
- <include name=".git*" />
- </fileset>
- </copy>
-
- <u:packageAndSignDist
- srcDir="${dist.src.dir}/.."
- archiveNameWithoutExt="${dist.archiveBaseName}-src"
- />
- </target>
-
- <macrodef name="packageAndSignDist" uri="http://freemarker.org/util">
- <attribute name="srcDir" />
- <attribute name="archiveNameWithoutExt" />
- <sequential>
- <local name="archive.tar"/>
- <property name="archive.tar" value="build/dist/@{archiveNameWithoutExt}.tar" />
- <local name="archive.gzip"/>
- <property name="archive.gzip" value="${archive.tar}.gz" />
- <delete file="${archive.tar}" />
- <tar tarfile="${archive.tar}" basedir="@{srcDir}" />
- <delete file="${archive.gzip}" />
- <gzip zipfile="${archive.gzip}" src="${archive.tar}" />
- <delete file="${archive.tar}" />
-
- <echo>Signing "${archive.gzip}"...</echo>
- <!-- gpg may hang if it exists: -->
- <delete file="${archive.gzip}.asc" />
- <exec executable="${gpgCommand}" failonerror="true">
- <arg value="--armor" />
- <arg value="--output" />
- <arg value="${archive.gzip}.asc" />
- <arg value="--detach-sig" />
- <arg value="${archive.gzip}" />
- </exec>
-
- <echo>*** Signature verification: ***</echo>
- <exec executable="${gpgCommand}" failonerror="true">
- <arg value="--verify" />
- <arg value="${archive.gzip}.asc" />
- <arg value="${archive.gzip}" />
- </exec>
- <local name="signatureGood" />
- <local name="signatureGood.y" />
- <input
- validargs="y,n"
- addproperty="signatureGood"
- >Is the above signer the intended one for Apache releases?</input>
- <condition property="signatureGood.y">
- <equals arg1="y" arg2="${signatureGood}"/>
- </condition>
- <fail unless="signatureGood.y" message="Task aborted by user." />
-
- <echo>Creating checksum files for "${archive.gzip}"...</echo>
- <checksum file="${archive.gzip}" fileext=".md5" algorithm="MD5" forceOverwrite="yes" />
- <checksum file="${archive.gzip}" fileext=".sha512" algorithm="SHA-512" forceOverwrite="yes" />
- </sequential>
- </macrodef>
-
- <target name="maven-pom">
- <echo file="build/pom.xml"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache</groupId>
- <artifactId>apache</artifactId>
- <version>17</version>
- </parent>
-
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- <version>${mavenVersion}</version>
-
- <packaging>jar</packaging>
-
- <name>Apache FreeMarker</name>
- <description>
- Google App Engine compliant variation of FreeMarker.
- FreeMarker is a "template engine"; a generic tool to generate text output based on templates.
- </description>
- <url>http://freemarker.org/</url>
- <organization>
- <name>Apache Software Foundation</name>
- <url>http://apache.org</url>
- </organization>
-
- <licenses>
- <license>
- <name>Apache License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-freemarker.git</connection>
- <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-freemarker.git</developerConnection>
- <url>https://git-wip-us.apache.org/repos/asf?p=incubator-freemarker.git</url>
- <tag>v${version}</tag>
- </scm>
-
- <issueManagement>
- <system>jira</system>
- <url>https://issues.apache.org/jira/browse/FREEMARKER/</url>
- </issueManagement>
-
- <mailingLists>
- <mailingList>
- <name>FreeMarker developer list</name>
- <post>dev@freemarker.incubator.apache.org</post>
- <subscribe>dev-subscribe@freemarker.incubator.apache.org</subscribe>
- <unsubscribe>dev-unsubscribe@freemarker.incubator.apache.org</unsubscribe>
- <archive>http://mail-archives.apache.org/mod_mbox/incubator-freemarker-dev/</archive>
- </mailingList>
- <mailingList>
- <name>FreeMarker commit and Jira notifications list</name>
- <post>notifications@freemarker.incubator.apache.org</post>
- <subscribe>notifications-subscribe@freemarker.incubator.apache.org</subscribe>
- <unsubscribe>notifications-unsubscribe@freemarker.incubator.apache.org</unsubscribe>
- <archive>http://mail-archives.apache.org/mod_mbox/incubator-freemarker-notifications/</archive>
- </mailingList>
- <mailingList>
- <name>FreeMarker management private</name>
- <post>private@freemarker.incubator.apache.org</post>
- </mailingList>
- </mailingLists>
-
- <dependencies>
- <!-- no required dependencies -->
- </dependencies>
-</project>
-]]></echo>
- </target>
-
- <!--
- Uploads the freemarker.jar that is in the current DISTRIBUTION DIRECTORY
- to a Maven repository (snapshot or central).
- Use this after "dist" (without interleaving "clean").
- -->
- <target name="maven-dist" depends="maven-pom"
- description="Releases the already built distro to a Maven repository">
- <jar destfile="build/maven-source-attachment.jar">
- <fileset dir="${dist.src.dir}/src/main/java" />
- <fileset dir="${dist.src.dir}/src/main/resources" />
- <metainf dir="${dist.src.dir}" includes="LICENSE, NOTICE, DISCLAIMER" />
- </jar>
-
- <jar destfile="build/maven-javadoc-attachment.jar">
- <fileset dir="${dist.bin.dir}/documentation/_html/api" />
- <metainf dir="${dist.bin.dir}" includes="LICENSE, DISCLAIMER" />
- </jar>
-
- <!-- These were copy-pasted from the org.apacha:apache parent POM: -->
- <property name="maven-server-id" value="apache.releases.https" />
- <property name="maven-repository-url" value="https://repository.apache.org/service/local/staging/deploy/maven2" />
- <!--
- Don't deploy to public snapshot repositories here!
- It isn't backward compatible as version ranges will pick them up.
- -->
- <input
- validargs="y,n"
- addproperty="mavenUpload.answer"
- >
-You are about uploading
-${dist.bin.dir}/freemarker.jar
-and its attachments to this Maven repository:
-${maven-repository-url}
-with Maven artifact version number ${mavenVersion}.
-Note that it's assumed that you have run `ant dist` just before this.
-Proceed? </input>
- <condition property="mavenUpload.yes">
- <equals arg1="y" arg2="${mavenUpload.answer}"/>
- </condition>
- <fail unless="mavenUpload.yes" message="Task aborted by user." />
-
- <!-- Sign and deploy the main artifact -->
- <exec executable="${mvnCommand}" failonerror="true">
- <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
- <!--
- As we use the gpg plugin instead of a normal Maven "deploy", sadly we can't just
- inherit the repo URL and repositoryId from the parent POM.
- -->
- <arg value="-Durl=${maven-repository-url}" />
- <arg value="-DrepositoryId=${maven-server-id}" />
- <arg value="-DpomFile=build/pom.xml" />
- <arg value="-Dfile=${dist.bin.dir}/freemarker.jar" />
- <arg value="-Pgpg" />
- </exec>
-
- <!-- Sign and deploy the sources artifact -->
- <exec executable="${mvnCommand}" failonerror="true">
- <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
- <arg value="-Durl=${maven-repository-url}" />
- <arg value="-DrepositoryId=${maven-server-id}" />
- <arg value="-DpomFile=build/pom.xml" />
- <arg value="-Dfile=build/maven-source-attachment.jar" />
- <arg value="-Dclassifier=sources" />
- <arg value="-Pgpg" />
- </exec>
-
- <!-- Sign and deploy the javadoc artifact -->
- <exec executable="${mvnCommand}" failonerror="true">
- <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
- <arg value="-Durl=${maven-repository-url}" />
- <arg value="-DrepositoryId=${maven-server-id}" />
- <arg value="-DpomFile=build/pom.xml" />
- <arg value="-Dfile=build/maven-javadoc-attachment.jar" />
- <arg value="-Dclassifier=javadoc" />
- <arg value="-Pgpg" />
- </exec>
-
- <echo>*****************************************************************</echo>
- <echo>Check the above lines for any Maven errors!</echo>
- <echo>Now you need to close and maybe release the staged repo on</echo>
- <echo>http://repository.apache.org.</echo>
- <echo>Note that before releasing, voting is needed!</echo>
- <echo>*****************************************************************</echo>
- </target>
-
-
- <!-- ================================================================== -->
- <!-- Dependency management (keep it exactly identical for all projects) -->
- <!-- ================================================================== -->
-
- <target name="_autoget-deps" unless="deps.available">
- <antcall target="update-deps" />
- </target>
-
- <target name="update-deps"
- description="Gets the latest version of the dependencies from the Web"
- >
- <echo>Getting dependencies...</echo>
- <echo>-------------------------------------------------------</echo>
- <ivy:settings id="remote" url="http://freemarker.org/repos/ivy/ivysettings-remote.xml" />
- <!-- Build an own repository that will serve us even offline: -->
- <ivy:retrieve settingsRef="remote" sync="true"
- ivypattern=".ivy.part/repo/[organisation]/[module]/ivy-[revision].xml"
- pattern=".ivy.part/repo/[organisation]/[module]/[artifact]-[revision].[ext]"
- />
- <echo>-------------------------------------------------------</echo>
- <echo>*** Successfully acquired dependencies from the Web ***</echo>
- <echo>Eclipse users: Now right-click on ivy.xml and Resolve! </echo>
- <echo>-------------------------------------------------------</echo>
- <!-- Only now that we got all the dependencies will we delete anything. -->
- <!-- Thus a net or repo outage doesn't left us without the dependencies. -->
-
- <!-- Save the resolution cache from the soon coming <delete>: -->
- <move todir=".ivy.part/update-deps-reso-cache">
- <fileset dir=".ivy/update-deps-reso-cache" />
- </move>
- <!-- Drop all the old stuff: -->
- <delete dir=".ivy" />
- <!-- And use the new stuff instead: -->
- <move todir=".ivy">
- <fileset dir=".ivy.part" />
- </move>
- </target>
-
- <!-- Do NOT call this from 'clean'; offline guys would stuck after that. -->
- <target name="clean-deps"
- description="Deletes all dependencies"
- >
- <delete dir=".ivy" />
- </target>
-
- <target name="publish-override" depends="jar"
- description="Ivy-publishes THIS project locally as an override"
- >
- <ivy:resolve />
- <ivy:publish
- pubrevision="${moduleBranch}-branch-head"
- artifactspattern="build/[artifact].[ext]"
- overwrite="true" forcedeliver="true"
- resolver="freemarker-devel-local-override"
- >
- <artifact name="freemarker" type="jar" ext="jar" />
- </ivy:publish>
- <delete file="build/ivy.xml" /> <!-- ivy:publish makes this -->
- <echo>-------------------------------------------------------</echo>
- <echo>*** Don't forget to `ant unpublish-override` later! ***</echo>
- </target>
-
- <target name="unpublish-override"
- description="Undoes publish-override (made in THIS project)"
- >
- <delete dir="${user.home}/.ivy2/freemarker-devel-local-override/${moduleOrg}/${moduleName}" />
- <delete dir="${user.home}/.ivy2/freemarker-devel-local-override-cache/${moduleOrg}/${moduleName}" />
- </target>
-
- <target name="unpublish-override-all"
- description="Undoes publish-override-s made in ALL projects"
- >
- <delete dir="${user.home}/.ivy2/freemarker-devel-local-override" />
- <delete dir="${user.home}/.ivy2/freemarker-devel-local-override-cache" />
- </target>
-
- <target name="uninstall"
- description="Deletes external files created by FreeMarker developement"
- >
- <delete dir="${user.home}/.ivy2/freemarker-devel-cache" />
- <delete dir="${user.home}/.ivy2/freemarker-devel-local-override" />
- <delete dir="${user.home}/.ivy2/freemarker-devel-local-override-cache " />
- </target>
-
- <target name="report-deps"
- description="Creates a HTML document that summarizes the dependencies."
- >
- <mkdir dir="build/deps-report" />
- <ivy:resolve />
- <ivy:report todir="build/deps-report" />
- </target>
-
- <target name="ide-dependencies" description="If your IDE has no Ivy support, this generates ide-lib/*.jar for it">
- <mkdir dir="ide-dependencies" />
- <delete includeEmptyDirs="true">
- <fileset dir="ide-dependencies">
- <include name="*/**" />
- </fileset>
- </delete>
- <ivy:retrieve conf="IDE" pattern="ide-dependencies/[artifact]-[revision].[ext]" />
- </target>
-
- <!--
- This meant to be called on the Continuous Integration server, so the
- integration builds appear in the freemarker.org public Ivy repository.
- The artifacts must be already built.
- -->
- <target name="server-publish-last-build"
- description="(For the Continuous Integration server only)"
- >
- <delete dir="build/dummy-server-ivy-repo" />
- <ivy:resolve />
- <ivy:publish
- pubrevision="${moduleBranch}-branch-head"
- artifactspattern="build/[artifact].[ext]"
- overwrite="true" forcedeliver="true"
- resolver="server-publishing-target"
- >
- <artifact name="freemarker" type="jar" ext="jar" />
- </ivy:publish>
- <delete file="build/ivy.xml" /> <!-- ivy:publish makes this -->
- </target>
-
- <target name="rat">
- <ivy:cachepath conf="rat" pathid="ivy.dep" />
- <taskdef
- uri="antlib:org.apache.rat.anttasks"
- resource="org/apache/rat/anttasks/antlib.xml"
- classpathref="ivy.dep"
- />
-
- <rat:report reportFile="build/rat-report-src.txt">
- <fileset dir="src"/>
- </rat:report>
- <rat:report reportFile="build/rat-report-dist-src.txt">
- <fileset dir="build/dist/src"/>
- </rat:report>
- <rat:report reportFile="build/rat-report-dist-bin.txt">
- <fileset dir="build/dist/bin"/>
- </rat:report>
- <echo level="info"><!--
- -->Rat reports were written into build/rat-report-*.txt<!--
- --></echo>
- </target>
-
- <target name="archive" depends=""
- description='Archives project with Git repo into the "archive" directory.'
- >
- <mkdir dir="archive" />
- <tstamp>
- <format property="tstamp" pattern="yyyyMMdd-HHmm" />
- </tstamp>
- <delete file="archive/freemarker-git-${tstamp}.tar" />
- <delete file="archive/freemarker-git-${tstamp}.tar.bz2" />
- <tar tarfile="archive/freemarker-git-${tstamp}.tar"
- basedir="."
- longfile="gnu"
- excludes="build/** .build/** .bin/** .ivy/** archive/**"
- />
- <bzip2 src="archive/freemarker-git-${tstamp}.tar"
- zipfile="archive/freemarker-git-${tstamp}.tar.bz2" />
- <delete file="archive/freemarker-git-${tstamp}.tar" />
- </target>
-
-</project>
diff --git a/codestyle.xml b/codestyle.xml
deleted file mode 100644
index 8fe15f0..0000000
--- a/codestyle.xml
+++ /dev/null
@@ -1,313 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- 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.
--->
-<profiles version="12">
-<profile kind="CodeFormatterProfile" name="FreeMarker" version="12">
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
-<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="8"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
-<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="true"/>
-</profile>
-</profiles>
diff --git a/ivy.xml b/ivy.xml
deleted file mode 100644
index 5aaf379..0000000
--- a/ivy.xml
+++ /dev/null
@@ -1,194 +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.
--->
-
-<!--
- AFTER CHANGING THIS FILE don't forget to issue: ant update-deps
--->
-<!DOCTYPE ivy-module [
- <!ENTITY jetty.version "7.6.16.v20140903">
- <!ENTITY slf4j.version "1.6.1">
- <!ENTITY spring.version "2.5.6.SEC03">
-]>
-<ivy-module version="2.0">
- <info organisation="org.freemarker" module="freemarker">
- <license name="Apache License, Version 2.0" url="http://freemarker.org/docs/app_license.html" />
- <description homepage="http://freemarker.org/">
- FreeMarker is a "template engine"; a generic tool to
- generate text output (anything from HTML to autogenerated source
- code) based on templates.
- </description>
- </info>
- <configurations>
- <conf name="default" extends="runtime" />
-
- <conf name="runtime"
- description="for using FreeMarker under J2SE 1.4+ (no optional dependencies included)"
- />
-
- <conf name="build.base" extends="default" visibility="private"
- description="for building FreeMarker without dependencies that optinal dependencies"
- />
-
- <conf name="build.jsp2.0" extends="build.base"
- description="for building FreeMarker with JSP 2.0 support"
- />
- <conf name="build.jsp2.1" extends="build.base"
- description="for building FreeMarker with JSP 2.1 support"
- />
-
- <conf name="build.jython2.0" extends="build.base"
- description="for building FreeMarker with Jython 2.0 support"
- />
- <conf name="build.jython2.2" extends="build.base"
- description="for building FreeMarker with Jython 2.2 support"
- />
- <conf name="build.jython2.5" extends="build.base"
- description="for building FreeMarker with Jython 2.5 support"
- />
-
- <conf name="test" extends="build.jython2.5"
- description="commons for both building and running the FreeMarker test suite"
- />
- <conf name="build.test" extends="test"
- description="for building FreeMarker test suite"
- />
- <conf name="run.test" extends="test"
- description="for running FreeMarker test suite"
- />
-
- <conf name="IDE" extends="build.test"
- description="to be used in IDE-s (maybe with the Ivy plugin)"
- />
-
- <conf name="retrotranslate" description="for retro-translation" />
-
- <conf name="parser" extends="default" description="for generating parser" />
-
- <conf name="manual" description="for generating the manual with Docgen" />
-
- <conf name="rat" description="for generating the Rat report" />
-
- <conf name="bnd" description="for creating OSGi bundle" />
-
- <conf name="example.servlet" description="servlet-based examples" />
- <conf name="example.webapp1" extends="example.servlet" />
- <conf name="example.webapp2" extends="example.servlet" />
- <conf name="example.struts-webapp" extends="example.servlet" />
- <conf name="example.ant" />
- </configurations>
- <publications>
- <artifact name="freemarker" type="jar" conf="runtime" ext="jar" />
- </publications>
- <dependencies>
- <!-- build -->
-
- <dependency org="jaxen" name="jaxen" rev="1.0-FCS" conf="build.base->default" />
- <dependency org="saxpath" name="saxpath" rev="1.0-FCS" conf="build.base->default" />
- <dependency org="xalan" name="xalan" rev="2.7.0" conf="build.base->default">
- <!-- The lowerst supported xml-apis version depends on JDK version; prevent any collosion: -->
- <exclude org="xml-apis" module="xml-apis" />
- </dependency>
- <dependency org="dom4j" name="dom4j" rev="1.3" conf="build.base->default" /> <!-- legacy -->
- <dependency org="jdom" name="jdom" rev="1.0b8" conf="build.base->default" /> <!-- legacy -->
-
- <dependency org="ant" name="ant" rev="1.6.5" conf="build.base->default">
- <!-- The lowerst supported xml-apis version depends on JDK version; prevent any collosion: -->
- <exclude org="xml-apis" module="xml-apis" />
- </dependency>
-
- <dependency org="javax.servlet.jsp" name="jsp-api" rev="2.0" conf="build.jsp2.0->default; example.struts-webapp->default" />
- <dependency org="javax.servlet" name="servlet-api" rev="2.4" conf="build.jsp2.0->default; example.servlet->default" />
- <dependency org="javax.servlet.jsp" name="jsp-api" rev="2.1" conf="build.jsp2.1->default" />
- <dependency org="javax.servlet" name="servlet-api" rev="2.5" conf="build.jsp2.1->default" />
-
- <dependency org="rhino" name="js" rev="1.6R1" conf="build.base->default" />
-
- <!-- We use Jython 2.1 because there was no 2.0 in central; the relevant methods are the same. -->
- <dependency org="jython" name="jython" rev="2.1" conf="build.jython2.0->default" />
- <dependency org="org.python" name="jython" rev="2.2.1" conf="build.jython2.2->default" />
- <dependency org="org.python" name="jython" rev="2.5.0" conf="build.jython2.5->default" />
-
- <dependency org="avalon-logkit" name="avalon-logkit" rev="2.0" conf="build.base->default" />
- <dependency org="org.slf4j" name="slf4j-api" rev="&slf4j.version;" conf="build.base->default" />
- <dependency org="org.slf4j" name="log4j-over-slf4j" rev="&slf4j.version;" conf="build.base->default" />
- <dependency org="org.slf4j" name="jcl-over-slf4j" rev="&slf4j.version;" conf="build.base->default" />
- <dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="build.base->default" />
-
- <dependency org="org.zeroturnaround" name="javarebel-sdk" rev="1.2.2" conf="build.base->default" />
-
- <dependency org="com.google.code.findbugs" name="annotations" rev="3.0.0" conf="build.base->default" />
-
- <!--dependency org="javax.script" name="script-api" rev="1.0" conf="build.base->default" /-->
- <!--dependency org="org.visigoths" name="cavalry" rev="1.0" conf="build.base->default" /-->
-
- <!-- test -->
-
- <!-- Note: Ant doesn't contain junit.jar any more -->
- <dependency org="junit" name="junit" rev="4.12" conf="test->default" />
- <dependency org="org.hamcrest" name="hamcrest-library" rev="1.3" conf="test->default" />
-
- <dependency org="ch.qos.logback" name="logback-classic" rev="1.1.2" conf="test->default" />
-
- <dependency org="commons-io" name="commons-io" rev="2.2" conf="test->default" />
- <dependency org="com.google.guava" name="guava-jdk5" rev="17.0" conf="test->default" />
-
- <dependency org="org.eclipse.jetty" name="jetty-server" rev="&jetty.version;" conf="test->default" />
- <dependency org="org.eclipse.jetty" name="jetty-webapp" rev="&jetty.version;" conf="test->default" />
- <dependency org="org.eclipse.jetty" name="jetty-jsp" rev="&jetty.version;" conf="test->default" />
- <dependency org="org.eclipse.jetty" name="jetty-util" rev="&jetty.version;" conf="test->default" />
-
- <dependency org="displaytag" name="displaytag" rev="1.2" conf="test->default">
- <exclude org="com.lowagie" name="itext" />
- <exclude org="org.slf4j" name="slf4j-log4j12" />
- <exclude org="org.slf4j" name="jcl104-over-slf4j" />
- <exclude org="log4j" name="log4j" />
- </dependency>
-
- <dependency org="org.springframework" name="spring-core" rev="&spring.version;" conf="test->default">
- <exclude org="commons-logging" name="commons-logging" />
- </dependency>
- <dependency org="org.springframework" name="spring-test" rev="&spring.version;" conf="test->default">
- <exclude org="commons-logging" name="commons-logging" />
- </dependency>
-
- <!-- docs -->
-
- <dependency org="org.freemarker" name="docgen" rev="2.0-branch-head" conf="manual->default" changing="true" />
-
- <!-- parser -->
-
- <dependency org="net.java.dev.javacc" name="javacc" rev="6.1.2" conf="parser->default" />
-
- <!-- bnd -->
-
- <dependency org="biz.aQute" name="bnd" rev="1.50.0" conf="bnd->default" />
-
- <!-- Rat -->
-
- <dependency org="org.apache.rat" name="apache-rat-tasks" rev="0.11" conf="rat->default" />
-
- <!-- As the tests *run* on Ant, so it's a provided dependency there. -->
- <exclude org="ant" module="ant" conf="run.test" />
-
- <!-- Ensure that JSP versions don't accidentally hide each-other -->
-
- <conflict org="javax.servlet.jsp" module="jsp-api" manager="strict" />
-
- </dependencies>
-</ivy-module>
\ No newline at end of file
diff --git a/ivysettings.xml b/ivysettings.xml
deleted file mode 100644
index 3369274..0000000
--- a/ivysettings.xml
+++ /dev/null
@@ -1,54 +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.
--->
-
-<ivysettings>
- <!-- Prevent IvyDE error: -->
- <property name="server.ivy.repo.root" value="${ivy.project.dir}/NOT_SET" override="false" />
-
- <caches defaultCacheDir="${ivy.project.dir}/.ivy/cache">
- <cache name="cacheForPrivate" useOrigin="true" defaultTTL="1s" />
-
- <!--
- Rather don't use useOrigin="true" here, as deleting from the target repo breaks the cache then.
- -->
- <cache name="cacheForLocalOverride"
- basedir="${user.home}/.ivy2/freemarker-devel-local-override-cache"
- defaultTTL="1s" lockStrategy="artifact-lock"
- />
- </caches>
- <resolvers>
- <chain name="freemarker-devel-local" returnFirst="true">
- <filesystem name="freemarker-devel-local-override" cache="cacheForLocalOverride">
- <ivy pattern="${user.home}/.ivy2/freemarker-devel-local-override/[organisation]/[module]/ivy-[revision].xml" />
- <artifact pattern="${user.home}/.ivy2/freemarker-devel-local-override/[organisation]/[module]/[artifact]-[revision].[ext]" />
- </filesystem>
- <filesystem name="project-private" cache="cacheForPrivate">
- <ivy pattern="${ivy.project.dir}/.ivy/repo/[organisation]/[module]/ivy-[revision].xml" />
- <artifact pattern="${ivy.project.dir}/.ivy/repo/[organisation]/[module]/[artifact]-[revision].[ext]" />
- </filesystem>
- </chain>
- <filesystem name="server-publishing-target">
- <ivy pattern="${server.ivy.repo.root}/[organisation]/[module]/ivy-[revision].xml" />
- <artifact pattern="${server.ivy.repo.root}/[organisation]/[module]/[artifact]-[revision].[ext]" />
- </filesystem>
- </resolvers>
- <modules>
- <module organisation="*" resolver="freemarker-devel-local" />
- </modules>
-</ivysettings>
diff --git a/osgi.bnd b/osgi.bnd
deleted file mode 100644
index 412055e..0000000
--- a/osgi.bnd
+++ /dev/null
@@ -1,64 +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.
-
-# This file is used for creating OSGi bundles with biz.aQute.bnd
-#
-# bnd is a tool that automatically discovers the possible exports and
-# imports by examining the class files, and generates the OSGi meta-info
-# based on that and this file.
-
--classpath: build/classes
--failok: false
-
-Bundle-SymbolicName: ${moduleOrg}.${moduleName}
-Bundle-Version: ${versionForOSGi}
-Bundle-License: Apache License, Version 2.0; see: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Vendor: freemarker.org
-
-Include-Resource: META-INF=build/classes/META-INF
-
-Export-Package: !freemarker.test.*, freemarker.*;version="${versionForOSGi}"
-# Important:
-# Packages that don't match nor the Export-Package nor the
-# Private-Package mainfest header will be excluded from
-# the .jar file!
-
-Import-Package: !freemarker.*, *;resolution:="optional"
-# The above makes all imports optional (like org.python, etc.),
-# except those that were explicitly listed (or are inside java.*).
-# Thus, even when the Java platfrom includes a package, it won't
-# be automatically imported, unless bnd generates the import statement
-# for them. Thus, when J2SE-1.5 becomes a requirement, these should be
-# added to the above list, as then they won't be optional anymore:
-# javax.xml.*, org.w3c.dom.*, org.xml.sax.*.
-
-# This is needed for "a.class.from.another.Bundle"?new() to work.
-DynamicImport-Package: *
-
-# Use "J2SE-<utilized-version>, J2SE-<minimum-version>" (i.e., highest to lowest).
-# See also: http://wiki.eclipse.org/Execution_Environments, "Compiling
-# against more than is required"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
-# Non-OSGi meta:
-Extension-name: FreeMarker
-Specification-Title: FreeMarker
-Specification-Version: ${versionForMf}
-Specification-Vendor: freemarker.org
-Implementation-Title: FreeMarker
-Implementation-Version: ${versionForMf}
-Implementation-Vendor: freemarker.org
diff --git a/src/dist/bin/NOTICE b/src/dist/bin/NOTICE
deleted file mode 100644
index 2c2cece..0000000
--- a/src/dist/bin/NOTICE
+++ /dev/null
@@ -1,56 +0,0 @@
-=========================================================================
-
-Apache FreeMarker
-Copyright 2015-2016 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-=========================================================================
-
-The documentation includes icons from Entypo pictograms, version 2.0,
-by Daniel Bruce (http://www.entypo.com/, http://www.danielbruce.se/),
-licensed under Creative Commons Attribution-ShareAlike 3.0 (CC BY-SA 3.0)
-(http://creativecommons.org/licenses/by-sa/3.0/legalcode) and under SIL
-Open Font License 1.1 (http://scripts.sil.org/OFL).
-
-=========================================================================
-
-The documentation includes icons from Font Awesome by Dave Gandy
-(http://fontawesome.io), licensed under SIL Open Font License 1.1
-(http://scripts.sil.org/OFL).
-
-=========================================================================
-
-The documentation includes icons from Material Design icons by Google
-(http://google.github.io/material-design-icons/), licensed under
-Creative Common Attribution 4.0 International License (CC-BY 4.0)
-(https://creativecommons.org/licenses/by/4.0/).
-
-=========================================================================
-
-FreeMarker, both in its source code and binary form (freemarker.jar)
-includes files that were developed outside the FreeMarker project, and
-are licensed by the Apache Software Foundation under the Apache License,
-Version 2.0. This is the same license as the license of FreeMaker. These
-files are:
-
- src/main/freemarker/ext/jsp/web-app_2_2.dtd
- src/main/freemarker/ext/jsp/web-app_2_3.dtd
- src/main/freemarker/ext/jsp/web-jsptaglibrary_1_1.dtd
- src/main/freemarker/ext/jsp/web-jsptaglibrary_1_2.dtd
-
-=========================================================================
-
-The FreeMarker source code contains the following binaries, which were
-produced by the FreeMarker project itself, and are hence covered by the
-license of the FreeMarker project:
-
- src/main/misc/overloadedNumberRules/prices.ods
- src/manual/en_US/docgen-originals/figures/overview.odg
- src/test/resources/freemarker/ext/jsp/webapps/config/WEB-INF/lib/WebappLocalFreemarkerServlet.jar
- src/test/resources/freemarker/ext/jsp/webapps/config/WEB-INF/lib/templates.jar
- src/test/resources/freemarker/ext/jsp/webapps/tldDiscovery/WEB-INF/lib/taglib-foo.jar
- src/test/resources/freemarker/ext/jsp/webapps/tldDiscovery/WEB-INF/taglib 2.jar
-
-=========================================================================
diff --git a/src/dist/bin/documentation/index.html b/src/dist/bin/documentation/index.html
deleted file mode 100644
index 5e31bc4..0000000
--- a/src/dist/bin/documentation/index.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
- 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.
--->
-
-<html lang="hu">
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta http-equiv="Content-Script-Type" content="text/javascript">
- <title>FreeMarker Documention</title>
- <style type="text/css">
- body {
- background: #FFF;
- padding: 2em;
- color: #000000;
- font-family: Arial,sans-serif;
- font-size: 16px;
- }
- h1 {
- font-size: 166%;
- margin-top: 1.5em;
- margin-bottom: 0.75em;
- color: #0050B2;
- font-family: Arial,sans-serif;
- font-weight: bold;
- }
- .top {
- margin-top: 0;
- }
- a:link,
- a:visited,
- a:hover,
- a:active {
- color:#00C;
- text-decoration: none;
- }
- </style>
-</head>
-
-<body>
- <p class="top">Offline FreeMarker Documentation:</p>
- <ul>
- <li><a href="_html/index.html">Manual</a></li>
- <li><a href="_html/api/index.html">Java API</a></li>
- </ul>
-
- <p><a href="http://freemarker.org/">Visit the FreeMarker home page</a> (help, editor plugins, latest downloads, etc.)</p>
-
- <p><i>Disclaimer: Apache FreeMarker is an effort undergoing incubation at The Apache Software Foundation (ASF). Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet t [...]
-</body>
-</html>
\ No newline at end of file
diff --git a/src/main/java/freemarker/cache/AndMatcher.java b/src/main/java/freemarker/cache/AndMatcher.java
deleted file mode 100644
index 7cf9082..0000000
--- a/src/main/java/freemarker/cache/AndMatcher.java
+++ /dev/null
@@ -1,45 +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 freemarker.cache;
-
-import java.io.IOException;
-
-/**
- * Logical "and" operation among the given matchers.
- *
- * @since 2.3.24
- */
-public class AndMatcher extends TemplateSourceMatcher {
-
- private final TemplateSourceMatcher[] matchers;
-
- public AndMatcher(TemplateSourceMatcher... matchers) {
- if (matchers.length == 0) throw new IllegalArgumentException("Need at least 1 matcher, had 0.");
- this.matchers = matchers;
- }
-
- @Override
- public boolean matches(String sourceName, Object templateSource) throws IOException {
- for (TemplateSourceMatcher matcher : matchers) {
- if (!(matcher.matches(sourceName, templateSource))) return false;
- }
- return true;
- }
-
-}
diff --git a/src/main/java/freemarker/cache/ByteArrayTemplateLoader.java b/src/main/java/freemarker/cache/ByteArrayTemplateLoader.java
deleted file mode 100644
index 11b2182..0000000
--- a/src/main/java/freemarker/cache/ByteArrayTemplateLoader.java
+++ /dev/null
@@ -1,151 +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 freemarker.cache;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import freemarker.template.utility.StringUtil;
-
-/**
- * A {@link TemplateLoader} that uses a {@link Map} with {@code byte[]} as its source of templates. This is similar to
- * {@link StringTemplateLoader}, but uses {@code byte[]} instead of {@link String}; see more details there.
- *
- * @since 2.3.24
- */
-public class ByteArrayTemplateLoader implements TemplateLoader {
-
- private final Map<String, ByteArrayTemplateSource> templates = new HashMap<String, ByteArrayTemplateSource>();
-
- /**
- * Puts a template into the loader. A call to this method is identical to
- * the call to the three-arg {@link #putTemplate(String, byte[], long)}
- * passing <tt>System.currentTimeMillis()</tt> as the third argument.
- * @param name the name of the template.
- * @param templateSource the source code of the template.
- */
- public void putTemplate(String name, byte[] templateSource) {
- putTemplate(name, templateSource, System.currentTimeMillis());
- }
-
- /**
- * Puts a template into the loader. The name can contain slashes to denote
- * logical directory structure, but must not start with a slash. If the
- * method is called multiple times for the same name and with different
- * last modified time, the configuration's template cache will reload the
- * template according to its own refresh settings (note that if the refresh
- * is disabled in the template cache, the template will not be reloaded).
- * Also, since the cache uses lastModified to trigger reloads, calling the
- * method with different source and identical timestamp won't trigger
- * reloading.
- * @param name the name of the template.
- * @param templateSource the source code of the template.
- * @param lastModified the time of last modification of the template in
- * terms of <tt>System.currentTimeMillis()</tt>
- */
- public void putTemplate(String name, byte[] templateSource, long lastModified) {
- templates.put(name, new ByteArrayTemplateSource(name, templateSource, lastModified));
- }
-
- public void closeTemplateSource(Object templateSource) {
- }
-
- public Object findTemplateSource(String name) {
- return templates.get(name);
- }
-
- public long getLastModified(Object templateSource) {
- return ((ByteArrayTemplateSource) templateSource).lastModified;
- }
-
- public Reader getReader(Object templateSource, String encoding) throws UnsupportedEncodingException {
- return new InputStreamReader(
- new ByteArrayInputStream(((ByteArrayTemplateSource) templateSource).source),
- encoding);
- }
-
- private static class ByteArrayTemplateSource {
- private final String name;
- private final byte[] source;
- private final long lastModified;
-
- ByteArrayTemplateSource(String name, byte[] source, long lastModified) {
- if (name == null) {
- throw new IllegalArgumentException("name == null");
- }
- if (source == null) {
- throw new IllegalArgumentException("source == null");
- }
- if (lastModified < -1L) {
- throw new IllegalArgumentException("lastModified < -1L");
- }
- this.name = name;
- this.source = source;
- this.lastModified = lastModified;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof ByteArrayTemplateSource) {
- return name.equals(((ByteArrayTemplateSource) obj).name);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
- }
-
- /**
- * Show class name and some details that are useful in template-not-found errors.
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(TemplateLoaderUtils.getClassNameForToString(this));
- sb.append("(Map { ");
- int cnt = 0;
- for (Iterator it = templates.keySet().iterator(); it.hasNext(); ) {
- cnt++;
- if (cnt != 1) {
- sb.append(", ");
- }
- if (cnt > 10) {
- sb.append("...");
- break;
- }
- sb.append(StringUtil.jQuote(it.next()));
- sb.append("=...");
- }
- if (cnt != 0) {
- sb.append(' ');
- }
- sb.append("})");
- return sb.toString();
- }
-
-}
diff --git a/src/main/java/freemarker/cache/CacheStorage.java b/src/main/java/freemarker/cache/CacheStorage.java
deleted file mode 100644
index cd9d720..0000000
--- a/src/main/java/freemarker/cache/CacheStorage.java
+++ /dev/null
@@ -1,37 +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 freemarker.cache;
-
-/**
- * Cache storage abstracts away the storage aspects of a cache - associating
- * an object with a key, retrieval and removal via the key. It is actually a
- * small subset of the {@link java.util.Map} interface.
- * The implementations can be coded in a non-threadsafe manner as the natural
- * user of the cache storage, {@link TemplateCache} does the necessary
- * synchronization.
- *
- * @see freemarker.template.Configuration#setCacheStorage(CacheStorage)
- */
-public interface CacheStorage {
- public Object get(Object key);
- public void put(Object key, Object value);
- public void remove(Object key);
- public void clear();
-}
diff --git a/src/main/java/freemarker/cache/CacheStorageWithGetSize.java b/src/main/java/freemarker/cache/CacheStorageWithGetSize.java
deleted file mode 100644
index 0d0f006..0000000
--- a/src/main/java/freemarker/cache/CacheStorageWithGetSize.java
+++ /dev/null
@@ -1,36 +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 freemarker.cache;
-
-/**
- * A cache storage that has a {@code getSize()} method for returning the current number of cache entries.
- *
- * @since 2.3.21
- */
-public interface CacheStorageWithGetSize extends CacheStorage {
-
- /**
- * Returns the current number of cache entries. This is intended to be used for monitoring. Note that depending on
- * the implementation, the cost of this operation is not necessary trivial, although calling it a few times per
- * minute should not be a problem.
- */
- int getSize();
-
-}
diff --git a/src/main/java/freemarker/cache/ClassTemplateLoader.java b/src/main/java/freemarker/cache/ClassTemplateLoader.java
deleted file mode 100644
index 1bfbec8..0000000
--- a/src/main/java/freemarker/cache/ClassTemplateLoader.java
+++ /dev/null
@@ -1,219 +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 freemarker.cache;
-
-import java.net.URL;
-
-import freemarker.template.utility.NullArgumentException;
-import freemarker.template.utility.StringUtil;
-
-/**
- * A {@link TemplateLoader} that can load templates from the "classpath". Naturally, it can load from jar files, or from
- * anywhere where Java can load classes from. Internally, it uses {@link Class#getResource(String)} or
- * {@link ClassLoader#getResource(String)} to load templates.
- */
-public class ClassTemplateLoader extends URLTemplateLoader {
-
- private final Class resourceLoaderClass;
- private final ClassLoader classLoader;
- private final String basePackagePath;
-
- /**
- * Creates a template loader that will use the {@link Class#getResource(String)} method of its own class to load the
- * resources, and {@code "/"} as base package path. This means that that template paths will be resolved relatively
- * the root package of the class hierarchy, so you hardly ever should use this constructor, rather do something like
- * this:<br>
- * {@link #ClassTemplateLoader(Class, String) new ClassTemplateLoader(com.example.myapplication.SomeClass.class,
- * "templates")}
- *
- * <p>
- * If you extend this class, then the extending class will be used to load the resources.
- *
- * @deprecated It's a confusing constructor, and seldom useful; use {@link #ClassTemplateLoader(Class, String)}
- * instead.
- */
- @Deprecated
- public ClassTemplateLoader() {
- this(null, true, null, "/");
- }
-
- /**
- * Creates a template loader that will use the {@link Class#getResource(String)} method of the specified class to
- * load the resources, and {@code ""} as base package path. This means that template paths will be resolved
- * relatively to the class location, that is, relatively to the directory (package) of the class.
- *
- * @param resourceLoaderClass
- * the class whose {@link Class#getResource(String)} will be used to load the templates.
- *
- * @deprecated It's confusing that the base path is {@code ""}; use {@link #ClassTemplateLoader(Class, String)}
- * instead.
- */
- @Deprecated
- public ClassTemplateLoader(Class resourceLoaderClass) {
- this(resourceLoaderClass, "");
- }
-
- /**
- * Creates a template loader that will use the {@link Class#getResource(String)} method of the specified class to
- * load the resources, and the specified base package path (absolute or relative).
- *
- * <p>
- * Examples:
- * <ul>
- * <li>Relative base path (will load from the {@code com.example.myapplication.templates} package):<br>
- * {@code new ClassTemplateLoader(com.example.myapplication.SomeClass.class, "templates")}
- * <li>Absolute base path:<br>
- * {@code new ClassTemplateLoader(somepackage.SomeClass.class, "/com/example/myapplication/templates")}
- * </ul>
- *
- * @param resourceLoaderClass
- * The class whose {@link Class#getResource(String)} method will be used to load the templates. Be sure
- * that you chose a class whose defining class-loader sees the templates. This parameter can't be
- * {@code null}.
- * @param basePackagePath
- * The package that contains the templates, in path ({@code /}-separated) format. If it doesn't start
- * with a {@code /} then it's relative to the path (package) of the {@code resourceLoaderClass} class. If
- * it starts with {@code /} then it's relative to the root of the package hierarchy. Note that path
- * components should be separated by forward slashes independently of the separator character used by the
- * underlying operating system. This parameter can't be {@code null}.
- *
- * @see #ClassTemplateLoader(ClassLoader, String)
- */
- public ClassTemplateLoader(Class resourceLoaderClass, String basePackagePath) {
- this(resourceLoaderClass, false, null, basePackagePath);
- }
-
- /**
- * Similar to {@link #ClassTemplateLoader(Class, String)}, but instead of {@link Class#getResource(String)} it uses
- * {@link ClassLoader#getResource(String)}. Because a {@link ClassLoader} isn't bound to any Java package, it
- * doesn't mater if the {@code basePackagePath} starts with {@code /} or not, it will be always relative to the root
- * of the package hierarchy
- *
- * @since 2.3.22
- */
- public ClassTemplateLoader(ClassLoader classLoader, String basePackagePath) {
- this(null, true, classLoader, basePackagePath);
- }
-
- private ClassTemplateLoader(Class resourceLoaderClass, boolean allowNullBaseClass, ClassLoader classLoader,
- String basePackagePath) {
- if (!allowNullBaseClass) {
- NullArgumentException.check("resourceLoaderClass", resourceLoaderClass);
- }
- NullArgumentException.check("basePackagePath", basePackagePath);
-
- // Either set a non-null resourceLoaderClass or a non-null classLoader, not both:
- this.resourceLoaderClass = classLoader == null ? (resourceLoaderClass == null ? this.getClass()
- : resourceLoaderClass) : null;
- if (this.resourceLoaderClass == null && classLoader == null) {
- throw new NullArgumentException("classLoader");
- }
- this.classLoader = classLoader;
-
- String canonBasePackagePath = canonicalizePrefix(basePackagePath);
- if (this.classLoader != null && canonBasePackagePath.startsWith("/")) {
- canonBasePackagePath = canonBasePackagePath.substring(1);
- }
- this.basePackagePath = canonBasePackagePath;
- }
-
- @Override
- protected URL getURL(String name) {
- String fullPath = basePackagePath + name;
-
- // Block java.net.URLClassLoader exploits:
- if (basePackagePath.equals("/") && !isSchemeless(fullPath)) {
- return null;
- }
-
- return resourceLoaderClass != null ? resourceLoaderClass.getResource(fullPath) : classLoader
- .getResource(fullPath);
- }
-
- private static boolean isSchemeless(String fullPath) {
- int i = 0;
- int ln = fullPath.length();
-
- // Skip a single initial /, as things like "/file:/..." might work:
- if (i < ln && fullPath.charAt(i) == '/') i++;
-
- // Check if there's no ":" earlier than a '/', as the URLClassLoader
- // could interpret that as an URL scheme:
- while (i < ln) {
- char c = fullPath.charAt(i);
- if (c == '/') return true;
- if (c == ':') return false;
- i++;
- }
- return true;
- }
-
- /**
- * Show class name and some details that are useful in template-not-found errors.
- *
- * @since 2.3.21
- */
- @Override
- public String toString() {
- return TemplateLoaderUtils.getClassNameForToString(this) + "("
- + (resourceLoaderClass != null
- ? "resourceLoaderClass=" + resourceLoaderClass.getName()
- : "classLoader=" + StringUtil.jQuote(classLoader))
- + ", basePackagePath"
- + "="
- + StringUtil.jQuote(basePackagePath)
- + (resourceLoaderClass != null
- ? (basePackagePath.startsWith("/") ? "" : " /* relatively to resourceLoaderClass pkg */")
- : ""
- )
- + ")";
- }
-
- /**
- * See the similar parameter of {@link #ClassTemplateLoader(Class, String)}; {@code null} when other mechanism is
- * used to load the resources.
- *
- * @since 2.3.22
- */
- public Class getResourceLoaderClass() {
- return resourceLoaderClass;
- }
-
- /**
- * See the similar parameter of {@link #ClassTemplateLoader(ClassLoader, String)}; {@code null} when other mechanism
- * is used to load the resources.
- *
- * @since 2.3.22
- */
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- /**
- * See the similar parameter of {@link #ClassTemplateLoader(ClassLoader, String)}; note that this is a normalized
- * version of what was actually passed to the constructor.
- *
- * @since 2.3.22
- */
- public String getBasePackagePath() {
- return basePackagePath;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/freemarker/cache/ConcurrentCacheStorage.java b/src/main/java/freemarker/cache/ConcurrentCacheStorage.java
deleted file mode 100644
index a791cec..0000000
--- a/src/main/java/freemarker/cache/ConcurrentCacheStorage.java
+++ /dev/null
@@ -1,35 +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 freemarker.cache;
-
-/**
- * An optional interface for cache storage that knows whether it can be
- * concurrently accessible without synchronization.
- */
-public interface ConcurrentCacheStorage extends CacheStorage {
-
- /**
- * Returns true if this instance of cache storage is concurrently
- * accessible from multiple threads without synchronization.
- * @return true if this instance of cache storage is concurrently
- * accessible from multiple threads without synchronization.
- */
- public boolean isConcurrent();
-}
diff --git a/src/main/java/freemarker/cache/ConditionalTemplateConfigurationFactory.java b/src/main/java/freemarker/cache/ConditionalTemplateConfigurationFactory.java
deleted file mode 100644
index 430632e..0000000
--- a/src/main/java/freemarker/cache/ConditionalTemplateConfigurationFactory.java
+++ /dev/null
@@ -1,76 +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 freemarker.cache;
-
-import java.io.IOException;
-
-import freemarker.core.TemplateConfiguration;
-import freemarker.template.Configuration;
-
-/**
- * Returns the given {@link TemplateConfiguration} directly, or another {@link TemplateConfigurationFactory}'s result, when
- * the specified matcher matches the template source.
- *
- * @since 2.3.24
- */
-public class ConditionalTemplateConfigurationFactory extends TemplateConfigurationFactory {
-
- private final TemplateSourceMatcher matcher;
- private final TemplateConfiguration templateConfiguration;
- private final TemplateConfigurationFactory templateConfigurationFactory;
-
- public ConditionalTemplateConfigurationFactory(
- TemplateSourceMatcher matcher, TemplateConfigurationFactory templateConfigurationFactory) {
- this.matcher = matcher;
- this.templateConfiguration = null;
- this.templateConfigurationFactory = templateConfigurationFactory;
- }
-
- public ConditionalTemplateConfigurationFactory(
- TemplateSourceMatcher matcher, TemplateConfiguration templateConfiguration) {
- this.matcher = matcher;
- this.templateConfiguration = templateConfiguration;
- this.templateConfigurationFactory = null;
- }
-
- @Override
- public TemplateConfiguration get(String sourceName, Object templateSource)
- throws IOException, TemplateConfigurationFactoryException {
- if (matcher.matches(sourceName, templateSource)) {
- if (templateConfigurationFactory != null) {
- return templateConfigurationFactory.get(sourceName, templateSource);
- } else {
- return templateConfiguration;
- }
- } else {
- return null;
- }
- }
-
- @Override
- protected void setConfigurationOfChildren(Configuration cfg) {
- if (templateConfiguration != null) {
- templateConfiguration.setParentConfiguration(cfg);
- }
- if (templateConfigurationFactory != null) {
- templateConfigurationFactory.setConfiguration(cfg);
- }
- }
-
-}
diff --git a/src/main/java/freemarker/cache/FileExtensionMatcher.java b/src/main/java/freemarker/cache/FileExtensionMatcher.java
deleted file mode 100644
index 23d052f..0000000
--- a/src/main/java/freemarker/cache/FileExtensionMatcher.java
+++ /dev/null
@@ -1,85 +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 freemarker.cache;
-
-import java.io.IOException;
-
-/**
- * Matches the file extension; unlike other matchers, by default case <em>insensitive</em>. A name (a path) is
- * considered to have the given extension exactly if it ends with a dot plus the extension.
- *
- * @since 2.3.24
- */
-public class FileExtensionMatcher extends TemplateSourceMatcher {
-
- private final String extension;
- private boolean caseInsensitive = true;
-
- /**
- * @param extension
- * The file extension (without the initial dot). Can't contain there characters:
- * {@code '/'}, {@code '*'}, {@code '?'}. May contains {@code '.'}, but can't start with it.
- */
- public FileExtensionMatcher(String extension) {
- if (extension.indexOf('/') != -1) {
- throw new IllegalArgumentException("A file extension can't contain \"/\": " + extension);
- }
- if (extension.indexOf('*') != -1) {
- throw new IllegalArgumentException("A file extension can't contain \"*\": " + extension);
- }
- if (extension.indexOf('?') != -1) {
- throw new IllegalArgumentException("A file extension can't contain \"*\": " + extension);
- }
- if (extension.startsWith(".")) {
- throw new IllegalArgumentException("A file extension can't start with \".\": " + extension);
- }
- this.extension = extension;
- }
-
- @Override
- public boolean matches(String sourceName, Object templateSource) throws IOException {
- int ln = sourceName.length();
- int extLn = extension.length();
- if (ln < extLn + 1 || sourceName.charAt(ln - extLn - 1) != '.') {
- return false;
- }
-
- return sourceName.regionMatches(caseInsensitive, ln - extLn, extension, 0, extLn);
- }
-
- public boolean isCaseInsensitive() {
- return caseInsensitive;
- }
-
- /**
- * Sets if the matching will be case insensitive (UNICODE compliant); default is {@code true}.
- */
- public void setCaseInsensitive(boolean caseInsensitive) {
- this.caseInsensitive = caseInsensitive;
- }
-
- /**
- * Fluid API variation of {@link #setCaseInsensitive(boolean)}
- */
- public FileExtensionMatcher caseInsensitive(boolean caseInsensitive) {
- setCaseInsensitive(caseInsensitive);
- return this;
- }
-
-}
diff --git a/src/main/java/freemarker/cache/FileNameGlobMatcher.java b/src/main/java/freemarker/cache/FileNameGlobMatcher.java
deleted file mode 100644
index 12d2ac6..0000000
--- a/src/main/java/freemarker/cache/FileNameGlobMatcher.java
+++ /dev/null
@@ -1,86 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.util.regex.Pattern;
-
-import freemarker.template.utility.StringUtil;
-
-/**
- * As opposed to {@link PathGlobMatcher}, it only compares the "file name" part (the part after the last {@code /}) of
- * the source name with the given glob. For example, the file name glob {@code *.ftlh} matches both {@code foo.ftlh} and
- * {@code foo/bar.ftlh}. With other words, that file name glob is equivalent with the {@code **}{@code /*.ftlh})
- * <em>path</em> glob ( {@link PathGlobMatcher}).
- *
- * @since 2.3.24
- */
-public class FileNameGlobMatcher extends TemplateSourceMatcher {
-
- private final String glob;
-
- private Pattern pattern;
- private boolean caseInsensitive;
-
- /**
- * @param glob
- * Glob with the syntax defined by {@link StringUtil#globToRegularExpression(String, boolean)}. Must not
- * start with {@code /}.
- */
- public FileNameGlobMatcher(String glob) {
- if (glob.indexOf('/') != -1) {
- throw new IllegalArgumentException("A file name glob can't contain \"/\": " + glob);
- }
- this.glob = glob;
- buildPattern();
- }
-
- private void buildPattern() {
- pattern = StringUtil.globToRegularExpression("**/" + glob, caseInsensitive);
- }
-
- @Override
- public boolean matches(String sourceName, Object templateSource) throws IOException {
- return pattern.matcher(sourceName).matches();
- }
-
- public boolean isCaseInsensitive() {
- return caseInsensitive;
- }
-
- /**
- * Sets if the matching will be case insensitive (UNICODE compliant); default is {@code false}.
- */
- public void setCaseInsensitive(boolean caseInsensitive) {
- boolean lastCaseInsensitive = this.caseInsensitive;
- this.caseInsensitive = caseInsensitive;
- if (lastCaseInsensitive != caseInsensitive) {
- buildPattern();
- }
- }
-
- /**
- * Fluid API variation of {@link #setCaseInsensitive(boolean)}
- */
- public FileNameGlobMatcher caseInsensitive(boolean caseInsensitive) {
- setCaseInsensitive(caseInsensitive);
- return this;
- }
-
-}
diff --git a/src/main/java/freemarker/cache/FileTemplateLoader.java b/src/main/java/freemarker/cache/FileTemplateLoader.java
deleted file mode 100644
index d14368f..0000000
--- a/src/main/java/freemarker/cache/FileTemplateLoader.java
+++ /dev/null
@@ -1,350 +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 freemarker.cache;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import freemarker.log.Logger;
-import freemarker.template.Configuration;
-import freemarker.template.utility.SecurityUtilities;
-import freemarker.template.utility.StringUtil;
-
-/**
- * A {@link TemplateLoader} that uses files inside a specified directory as the source of templates. By default it does
- * security checks on the <em>canonical</em> path that will prevent it serving templates outside that specified
- * directory. If you want symbolic links that point outside the template directory to work, you need to disable this
- * feature by using {@link #FileTemplateLoader(File, boolean)} with {@code true} second argument, but before that, check
- * the security implications there!
- */
-public class FileTemplateLoader implements TemplateLoader {
-
- /**
- * By setting this Java system property to {@code true}, you can change the default of
- * {@code #getEmulateCaseSensitiveFileSystem()}.
- */
- public static String SYSTEM_PROPERTY_NAME_EMULATE_CASE_SENSITIVE_FILE_SYSTEM
- = "org.freemarker.emulateCaseSensitiveFileSystem";
- private static final boolean EMULATE_CASE_SENSITIVE_FILE_SYSTEM_DEFAULT;
- static {
- final String s = SecurityUtilities.getSystemProperty(SYSTEM_PROPERTY_NAME_EMULATE_CASE_SENSITIVE_FILE_SYSTEM,
- "false");
- boolean emuCaseSensFS;
- try {
- emuCaseSensFS = StringUtil.getYesNo(s);
- } catch (Exception e) {
- emuCaseSensFS = false;
- }
- EMULATE_CASE_SENSITIVE_FILE_SYSTEM_DEFAULT = emuCaseSensFS;
- }
-
- private static final int CASE_CHECH_CACHE_HARD_SIZE = 50;
- private static final int CASE_CHECK_CACHE__SOFT_SIZE = 1000;
- private static final boolean SEP_IS_SLASH = File.separatorChar == '/';
-
- private static final Logger LOG = Logger.getLogger("freemarker.cache");
-
- public final File baseDir;
- private final String canonicalBasePath;
- private boolean emulateCaseSensitiveFileSystem;
- private MruCacheStorage correctCasePaths;
-
- /**
- * Creates a new file template cache that will use the current directory (the value of the system property
- * <code>user.dir</code> as the base directory for loading templates. It will not allow access to template files
- * that are accessible through symlinks that point outside the base directory.
- *
- * @deprecated Relying on what the current directory is is a bad practice; use
- * {@link FileTemplateLoader#FileTemplateLoader(File)} instead.
- */
- @Deprecated
- public FileTemplateLoader()
- throws IOException {
- this(new File(SecurityUtilities.getSystemProperty("user.dir")));
- }
-
- /**
- * Creates a new file template loader that will use the specified directory
- * as the base directory for loading templates. It will not allow access to
- * template files that are accessible through symlinks that point outside
- * the base directory.
- * @param baseDir the base directory for loading templates
- */
- public FileTemplateLoader(final File baseDir)
- throws IOException {
- this(baseDir, false);
- }
-
- /**
- * Creates a new file template loader that will use the specified directory as the base directory for loading
- * templates. See the parameters for allowing symlinks that point outside the base directory.
- *
- * @param baseDir
- * the base directory for loading templates
- *
- * @param disableCanonicalPathCheck
- * If {@code true}, it will not check if the file to be loaded is inside the {@code baseDir} or not,
- * according the <em>canonical</em> paths of the {@code baseDir} and the file to load. Note that
- * {@link Configuration#getTemplate(String)} and (its overloads) already prevents backing out from the
- * template directory with paths like {@code /../../../etc/password}, however, that can be circumvented
- * with symbolic links or other file system features. If you really want to use symbolic links that point
- * outside the {@code baseDir}, set this parameter to {@code true}, but then be very careful with
- * template paths that are supplied by the visitor or an external system.
- */
- public FileTemplateLoader(final File baseDir, final boolean disableCanonicalPathCheck)
- throws IOException {
- try {
- Object[] retval = (Object[]) AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- if (!baseDir.exists()) {
- throw new FileNotFoundException(baseDir + " does not exist.");
- }
- if (!baseDir.isDirectory()) {
- throw new IOException(baseDir + " is not a directory.");
- }
- Object[] retval = new Object[2];
- if (disableCanonicalPathCheck) {
- retval[0] = baseDir;
- retval[1] = null;
- } else {
- retval[0] = baseDir.getCanonicalFile();
- String basePath = ((File) retval[0]).getPath();
- // Most canonical paths don't end with File.separator,
- // but some does. Like, "C:\" VS "C:\templates".
- if (!basePath.endsWith(File.separator)) {
- basePath += File.separatorChar;
- }
- retval[1] = basePath;
- }
- return retval;
- }
- });
- this.baseDir = (File) retval[0];
- this.canonicalBasePath = (String) retval[1];
-
- setEmulateCaseSensitiveFileSystem(getEmulateCaseSensitiveFileSystemDefault());
- } catch (PrivilegedActionException e) {
- throw (IOException) e.getException();
- }
- }
-
- public Object findTemplateSource(final String name)
- throws IOException {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- File source = new File(baseDir, SEP_IS_SLASH ? name :
- name.replace('/', File.separatorChar));
- if (!source.isFile()) {
- return null;
- }
- // Security check for inadvertently returning something
- // outside the template directory when linking is not
- // allowed.
- if (canonicalBasePath != null) {
- String normalized = source.getCanonicalPath();
- if (!normalized.startsWith(canonicalBasePath)) {
- throw new SecurityException(source.getAbsolutePath()
- + " resolves to " + normalized + " which " +
- " doesn't start with " + canonicalBasePath);
- }
- }
-
- if (emulateCaseSensitiveFileSystem && !isNameCaseCorrect(source)) {
- return null;
- }
-
- return source;
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException) e.getException();
- }
- }
-
- public long getLastModified(final Object templateSource) {
- return ((Long) (AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run() {
- return Long.valueOf(((File) templateSource).lastModified());
- }
- }))).longValue();
-
-
- }
-
- public Reader getReader(final Object templateSource, final String encoding)
- throws IOException {
- try {
- return (Reader) AccessController.doPrivileged(new PrivilegedExceptionAction()
- {
- public Object run()
- throws IOException {
- if (!(templateSource instanceof File)) {
- throw new IllegalArgumentException(
- "templateSource wasn't a File, but a: " +
- templateSource.getClass().getName());
- }
- return new InputStreamReader(new FileInputStream((File) templateSource), encoding);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException) e.getException();
- }
- }
-
- /**
- * Called by {@link #findTemplateSource(String)} when {@link #getEmulateCaseSensitiveFileSystem()} is {@code true}. Should throw
- * {@link FileNotFoundException} if there's a mismatch; the error message should contain both the requested and the
- * correct file name.
- */
- private boolean isNameCaseCorrect(File source) throws IOException {
- final String sourcePath = source.getPath();
- synchronized (correctCasePaths) {
- if (correctCasePaths.get(sourcePath) != null) {
- return true;
- }
- }
-
- final File parentDir = source.getParentFile();
- if (parentDir != null) {
- if (!baseDir.equals(parentDir) && !isNameCaseCorrect(parentDir)) {
- return false;
- }
-
- final String[] listing = parentDir.list();
- if (listing != null) {
- final String fileName = source.getName();
-
- boolean identicalNameFound = false;
- for (int i = 0; !identicalNameFound && i < listing.length; i++) {
- if (fileName.equals(listing[i])) {
- identicalNameFound = true;
- }
- }
-
- if (!identicalNameFound) {
- // If we find a similarly named file that only differs in case, then this is a file-not-found.
- for (int i = 0; i < listing.length; i++) {
- final String listingEntry = listing[i];
- if (fileName.equalsIgnoreCase(listingEntry)) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Emulating file-not-found because of letter case differences to the "
- + "real file, for: " + sourcePath);
- }
- return false;
- }
- }
- }
- }
- }
-
- synchronized (correctCasePaths) {
- correctCasePaths.put(sourcePath, Boolean.TRUE);
- }
- return true;
- }
-
- public void closeTemplateSource(Object templateSource) {
- // Do nothing.
- }
-
- /**
- * Returns the base directory in which the templates are searched. This comes from the constructor argument, but
- * it's possibly a canonicalized version of that.
- *
- * @since 2.3.21
- */
- public File getBaseDirectory() {
- return baseDir;
- }
-
- /**
- * Intended for development only, checks if the template name matches the case (upper VS lower case letters) of the
- * actual file name, and if it doesn't, it emulates a file-not-found even if the file system is case insensitive.
- * This is useful when developing application on Windows, which will be later installed on Linux, OS X, etc. This
- * check can be resource intensive, as to check the file name the directories involved, up to the
- * {@link #getBaseDirectory()} directory, must be listed. Positive results (matching case) will be cached without
- * expiration time.
- *
- * <p>The default in {@link FileTemplateLoader} is {@code false}, but subclasses may change they by overriding
- * {@link #getEmulateCaseSensitiveFileSystemDefault()}.
- *
- * @since 2.3.23
- */
- public void setEmulateCaseSensitiveFileSystem(boolean nameCaseChecked) {
- // Ensure that the cache exists exactly when needed:
- if (nameCaseChecked) {
- if (correctCasePaths == null) {
- correctCasePaths = new MruCacheStorage(CASE_CHECH_CACHE_HARD_SIZE, CASE_CHECK_CACHE__SOFT_SIZE);
- }
- } else {
- correctCasePaths = null;
- }
-
- this.emulateCaseSensitiveFileSystem = nameCaseChecked;
- }
-
- /**
- * Getter pair of {@link #setEmulateCaseSensitiveFileSystem(boolean)}.
- *
- * @since 2.3.23
- */
- public boolean getEmulateCaseSensitiveFileSystem() {
- return emulateCaseSensitiveFileSystem;
- }
-
- /**
- * Returns the default of {@link #getEmulateCaseSensitiveFileSystem()}. In {@link FileTemplateLoader} it's
- * {@code false}, unless the {@link #SYSTEM_PROPERTY_NAME_EMULATE_CASE_SENSITIVE_FILE_SYSTEM} system property was
- * set to {@code true}, but this can be overridden here in custom subclasses. For example, if your environment
- * defines something like developer mode, you may want to override this to return {@code true} on Windows.
- *
- * @since 2.3.23
- */
- protected boolean getEmulateCaseSensitiveFileSystemDefault() {
- return EMULATE_CASE_SENSITIVE_FILE_SYSTEM_DEFAULT;
- }
-
- /**
- * Show class name and some details that are useful in template-not-found errors.
- *
- * @since 2.3.21
- */
- @Override
- public String toString() {
- // We don't StringUtil.jQuote paths here, because on Windows there will be \\-s then that some may find
- // confusing.
- return TemplateLoaderUtils.getClassNameForToString(this) + "("
- + "baseDir=\"" + baseDir + "\""
- + (canonicalBasePath != null ? ", canonicalBasePath=\"" + canonicalBasePath + "\"" : "")
- + (emulateCaseSensitiveFileSystem ? ", emulateCaseSensitiveFileSystem=true" : "")
- + ")";
- }
-
-}
diff --git a/src/main/java/freemarker/cache/FirstMatchTemplateConfigurationFactory.java b/src/main/java/freemarker/cache/FirstMatchTemplateConfigurationFactory.java
deleted file mode 100644
index 9382656..0000000
--- a/src/main/java/freemarker/cache/FirstMatchTemplateConfigurationFactory.java
+++ /dev/null
@@ -1,118 +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 freemarker.cache;
-
-import java.io.IOException;
-
-import freemarker.core.TemplateConfiguration;
-import freemarker.template.Configuration;
-import freemarker.template.utility.StringUtil;
-
-/**
- * Returns the first non-{@code null} result of the child factories, ignoring all further child factories. The child
- * factories are called in the order as they were added.
- */
-public class FirstMatchTemplateConfigurationFactory extends TemplateConfigurationFactory {
-
- private final TemplateConfigurationFactory[] templateConfigurationFactories;
- private boolean allowNoMatch;
- private String noMatchErrorDetails;
-
- public FirstMatchTemplateConfigurationFactory(TemplateConfigurationFactory... templateConfigurationFactories) {
- this.templateConfigurationFactories = templateConfigurationFactories;
- }
-
- @Override
- public TemplateConfiguration get(String sourceName, Object templateSource)
- throws IOException, TemplateConfigurationFactoryException {
- for (TemplateConfigurationFactory tcf : templateConfigurationFactories) {
- TemplateConfiguration tc = tcf.get(sourceName, templateSource);
- if (tc != null) {
- return tc;
- }
- }
- if (!allowNoMatch) {
- throw new TemplateConfigurationFactoryException(
- FirstMatchTemplateConfigurationFactory.class.getSimpleName()
- + " has found no matching choice for source name "
- + StringUtil.jQuote(sourceName) + ". "
- + (noMatchErrorDetails != null
- ? "Error details: " + noMatchErrorDetails
- : "(Set the noMatchErrorDetails property of the factory bean to give a more specific error "
- + "message. Set allowNoMatch to true if this shouldn't be an error.)"));
- }
- return null;
- }
-
- /**
- * Getter pair of {@link #setAllowNoMatch(boolean)}.
- */
- public boolean getAllowNoMatch() {
- return allowNoMatch;
- }
-
- /**
- * Use this to specify if having no matching choice is an error. The default is {@code false}, that is, it's an
- * error if there was no matching choice.
- *
- * @see #setNoMatchErrorDetails(String)
- */
- public void setAllowNoMatch(boolean allowNoMatch) {
- this.allowNoMatch = allowNoMatch;
- }
-
- /**
- * Use this to specify the text added to the exception error message when there was no matching choice.
- * The default is {@code null} (no error details).
- *
- * @see #setAllowNoMatch(boolean)
- */
- public String getNoMatchErrorDetails() {
- return noMatchErrorDetails;
- }
-
-
- public void setNoMatchErrorDetails(String noMatchErrorDetails) {
- this.noMatchErrorDetails = noMatchErrorDetails;
- }
-
- /**
- * Same as {@link #setAllowNoMatch(boolean)}, but return this object to support "fluent API" style.
- */
- public FirstMatchTemplateConfigurationFactory allowNoMatch(boolean allow) {
- setAllowNoMatch(allow);
- return this;
- }
-
- /**
- * Same as {@link #setNoMatchErrorDetails(String)}, but return this object to support "fluent API" style.
- */
- public FirstMatchTemplateConfigurationFactory noMatchErrorDetails(String message) {
- setNoMatchErrorDetails(message);
- return this;
- }
-
- @Override
- protected void setConfigurationOfChildren(Configuration cfg) {
- for (TemplateConfigurationFactory templateConfigurationFactory : templateConfigurationFactories) {
- templateConfigurationFactory.setConfiguration(cfg);
- }
- }
-
-}
diff --git a/src/main/java/freemarker/cache/GetLastModifiedException.java b/src/main/java/freemarker/cache/GetLastModifiedException.java
deleted file mode 100644
index 1f369f5..0000000
--- a/src/main/java/freemarker/cache/GetLastModifiedException.java
+++ /dev/null
@@ -1,41 +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 freemarker.cache;
-
-import java.io.IOException;
-
-
-/**
- * Used be {@link TemplateLoader#getLastModified(Object)} to indicate an error getting the last modification date. That
- * should be just an {@link IOException}, but due to backward compatibility constraints that wasn't possible;
- * {@link TemplateLoader#getLastModified(Object)} doesn't allow throwing checked exception.
- *
- * @since 2.4.0
- */
-public class GetLastModifiedException extends RuntimeException {
-
- public GetLastModifiedException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public GetLastModifiedException(String message) {
- super(message);
- }
-
-}
diff --git a/src/main/java/freemarker/cache/MergingTemplateConfigurationFactory.java b/src/main/java/freemarker/cache/MergingTemplateConfigurationFactory.java
deleted file mode 100644
index 3675d19..0000000
--- a/src/main/java/freemarker/cache/MergingTemplateConfigurationFactory.java
+++ /dev/null
@@ -1,78 +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 freemarker.cache;
-
-import java.io.IOException;
-
-import freemarker.core.TemplateConfiguration;
-import freemarker.template.Configuration;
-
-/**
- * Returns the merged results of all the child factories. The factories are merged in the order as they were added.
- * {@code null} results from the child factories will be ignored. If all child factories return {@code null}, the result
- * of this factory will be {@code null} too.
- *
- * @since 2.3.24
- */
-public class MergingTemplateConfigurationFactory extends TemplateConfigurationFactory {
-
- private final TemplateConfigurationFactory[] templateConfigurationFactories;
-
- public MergingTemplateConfigurationFactory(TemplateConfigurationFactory... templateConfigurationFactories) {
- this.templateConfigurationFactories = templateConfigurationFactories;
- }
-
- @Override
- public TemplateConfiguration get(String sourceName, Object templateSource)
- throws IOException, TemplateConfigurationFactoryException {
- TemplateConfiguration mergedTC = null;
- TemplateConfiguration resultTC = null;
- for (TemplateConfigurationFactory tcf : templateConfigurationFactories) {
- TemplateConfiguration tc = tcf.get(sourceName, templateSource);
- if (tc != null) {
- if (resultTC == null) {
- resultTC = tc;
- } else {
- if (mergedTC == null) {
- Configuration cfg = getConfiguration();
- if (cfg == null) {
- throw new IllegalStateException(
- "The TemplateConfigurationFactory wasn't associated to a Configuration yet.");
- }
-
- mergedTC = new TemplateConfiguration();
- mergedTC.setParentConfiguration(cfg);
- mergedTC.merge(resultTC);
- resultTC = mergedTC;
- }
- mergedTC.merge(tc);
- }
- }
- }
- return resultTC;
- }
-
- @Override
- protected void setConfigurationOfChildren(Configuration cfg) {
- for (TemplateConfigurationFactory templateConfigurationFactory : templateConfigurationFactories) {
- templateConfigurationFactory.setConfiguration(cfg);
- }
- }
-
-}
diff --git a/src/main/java/freemarker/cache/MruCacheStorage.java b/src/main/java/freemarker/cache/MruCacheStorage.java
deleted file mode 100644
index 4717876..0000000
--- a/src/main/java/freemarker/cache/MruCacheStorage.java
+++ /dev/null
@@ -1,322 +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 freemarker.cache;
-
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A cache storage that implements a two-level Most Recently Used cache. In the
- * first level, items are strongly referenced up to the specified maximum. When
- * the maximum is exceeded, the least recently used item is moved into the
- * second level cache, where they are softly referenced, up to another
- * specified maximum. When the second level maximum is also exceeded, the least
- * recently used item is discarded altogether. This cache storage is a
- * generalization of both {@link StrongCacheStorage} and
- * {@link SoftCacheStorage} - the effect of both of them can be achieved by
- * setting one maximum to zero and the other to the largest positive integer.
- * On the other hand, if you wish to use this storage in a strong-only mode, or
- * in a soft-only mode, you might consider using {@link StrongCacheStorage} or
- * {@link SoftCacheStorage} instead, as they can be used by
- * {@link TemplateCache} concurrently without any synchronization on a 5.0 or
- * later JRE.
- *
- * <p>This class is <em>NOT</em> thread-safe. If it's accessed from multiple
- * threads concurrently, proper synchronization must be provided by the callers.
- * Note that {@link TemplateCache}, the natural user of this class provides the
- * necessary synchronizations when it uses the class.
- * Also you might consider whether you need this sort of a mixed storage at all
- * in your solution, as in most cases SoftCacheStorage can also be sufficient.
- * SoftCacheStorage will use Java soft references, and they already use access
- * timestamps internally to bias the garbage collector against clearing
- * recently used references, so you can get reasonably good (and
- * memory-sensitive) most-recently-used caching through
- * {@link SoftCacheStorage} as well.
- *
- * @see freemarker.template.Configuration#setCacheStorage(CacheStorage)
- */
-public class MruCacheStorage implements CacheStorageWithGetSize {
- private final MruEntry strongHead = new MruEntry();
- private final MruEntry softHead = new MruEntry();
- {
- softHead.linkAfter(strongHead);
- }
- private final Map map = new HashMap();
- private final ReferenceQueue refQueue = new ReferenceQueue();
- private final int strongSizeLimit;
- private final int softSizeLimit;
- private int strongSize = 0;
- private int softSize = 0;
-
- /**
- * Creates a new MRU cache storage with specified maximum cache sizes. Each
- * cache size can vary between 0 and {@link Integer#MAX_VALUE}.
- * @param strongSizeLimit the maximum number of strongly referenced templates; when exceeded, the entry used
- * the least recently will be moved into the soft cache.
- * @param softSizeLimit the maximum number of softly referenced templates; when exceeded, the entry used
- * the least recently will be discarded.
- */
- public MruCacheStorage(int strongSizeLimit, int softSizeLimit) {
- if (strongSizeLimit < 0) throw new IllegalArgumentException("strongSizeLimit < 0");
- if (softSizeLimit < 0) throw new IllegalArgumentException("softSizeLimit < 0");
- this.strongSizeLimit = strongSizeLimit;
- this.softSizeLimit = softSizeLimit;
- }
-
- public Object get(Object key) {
- removeClearedReferences();
- MruEntry entry = (MruEntry) map.get(key);
- if (entry == null) {
- return null;
- }
- relinkEntryAfterStrongHead(entry, null);
- Object value = entry.getValue();
- if (value instanceof MruReference) {
- // This can only happen with strongSizeLimit == 0
- return ((MruReference) value).get();
- }
- return value;
- }
-
- public void put(Object key, Object value) {
- removeClearedReferences();
- MruEntry entry = (MruEntry) map.get(key);
- if (entry == null) {
- entry = new MruEntry(key, value);
- map.put(key, entry);
- linkAfterStrongHead(entry);
- } else {
- relinkEntryAfterStrongHead(entry, value);
- }
-
- }
-
- public void remove(Object key) {
- removeClearedReferences();
- removeInternal(key);
- }
-
- private void removeInternal(Object key) {
- MruEntry entry = (MruEntry) map.remove(key);
- if (entry != null) {
- unlinkEntryAndInspectIfSoft(entry);
- }
- }
-
- public void clear() {
- strongHead.makeHead();
- softHead.linkAfter(strongHead);
- map.clear();
- strongSize = softSize = 0;
- // Quick refQueue processing
- while (refQueue.poll() != null);
- }
-
- private void relinkEntryAfterStrongHead(MruEntry entry, Object newValue) {
- if (unlinkEntryAndInspectIfSoft(entry) && newValue == null) {
- // Turn soft reference into strong reference, unless is was cleared
- MruReference mref = (MruReference) entry.getValue();
- Object strongValue = mref.get();
- if (strongValue != null) {
- entry.setValue(strongValue);
- linkAfterStrongHead(entry);
- } else {
- map.remove(mref.getKey());
- }
- } else {
- if (newValue != null) {
- entry.setValue(newValue);
- }
- linkAfterStrongHead(entry);
- }
- }
-
- private void linkAfterStrongHead(MruEntry entry) {
- entry.linkAfter(strongHead);
- if (strongSize == strongSizeLimit) {
- // softHead.previous is LRU strong entry
- MruEntry lruStrong = softHead.getPrevious();
- // Attila: This is equaivalent to strongSizeLimit != 0
- // DD: But entry.linkAfter(strongHead) was just executed above, so
- // lruStrong != strongHead is true even if strongSizeLimit == 0.
- if (lruStrong != strongHead) {
- lruStrong.unlink();
- if (softSizeLimit > 0) {
- lruStrong.linkAfter(softHead);
- lruStrong.setValue(new MruReference(lruStrong, refQueue));
- if (softSize == softSizeLimit) {
- // List is circular, so strongHead.previous is LRU soft entry
- MruEntry lruSoft = strongHead.getPrevious();
- lruSoft.unlink();
- map.remove(lruSoft.getKey());
- } else {
- ++softSize;
- }
- } else {
- map.remove(lruStrong.getKey());
- }
- }
- } else {
- ++strongSize;
- }
- }
-
- private boolean unlinkEntryAndInspectIfSoft(MruEntry entry) {
- entry.unlink();
- if (entry.getValue() instanceof MruReference) {
- --softSize;
- return true;
- } else {
- --strongSize;
- return false;
- }
- }
-
- private void removeClearedReferences() {
- for (; ; ) {
- MruReference ref = (MruReference) refQueue.poll();
- if (ref == null) {
- break;
- }
- removeInternal(ref.getKey());
- }
- }
-
- /**
- * Returns the configured upper limit of the number of strong cache entries.
- *
- * @since 2.3.21
- */
- public int getStrongSizeLimit() {
- return strongSizeLimit;
- }
-
- /**
- * Returns the configured upper limit of the number of soft cache entries.
- *
- * @since 2.3.21
- */
- public int getSoftSizeLimit() {
- return softSizeLimit;
- }
-
- /**
- * Returns the <em>current</em> number of strong cache entries.
- *
- * @see #getStrongSizeLimit()
- * @since 2.3.21
- */
- public int getStrongSize() {
- return strongSize;
- }
-
- /**
- * Returns a close approximation of the <em>current</em> number of soft cache entries.
- *
- * @see #getSoftSizeLimit()
- * @since 2.3.21
- */
- public int getSoftSize() {
- removeClearedReferences();
- return softSize;
- }
-
- /**
- * Returns a close approximation of the current number of cache entries.
- *
- * @see #getStrongSize()
- * @see #getSoftSize()
- * @since 2.3.21
- */
- public int getSize() {
- return getSoftSize() + getStrongSize();
- }
-
- private static final class MruEntry {
- private MruEntry prev;
- private MruEntry next;
- private final Object key;
- private Object value;
-
- /**
- * Used solely to construct the head element
- */
- MruEntry() {
- makeHead();
- key = value = null;
- }
-
- MruEntry(Object key, Object value) {
- this.key = key;
- this.value = value;
- }
-
- Object getKey() {
- return key;
- }
-
- Object getValue() {
- return value;
- }
-
- void setValue(Object value) {
- this.value = value;
- }
-
- MruEntry getPrevious() {
- return prev;
- }
-
- void linkAfter(MruEntry entry) {
- next = entry.next;
- entry.next = this;
- prev = entry;
- next.prev = this;
- }
-
- void unlink() {
- next.prev = prev;
- prev.next = next;
- prev = null;
- next = null;
- }
-
- void makeHead() {
- prev = next = this;
- }
- }
-
- private static class MruReference extends SoftReference {
- private final Object key;
-
- MruReference(MruEntry entry, ReferenceQueue queue) {
- super(entry.getValue(), queue);
- this.key = entry.getKey();
- }
-
- Object getKey() {
- return key;
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/src/main/java/freemarker/cache/MultiTemplateLoader.java b/src/main/java/freemarker/cache/MultiTemplateLoader.java
deleted file mode 100644
index 1500056..0000000
--- a/src/main/java/freemarker/cache/MultiTemplateLoader.java
+++ /dev/null
@@ -1,203 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A {@link TemplateLoader} that uses a set of other loaders to load the templates. On every request, loaders are
- * queried in the order of their appearance in the array of loaders provided to the constructor. However, if a request
- * for some template name was already satisfied in the past by one of the loaders, that Loader is queried first (a soft
- * affinity).
- *
- * <p>
- * This class is <em>not</em> thread-safe. If it's accessed from multiple threads concurrently, proper synchronization
- * must be provided by the callers. Note that {@link TemplateCache}, the natural user of this class, provides the
- * necessary synchronizations when it uses this class, so then you don't have to worry this.
- */
-public class MultiTemplateLoader implements StatefulTemplateLoader {
-
- private final TemplateLoader[] loaders;
- private final Map lastLoaderForName = Collections.synchronizedMap(new HashMap());
-
- /**
- * Creates a new multi template Loader that will use the specified loaders.
- *
- * @param loaders
- * the loaders that are used to load templates.
- */
- public MultiTemplateLoader(TemplateLoader[] loaders) {
- this.loaders = loaders.clone();
- }
-
- public Object findTemplateSource(String name)
- throws IOException {
- // Use soft affinity - give the loader that last found this
- // resource a chance to find it again first.
- TemplateLoader lastLoader = (TemplateLoader) lastLoaderForName.get(name);
- if (lastLoader != null) {
- Object source = lastLoader.findTemplateSource(name);
- if (source != null) {
- return new MultiSource(source, lastLoader);
- }
- }
-
- // If there is no affine loader, or it could not find the resource
- // again, try all loaders in order of appearance. If any manages
- // to find the resource, then associate it as the new affine loader
- // for this resource.
- for (int i = 0; i < loaders.length; ++i) {
- TemplateLoader loader = loaders[i];
- Object source = loader.findTemplateSource(name);
- if (source != null) {
- lastLoaderForName.put(name, loader);
- return new MultiSource(source, loader);
- }
- }
-
- lastLoaderForName.remove(name);
- // Resource not found
- return null;
- }
-
- private Object modifyForIcI(Object source) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public long getLastModified(Object templateSource) {
- return ((MultiSource) templateSource).getLastModified();
- }
-
- public Reader getReader(Object templateSource, String encoding)
- throws IOException {
- return ((MultiSource) templateSource).getReader(encoding);
- }
-
- public void closeTemplateSource(Object templateSource)
- throws IOException {
- ((MultiSource) templateSource).close();
- }
-
- public void resetState() {
- lastLoaderForName.clear();
- for (int i = 0; i < loaders.length; i++) {
- TemplateLoader loader = loaders[i];
- if (loader instanceof StatefulTemplateLoader) {
- ((StatefulTemplateLoader) loader).resetState();
- }
- }
- }
-
- /**
- * Represents a template source bound to a specific template loader. It serves as the complete template source
- * descriptor used by the MultiTemplateLoader class.
- */
- static final class MultiSource {
-
- private final Object source;
- private final TemplateLoader loader;
-
- MultiSource(Object source, TemplateLoader loader) {
- this.source = source;
- this.loader = loader;
- }
-
- long getLastModified() {
- return loader.getLastModified(source);
- }
-
- Reader getReader(String encoding)
- throws IOException {
- return loader.getReader(source, encoding);
- }
-
- void close()
- throws IOException {
- loader.closeTemplateSource(source);
- }
-
- Object getWrappedSource() {
- return source;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof MultiSource) {
- MultiSource m = (MultiSource) o;
- return m.loader.equals(loader) && m.source.equals(source);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return loader.hashCode() + 31 * source.hashCode();
- }
-
- @Override
- public String toString() {
- return source.toString();
- }
- }
-
- /**
- * Show class name and some details that are useful in template-not-found errors.
- *
- * @since 2.3.21
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("MultiTemplateLoader(");
- for (int i = 0; i < loaders.length; i++) {
- if (i != 0) {
- sb.append(", ");
- }
- sb.append("loader").append(i + 1).append(" = ").append(loaders[i]);
- }
- sb.append(")");
- return sb.toString();
- }
-
- /**
- * Returns the number of {@link TemplateLoader}-s directly inside this {@link TemplateLoader}.
- *
- * @since 2.3.23
- */
- public int getTemplateLoaderCount() {
- return loaders.length;
- }
-
- /**
- * Returns the {@link TemplateLoader} at the given index.
- *
- * @param index
- * Must be below {@link #getTemplateLoaderCount()}.
- */
- public TemplateLoader getTemplateLoader(int index) {
- return loaders[index];
- }
-
-}
diff --git a/src/main/java/freemarker/cache/NotMatcher.java b/src/main/java/freemarker/cache/NotMatcher.java
deleted file mode 100644
index 871b2bc..0000000
--- a/src/main/java/freemarker/cache/NotMatcher.java
+++ /dev/null
@@ -1,41 +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 freemarker.cache;
-
-import java.io.IOException;
-
-/**
- * Logical "not" operation on the given matcher.
- *
- * @since 2.3.24
- */
-public class NotMatcher extends TemplateSourceMatcher {
-
- private final TemplateSourceMatcher matcher;
-
- public NotMatcher(TemplateSourceMatcher matcher) {
- this.matcher = matcher;
- }
-
- @Override
- public boolean matches(String sourceName, Object templateSource) throws IOException {
- return !matcher.matches(sourceName, templateSource);
- }
-
-}
diff --git a/src/main/java/freemarker/cache/NullCacheStorage.java b/src/main/java/freemarker/cache/NullCacheStorage.java
deleted file mode 100644
index ff79412..0000000
--- a/src/main/java/freemarker/cache/NullCacheStorage.java
+++ /dev/null
@@ -1,66 +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 freemarker.cache;
-
-/**
- * A cache storage that doesn't store anything. Use this if you
- * don't want caching.
- *
- * @see freemarker.template.Configuration#setCacheStorage(CacheStorage)
- *
- * @since 2.3.17
- */
-public class NullCacheStorage implements ConcurrentCacheStorage, CacheStorageWithGetSize {
-
- /**
- * @since 2.3.22
- */
- public static final NullCacheStorage INSTANCE = new NullCacheStorage();
-
- public boolean isConcurrent() {
- return true;
- }
-
- public Object get(Object key) {
- return null;
- }
-
- public void put(Object key, Object value) {
- // do nothing
- }
-
- public void remove(Object key) {
- // do nothing
- }
-
- public void clear() {
- // do nothing
- }
-
- /**
- * Always returns 0.
- *
- * @since 2.3.21
- */
- public int getSize() {
- return 0;
- }
-
-}
diff --git a/src/main/java/freemarker/cache/OrMatcher.java b/src/main/java/freemarker/cache/OrMatcher.java
deleted file mode 100644
index 069063d..0000000
--- a/src/main/java/freemarker/cache/OrMatcher.java
+++ /dev/null
@@ -1,45 +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 freemarker.cache;
-
-import java.io.IOException;
-
-/**
- * Logical "or" operation among the given matchers.
- *
- * @since 2.3.24
- */
-public class OrMatcher extends TemplateSourceMatcher {
-
- private final TemplateSourceMatcher[] matchers;
-
- public OrMatcher(TemplateSourceMatcher... matchers) {
- if (matchers.length == 0) throw new IllegalArgumentException("Need at least 1 matcher, had 0.");
- this.matchers = matchers;
- }
-
- @Override
- public boolean matches(String sourceName, Object templateSource) throws IOException {
- for (TemplateSourceMatcher matcher : matchers) {
- if ((matcher.matches(sourceName, templateSource))) return true;
- }
- return false;
- }
-
-}
diff --git a/src/main/java/freemarker/cache/PathGlobMatcher.java b/src/main/java/freemarker/cache/PathGlobMatcher.java
deleted file mode 100644
index ac66c9a..0000000
--- a/src/main/java/freemarker/cache/PathGlobMatcher.java
+++ /dev/null
@@ -1,100 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.util.regex.Pattern;
-
-import freemarker.template.utility.StringUtil;
-
-/**
- * Matches the whole template source name (also known as template source path) with the given glob.
- * Note that the template source name is relative to the template storage root defined by the {@link TemplateLoader};
- * it's not the full path of a file on the file system.
- *
- * <p>This glob implementation recognizes {@code **} (Ant-style directory wildcard) among others. For more details see
- * {@link StringUtil#globToRegularExpression(String, boolean)}.
- *
- * <p>About the usage of {@code /} (slash):
- * <ul>
- * <li>You aren't allowed to start the glob with {@code /}, because template names (template paths) never start with
- * it.
- * <li>Future FreeMarker versions (compared to 2.3.24) might will support importing whole directories. Directory paths
- * in FreeMarker should end with {@code /}. Hence, {@code foo/bar} refers to the file {bar}, while
- * {@code foo/bar/} refers to the {bar} directory.
- * </ul>
- *
- * <p>By default the glob is case sensitive, but this can be changed with {@link #setCaseInsensitive(boolean)} (or
- * {@link #caseInsensitive(boolean)}).
- *
- * @since 2.3.24
- */
-public class PathGlobMatcher extends TemplateSourceMatcher {
-
- private final String glob;
-
- private Pattern pattern;
- private boolean caseInsensitive;
-
- /**
- * @param glob
- * Glob with the syntax defined by {@link StringUtil#globToRegularExpression(String, boolean)}. Must not
- * start with {@code /}.
- */
- public PathGlobMatcher(String glob) {
- if (glob.startsWith("/")) {
- throw new IllegalArgumentException("Absolute template paths need no inital \"/\"; remove it from: " + glob);
- }
- this.glob = glob;
- buildPattern();
- }
-
- private void buildPattern() {
- pattern = StringUtil.globToRegularExpression(glob, caseInsensitive);
- }
-
- @Override
- public boolean matches(String sourceName, Object templateSource) throws IOException {
- return pattern.matcher(sourceName).matches();
- }
-
- public boolean isCaseInsensitive() {
- return caseInsensitive;
- }
-
- /**
- * Sets if the matching will be case insensitive (UNICODE compliant); default is {@code false}.
- */
- public void setCaseInsensitive(boolean caseInsensitive) {
- boolean lastCaseInsensitive = this.caseInsensitive;
- this.caseInsensitive = caseInsensitive;
- if (lastCaseInsensitive != caseInsensitive) {
- buildPattern();
- }
- }
-
- /**
- * Fluid API variation of {@link #setCaseInsensitive(boolean)}
- */
- public PathGlobMatcher caseInsensitive(boolean caseInsensitive) {
- setCaseInsensitive(caseInsensitive);
- return this;
- }
-
-}
diff --git a/src/main/java/freemarker/cache/PathRegexMatcher.java b/src/main/java/freemarker/cache/PathRegexMatcher.java
deleted file mode 100644
index eb19c54..0000000
--- a/src/main/java/freemarker/cache/PathRegexMatcher.java
+++ /dev/null
@@ -1,54 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.util.regex.Pattern;
-
-import freemarker.template.utility.StringUtil;
-
-/**
- * Matches the whole template source name (also known as template source path) with the given regular expression.
- * Note that the template source name is relative to the template storage root defined by the {@link TemplateLoader};
- * it's not the full path of a file on the file system.
- *
- * @since 2.3.24
- */
-public class PathRegexMatcher extends TemplateSourceMatcher {
-
- private final Pattern pattern;
-
- /**
- * @param regex
- * Glob with the syntax defined by {@link StringUtil#globToRegularExpression(String)}. Must not
- * start with {@code /}.
- */
- public PathRegexMatcher(String regex) {
- if (regex.startsWith("/")) {
- throw new IllegalArgumentException("Absolute template paths need no inital \"/\"; remove it from: " + regex);
- }
- pattern = Pattern.compile(regex);
- }
-
- @Override
- public boolean matches(String sourceName, Object templateSource) throws IOException {
- return pattern.matcher(sourceName).matches();
- }
-
-}
diff --git a/src/main/java/freemarker/cache/SoftCacheStorage.java b/src/main/java/freemarker/cache/SoftCacheStorage.java
deleted file mode 100644
index 0aa871a..0000000
--- a/src/main/java/freemarker/cache/SoftCacheStorage.java
+++ /dev/null
@@ -1,141 +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 freemarker.cache;
-
-import java.lang.ref.Reference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import freemarker.template.utility.UndeclaredThrowableException;
-
-/**
- * Soft cache storage is a cache storage that uses {@link SoftReference} objects to hold the objects it was passed,
- * therefore allows the garbage collector to purge the cache when it determines that it wants to free up memory. This
- * class is thread-safe to the extent that its underlying map is. The parameterless constructor uses a thread-safe map
- * since 2.3.24 or Java 5.
- *
- * @see freemarker.template.Configuration#setCacheStorage(CacheStorage)
- */
-public class SoftCacheStorage implements ConcurrentCacheStorage, CacheStorageWithGetSize {
- private static final Method atomicRemove = getAtomicRemoveMethod();
-
- private final ReferenceQueue queue = new ReferenceQueue();
- private final Map map;
- private final boolean concurrent;
-
- /**
- * Creates an instance that uses a {@link ConcurrentMap} internally.
- */
- public SoftCacheStorage() {
- this(new ConcurrentHashMap());
- }
-
- /**
- * Returns true if the underlying Map is a {@code ConcurrentMap}.
- */
- public boolean isConcurrent() {
- return concurrent;
- }
-
- public SoftCacheStorage(Map backingMap) {
- map = backingMap;
- this.concurrent = map instanceof ConcurrentMap;
- }
-
- public Object get(Object key) {
- processQueue();
- Reference ref = (Reference) map.get(key);
- return ref == null ? null : ref.get();
- }
-
- public void put(Object key, Object value) {
- processQueue();
- map.put(key, new SoftValueReference(key, value, queue));
- }
-
- public void remove(Object key) {
- processQueue();
- map.remove(key);
- }
-
- public void clear() {
- map.clear();
- processQueue();
- }
-
- /**
- * Returns a close approximation of the number of cache entries.
- *
- * @since 2.3.21
- */
- public int getSize() {
- processQueue();
- return map.size();
- }
-
- private void processQueue() {
- for (; ; ) {
- SoftValueReference ref = (SoftValueReference) queue.poll();
- if (ref == null) {
- return;
- }
- Object key = ref.getKey();
- if (concurrent) {
- try {
- atomicRemove.invoke(map, new Object[] { key, ref });
- } catch (IllegalAccessException e) {
- throw new UndeclaredThrowableException(e);
- } catch (InvocationTargetException e) {
- throw new UndeclaredThrowableException(e);
- }
- } else if (map.get(key) == ref) {
- map.remove(key);
- }
- }
- }
-
- private static final class SoftValueReference extends SoftReference {
- private final Object key;
-
- SoftValueReference(Object key, Object value, ReferenceQueue queue) {
- super(value, queue);
- this.key = key;
- }
-
- Object getKey() {
- return key;
- }
- }
-
- private static Method getAtomicRemoveMethod() {
- try {
- return Class.forName("java.util.concurrent.ConcurrentMap").getMethod("remove", new Class[] { Object.class, Object.class });
- } catch (ClassNotFoundException e) {
- return null;
- } catch (NoSuchMethodException e) {
- throw new UndeclaredThrowableException(e);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/freemarker/cache/StatefulTemplateLoader.java b/src/main/java/freemarker/cache/StatefulTemplateLoader.java
deleted file mode 100644
index 0387793..0000000
--- a/src/main/java/freemarker/cache/StatefulTemplateLoader.java
+++ /dev/null
@@ -1,35 +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 freemarker.cache;
-
-import freemarker.template.Configuration;
-
-/**
- * Interface that can be implemented by template loaders that maintain some
- * sort of internal state (i.e. caches of earlier lookups for performance
- * optimization purposes etc.) and support resetting of their state.
- */
-public interface StatefulTemplateLoader extends TemplateLoader {
- /**
- * Invoked by {@link Configuration#clearTemplateCache()} to instruct this
- * template loader to throw away its current state and start afresh.
- */
- public void resetState();
-}
diff --git a/src/main/java/freemarker/cache/StringTemplateLoader.java b/src/main/java/freemarker/cache/StringTemplateLoader.java
deleted file mode 100644
index e3ccf1a..0000000
--- a/src/main/java/freemarker/cache/StringTemplateLoader.java
+++ /dev/null
@@ -1,176 +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 freemarker.cache;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import freemarker.template.utility.StringUtil;
-
-/**
- * A {@link TemplateLoader} that uses a {@link Map} with {@link String}-s as its source of
- * templates.
- *
- * In most case the regular way of loading templates from files will be fine.
- * However, there can be situations where you don't want to or can't load a
- * template from a file, e.g. if you have to deploy a single jar for
- * JavaWebStart or if they are contained within a database.
- * A single template can be created manually
- * e.g.
- * <pre>
- * String templateStr="Hello ${user}";
- * Template t = new Template("name", new StringReader(templateStr),
- * new Configuration());
- * </pre>
- * If, however, you want to create templates from strings which import other
- * templates this method doesn't work.
- *
- * In that case you can create a StringTemplateLoader and add each template to
- * it:
- * <pre>
- * StringTemplateLoader stringLoader = new StringTemplateLoader();
- * stringLoader.putTemplate("greetTemplate", "<#macro greet>Hello</#macro>");
- * stringLoader.putTemplate("myTemplate", "<#include \"greetTemplate\"><@greet/> World!");
- * </pre>
- * Then you tell your Configuration object to use it:
- * <pre>
- * cfg.setTemplateLoader(stringLoader);
- * </pre>
- * After that you should be able to use the templates as usual. Often you will
- * want to combine a <tt>StringTemplateLoader</tt> with another loader. You can
- * do so using a {@link freemarker.cache.MultiTemplateLoader}.
- */
-public class StringTemplateLoader implements TemplateLoader {
-
- private final Map<String, StringTemplateSource> templates = new HashMap<String, StringTemplateSource>();
-
- /**
- * Puts a template into the loader. A call to this method is identical to
- * the call to the three-arg {@link #putTemplate(String, String, long)}
- * passing <tt>System.currentTimeMillis()</tt> as the third argument.
- * @param name the name of the template.
- * @param templateSource the source code of the template.
- */
- public void putTemplate(String name, String templateSource) {
- putTemplate(name, templateSource, System.currentTimeMillis());
- }
-
- /**
- * Puts a template into the loader. The name can contain slashes to denote
- * logical directory structure, but must not start with a slash. If the
- * method is called multiple times for the same name and with different
- * last modified time, the configuration's template cache will reload the
- * template according to its own refresh settings (note that if the refresh
- * is disabled in the template cache, the template will not be reloaded).
- * Also, since the cache uses lastModified to trigger reloads, calling the
- * method with different source and identical timestamp won't trigger
- * reloading.
- * @param name the name of the template.
- * @param templateSource the source code of the template.
- * @param lastModified the time of last modification of the template in
- * terms of <tt>System.currentTimeMillis()</tt>
- */
- public void putTemplate(String name, String templateSource, long lastModified) {
- templates.put(name, new StringTemplateSource(name, templateSource, lastModified));
- }
-
- public void closeTemplateSource(Object templateSource) {
- }
-
- public Object findTemplateSource(String name) {
- return templates.get(name);
- }
-
- public long getLastModified(Object templateSource) {
- return ((StringTemplateSource) templateSource).lastModified;
- }
-
- public Reader getReader(Object templateSource, String encoding) {
- return new StringReader(((StringTemplateSource) templateSource).source);
- }
-
- private static class StringTemplateSource {
- private final String name;
- private final String source;
- private final long lastModified;
-
- StringTemplateSource(String name, String source, long lastModified) {
- if (name == null) {
- throw new IllegalArgumentException("name == null");
- }
- if (source == null) {
- throw new IllegalArgumentException("source == null");
- }
- if (lastModified < -1L) {
- throw new IllegalArgumentException("lastModified < -1L");
- }
- this.name = name;
- this.source = source;
- this.lastModified = lastModified;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof StringTemplateSource) {
- return name.equals(((StringTemplateSource) obj).name);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
- }
-
- /**
- * Show class name and some details that are useful in template-not-found errors.
- *
- * @since 2.3.21
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(TemplateLoaderUtils.getClassNameForToString(this));
- sb.append("(Map { ");
- int cnt = 0;
- for (Iterator it = templates.keySet().iterator(); it.hasNext(); ) {
- cnt++;
- if (cnt != 1) {
- sb.append(", ");
- }
- if (cnt > 10) {
- sb.append("...");
- break;
- }
- sb.append(StringUtil.jQuote(it.next()));
- sb.append("=...");
- }
- if (cnt != 0) {
- sb.append(' ');
- }
- sb.append("})");
- return sb.toString();
- }
-
-}
diff --git a/src/main/java/freemarker/cache/StrongCacheStorage.java b/src/main/java/freemarker/cache/StrongCacheStorage.java
deleted file mode 100644
index 53008bf..0000000
--- a/src/main/java/freemarker/cache/StrongCacheStorage.java
+++ /dev/null
@@ -1,67 +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 freemarker.cache;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Strong cache storage is a cache storage that simply wraps a {@link Map}. It holds a strong reference to all objects
- * it was passed, therefore prevents the cache from being purged during garbage collection. This class is always
- * thread-safe since 2.3.24, before that if we are running on Java 5 or later.
- *
- * @see freemarker.template.Configuration#setCacheStorage(CacheStorage)
- */
-public class StrongCacheStorage implements ConcurrentCacheStorage, CacheStorageWithGetSize {
-
- private final Map map = new ConcurrentHashMap();
-
- /**
- * Always returns {@code true}.
- */
- public boolean isConcurrent() {
- return true;
- }
-
- public Object get(Object key) {
- return map.get(key);
- }
-
- public void put(Object key, Object value) {
- map.put(key, value);
- }
-
- public void remove(Object key) {
- map.remove(key);
- }
-
- /**
- * Returns a close approximation of the number of cache entries.
- *
- * @since 2.3.21
- */
- public int getSize() {
- return map.size();
- }
-
- public void clear() {
- map.clear();
- }
-}
diff --git a/src/main/java/freemarker/cache/TemplateCache.java b/src/main/java/freemarker/cache/TemplateCache.java
deleted file mode 100644
index a357500..0000000
--- a/src/main/java/freemarker/cache/TemplateCache.java
+++ /dev/null
@@ -1,1016 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.lang.reflect.Method;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.StringTokenizer;
-
-import freemarker.cache.MultiTemplateLoader.MultiSource;
-import freemarker.core.BugException;
-import freemarker.core.Environment;
-import freemarker.core.TemplateConfiguration;
-import freemarker.log.Logger;
-import freemarker.template.Configuration;
-import freemarker.template.MalformedTemplateNameException;
-import freemarker.template.Template;
-import freemarker.template.TemplateNotFoundException;
-import freemarker.template._TemplateAPI;
-import freemarker.template.utility.NullArgumentException;
-import freemarker.template.utility.StringUtil;
-import freemarker.template.utility.UndeclaredThrowableException;
-
-/**
- * Performs caching and on-demand loading of the templates.
- * The actual template "file" loading is delegated to a {@link TemplateLoader} that you can specify in the constructor.
- * Some aspects of caching is delegated to a {@link CacheStorage} that you can also specify in the constructor.
- *
- * <p>Typically you don't instantiate or otherwise use this class directly. The {@link Configuration} embeds an
- * instance of this class, that you access indirectly through {@link Configuration#getTemplate(String)} and other
- * {@link Configuration} API-s. Then {@link TemplateLoader} and {@link CacheStorage} can be set with
- * {@link Configuration#setTemplateLoader(TemplateLoader)} and
- * {@link Configuration#setCacheStorage(CacheStorage)}.
- */
-public class TemplateCache {
-
- /**
- * The default template update delay; see {@link Configuration#setTemplateUpdateDelayMilliseconds(long)}.
- *
- * @since 2.3.23
- */
- public static final long DEFAULT_TEMPLATE_UPDATE_DELAY_MILLIS = 5000L;
-
- private static final String ASTERISKSTR = "*";
- private static final char ASTERISK = '*';
- private static final char SLASH = '/';
- private static final String LOCALE_PART_SEPARATOR = "_";
- private static final Logger LOG = Logger.getLogger("freemarker.cache");
-
- /** Maybe {@code null}. */
- private final TemplateLoader templateLoader;
-
- /** Here we keep our cached templates */
- private final CacheStorage storage;
- private final TemplateLookupStrategy templateLookupStrategy;
- private final TemplateNameFormat templateNameFormat;
- private final TemplateConfigurationFactory templateConfigurations;
-
- private final boolean isStorageConcurrent;
- /** {@link Configuration#setTemplateUpdateDelayMilliseconds(long)} */
- private long updateDelay = DEFAULT_TEMPLATE_UPDATE_DELAY_MILLIS;
- /** {@link Configuration#setLocalizedLookup(boolean)} */
- private boolean localizedLookup = true;
-
- private Configuration config;
-
- /**
- * Returns a template cache that will first try to load a template from
- * the file system relative to the current user directory (i.e. the value
- * of the system property <code>user.dir</code>), then from the classpath.
- *
- * @deprecated Use {@link #TemplateCache(TemplateLoader)} instead. The default loader is useless in most
- * applications, also it can mean a security risk.
- */
- @Deprecated
- public TemplateCache() {
- this(_TemplateAPI.createDefaultTemplateLoader(Configuration.VERSION_2_3_0));
- }
-
- /**
- * @deprecated Use {@link #TemplateCache(TemplateLoader, CacheStorage, Configuration)} instead.
- */
- @Deprecated
- public TemplateCache(TemplateLoader templateLoader) {
- this(templateLoader, (Configuration) null);
- }
-
- /**
- * @deprecated Use {@link #TemplateCache(TemplateLoader, CacheStorage, Configuration)} instead.
- */
- @Deprecated
- public TemplateCache(TemplateLoader templateLoader, CacheStorage cacheStorage) {
- this(templateLoader, cacheStorage, null);
- }
-
- /**
- * Same as {@link #TemplateCache(TemplateLoader, CacheStorage, Configuration)} with a new {@link SoftCacheStorage}
- * as the 2nd parameter.
- *
- * @since 2.3.21
- */
- public TemplateCache(TemplateLoader templateLoader, Configuration config) {
- this(templateLoader, _TemplateAPI.createDefaultCacheStorage(Configuration.VERSION_2_3_0), config);
- }
-
- /**
- * Same as
- * {@link #TemplateCache(TemplateLoader, CacheStorage, TemplateLookupStrategy, TemplateNameFormat, Configuration)}
- * with {@link TemplateLookupStrategy#DEFAULT_2_3_0} and {@link TemplateNameFormat#DEFAULT_2_3_0}.
- *
- * @since 2.3.21
- */
- public TemplateCache(TemplateLoader templateLoader, CacheStorage cacheStorage, Configuration config) {
- this(templateLoader, cacheStorage,
- _TemplateAPI.getDefaultTemplateLookupStrategy(Configuration.VERSION_2_3_0),
- _TemplateAPI.getDefaultTemplateNameFormat(Configuration.VERSION_2_3_0),
- config);
- }
-
- /**
- * Same as
- * {@link TemplateCache#TemplateCache(TemplateLoader, CacheStorage, TemplateLookupStrategy, TemplateNameFormat,
- * TemplateConfigurationFactory, Configuration)} with {@code null} for {@code templateConfigurations}-s.
- *
- * @since 2.3.22
- */
- public TemplateCache(TemplateLoader templateLoader, CacheStorage cacheStorage,
- TemplateLookupStrategy templateLookupStrategy, TemplateNameFormat templateNameFormat,
- Configuration config) {
- this(templateLoader, cacheStorage, templateLookupStrategy, templateNameFormat, null, config);
- }
-
- /**
- * @param templateLoader
- * The {@link TemplateLoader} to use. Can't be {@code null}.
- * @param cacheStorage
- * The {@link CacheStorage} to use. Can't be {@code null}.
- * @param templateLookupStrategy
- * The {@link TemplateLookupStrategy} to use. Can't be {@code null}.
- * @param templateNameFormat
- * The {@link TemplateNameFormat} to use. Can't be {@code null}.
- * @param templateConfigurations
- * The {@link TemplateConfigurationFactory} to use. Can be {@code null} (then all templates will use the
- * settings coming from the {@link Configuration} as is).
- * @param config
- * The {@link Configuration} this cache will be used for. Can be {@code null} for backward compatibility,
- * as it can be set with {@link #setConfiguration(Configuration)} later.
- *
- * @since 2.3.24
- */
- public TemplateCache(TemplateLoader templateLoader, CacheStorage cacheStorage,
- TemplateLookupStrategy templateLookupStrategy, TemplateNameFormat templateNameFormat,
- TemplateConfigurationFactory templateConfigurations,
- Configuration config) {
- this.templateLoader = templateLoader;
-
- NullArgumentException.check("cacheStorage", cacheStorage);
- this.storage = cacheStorage;
- isStorageConcurrent = cacheStorage instanceof ConcurrentCacheStorage &&
- ((ConcurrentCacheStorage) cacheStorage).isConcurrent();
-
- NullArgumentException.check("templateLookupStrategy", templateLookupStrategy);
- this.templateLookupStrategy = templateLookupStrategy;
-
- NullArgumentException.check("templateNameFormat", templateNameFormat);
- this.templateNameFormat = templateNameFormat;
-
- // Can be null
- this.templateConfigurations = templateConfigurations;
-
- this.config = config;
- }
-
- /**
- * Sets the configuration object to which this cache belongs. This
- * method is called by the configuration itself to establish the
- * relation, and should not be called by users.
- *
- * @deprecated Use the {@link #TemplateCache(TemplateLoader, CacheStorage, Configuration)} constructor.
- */
- @Deprecated
- public void setConfiguration(Configuration config) {
- this.config = config;
- clear();
- }
-
- public TemplateLoader getTemplateLoader() {
- return templateLoader;
- }
-
- public CacheStorage getCacheStorage() {
- return storage;
- }
-
- /**
- * @since 2.3.22
- */
- public TemplateLookupStrategy getTemplateLookupStrategy() {
- return templateLookupStrategy;
- }
-
- /**
- * @since 2.3.22
- */
- public TemplateNameFormat getTemplateNameFormat() {
- return templateNameFormat;
- }
-
- /**
- * @since 2.3.24
- */
- public TemplateConfigurationFactory getTemplateConfigurations() {
- return templateConfigurations;
- }
-
- /**
- * Retrieves the template with the given name (and according the specified further parameters) from the template
- * cache, loading it into the cache first if it's missing/staled.
- *
- * <p>
- * All parameters must be non-{@code null}, except {@code customLookupCondition}. For the meaning of the parameters
- * see {@link Configuration#getTemplate(String, Locale, String, boolean)}.
- *
- * @return A {@link MaybeMissingTemplate} object that contains the {@link Template}, or a
- * {@link MaybeMissingTemplate} object that contains {@code null} as the {@link Template} and information
- * about the missing template. The return value itself is never {@code null}. Note that exceptions occurring
- * during template loading will not be classified as a missing template, so they will cause an exception to
- * be thrown by this method instead of returning a {@link MaybeMissingTemplate}. The idea is that having a
- * missing template is normal (not exceptional), providing that the backing storage mechanism could indeed
- * check that it's missing.
- *
- * @throws MalformedTemplateNameException
- * If the {@code name} was malformed according the current {@link TemplateNameFormat}. However, if the
- * {@link TemplateNameFormat} is {@link TemplateNameFormat#DEFAULT_2_3_0} and
- * {@link Configuration#getIncompatibleImprovements()} is less than 2.4.0, then instead of throwing this
- * exception, a {@link MaybeMissingTemplate} will be returned, similarly as if the template were missing
- * (the {@link MaybeMissingTemplate#getMissingTemplateReason()} will describe the real error).
- *
- * @throws IOException
- * If reading the template has failed from a reason other than the template is missing. This method
- * should never be a {@link TemplateNotFoundException}, as that condition is indicated in the return
- * value.
- *
- * @since 2.3.22
- */
- public MaybeMissingTemplate getTemplate(String name, Locale locale, Object customLookupCondition,
- String encoding, boolean parseAsFTL)
- throws IOException {
- NullArgumentException.check("name", name);
- NullArgumentException.check("locale", locale);
- NullArgumentException.check("encoding", encoding);
-
- try {
- name = templateNameFormat.normalizeAbsoluteName(name);
- } catch (MalformedTemplateNameException e) {
- // If we don't have to emulate backward compatible behavior, then just rethrow it:
- if (templateNameFormat != TemplateNameFormat.DEFAULT_2_3_0
- || config.getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_4_0) {
- throw e;
- }
- return new MaybeMissingTemplate(null, e);
- }
-
- if (templateLoader == null) {
- return new MaybeMissingTemplate(name, "The TemplateLoader was null.");
- }
-
- Template template = getTemplateInternal(name, locale, customLookupCondition, encoding, parseAsFTL);
- return template != null ? new MaybeMissingTemplate(template) : new MaybeMissingTemplate(name, (String) null);
- }
-
- /**
- * Similar to {@link #getTemplate(String, Locale, Object, String, boolean)} with {@code null}
- * {@code customLookupCondition}.
- *
- * @return {@link MaybeMissingTemplate#getTemplate()} of the
- * {@link #getTemplate(String, Locale, Object, String, boolean)} return value.
- *
- * @deprecated Use {@link #getTemplate(String, Locale, Object, String, boolean)}, which can return more detailed
- * result when the template is missing.
- */
- @Deprecated
- public Template getTemplate(String name, Locale locale, String encoding, boolean parseAsFTL)
- throws IOException {
- return getTemplate(name, locale, null, encoding, parseAsFTL).getTemplate();
- }
-
- /**
- * Returns the deprecated default template loader of FreeMarker 2.3.0.
- *
- * @deprecated The {@link TemplateLoader} should be always specified by the constructor caller.
- */
- @Deprecated
- protected static TemplateLoader createLegacyDefaultTemplateLoader() {
- return _TemplateAPI.createDefaultTemplateLoader(Configuration.VERSION_2_3_0);
- }
-
- private Template getTemplateInternal(
- final String name, final Locale locale, final Object customLookupCondition,
- final String encoding, final boolean parseAsFTL)
- throws IOException {
- final boolean debug = LOG.isDebugEnabled();
- final String debugName = debug
- ? buildDebugName(name, locale, customLookupCondition, encoding, parseAsFTL)
- : null;
- final TemplateKey tk = new TemplateKey(name, locale, customLookupCondition, encoding, parseAsFTL);
-
- CachedTemplate cachedTemplate;
- if (isStorageConcurrent) {
- cachedTemplate = (CachedTemplate) storage.get(tk);
- } else {
- synchronized (storage) {
- cachedTemplate = (CachedTemplate) storage.get(tk);
- }
- }
-
- final long now = System.currentTimeMillis();
-
- long lastModified = -1L;
- boolean rethrown = false;
- TemplateLookupResult newLookupResult = null;
- try {
- if (cachedTemplate != null) {
- // If we're within the refresh delay, return the cached copy
- if (now - cachedTemplate.lastChecked < updateDelay) {
- if (debug) {
- LOG.debug(debugName + " cached copy not yet stale; using cached.");
- }
- // Can be null, indicating a cached negative lookup
- Object t = cachedTemplate.templateOrException;
- if (t instanceof Template || t == null) {
- return (Template) t;
- } else if (t instanceof RuntimeException) {
- throwLoadFailedException((RuntimeException) t);
- } else if (t instanceof IOException) {
- rethrown = true;
- throwLoadFailedException((IOException) t);
- }
- throw new BugException("t is " + t.getClass().getName());
- }
-
- // Clone as the instance bound to the map should be treated as
- // immutable to ensure proper concurrent semantics
- cachedTemplate = cachedTemplate.cloneCachedTemplate();
- // Update the last-checked flag
- cachedTemplate.lastChecked = now;
-
- // Find the template source
- newLookupResult = lookupTemplate(name, locale, customLookupCondition);
-
- // Template source was removed
- if (!newLookupResult.isPositive()) {
- if (debug) {
- LOG.debug(debugName + " no source found.");
- }
- storeNegativeLookup(tk, cachedTemplate, null);
- return null;
- }
-
- // If the source didn't change and its last modified date
- // also didn't change, return the cached version.
- final Object newLookupResultSource = newLookupResult.getTemplateSource();
- lastModified = templateLoader.getLastModified(newLookupResultSource);
- boolean lastModifiedNotChanged = lastModified == cachedTemplate.lastModified;
- boolean sourceEquals = newLookupResultSource.equals(cachedTemplate.source);
- if (lastModifiedNotChanged && sourceEquals) {
- if (debug) {
- LOG.debug(debugName + ": using cached since " + newLookupResultSource + " hasn't changed.");
- }
- storeCached(tk, cachedTemplate);
- return (Template) cachedTemplate.templateOrException;
- } else if (debug) {
- if (!sourceEquals) {
- LOG.debug("Updating source because: " +
- "sourceEquals=" + sourceEquals +
- ", newlyFoundSource=" + StringUtil.jQuoteNoXSS(newLookupResultSource) +
- ", cached.source=" + StringUtil.jQuoteNoXSS(cachedTemplate.source));
- } else if (!lastModifiedNotChanged) {
- LOG.debug("Updating source because: " +
- "lastModifiedNotChanged=" + lastModifiedNotChanged +
- ", cached.lastModified=" + cachedTemplate.lastModified +
- " != source.lastModified=" + lastModified);
- }
- }
- } else {
- if (debug) {
- LOG.debug("Couldn't find template in cache for " + debugName + "; will try to load it.");
- }
-
- // Construct a new CachedTemplate entry. Note we set the
- // cachedTemplate.lastModified to Long.MIN_VALUE. This is
- // a flag that signs it has to be explicitly queried later on.
- cachedTemplate = new CachedTemplate();
- cachedTemplate.lastChecked = now;
-
- newLookupResult = lookupTemplate(name, locale, customLookupCondition);
-
- if (!newLookupResult.isPositive()) {
- storeNegativeLookup(tk, cachedTemplate, null);
- return null;
- }
-
- cachedTemplate.lastModified = lastModified = Long.MIN_VALUE;
- }
-
- Object source = newLookupResult.getTemplateSource();
- cachedTemplate.source = source;
-
- // If we get here, then we need to (re)load the template
- if (debug) {
- LOG.debug("Loading template for " + debugName + " from " + StringUtil.jQuoteNoXSS(source));
- }
-
- lastModified = lastModified == Long.MIN_VALUE ? templateLoader.getLastModified(source) : lastModified;
- Template template = loadTemplate(
- source,
- name, newLookupResult.getTemplateSourceName(), locale, customLookupCondition,
- encoding, parseAsFTL);
- cachedTemplate.templateOrException = template;
- cachedTemplate.lastModified = lastModified;
- storeCached(tk, cachedTemplate);
- return template;
- } catch (RuntimeException e) {
- if (cachedTemplate != null) {
- storeNegativeLookup(tk, cachedTemplate, e);
- }
- throw e;
- } catch (IOException e) {
- if (!rethrown) {
- storeNegativeLookup(tk, cachedTemplate, e);
- }
- throw e;
- } finally {
- if (newLookupResult != null && newLookupResult.isPositive()) {
- templateLoader.closeTemplateSource(newLookupResult.getTemplateSource());
- }
- }
- }
-
- private static final Method INIT_CAUSE = getInitCauseMethod();
-
- private static final Method getInitCauseMethod() {
- try {
- return Throwable.class.getMethod("initCause", new Class[] { Throwable.class });
- } catch (NoSuchMethodException e) {
- return null;
- }
- }
-
- /**
- * Creates an {@link IOException} that has a cause exception.
- */
- // [Java 6] Remove
- private IOException newIOException(String message, Throwable cause) {
- if (cause == null) {
- return new IOException(message);
- }
-
- IOException ioe;
- if (INIT_CAUSE != null) {
- ioe = new IOException(message);
- try {
- INIT_CAUSE.invoke(ioe, cause);
- } catch (RuntimeException ex) {
- throw ex;
- } catch (Exception ex) {
- throw new UndeclaredThrowableException(ex);
- }
- } else {
- ioe = new IOException(message + "\nCaused by: " + cause.getClass().getName() +
- ": " + cause.getMessage());
- }
- return ioe;
- }
-
- private void throwLoadFailedException(Throwable e) throws IOException {
- throw newIOException("There was an error loading the " +
- "template on an earlier attempt; see cause exception.", e);
- }
-
- private void storeNegativeLookup(TemplateKey tk,
- CachedTemplate cachedTemplate, Exception e) {
- cachedTemplate.templateOrException = e;
- cachedTemplate.source = null;
- cachedTemplate.lastModified = 0L;
- storeCached(tk, cachedTemplate);
- }
-
- private void storeCached(TemplateKey tk, CachedTemplate cachedTemplate) {
- if (isStorageConcurrent) {
- storage.put(tk, cachedTemplate);
- } else {
- synchronized (storage) {
- storage.put(tk, cachedTemplate);
- }
- }
- }
-
- private Template loadTemplate(
- final Object source,
- final String name, final String sourceName, Locale locale, final Object customLookupCondition,
- String initialEncoding, final boolean parseAsFTL) throws IOException {
- final TemplateConfiguration tc;
- try {
- tc = templateConfigurations != null ? templateConfigurations.get(sourceName, source) : null;
- } catch (TemplateConfigurationFactoryException e) {
- throw newIOException("Error while getting TemplateConfiguration; see cause exception.", e);
- }
- if (tc != null) {
- // TC.{encoding,locale} is stronger than the cfg.getTemplate arguments by design.
- if (tc.isEncodingSet()) {
- initialEncoding = tc.getEncoding();
- }
- if (tc.isLocaleSet()) {
- locale = tc.getLocale();
- }
- }
-
- Template template;
- {
- if (parseAsFTL) {
- try {
- final Reader reader = templateLoader.getReader(source, initialEncoding);
- try {
- template = new Template(name, sourceName, reader, config, tc, initialEncoding);
- } finally {
- reader.close();
- }
- } catch (Template.WrongEncodingException wee) {
- String actualEncoding = wee.getTemplateSpecifiedEncoding();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Initial encoding \"" + initialEncoding + "\" was incorrect, re-reading with \""
- + actualEncoding + "\". Template: " + sourceName);
- }
-
- final Reader reader = templateLoader.getReader(source, actualEncoding);
- try {
- template = new Template(name, sourceName, reader, config, tc, actualEncoding);
- } finally {
- reader.close();
- }
- }
- } else {
- // Read the contents into a StringWriter, then construct a single-text-block template from it.
- final StringWriter sw = new StringWriter();
- final char[] buf = new char[4096];
- final Reader reader = templateLoader.getReader(source, initialEncoding);
- try {
- fetchChars: while (true) {
- int charsRead = reader.read(buf);
- if (charsRead > 0) {
- sw.write(buf, 0, charsRead);
- } else if (charsRead < 0) {
- break fetchChars;
- }
- }
- } finally {
- reader.close();
- }
- template = Template.getPlainTextTemplate(name, sourceName, sw.toString(), config);
- template.setEncoding(initialEncoding);
- }
- }
-
- if (tc != null) {
- tc.apply(template);
- }
-
- template.setLocale(locale);
- template.setCustomLookupCondition(customLookupCondition);
- return template;
- }
-
- /**
- * Gets the delay in milliseconds between checking for newer versions of a
- * template source.
- * @return the current value of the delay
- */
- public long getDelay() {
- // synchronized was moved here so that we don't advertise that it's thread-safe, as it's not.
- synchronized (this) {
- return updateDelay;
- }
- }
-
- /**
- * Sets the delay in milliseconds between checking for newer versions of a
- * template sources.
- * @param delay the new value of the delay
- */
- public void setDelay(long delay) {
- // synchronized was moved here so that we don't advertise that it's thread-safe, as it's not.
- synchronized (this) {
- this.updateDelay = delay;
- }
- }
-
- /**
- * Returns if localized template lookup is enabled or not.
- */
- public boolean getLocalizedLookup() {
- // synchronized was moved here so that we don't advertise that it's thread-safe, as it's not.
- synchronized (this) {
- return localizedLookup;
- }
- }
-
- /**
- * Setis if localized template lookup is enabled or not.
- */
- public void setLocalizedLookup(boolean localizedLookup) {
- // synchronized was moved here so that we don't advertise that it's thread-safe, as it's not.
- synchronized (this) {
- if (this.localizedLookup != localizedLookup) {
- this.localizedLookup = localizedLookup;
- clear();
- }
- }
- }
-
- /**
- * Removes all entries from the cache, forcing reloading of templates
- * on subsequent {@link #getTemplate(String, Locale, String, boolean)}
- * calls. If the configured template loader is
- * {@link StatefulTemplateLoader stateful}, then its
- * {@link StatefulTemplateLoader#resetState()} method is invoked as well.
- */
- public void clear() {
- synchronized (storage) {
- storage.clear();
- if (templateLoader instanceof StatefulTemplateLoader) {
- ((StatefulTemplateLoader) templateLoader).resetState();
- }
- }
- }
-
- /**
- * Same as {@link #removeTemplate(String, Locale, Object, String, boolean)} with {@code null}
- * {@code customLookupCondition}.
- */
- public void removeTemplate(
- String name, Locale locale, String encoding, boolean parse) throws IOException {
- removeTemplate(name, locale, null, encoding, parse);
- }
-
- /**
- * Removes an entry from the cache, hence forcing the re-loading of it when it's next time requested. (It doesn't
- * delete the template file itself.) This is to give the application finer control over cache updating than
- * {@link #setDelay(long)} alone does.
- *
- * For the meaning of the parameters, see
- * {@link Configuration#getTemplate(String, Locale, Object, String, boolean, boolean)}
- */
- public void removeTemplate(
- String name, Locale locale, Object customLookupCondition, String encoding, boolean parse)
- throws IOException {
- if (name == null) {
- throw new IllegalArgumentException("Argument \"name\" can't be null");
- }
- if (locale == null) {
- throw new IllegalArgumentException("Argument \"locale\" can't be null");
- }
- if (encoding == null) {
- throw new IllegalArgumentException("Argument \"encoding\" can't be null");
- }
- name = templateNameFormat.normalizeAbsoluteName(name);
- if (name != null && templateLoader != null) {
- boolean debug = LOG.isDebugEnabled();
- String debugName = debug
- ? buildDebugName(name, locale, customLookupCondition, encoding, parse)
- : null;
- TemplateKey tk = new TemplateKey(name, locale, customLookupCondition, encoding, parse);
-
- if (isStorageConcurrent) {
- storage.remove(tk);
- } else {
- synchronized (storage) {
- storage.remove(tk);
- }
- }
- if (debug) {
- LOG.debug(debugName + " was removed from the cache, if it was there");
- }
- }
- }
-
- private String buildDebugName(String name, Locale locale, Object customLookupCondition, String encoding,
- boolean parse) {
- return StringUtil.jQuoteNoXSS(name) + "("
- + StringUtil.jQuoteNoXSS(locale)
- + (customLookupCondition != null ? ", cond=" + StringUtil.jQuoteNoXSS(customLookupCondition) : "")
- + ", " + encoding
- + (parse ? ", parsed)" : ", unparsed]");
- }
-
- /**
- * @deprecated Use {@link Environment#toFullTemplateName(String, String)} instead, as that can throw
- * {@link MalformedTemplateNameException}, and is on a more logical place anyway.
- *
- * @throws IllegalArgumentException
- * If the {@code baseName} or {@code targetName} is malformed according the {@link TemplateNameFormat}
- * in use.
- */
- @Deprecated
- public static String getFullTemplatePath(Environment env, String baseName, String targetName) {
- try {
- return env.toFullTemplateName(baseName, targetName);
- } catch (MalformedTemplateNameException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- private TemplateLookupResult lookupTemplate(String name, Locale locale, Object customLookupCondition)
- throws IOException {
- final TemplateLookupResult lookupResult = templateLookupStrategy.lookup(
- new TemplateCacheTemplateLookupContext(name, locale, customLookupCondition));
- if (lookupResult == null) {
- throw new NullPointerException("Lookup result shouldn't be null");
- }
- return lookupResult;
- }
-
- private TemplateLookupResult lookupTemplateWithAcquisitionStrategy(String path) throws IOException {
- int asterisk = path.indexOf(ASTERISK);
- // Shortcut in case there is no acquisition
- if (asterisk == -1) {
- return TemplateLookupResult.from(path, findTemplateSource(path));
- }
- StringTokenizer tok = new StringTokenizer(path, "/");
- int lastAsterisk = -1;
- List tokpath = new ArrayList();
- while (tok.hasMoreTokens()) {
- String pathToken = tok.nextToken();
- if (pathToken.equals(ASTERISKSTR)) {
- if (lastAsterisk != -1) {
- tokpath.remove(lastAsterisk);
- }
- lastAsterisk = tokpath.size();
- }
- tokpath.add(pathToken);
- }
- if (lastAsterisk == -1) { // if there was no real "*" step after all
- return TemplateLookupResult.from(path, findTemplateSource(path));
- }
- String basePath = concatPath(tokpath, 0, lastAsterisk);
- String resourcePath = concatPath(tokpath, lastAsterisk + 1, tokpath.size());
- if (resourcePath.endsWith("/")) {
- resourcePath = resourcePath.substring(0, resourcePath.length() - 1);
- }
- StringBuilder buf = new StringBuilder(path.length()).append(basePath);
- int l = basePath.length();
- for (; ; ) {
- String fullPath = buf.append(resourcePath).toString();
- Object templateSource = findTemplateSource(fullPath);
- if (templateSource != null) {
- return TemplateLookupResult.from(fullPath, templateSource);
- }
- if (l == 0) {
- return TemplateLookupResult.createNegativeResult();
- }
- l = basePath.lastIndexOf(SLASH, l - 2) + 1;
- buf.setLength(l);
- }
- }
-
- private Object findTemplateSource(String path) throws IOException {
- final Object result = templateLoader.findTemplateSource(path);
- if (LOG.isDebugEnabled()) {
- LOG.debug("TemplateLoader.findTemplateSource(" + StringUtil.jQuote(path) + "): "
- + (result == null ? "Not found" : "Found"));
- }
- return modifyForConfIcI(result);
- }
-
- /**
- * If IcI >= 2.3.21, sets {@link URLTemplateSource#setUseCaches(boolean)} to {@code false} for sources that come
- * from a {@link TemplateLoader} where {@link URLConnection} cache usage wasn't set explicitly.
- */
- private Object modifyForConfIcI(Object templateSource) {
- if (templateSource == null) return null;
-
- if (config.getIncompatibleImprovements().intValue() < _TemplateAPI.VERSION_INT_2_3_21) {
- return templateSource;
- }
-
- if (templateSource instanceof URLTemplateSource) {
- URLTemplateSource urlTemplateSource = (URLTemplateSource) templateSource;
- if (urlTemplateSource.getUseCaches() == null) { // It was left unset
- urlTemplateSource.setUseCaches(false);
- }
- } else if (templateSource instanceof MultiSource) {
- modifyForConfIcI(((MultiSource) templateSource).getWrappedSource());
- }
- return templateSource;
- }
-
- private String concatPath(List path, int from, int to) {
- StringBuilder buf = new StringBuilder((to - from) * 16);
- for (int i = from; i < to; ++i) {
- buf.append(path.get(i)).append('/');
- }
- return buf.toString();
- }
-
- /**
- * This class holds a (name, locale) pair and is used as the key in
- * the cached templates map.
- */
- private static final class TemplateKey {
- private final String name;
- private final Locale locale;
- private final Object customLookupCondition;
- private final String encoding;
- private final boolean parse;
-
- TemplateKey(String name, Locale locale, Object customLookupCondition, String encoding, boolean parse) {
- this.name = name;
- this.locale = locale;
- this.customLookupCondition = customLookupCondition;
- this.encoding = encoding;
- this.parse = parse;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof TemplateKey) {
- TemplateKey tk = (TemplateKey) o;
- return
- parse == tk.parse &&
- name.equals(tk.name) &&
- locale.equals(tk.locale) &&
- nullSafeEquals(customLookupCondition, tk.customLookupCondition) &&
- encoding.equals(tk.encoding);
- }
- return false;
- }
-
- private boolean nullSafeEquals(Object o1, Object o2) {
- return o1 != null
- ? (o2 != null ? o1.equals(o2) : false)
- : o2 == null;
- }
-
- @Override
- public int hashCode() {
- return
- name.hashCode() ^
- locale.hashCode() ^
- encoding.hashCode() ^
- (customLookupCondition != null ? customLookupCondition.hashCode() : 0) ^
- Boolean.valueOf(!parse).hashCode();
- }
- }
-
- /**
- * This class holds the cached template and associated information
- * (the source object (already closed), and the last-checked and last-modified time stamps).
- * It is used as the value in the cached templates map. Note: this class
- * is Serializable to allow custom 3rd party CacheStorage implementations
- * to serialize/replicate them (see tracker issue #1926150); FreeMarker
- * code itself doesn't rely on its serializability.
- */
- private static final class CachedTemplate implements Cloneable, Serializable {
- private static final long serialVersionUID = 1L;
-
- Object templateOrException;
- Object source;
- long lastChecked;
- long lastModified;
-
- public CachedTemplate cloneCachedTemplate() {
- try {
- return (CachedTemplate) super.clone();
- } catch (CloneNotSupportedException e) {
- throw new UndeclaredThrowableException(e);
- }
- }
- }
-
- private class TemplateCacheTemplateLookupContext extends TemplateLookupContext {
-
- TemplateCacheTemplateLookupContext(String templateName, Locale templateLocale, Object customLookupCondition) {
- super(templateName, localizedLookup ? templateLocale : null, customLookupCondition);
- }
-
- @Override
- public TemplateLookupResult lookupWithAcquisitionStrategy(String name) throws IOException {
- // Only one of the possible ways of making a name non-normalized, but is the easiest mistake to do:
- if (name.startsWith("/")) {
- throw new IllegalArgumentException("Non-normalized name, starts with \"/\": " + name);
- }
-
- return TemplateCache.this.lookupTemplateWithAcquisitionStrategy(name);
- }
-
- @Override
- public TemplateLookupResult lookupWithLocalizedThenAcquisitionStrategy(final String templateName,
- final Locale templateLocale) throws IOException {
-
- if (templateLocale == null) {
- return lookupWithAcquisitionStrategy(templateName);
- }
-
- int lastDot = templateName.lastIndexOf('.');
- String prefix = lastDot == -1 ? templateName : templateName.substring(0, lastDot);
- String suffix = lastDot == -1 ? "" : templateName.substring(lastDot);
- String localeName = LOCALE_PART_SEPARATOR + templateLocale.toString();
- StringBuilder buf = new StringBuilder(templateName.length() + localeName.length());
- buf.append(prefix);
- tryLocaleNameVariations: while (true) {
- buf.setLength(prefix.length());
- String path = buf.append(localeName).append(suffix).toString();
- TemplateLookupResult lookupResult = lookupWithAcquisitionStrategy(path);
- if (lookupResult.isPositive()) {
- return lookupResult;
- }
-
- int lastUnderscore = localeName.lastIndexOf('_');
- if (lastUnderscore == -1) {
- break tryLocaleNameVariations;
- }
- localeName = localeName.substring(0, lastUnderscore);
- }
- return createNegativeLookupResult();
- }
-
- }
-
- /**
- * Used for the return value of {@link TemplateCache#getTemplate(String, Locale, Object, String, boolean)}.
- *
- * @since 2.3.22
- */
- public final static class MaybeMissingTemplate {
-
- private final Template template;
- private final String missingTemplateNormalizedName;
- private final String missingTemplateReason;
- private final MalformedTemplateNameException missingTemplateCauseException;
-
- private MaybeMissingTemplate(Template template) {
- this.template = template;
- this.missingTemplateNormalizedName = null;
- this.missingTemplateReason = null;
- this.missingTemplateCauseException = null;
- }
-
- private MaybeMissingTemplate(String normalizedName, MalformedTemplateNameException missingTemplateCauseException) {
- this.template = null;
- this.missingTemplateNormalizedName = normalizedName;
- this.missingTemplateReason = null;
- this.missingTemplateCauseException = missingTemplateCauseException;
- }
-
- private MaybeMissingTemplate(String normalizedName, String missingTemplateReason) {
- this.template = null;
- this.missingTemplateNormalizedName = normalizedName;
- this.missingTemplateReason = missingTemplateReason;
- this.missingTemplateCauseException = null;
- }
-
- /**
- * The {@link Template} if it wasn't missing, otherwise {@code null}.
- */
- public Template getTemplate() {
- return template;
- }
-
- /**
- * When the template was missing, this <em>possibly</em> contains the explanation, or {@code null}. If the
- * template wasn't missing (i.e., when {@link #getTemplate()} return non-{@code null}) this is always
- * {@code null}.
- */
- public String getMissingTemplateReason() {
- return missingTemplateReason != null
- ? missingTemplateReason
- : (missingTemplateCauseException != null
- ? missingTemplateCauseException.getMalformednessDescription()
- : null);
- }
-
- /**
- * When the template was missing, this <em>possibly</em> contains its normalized name. If the template wasn't
- * missing (i.e., when {@link #getTemplate()} return non-{@code null}) this is always {@code null}. When the
- * template is missing, it will be {@code null} for example if the normalization itself was unsuccessful.
- */
- public String getMissingTemplateNormalizedName() {
- return missingTemplateNormalizedName;
- }
-
- }
-
-}
diff --git a/src/main/java/freemarker/cache/TemplateConfigurationFactory.java b/src/main/java/freemarker/cache/TemplateConfigurationFactory.java
deleted file mode 100644
index ec8d2ae..0000000
--- a/src/main/java/freemarker/cache/TemplateConfigurationFactory.java
+++ /dev/null
@@ -1,91 +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 freemarker.cache;
-
-import java.io.IOException;
-
-import freemarker.core.TemplateConfiguration;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-
-/**
- * Creates (or returns) {@link TemplateConfiguration}-s for template sources.
- *
- * @since 2.3.24
- */
-public abstract class TemplateConfigurationFactory {
-
- private Configuration cfg;
-
- /**
- * Returns (maybe creates) the {@link TemplateConfiguration} for the given template source.
- *
- * @param sourceName
- * The name (path) that was used for {@link TemplateLoader#findTemplateSource(String)}. See
- * {@link Template#getSourceName()} for details.
- * @param templateSource
- * The object returned by {@link TemplateLoader#findTemplateSource(String)}.
- *
- * @return The {@link TemplateConfiguration} to apply, or {@code null} if the there's no {@link TemplateConfiguration} for
- * this template source.
- *
- * @throws IOException
- * Typically, if there factory needs further I/O to find out more about the template source, but that
- * fails.
- * @throws TemplateConfigurationFactoryException
- * If there's a problem that's specific to the factory logic.
- */
- public abstract TemplateConfiguration get(String sourceName, Object templateSource)
- throws IOException, TemplateConfigurationFactoryException;
-
- /**
- * Binds this {@link TemplateConfigurationFactory} to a {@link Configuration}. Once it's bound, it can't be bound to
- * another {@link Configuration} any more. This is automatically called by
- * {@link Configuration#setTemplateConfigurations(TemplateConfigurationFactory)}.
- */
- public final void setConfiguration(Configuration cfg) {
- if (this.cfg != null) {
- if (cfg != this.cfg) {
- throw new IllegalStateException(
- "The TemplateConfigurationFactory is already bound to another Configuration");
- }
- return;
- } else {
- this.cfg = cfg;
- setConfigurationOfChildren(cfg);
- }
- }
-
- /**
- * Returns the configuration this object belongs to, or {@code null} if it isn't yet bound to a
- * {@link Configuration}.
- */
- public Configuration getConfiguration() {
- return cfg;
- }
-
- /**
- * Calls {@link TemplateConfiguration#setParentConfiguration(Configuration)} on each enclosed
- * {@link TemplateConfiguration} and {@link TemplateConfigurationFactory#setConfiguration(Configuration)}
- * on each enclosed {@link TemplateConfigurationFactory} objects. It only supposed to call these on the direct
- * "children" of this object, not on the children of the children.
- */
- protected abstract void setConfigurationOfChildren(Configuration cfg);
-
-}
diff --git a/src/main/java/freemarker/cache/TemplateConfigurationFactoryException.java b/src/main/java/freemarker/cache/TemplateConfigurationFactoryException.java
deleted file mode 100644
index abbce62..0000000
--- a/src/main/java/freemarker/cache/TemplateConfigurationFactoryException.java
+++ /dev/null
@@ -1,36 +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 freemarker.cache;
-
-/**
- * Non-I/O exception thrown by {@link TemplateConfigurationFactory}-s.
- *
- * @since 2.3.24
- */
-public class TemplateConfigurationFactoryException extends Exception {
-
- public TemplateConfigurationFactoryException(String message) {
- super(message);
- }
-
- public TemplateConfigurationFactoryException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/src/main/java/freemarker/cache/TemplateLoader.java b/src/main/java/freemarker/cache/TemplateLoader.java
deleted file mode 100644
index a545771..0000000
--- a/src/main/java/freemarker/cache/TemplateLoader.java
+++ /dev/null
@@ -1,159 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.io.Reader;
-
-import freemarker.template.Configuration;
-import freemarker.template.TemplateNotFoundException;
-
-/**
- * FreeMarker loads template "files" through objects that implement this interface,
- * thus the templates need not be real files, and can come from any kind of data source
- * (like classpath, servlet context, database, etc). While FreeMarker provides a few
- * {@link TemplateLoader} implementations out-of-the-box, it's normal for embedding
- * frameworks to use their own implementations.
- *
- * <p>To set the {@link TemplateLoader} used by FreeMaker, use
- * {@link Configuration#setTemplateLoader(TemplateLoader)}.
- *
- * <p>Implementations of this interface should be thread-safe.
- *
- * <p>Implementations should override {@link Object#toString()} to show information about from where the
- * {@link TemplateLoader} loads the templates. For example, for a template loader that loads template from database
- * table {@code toString} could return something like
- * {@code "MyDatabaseTemplateLoader(user=\"cms\", table=\"mail_templates\")"}. This string will be shown in
- * {@link TemplateNotFoundException} exception messages, next to the template name.
- *
- * <p>For those who has to dig deeper, note that the {@link TemplateLoader} is actually stored inside
- * the {@link TemplateCache} of the {@link Configuration}, and is normally only accessed directly
- * by the {@link TemplateCache}, and templates are get via the {@link TemplateCache} API-s.
- */
-public interface TemplateLoader {
-
- /**
- * Finds the template in the backing storage and returns an object that identifies the storage location where the
- * template can be loaded from. See the return value for more information.
- *
- * @param name
- * The name of the template, already localized and normalized by the
- * {@link freemarker.cache.TemplateCache cache}. It is completely up to the loader implementation to
- * interpret the name, however it should expect to receive hierarchical paths where path components are
- * separated by a slash (not backslash). Backslashes (or any other OS specific separator character) are
- * not considered as separators by FreeMarker, and thus they will not be replaced with slash before
- * passing to this method, so it's up to the template loader to handle them (say, be throwing and
- * exception that tells the user that the path (s)he has entered is invalid, as (s)he must use slash --
- * typical mistake of Windows users). The passed names are always considered relative to some
- * loader-defined root location (often referred as the "template root directory"), and will never start
- * with a slash, nor will they contain a path component consisting of either a single or a double dot --
- * these are all resolved by the template cache before passing the name to the loader. As a side effect,
- * paths that trivially reach outside template root directory, such as <tt>../my.ftl</tt>, will be
- * rejected by the template cache, so they never reach the template loader. Note again, that if the path
- * uses backslash as path separator instead of slash as (the template loader should not accept that), the
- * normalization will not properly happen, as FreeMarker (the cache) recognizes only the slashes as
- * separators.
- *
- * @return An object representing the template source, which can be supplied in subsequent calls to
- * {@link #getLastModified(Object)} and {@link #getReader(Object, String)}, when those are called on the
- * same {@link TemplateLoader}. {@code null} must be returned if the source for the template doesn't exist;
- * don't throw exception then! The exact type of this object is up to the {@link TemplateLoader}
- * implementation. As this object is possibly used as hash key in caches, and is surly compared with another
- * template source for equality, <b>it must have a proper {@link Object#equals(Object)} and
- * {@link Object#hashCode()}) implementation</b>. Especially, template sources that refer to the same
- * physical source must be equivalent, otherwise template caching can become inefficient. This is only
- * expected from {@link Object#equals(Object)} when the compared template sources came from the same
- * {@link TemplateLoader} instance. Also, it must not influence the equality if the source is open or
- * closed ({@link #closeTemplateSource(Object)}).
- *
- * @throws IOException
- * When an error occurs that makes it impossible to find out if the template exists, or to access the
- * existing template. Don't throw exception if the template doesn't exist, instead return with
- * {@code null} then!
- */
- public Object findTemplateSource(String name)
- throws IOException;
-
- /**
- * Returns the time of last modification of the specified template source, if the backing storage mechanism supports
- * that.
- *
- * @param templateSource
- * an object representing a template source, obtained through a prior call to
- * {@link #findTemplateSource(String)}. This must be an object on which
- * {@link TemplateLoader#closeTemplateSource(Object)} wasn't applied yet.
- * @return The time of last modification of the specified template source, or -1 if the time is not known. In
- * principle, -1 should be only returned if the backing storage doesn't store last modification times, not
- * when there was an error during getting the last modification time (then you should throw
- * {@link GetLastModifiedException}). However, Java's {@code File} and {@code URL} API can't differentiate
- * between these two cases, so for {@link TemplateLoader} based on those -1 is also used when an error has
- * occurred.
- *
- * @throws GetLastModifiedException
- * If there was an error when reading the last modification date (since 2.4.0). Note that for backward
- * compatibility, this is an unchecked exception, and is not an {@link IOException}.
- */
- public long getLastModified(Object templateSource) throws GetLastModifiedException;
-
- /**
- * Returns the character stream of a template represented by the specified template source. This method is possibly
- * called for multiple times for the same template source object, and it must always return a {@link Reader} that
- * reads the template from its beginning. Before this method is called for the second time (or later), its caller
- * must close the previously returned {@link Reader}, and it must not use it anymore. That is, this method is not
- * required to support multiple concurrent readers for the same source {@code templateSource} object.
- *
- * <p>
- * Typically, this method is called if the template is missing from the cache, or if after calling
- * {@link #findTemplateSource(String)} and {@link #getLastModified(Object)} it was determined that the cached copy
- * of the template is stale. Then, if it turns out that the {@code encoding} parameter used doesn't match the actual
- * template content (based on the {@code #ftl encoding=...} header), this method will be called for a second time
- * with the correct {@code encoding} parameter value.
- *
- * @param templateSource
- * an object representing a template source, obtained through a prior call to
- * {@link #findTemplateSource(String)}. This must be an object on which
- * {@link TemplateLoader#closeTemplateSource(Object)} wasn't applied yet.
- * @param encoding
- * the character encoding used to translate source bytes to characters. Some loaders may not have access
- * to the byte representation of the template stream, and instead directly obtain a character stream.
- * These loaders should ignore the encoding parameter.
- *
- * @return A {@link Reader} representing the template character stream. It's the responsibility of the caller (which
- * is {@link TemplateCache} usually) to {@code close()} it. The {@link Reader} is not required to work after
- * the {@code templateSource} was closed ({@link #closeTemplateSource(Object)}).
- *
- * @throws IOException
- * if an I/O error occurs while accessing the stream.
- */
- public Reader getReader(Object templateSource, String encoding)
- throws IOException;
-
- /**
- * Closes the template source, releasing any resources held that are only required for reading the template and/or
- * its metadata. This is the last method that is called by the {@link TemplateCache} for a template source, except
- * that {@link Object#equals(Object)} is might called later too. {@link TemplateCache} ensures that this method will
- * be called on every object that is returned from {@link #findTemplateSource(String)}.
- *
- * @param templateSource
- * the template source that should be closed.
- */
- public void closeTemplateSource(Object templateSource)
- throws IOException;
-}
diff --git a/src/main/java/freemarker/cache/TemplateLoaderUtils.java b/src/main/java/freemarker/cache/TemplateLoaderUtils.java
deleted file mode 100644
index e229e76..0000000
--- a/src/main/java/freemarker/cache/TemplateLoaderUtils.java
+++ /dev/null
@@ -1,38 +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 freemarker.cache;
-
-import freemarker.template.Configuration;
-
-final class TemplateLoaderUtils {
-
- private TemplateLoaderUtils() {
- // Not meant to be instantiated
- }
-
- public static String getClassNameForToString(TemplateLoader templateLoader) {
- final Class tlClass = templateLoader.getClass();
- final Package tlPackage = tlClass.getPackage();
- return tlPackage == Configuration.class.getPackage() || tlPackage == TemplateLoader.class.getPackage()
- ? tlClass.getSimpleName() : tlClass.getName();
- }
-
-
-}
diff --git a/src/main/java/freemarker/cache/TemplateLookupContext.java b/src/main/java/freemarker/cache/TemplateLookupContext.java
deleted file mode 100644
index c605e15..0000000
--- a/src/main/java/freemarker/cache/TemplateLookupContext.java
+++ /dev/null
@@ -1,107 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.util.Locale;
-
-import freemarker.template.Configuration;
-
-/**
- * Used as the parameter of {@link TemplateLookupStrategy#lookup(TemplateLookupContext)}.
- * You can't create instances of this, only receive them from FreeMarker.
- *
- * @since 2.3.22
- */
-public abstract class TemplateLookupContext {
-
- private final String templateName;
- private final Locale templateLocale;
- private final Object customLookupCondition;
-
- /**
- * Finds the template source based on its <em>normalized</em> name; handles {@code *} steps (so called acquisition),
- * otherwise it just calls {@link TemplateLoader#findTemplateSource(String)}.
- *
- * @param templateName
- * Must be a normalized name, like {@code "foo/bar/baaz.ftl"}. A name is not normalized when, among
- * others, it starts with {@code /}, or contains {@code .} or {@code ..} paths steps, or it uses
- * backslash ({@code \}) instead of {@code /}. A normalized name might contains "*" steps.
- *
- * @return The result of the lookup. Not {@code null}; check {@link TemplateLookupResult#isPositive()} to see if the
- * lookup has found anything.
- */
- public abstract TemplateLookupResult lookupWithAcquisitionStrategy(String templateName) throws IOException;
-
- /**
- * Finds the template source based on its <em>normalized</em> name; tries localized variations going from most
- * specific to less specific, and for each variation it delegates to {@link #lookupWithAcquisitionStrategy(String)}.
- * If {@code templateLocale} is {@code null} (typically, because {@link Configuration#getLocalizedLookup()} is
- * {@code false})), then it's the same as calling {@link #lookupWithAcquisitionStrategy(String)} directly. This is
- * the default strategy of FreeMarker (at least in 2.3.x), so for more information, see
- * {@link TemplateLookupStrategy#DEFAULT_2_3_0}.
- */
- public abstract TemplateLookupResult lookupWithLocalizedThenAcquisitionStrategy(String templateName,
- Locale templateLocale) throws IOException;
-
- /** Default visibility to prevent extending the class from outside this package. */
- TemplateLookupContext(String templateName, Locale templateLocale, Object customLookupCondition) {
- this.templateName = templateName;
- this.templateLocale = templateLocale;
- this.customLookupCondition = customLookupCondition;
- }
-
- /**
- * The normalized name (path) of the template (relatively to the {@link TemplateLoader}). Not {@code null}.
- */
- public String getTemplateName() {
- return templateName;
- }
-
- /**
- * {@code null} if localized lookup is disabled (see {@link Configuration#getLocalizedLookup()}), otherwise the
- * locale requested.
- */
- public Locale getTemplateLocale() {
- return templateLocale;
- }
-
- /**
- * Returns the value of the {@code customLookupCondition} parameter of
- * {@link Configuration#getTemplate(String, Locale, Object, String, boolean, boolean)}; see requirements there, such
- * as having a proper {@link Object#equals(Object)} and {@link Object#hashCode()} method. The interpretation of this
- * value is up to the custom {@link TemplateLookupStrategy}. Usually, it's used similarly to as the default lookup
- * strategy uses {@link #getTemplateLocale()}, that is, to look for a template variation that satisfies the
- * condition, and then maybe fall back to more generic template if that's missing.
- */
- public Object getCustomLookupCondition() {
- return customLookupCondition;
- }
-
- /**
- * Creates a not-found lookup result that then can be used as the return value of
- * {@link TemplateLookupStrategy#lookup(TemplateLookupContext)}. (In the current implementation it just always
- * returns the same static singleton, but that might need to change in the future.)
- */
- public TemplateLookupResult createNegativeLookupResult() {
- return TemplateLookupResult.createNegativeResult();
- }
-
-}
diff --git a/src/main/java/freemarker/cache/TemplateLookupResult.java b/src/main/java/freemarker/cache/TemplateLookupResult.java
deleted file mode 100644
index cb7a58b..0000000
--- a/src/main/java/freemarker/cache/TemplateLookupResult.java
+++ /dev/null
@@ -1,137 +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 freemarker.cache;
-
-import freemarker.template.Template;
-import freemarker.template.utility.NullArgumentException;
-
-/**
- * The return value of {@link TemplateLookupStrategy#lookup(TemplateLookupContext)} and similar lookup methods. You
- * usually get one from {@link TemplateLookupContext#lookupWithAcquisitionStrategy(String)} or
- * {@link TemplateLookupContext#createNegativeLookupResult()}; you can't create instances of this directly.
- *
- * @since 2.3.22
- */
-public abstract class TemplateLookupResult {
-
- /** Used internally to get a not-found result (currently just a static singleton). */
- static TemplateLookupResult createNegativeResult() {
- return NegativeTemplateLookupResult.INSTANCE;
- }
-
- /** Used internally to create the appropriate kind of result from the parameters. */
- static TemplateLookupResult from(String templateSourceName, Object templateSource) {
- return templateSource != null
- ? new PositiveTemplateLookupResult(templateSourceName, templateSource)
- : createNegativeResult();
- }
-
- private TemplateLookupResult() {
- // nop
- }
-
- /**
- * The source name of the template found (see {@link Template#getSourceName()}), or {@code null} if
- * {@link #isPositive()} is {@code false}.
- */
- public abstract String getTemplateSourceName();
-
- /**
- * Tells if the lookup has found a matching template.
- */
- public abstract boolean isPositive();
-
- /**
- * Used internally to extract the {@link TemplateLoader} source; {@code null} if
- * {@link #isPositive()} is {@code false}.
- */
- abstract Object getTemplateSource();
-
- private static final class PositiveTemplateLookupResult extends TemplateLookupResult {
-
- private final String templateSourceName;
- private final Object templateSource;
-
- /**
- * @param templateSourceName
- * The name of the matching template found. This is not necessarily the same as the template name
- * with which the template was originally requested. For example, one may gets a template for the
- * {@code "foo.ftl"} name, but due to localized lookup the template is actually loaded from
- * {@code "foo_de.ftl"}. Then this parameter must be {@code "foo_de.ftl"}, not {@code "foo.ftl"}. Not
- * {@code null}.
- *
- * @param templateSource
- * See {@link TemplateLoader#findTemplateSource(String)} to understand what that means. Not
- * {@code null}.
- */
- private PositiveTemplateLookupResult(String templateSourceName, Object templateSource) {
- NullArgumentException.check("templateName", templateSourceName);
- NullArgumentException.check("templateSource", templateSource);
-
- if (templateSource instanceof TemplateLookupResult) {
- throw new IllegalArgumentException();
- }
-
- this.templateSourceName = templateSourceName;
- this.templateSource = templateSource;
- }
-
- @Override
- public String getTemplateSourceName() {
- return templateSourceName;
- }
-
- @Override
- Object getTemplateSource() {
- return templateSource;
- }
-
- @Override
- public boolean isPositive() {
- return true;
- }
- }
-
- private static final class NegativeTemplateLookupResult extends TemplateLookupResult {
-
- private static final NegativeTemplateLookupResult INSTANCE = new NegativeTemplateLookupResult();
-
- private NegativeTemplateLookupResult() {
- // nop
- }
-
- @Override
- public String getTemplateSourceName() {
- return null;
- }
-
- @Override
- Object getTemplateSource() {
- return null;
- }
-
- @Override
- public boolean isPositive() {
- return false;
- }
-
- }
-
-}
diff --git a/src/main/java/freemarker/cache/TemplateLookupStrategy.java b/src/main/java/freemarker/cache/TemplateLookupStrategy.java
deleted file mode 100644
index 6b50aa9..0000000
--- a/src/main/java/freemarker/cache/TemplateLookupStrategy.java
+++ /dev/null
@@ -1,115 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.util.Locale;
-
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-
-/**
- * Finds the {@link TemplateLoader}-level (storage-level) template source for the template name with which the template
- * was requested (as in {@link Configuration#getTemplate(String)}). This usually means trying various
- * {@link TemplateLoader}-level template names (so called source names; see also {@link Template#getSourceName()}) that
- * were deduced from the requested name. Trying a name usually means calling
- * {@link TemplateLookupContext#lookupWithAcquisitionStrategy(String)} with it and checking the value of
- * {@link TemplateLookupResult#isPositive()}.
- *
- * <p>
- * Before you write your own lookup strategy, know that:
- * <ul>
- * <li>A template lookup strategy meant to operate solely with template names, not with {@link TemplateLoader}-s
- * directly. Basically, it's a mapping between the template names that templates and API-s like
- * {@link Configuration#getTemplate(String)} see, and those that the underlying {@link TemplateLoader} sees.
- * <li>A template lookup strategy doesn't influence the template's name ({@link Template#getName()}), which is the
- * normalized form of the template name as it was requested (with {@link Configuration#getTemplate(String)}, etc.). It
- * only influences the so called source name of the template ({@link Template#getSourceName()}). The template's name is
- * used as the basis for resolving relative inclusions/imports in the template. The source name is pretty much only used
- * in error messages as error location, and of course, to actually load the template "file".
- * <li>Understand the impact of the last point if your template lookup strategy fiddles not only with the file name part
- * of the template name, but also with the directory part. For example, one may want to map "foo.ftl" to "en/foo.ftl",
- * "fr/foo.ftl", etc. That's legal, but the result is kind of like if you had several root directories ("en/", "fr/",
- * etc.) that are layered over each other to form a single merged directory. (This is what's desirable in typical
- * applications, yet it can be confusing.)
- * </ul>
- *
- * @see Configuration#setTemplateLookupStrategy(TemplateLookupStrategy)
- *
- * @since 2.3.22
- */
-public abstract class TemplateLookupStrategy {
-
- /**
- * <p>
- * The default lookup strategy of FreeMarker.
- *
- * <p>
- * Through an example: Assuming localized lookup is enabled and that a template is requested for the name
- * {@code example.ftl} and {@code Locale("es", "ES", "Traditional_WIN")}, it will try the following template names,
- * in this order: {@code "foo_en_AU_Traditional_WIN.ftl"}, {@code "foo_en_AU_Traditional.ftl"},
- * {@code "foo_en_AU.ftl"}, {@code "foo_en.ftl"}, {@code "foo.ftl"}. It stops at the first variation where it finds
- * a template. (If the template name contains "*" steps, finding the template for the attempted localized variation
- * happens with the template acquisition mechanism.) If localized lookup is disabled, it won't try to add any locale
- * strings, so it just looks for {@code "foo.ftl"}.
- *
- * <p>
- * The generation of the localized name variation with the default lookup strategy, happens like this: It removes
- * the file extension (the part starting with the <em>last</em> dot), then appends {@link Locale#toString()} after
- * it, and puts back the extension. Then it starts to remove the parts from the end of the locale, considering
- * {@code "_"} as the separator between the parts. It won't remove parts that are not part of the locale string
- * (like if the requested template name is {@code foo_bar.ftl}, it won't remove the {@code "_bar"}).
- */
- public static final TemplateLookupStrategy DEFAULT_2_3_0 = new Default020300();
-
- /**
- * Finds the template source that matches the template name, locale (if not {@code null}) and other parameters
- * specified in the {@link TemplateLookupContext}. See also the class-level {@link TemplateLookupStrategy}
- * documentation to understand lookup strategies more.
- *
- * @param ctx
- * Contains the parameters for which the matching template need to be found, and operations that
- * are needed to implement the strategy. Some of the important input parameters are:
- * {@link TemplateLookupContext#getTemplateName()}, {@link TemplateLookupContext#getTemplateLocale()}.
- * The most important operations are {@link TemplateLookupContext#lookupWithAcquisitionStrategy(String)}
- * and {@link TemplateLookupContext#createNegativeLookupResult()}. (Note that you deliberately can't
- * use {@link TemplateLoader}-s directly to implement lookup.)
- *
- * @return Usually the return value of {@link TemplateLookupContext#lookupWithAcquisitionStrategy(String)}, or
- * {@code TemplateLookupContext#createNegativeLookupResult()} if no matching template exists. Can't be
- * {@code null}.
- */
- public abstract TemplateLookupResult lookup(TemplateLookupContext ctx) throws IOException;
-
- private static class Default020300 extends TemplateLookupStrategy {
-
- @Override
- public TemplateLookupResult lookup(TemplateLookupContext ctx) throws IOException {
- return ctx.lookupWithLocalizedThenAcquisitionStrategy(ctx.getTemplateName(), ctx.getTemplateLocale());
- }
-
- @Override
- public String toString() {
- return "TemplateLookupStrategy.DEFAULT_2_3_0";
- }
-
- }
-
-}
diff --git a/src/main/java/freemarker/cache/TemplateNameFormat.java b/src/main/java/freemarker/cache/TemplateNameFormat.java
deleted file mode 100644
index 2e06795..0000000
--- a/src/main/java/freemarker/cache/TemplateNameFormat.java
+++ /dev/null
@@ -1,432 +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 freemarker.cache;
-
-import freemarker.template.Configuration;
-import freemarker.template.MalformedTemplateNameException;
-import freemarker.template.TemplateNotFoundException;
-import freemarker.template.Version;
-import freemarker.template.utility.StringUtil;
-
-/**
- * Symbolized template name format. The API of this class isn't exposed as it's too immature, so custom
- * template name formats aren't possible yet.
- *
- * @since 2.3.22
- */
-public abstract class TemplateNameFormat {
-
- private TemplateNameFormat() {
- // Currently can't be instantiated from outside
- }
-
- /**
- * The default template name format when {@link Configuration#Configuration(Version) incompatible_improvements} is
- * below 2.4.0. As of FreeMarker 2.4.0, the default {@code incompatible_improvements} is still {@code 2.3.0}, and it
- * will certainly remain so for a very long time. In new projects it's highly recommended to use
- * {@link #DEFAULT_2_4_0} instead.
- */
- public static final TemplateNameFormat DEFAULT_2_3_0 = new Default020300();
-
- /**
- * The default template name format only when {@link Configuration#Configuration(Version) incompatible_improvements}
- * is set to 2.4.0 (or higher). This is not the out-of-the-box default format of FreeMarker 2.4.x, because the
- * default {@code incompatible_improvements} is still 2.3.0 there.
- *
- * <p>
- * Differences to the {@link #DEFAULT_2_3_0} format:
- *
- * <ul>
- *
- * <li>The scheme and the path need not be separated with {@code "://"} anymore, only with {@code ":"}. This makes
- * template names like {@code "classpath:foo.ftl"} interpreted as an absolute name with scheme {@code "classpath"}
- * and absolute path "foo.ftl". The scheme name before the {@code ":"} can't contain {@code "/"}, or else it's
- * treated as a malformed name. The scheme part can be separated either with {@code "://"} or just {@code ":"} from
- * the path. Hence, {@code myschme:/x} is normalized to {@code myschme:x}, while {@code myschme:///x} is normalized
- * to {@code myschme://x}, but {@code myschme://x} or {@code myschme:/x} aren't changed by normalization. It's up
- * the {@link TemplateLoader} to which the normalized names are passed to decide which of these scheme separation
- * conventions are valid (maybe both).</li>
- *
- * <li>{@code ":"} is not allowed in template names, except as the scheme separator (see previous point).
- *
- * <li>Malformed paths throw {@link MalformedTemplateNameException} instead of acting like if the template wasn't
- * found.
- *
- * <li>{@code "\"} (backslash) is not allowed in template names, and causes {@link MalformedTemplateNameException}.
- * With {@link #DEFAULT_2_3_0} you would certainly end up with a {@link TemplateNotFoundException} (or worse,
- * it would work, but steps like {@code ".."} wouldn't be normalized by FreeMarker).
- *
- * <li>Template names might end with {@code /}, like {@code "foo/"}, and the presence or lack of the terminating
- * {@code /} is seen as significant. While their actual interpretation is up to the {@link TemplateLoader},
- * operations that manipulate template names assume that the last step refers to a "directory" as opposed to a
- * "file" exactly if the terminating {@code /} is present. Except, the empty name is assumed to refer to the root
- * "directory" (despite that it doesn't end with {@code /}).
- *
- * <li>{@code //} is normalized to {@code /}, except of course if it's in the scheme name terminator. Like
- * {@code foo//bar///baaz.ftl} is normalized to {@code foo/bar/baaz.ftl}. (In general, 0 long step names aren't
- * possible anymore.)</li>
- *
- * <li>The {@code ".."} bugs of the legacy normalizer are fixed: {@code ".."} steps has removed the preceding
- * {@code "."} or {@code "*"} or scheme steps, not treating them specially as they should be. Now these work as
- * expected. Examples: {@code "a/./../c"} has become to {@code "a/c"}, now it will be {@code "c"}; {@code "a/b/*}
- * {@code /../c"} has become to {@code "a/b/c"}, now it will be {@code "a/*}{@code /c"}; {@code "scheme://.."} has
- * become to {@code "scheme:/"}, now it will be {@code null} ({@link TemplateNotFoundException}) for backing out of
- * the root directory.</li>
- *
- * <li>As now directory paths has to be handled as well, it recognizes terminating, leading, and lonely {@code ".."}
- * and {@code "."} steps. For example, {@code "foo/bar/.."} now becomes to {@code "foo/"}</li>
- *
- * <li>Multiple consecutive {@code *} steps are normalized to one</li>
- *
- * </ul>
- */
- public static final TemplateNameFormat DEFAULT_2_4_0 = new Default020400();
-
- /**
- * @param baseName Maybe {@code null}, maybe a "file" name instead of a "directory" name.
- * @param targetName No {@code null}. Maybe relative, maybe absolute.
- */
- abstract String toAbsoluteName(String baseName, String targetName) throws MalformedTemplateNameException;
-
- /**
- * @return For backward compatibility only, {@code null} is allowed and will be treated as if the template doesn't
- * exist (despite that a normalizer doesn't access the storage, so it's not its duty to decide that).
- */
- abstract String normalizeAbsoluteName(String name) throws MalformedTemplateNameException;
-
- private static final class Default020300 extends TemplateNameFormat {
- @Override
- String toAbsoluteName(String baseName, String targetName) {
- if (baseName == null) {
- return targetName;
- }
-
- if (targetName.indexOf("://") > 0) {
- return targetName;
- } else if (targetName.startsWith("/")) {
- int schemeSepIdx = baseName.indexOf("://");
- if (schemeSepIdx > 0) {
- return baseName.substring(0, schemeSepIdx + 2) + targetName;
- } else {
- return targetName.substring(1);
- }
- } else {
- if (!baseName.endsWith("/")) {
- baseName = baseName.substring(0, baseName.lastIndexOf("/") + 1);
- }
- return baseName + targetName;
- }
- }
-
- @Override
- String normalizeAbsoluteName(final String name) throws MalformedTemplateNameException {
- // Disallow 0 for security reasons.
- checkNameHasNoNullCharacter(name);
-
- // The legacy algorithm haven't considered schemes, so the name is in effect a path.
- // Also, note that `path` will be repeatedly replaced below, while `name` is final.
- String path = name;
-
- for (; ; ) {
- int parentDirPathLoc = path.indexOf("/../");
- if (parentDirPathLoc == 0) {
- // If it starts with /../, then it reaches outside the template
- // root.
- throw newRootLeavingException(name);
- }
- if (parentDirPathLoc == -1) {
- if (path.startsWith("../")) {
- throw newRootLeavingException(name);
- }
- break;
- }
- int previousSlashLoc = path.lastIndexOf('/', parentDirPathLoc - 1);
- path = path.substring(0, previousSlashLoc + 1) +
- path.substring(parentDirPathLoc + "/../".length());
- }
- for (; ; ) {
- int currentDirPathLoc = path.indexOf("/./");
- if (currentDirPathLoc == -1) {
- if (path.startsWith("./")) {
- path = path.substring("./".length());
- }
- break;
- }
- path = path.substring(0, currentDirPathLoc) +
- path.substring(currentDirPathLoc + "/./".length() - 1);
- }
- // Editing can leave us with a leading slash; strip it.
- if (path.length() > 1 && path.charAt(0) == '/') {
- path = path.substring(1);
- }
- return path;
- }
-
- @Override
- public String toString() {
- return "TemplateNameFormat.DEFAULT_2_3_0";
- }
-
- }
-
- private static final class Default020400 extends TemplateNameFormat {
- @Override
- String toAbsoluteName(String baseName, String targetName) {
- if (baseName == null) {
- return targetName;
- }
-
- if (findSchemeSectionEnd(targetName) != 0) {
- return targetName;
- } else if (targetName.startsWith("/")) { // targetName is an absolute path
- final String targetNameAsRelative = targetName.substring(1);
- final int schemeSectionEnd = findSchemeSectionEnd(baseName);
- if (schemeSectionEnd == 0) {
- return targetNameAsRelative;
- } else {
- // Prepend the scheme of baseName:
- return baseName.substring(0, schemeSectionEnd) + targetNameAsRelative;
- }
- } else { // targetName is a relative path
- if (!baseName.endsWith("/")) {
- // Not a directory name => get containing directory name
- int baseEnd = baseName.lastIndexOf("/") + 1;
- if (baseEnd == 0) {
- // For something like "classpath:t.ftl", must not remove the scheme part:
- baseEnd = findSchemeSectionEnd(baseName);
- }
- baseName = baseName.substring(0, baseEnd);
- }
- return baseName + targetName;
- }
- }
-
- @Override
- String normalizeAbsoluteName(final String name) throws MalformedTemplateNameException {
- // Disallow 0 for security reasons.
- checkNameHasNoNullCharacter(name);
-
- if (name.indexOf('\\') != -1) {
- throw new MalformedTemplateNameException(
- name,
- "Backslash (\"\\\") is not allowed in template names. Use slash (\"/\") instead.");
- }
-
- // Split name to a scheme and a path:
- final String scheme;
- String path;
- {
- int schemeSectionEnd = findSchemeSectionEnd(name);
- if (schemeSectionEnd == 0) {
- scheme = null;
- path = name;
- } else {
- scheme = name.substring(0, schemeSectionEnd);
- path = name.substring(schemeSectionEnd);
- }
- }
-
- if (path.indexOf(':') != -1) {
- throw new MalformedTemplateNameException(name,
- "The ':' character can only be used after the scheme name (if there's any), "
- + "not in the path part");
- }
-
- path = removeRedundantSlashes(path);
- // path now doesn't start with "/"
-
- path = removeDotSteps(path);
-
- path = resolveDotDotSteps(path, name);
-
- path = removeRedundantStarSteps(path);
-
- return scheme == null ? path : scheme + path;
- }
-
- private int findSchemeSectionEnd(String name) {
- int schemeColonIdx = name.indexOf(":");
- if (schemeColonIdx == -1 || name.lastIndexOf('/', schemeColonIdx - 1) != -1) {
- return 0;
- } else {
- // If there's a following "//", it's treated as the part of the scheme section:
- if (schemeColonIdx + 2 < name.length()
- && name.charAt(schemeColonIdx + 1) == '/' && name.charAt(schemeColonIdx + 2) == '/') {
- return schemeColonIdx + 3;
- } else {
- return schemeColonIdx + 1;
- }
- }
- }
-
- private String removeRedundantSlashes(String path) {
- String prevName;
- do {
- prevName = path;
- path = StringUtil.replace(path, "//", "/");
- } while (prevName != path);
- return path.startsWith("/") ? path.substring(1) : path;
- }
-
- private String removeDotSteps(String path) {
- int nextFromIdx = path.length() - 1;
- findDotSteps: while (true) {
- final int dotIdx = path.lastIndexOf('.', nextFromIdx);
- if (dotIdx < 0) {
- return path;
- }
- nextFromIdx = dotIdx - 1;
-
- if (dotIdx != 0 && path.charAt(dotIdx - 1) != '/') {
- // False alarm
- continue findDotSteps;
- }
-
- final boolean slashRight;
- if (dotIdx + 1 == path.length()) {
- slashRight = false;
- } else if (path.charAt(dotIdx + 1) == '/') {
- slashRight = true;
- } else {
- // False alarm
- continue findDotSteps;
- }
-
- if (slashRight) { // "foo/./bar" or "./bar"
- path = path.substring(0, dotIdx) + path.substring(dotIdx + 2);
- } else { // "foo/." or "."
- path = path.substring(0, path.length() - 1);
- }
- }
- }
-
- /**
- * @param name The original name, needed for exception error messages.
- */
- private String resolveDotDotSteps(String path, final String name) throws MalformedTemplateNameException {
- int nextFromIdx = 0;
- findDotDotSteps: while (true) {
- final int dotDotIdx = path.indexOf("..", nextFromIdx);
- if (dotDotIdx < 0) {
- return path;
- }
-
- if (dotDotIdx == 0) {
- throw newRootLeavingException(name);
- } else if (path.charAt(dotDotIdx - 1) != '/') {
- // False alarm
- nextFromIdx = dotDotIdx + 3;
- continue findDotDotSteps;
- }
- // Here we know that it has a preceding "/".
-
- final boolean slashRight;
- if (dotDotIdx + 2 == path.length()) {
- slashRight = false;
- } else if (path.charAt(dotDotIdx + 2) == '/') {
- slashRight = true;
- } else {
- // False alarm
- nextFromIdx = dotDotIdx + 3;
- continue findDotDotSteps;
- }
-
- int previousSlashIdx;
- boolean skippedStarStep = false;
- {
- int searchSlashBacwardsFrom = dotDotIdx - 2; // before the "/.."
- scanBackwardsForSlash: while (true) {
- if (searchSlashBacwardsFrom == -1) {
- throw newRootLeavingException(name);
- }
- previousSlashIdx = path.lastIndexOf('/', searchSlashBacwardsFrom);
- if (previousSlashIdx == -1) {
- if (searchSlashBacwardsFrom == 0 && path.charAt(0) == '*') {
- // "*/.."
- throw newRootLeavingException(name);
- }
- break scanBackwardsForSlash;
- }
- if (path.charAt(previousSlashIdx + 1) == '*' && path.charAt(previousSlashIdx + 2) == '/') {
- skippedStarStep = true;
- searchSlashBacwardsFrom = previousSlashIdx - 1;
- } else {
- break scanBackwardsForSlash;
- }
- }
- }
-
- // Note: previousSlashIdx is possibly -1
- // Removed part in {}: "a/{b/*/../}c" or "a/{b/*/..}"
- path = path.substring(0, previousSlashIdx + 1)
- + (skippedStarStep ? "*/" : "")
- + path.substring(dotDotIdx + (slashRight ? 3 : 2));
- nextFromIdx = previousSlashIdx + 1;
- }
- }
-
- private String removeRedundantStarSteps(String path) {
- String prevName;
- removeDoubleStarSteps: do {
- int supiciousIdx = path.indexOf("*/*");
- if (supiciousIdx == -1) {
- break removeDoubleStarSteps;
- }
-
- prevName = path;
-
- // Is it delimited on both sided by "/" or by the string boundaires?
- if ((supiciousIdx == 0 || path.charAt(supiciousIdx - 1) == '/')
- && (supiciousIdx + 3 == path.length() || path.charAt(supiciousIdx + 3) == '/')) {
- path = path.substring(0, supiciousIdx) + path.substring(supiciousIdx + 2);
- }
- } while (prevName != path);
-
- // An initial "*" step is redundant:
- if (path.startsWith("*")) {
- if (path.length() == 1) {
- path = "";
- } else if (path.charAt(1) == '/') {
- path = path.substring(2);
- }
- // else: it's wasn't a "*" step.
- }
-
- return path;
- }
-
- @Override
- public String toString() {
- return "TemplateNameFormat.DEFAULT_2_4_0";
- }
- }
-
- private static void checkNameHasNoNullCharacter(final String name) throws MalformedTemplateNameException {
- if (name.indexOf(0) != -1) {
- throw new MalformedTemplateNameException(name,
- "Null character (\\u0000) in the name; possible attack attempt");
- }
- }
-
- private static MalformedTemplateNameException newRootLeavingException(final String name) {
- return new MalformedTemplateNameException(name, "Backing out from the root directory is not allowed");
- }
-
-}
diff --git a/src/main/java/freemarker/cache/TemplateSourceMatcher.java b/src/main/java/freemarker/cache/TemplateSourceMatcher.java
deleted file mode 100644
index 478aaee..0000000
--- a/src/main/java/freemarker/cache/TemplateSourceMatcher.java
+++ /dev/null
@@ -1,30 +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 freemarker.cache;
-
-import java.io.IOException;
-
-/**
- * @since 2.3.24
- */
-public abstract class TemplateSourceMatcher {
-
- abstract boolean matches(String sourceName, Object templateSource) throws IOException;
-
-}
diff --git a/src/main/java/freemarker/cache/URLTemplateLoader.java b/src/main/java/freemarker/cache/URLTemplateLoader.java
deleted file mode 100644
index e975869..0000000
--- a/src/main/java/freemarker/cache/URLTemplateLoader.java
+++ /dev/null
@@ -1,119 +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 freemarker.cache;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.net.URLConnection;
-
-import freemarker.template.Configuration;
-
-/**
- * This is an abstract template loader that can load templates whose
- * location can be described by an URL. Subclasses only need to override
- * the {@link #getURL(String)} method. Both {@link ClassTemplateLoader} and
- * {@link WebappTemplateLoader} are (quite trivial) subclasses of this class.
- */
-public abstract class URLTemplateLoader implements TemplateLoader {
-
- private Boolean urlConnectionUsesCaches;
-
- public Object findTemplateSource(String name)
- throws IOException {
- URL url = getURL(name);
- return url == null ? null : new URLTemplateSource(url, getURLConnectionUsesCaches());
- }
-
- /**
- * Given a template name (plus potential locale decorations) retrieves
- * an URL that points the template source.
- * @param name the name of the sought template, including the locale
- * decorations.
- * @return an URL that points to the template source, or null if it can
- * determine that the template source does not exist.
- */
- protected abstract URL getURL(String name);
-
- public long getLastModified(Object templateSource) {
- return ((URLTemplateSource) templateSource).lastModified();
- }
-
- public Reader getReader(Object templateSource, String encoding)
- throws IOException {
- return new InputStreamReader(
- ((URLTemplateSource) templateSource).getInputStream(),
- encoding);
- }
-
- public void closeTemplateSource(Object templateSource)
- throws IOException {
- ((URLTemplateSource) templateSource).close();
- }
-
- /**
- * Can be used by subclasses to canonicalize URL path prefixes.
- * @param prefix the path prefix to canonicalize
- * @return the canonicalized prefix. All backslashes are replaced with
- * forward slashes, and a trailing slash is appended if the original
- * prefix wasn't empty and didn't already end with a slash.
- */
- protected static String canonicalizePrefix(String prefix) {
- // make it foolproof
- prefix = prefix.replace('\\', '/');
- // ensure there's a trailing slash
- if (prefix.length() > 0 && !prefix.endsWith("/")) {
- prefix += "/";
- }
- return prefix;
- }
-
- /**
- * Getter pair of {@link #setURLConnectionUsesCaches(Boolean)}.
- *
- * @since 2.3.21
- */
- public Boolean getURLConnectionUsesCaches() {
- return urlConnectionUsesCaches;
- }
-
- /**
- * Sets if {@link URLConnection#setUseCaches(boolean)} will be called, and with what value. By default this is
- * {@code null}; see the behavior then below. The recommended value is {@code false}, so that FreeMarker can always
- * reliably detect when a template was changed. The default is {@code null} only for backward compatibility,
- * and certainly will be changed to {@code false} in 2.4.0. As FreeMarker has its own template cache with its
- * own update delay setting ({@link Configuration#setTemplateUpdateDelay(int)}), setting this to {@code false}
- * shouldn't cause performance problems.
- *
- * <p>Regarding {@code null} value: By default then {@link URLConnection#setUseCaches(boolean)} won't be called,
- * and so the default of the {@link URLConnection} subclass will be in effect (usually {@code true}). That's the
- * 2.3.0-compatible mode. However, if {@link Configuration#getIncompatibleImprovements()} is at least 2.3.21, then
- * when {@code Configuration.getTemplate} is used, {@code null} will mean {@code false}. Note that this 2.3.21 trick
- * only works if the template is loaded through {@code Configuration.getTemplate} (or {@link TemplateCache}).
- *
- * @since 2.3.21
- */
- public void setURLConnectionUsesCaches(Boolean urlConnectionUsesCaches) {
- this.urlConnectionUsesCaches = urlConnectionUsesCaches;
- }
-
-}
diff --git a/src/main/java/freemarker/cache/URLTemplateSource.java b/src/main/java/freemarker/cache/URLTemplateSource.java
deleted file mode 100644
index 716b642..0000000
--- a/src/main/java/freemarker/cache/URLTemplateSource.java
+++ /dev/null
@@ -1,144 +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 freemarker.cache;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.JarURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-
-/**
- * Wraps a <code>java.net.URL</code>, and implements methods required for a typical template source.
- */
-class URLTemplateSource {
- private final URL url;
- private URLConnection conn;
- private InputStream inputStream;
- private Boolean useCaches;
-
- /**
- * @param useCaches {@code null} if this aspect wasn't set in the parent {@link TemplateLoader}.
- */
- URLTemplateSource(URL url, Boolean useCaches) throws IOException {
- this.url = url;
- this.conn = url.openConnection();
- this.useCaches = useCaches;
- if (useCaches != null) {
- conn.setUseCaches(useCaches.booleanValue());
- }
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof URLTemplateSource) {
- return url.equals(((URLTemplateSource) o).url);
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return url.hashCode();
- }
-
- @Override
- public String toString() {
- return url.toString();
- }
-
- long lastModified() {
- if (conn instanceof JarURLConnection) {
- // There is a bug in sun's jar url connection that causes file handle leaks when calling getLastModified()
- // Since the time stamps of jar file contents can't vary independent from the jar file timestamp, just use
- // the jar file timestamp
- URL jarURL = ((JarURLConnection) conn).getJarFileURL();
- if (jarURL.getProtocol().equals("file")) {
- // Return the last modified time of the underlying file - saves some opening and closing
- return new File(jarURL.getFile()).lastModified();
- } else {
- // Use the URL mechanism
- URLConnection jarConn = null;
- try {
- jarConn = jarURL.openConnection();
- return jarConn.getLastModified();
- } catch (IOException e) {
- return -1;
- } finally {
- try {
- if (jarConn != null) jarConn.getInputStream().close();
- } catch (IOException e) { }
- }
- }
- } else {
- long lastModified = conn.getLastModified();
- if (lastModified == -1L && url.getProtocol().equals("file")) {
- // Hack for obtaining accurate last modified time for
- // URLs that point to the local file system. This is fixed
- // in JDK 1.4, but prior JDKs returns -1 for file:// URLs.
- return new File(url.getFile()).lastModified();
- } else {
- return lastModified;
- }
- }
- }
-
- InputStream getInputStream() throws IOException {
- if (inputStream != null) {
- // Ensure that the returned InputStream reads from the beginning of the resource when getInputStream()
- // is called for the second time:
- try {
- inputStream.close();
- } catch (IOException e) {
- // Ignore; this is maybe because it was closed for the 2nd time now
- }
- this.conn = url.openConnection();
- }
- inputStream = conn.getInputStream();
- return inputStream;
- }
-
- void close() throws IOException {
- try {
- if (inputStream != null) {
- inputStream.close();
- } else {
- conn.getInputStream().close();
- }
- } finally {
- inputStream = null;
- conn = null;
- }
- }
-
- Boolean getUseCaches() {
- return useCaches;
- }
-
- void setUseCaches(boolean useCaches) {
- if (this.conn != null) {
- conn.setUseCaches(useCaches);
- this.useCaches = Boolean.valueOf(useCaches);
- }
- }
-
-}
diff --git a/src/main/java/freemarker/cache/WebappTemplateLoader.java b/src/main/java/freemarker/cache/WebappTemplateLoader.java
deleted file mode 100644
index d4f32dc..0000000
--- a/src/main/java/freemarker/cache/WebappTemplateLoader.java
+++ /dev/null
@@ -1,221 +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 freemarker.cache;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.servlet.ServletContext;
-
-import freemarker.log.Logger;
-import freemarker.template.Configuration;
-import freemarker.template.utility.CollectionUtils;
-import freemarker.template.utility.StringUtil;
-
-/**
- * A {@link TemplateLoader} that uses streams reachable through {@link ServletContext#getResource(String)} as its source
- * of templates.
- */
-public class WebappTemplateLoader implements TemplateLoader {
-
- private static final Logger LOG = Logger.getLogger("freemarker.cache");
-
- private final ServletContext servletContext;
- private final String subdirPath;
-
- private Boolean urlConnectionUsesCaches;
-
- private boolean attemptFileAccess = true;
-
- /**
- * Creates a resource template cache that will use the specified servlet context to load the resources. It will use
- * the base path of <code>"/"</code> meaning templates will be resolved relative to the servlet context root
- * location.
- *
- * @param servletContext
- * the servlet context whose {@link ServletContext#getResource(String)} will be used to load the
- * templates.
- */
- public WebappTemplateLoader(ServletContext servletContext) {
- this(servletContext, "/");
- }
-
- /**
- * Creates a template loader that will use the specified servlet context to load the resources. It will use the
- * specified base path, which is interpreted relatively to the context root (does not mater if you start it with "/"
- * or not). Path components should be separated by forward slashes independently of the separator character used by
- * the underlying operating system.
- *
- * @param servletContext
- * the servlet context whose {@link ServletContext#getResource(String)} will be used to load the
- * templates.
- * @param subdirPath
- * the base path to template resources.
- */
- public WebappTemplateLoader(ServletContext servletContext, String subdirPath) {
- if (servletContext == null) {
- throw new IllegalArgumentException("servletContext == null");
- }
- if (subdirPath == null) {
- throw new IllegalArgumentException("path == null");
- }
-
- subdirPath = subdirPath.replace('\\', '/');
- if (!subdirPath.endsWith("/")) {
- subdirPath += "/";
- }
- if (!subdirPath.startsWith("/")) {
- subdirPath = "/" + subdirPath;
- }
- this.subdirPath = subdirPath;
- this.servletContext = servletContext;
- }
-
- public Object findTemplateSource(String name) throws IOException {
- String fullPath = subdirPath + name;
-
- if (attemptFileAccess) {
- // First try to open as plain file (to bypass servlet container resource caches).
- try {
- String realPath = servletContext.getRealPath(fullPath);
- if (realPath != null) {
- File file = new File(realPath);
- if (file.canRead() && file.isFile()) {
- return file;
- }
- }
- } catch (SecurityException e) {
- ;// ignore
- }
- }
-
- // If it fails, try to open it with servletContext.getResource.
- URL url = null;
- try {
- url = servletContext.getResource(fullPath);
- } catch (MalformedURLException e) {
- LOG.warn("Could not retrieve resource " + StringUtil.jQuoteNoXSS(fullPath),
- e);
- return null;
- }
- return url == null ? null : new URLTemplateSource(url, getURLConnectionUsesCaches());
- }
-
- public long getLastModified(Object templateSource) {
- if (templateSource instanceof File) {
- return ((File) templateSource).lastModified();
- } else {
- return ((URLTemplateSource) templateSource).lastModified();
- }
- }
-
- public Reader getReader(Object templateSource, String encoding)
- throws IOException {
- if (templateSource instanceof File) {
- return new InputStreamReader(
- new FileInputStream((File) templateSource),
- encoding);
- } else {
- return new InputStreamReader(
- ((URLTemplateSource) templateSource).getInputStream(),
- encoding);
- }
- }
-
- public void closeTemplateSource(Object templateSource) throws IOException {
- if (templateSource instanceof File) {
- // Do nothing.
- } else {
- ((URLTemplateSource) templateSource).close();
- }
- }
-
- /**
- * Getter pair of {@link #setURLConnectionUsesCaches(Boolean)}.
- *
- * @since 2.3.21
- */
- public Boolean getURLConnectionUsesCaches() {
- return urlConnectionUsesCaches;
- }
-
- /**
- * It does the same as {@link URLTemplateLoader#setURLConnectionUsesCaches(Boolean)}; see there.
- *
- * @since 2.3.21
- */
- public void setURLConnectionUsesCaches(Boolean urlConnectionUsesCaches) {
- this.urlConnectionUsesCaches = urlConnectionUsesCaches;
- }
-
- /**
- * Show class name and some details that are useful in template-not-found errors.
- *
- * @since 2.3.21
- */
- @Override
- public String toString() {
- return TemplateLoaderUtils.getClassNameForToString(this)
- + "(subdirPath=" + StringUtil.jQuote(subdirPath)
- + ", servletContext={contextPath=" + StringUtil.jQuote(getContextPath())
- + ", displayName=" + StringUtil.jQuote(servletContext.getServletContextName()) + "})";
- }
-
- /** Gets the context path if we are on Servlet 2.5+, or else returns failure description string. */
- private String getContextPath() {
- try {
- Method m = servletContext.getClass().getMethod("getContextPath", CollectionUtils.EMPTY_CLASS_ARRAY);
- return (String) m.invoke(servletContext, CollectionUtils.EMPTY_OBJECT_ARRAY);
- } catch (Throwable e) {
- return "[can't query before Serlvet 2.5]";
- }
- }
-
- /**
- * Getter pair of {@link #setAttemptFileAccess(boolean)}.
- *
- * @since 2.3.23
- */
- public boolean getAttemptFileAccess() {
- return attemptFileAccess;
- }
-
- /**
- * Specifies that before loading templates with {@link ServletContext#getResource(String)}, it should try to load
- * the template as {@link File}; default is {@code true}, though it's not always recommended anymore. This is a
- * workaround for the case when the servlet container doesn't show template modifications after the template was
- * already loaded earlier. But it's certainly better to counter this problem by disabling the URL connection cache
- * with {@link #setURLConnectionUsesCaches(Boolean)}, which is also the default behavior with
- * {@link Configuration#setIncompatibleImprovements(freemarker.template.Version) incompatible_improvements} 2.3.21
- * and later.
- *
- * @since 2.3.23
- */
- public void setAttemptFileAccess(boolean attemptLoadingFromFile) {
- this.attemptFileAccess = attemptLoadingFromFile;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/freemarker/cache/_CacheAPI.java b/src/main/java/freemarker/cache/_CacheAPI.java
deleted file mode 100644
index 2643e81..0000000
--- a/src/main/java/freemarker/cache/_CacheAPI.java
+++ /dev/null
@@ -1,40 +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 freemarker.cache;
-
-import freemarker.template.MalformedTemplateNameException;
-
-/**
- * For internal use only; don't depend on this, there's no backward compatibility guarantee at all!
- * This class is to work around the lack of module system in Java, i.e., so that other FreeMarker packages can
- * access things inside this package that users shouldn't.
- */
-public class _CacheAPI {
-
- public _CacheAPI() {
- // TODO Auto-generated constructor stub
- }
-
- public static String toAbsoluteName(TemplateNameFormat templateNameFormat, String baseName, String targetName)
- throws MalformedTemplateNameException {
- return templateNameFormat.toAbsoluteName(baseName, targetName);
- }
-
-}
diff --git a/src/main/java/freemarker/cache/package.html b/src/main/java/freemarker/cache/package.html
deleted file mode 100644
index bf806df..0000000
--- a/src/main/java/freemarker/cache/package.html
+++ /dev/null
@@ -1,30 +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.
--->
-<html>
-<head>
-</head>
-<body bgcolor="white">
-<p>Template <em>loading</em> and caching.
-Beside the actual template cache, it contains loaders that can load template
-files from the file system, from the classpath, or from a web application
-context. If you have specific needs, you can plug custom template loaders into
-the system by implementing the template loader interface.
-</p>
-</body>
-</html>
diff --git a/src/main/java/freemarker/core/APINotSupportedTemplateException.java b/src/main/java/freemarker/core/APINotSupportedTemplateException.java
deleted file mode 100644
index d218beb..0000000
--- a/src/main/java/freemarker/core/APINotSupportedTemplateException.java
+++ /dev/null
@@ -1,76 +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 freemarker.core;
-
-import freemarker.template.DefaultObjectWrapper;
-import freemarker.template.ObjectWrapper;
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleSequence;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateModel;
-import freemarker.template._TemplateAPI;
-
-/**
- * Thrown when {@code ?api} is not supported by a value.
- */
-class APINotSupportedTemplateException extends TemplateException {
-
- APINotSupportedTemplateException(Environment env, Expression blamedExpr, TemplateModel model) {
- super(null, env, blamedExpr, buildDescription(env, blamedExpr, model));
- }
-
- protected static _ErrorDescriptionBuilder buildDescription(Environment env, Expression blamedExpr,
- TemplateModel tm) {
- final _ErrorDescriptionBuilder desc = new _ErrorDescriptionBuilder(
- "The value doesn't support ?api. See requirements in the FreeMarker Manual. ("
- + "FTL type: ", new _DelayedFTLTypeDescription(tm),
- ", TemplateModel class: ", new _DelayedShortClassName(tm.getClass()),
- ", ObjectWapper: ", new _DelayedToString(env.getObjectWrapper()), ")"
- ).blame(blamedExpr);
-
- if (blamedExpr.isLiteral()) {
- desc.tip("Only adapted Java objects can possibly have API, not values created inside templates.");
- } else {
- ObjectWrapper ow = env.getObjectWrapper();
- if (ow instanceof DefaultObjectWrapper
- && (tm instanceof SimpleHash || tm instanceof SimpleSequence)) {
- DefaultObjectWrapper dow = (DefaultObjectWrapper) ow;
- if (!dow.getUseAdaptersForContainers()) {
- desc.tip("In the FreeMarker configuration, \"", Configurable.OBJECT_WRAPPER_KEY,
- "\" is a DefaultObjectWrapper with its \"useAdaptersForContainers\" property set to "
- + "false. Setting it to true might solves this problem.");
- if (dow.getIncompatibleImprovements().intValue() < _TemplateAPI.VERSION_INT_2_3_22) {
- desc.tip("Setting DefaultObjectWrapper's \"incompatibleImprovements\" to 2.3.22 or higher will "
- + "change the default value of \"useAdaptersForContainers\" to true.");
- }
- } else if (tm instanceof SimpleSequence && dow.getForceLegacyNonListCollections()) {
- desc.tip("In the FreeMarker configuration, \"",
- Configurable.OBJECT_WRAPPER_KEY,
- "\" is a DefaultObjectWrapper with its \"forceLegacyNonListCollections\" property set "
- + "to true. If you are trying to access the API of a non-List Collection, setting the "
- + "\"forceLegacyNonListCollections\" property to false might solves this problem.");
- }
- }
- }
-
- return desc;
- }
-
-}
diff --git a/src/main/java/freemarker/core/AddConcatExpression.java b/src/main/java/freemarker/core/AddConcatExpression.java
deleted file mode 100644
index 4dbfd78..0000000
--- a/src/main/java/freemarker/core/AddConcatExpression.java
+++ /dev/null
@@ -1,284 +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 freemarker.core;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import freemarker.template.SimpleNumber;
-import freemarker.template.SimpleScalar;
-import freemarker.template.SimpleSequence;
-import freemarker.template.TemplateCollectionModel;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateHashModel;
-import freemarker.template.TemplateHashModelEx;
-import freemarker.template.TemplateModel;
-import freemarker.template.TemplateModelException;
-import freemarker.template.TemplateModelIterator;
-import freemarker.template.TemplateNumberModel;
-import freemarker.template.TemplateScalarModel;
-import freemarker.template.TemplateSequenceModel;
-
-/**
- * An operator for the + operator. Note that this is treated
- * separately from the other 4 arithmetic operators,
- * since + is overloaded to mean string concatenation.
- */
-final class AddConcatExpression extends Expression {
-
- private final Expression left;
- private final Expression right;
-
- AddConcatExpression(Expression left, Expression right) {
- this.left = left;
- this.right = right;
- }
-
- @Override
- TemplateModel _eval(Environment env) throws TemplateException {
- return _eval(env, this, left, left.eval(env), right, right.eval(env));
- }
-
- /**
- * @param leftExp
- * Used for error messages only; can be {@code null}
- * @param rightExp
- * Used for error messages only; can be {@code null}
- */
- static TemplateModel _eval(Environment env,
- TemplateObject parent,
- Expression leftExp, TemplateModel leftModel,
- Expression rightExp, TemplateModel rightModel)
- throws TemplateModelException, TemplateException, NonStringException {
- if (leftModel instanceof TemplateNumberModel && rightModel instanceof TemplateNumberModel) {
- Number first = EvalUtil.modelToNumber((TemplateNumberModel) leftModel, leftExp);
- Number second = EvalUtil.modelToNumber((TemplateNumberModel) rightModel, rightExp);
- return _evalOnNumbers(env, parent, first, second);
- } else if (leftModel instanceof TemplateSequenceModel && rightModel instanceof TemplateSequenceModel) {
- return new ConcatenatedSequence((TemplateSequenceModel) leftModel, (TemplateSequenceModel) rightModel);
- } else {
- try {
- Object leftOMOrStr = EvalUtil.coerceModelToStringOrMarkup(
- leftModel, leftExp, (String) null, env);
- Object rightOMOrStr = EvalUtil.coerceModelToStringOrMarkup(
- rightModel, rightExp, (String) null, env);
-
- if (leftOMOrStr instanceof String) {
- if (rightOMOrStr instanceof String) {
- return new SimpleScalar(((String) leftOMOrStr).concat((String) rightOMOrStr));
- } else { // rightOMOrStr instanceof TemplateMarkupOutputModel
- TemplateMarkupOutputModel<?> rightMO = (TemplateMarkupOutputModel<?>) rightOMOrStr;
- return EvalUtil.concatMarkupOutputs(parent,
- rightMO.getOutputFormat().fromPlainTextByEscaping((String) leftOMOrStr),
- rightMO);
- }
- } else { // leftOMOrStr instanceof TemplateMarkupOutputModel
- TemplateMarkupOutputModel<?> leftMO = (TemplateMarkupOutputModel<?>) leftOMOrStr;
- if (rightOMOrStr instanceof String) { // markup output
- return EvalUtil.concatMarkupOutputs(parent,
- leftMO,
- leftMO.getOutputFormat().fromPlainTextByEscaping((String) rightOMOrStr));
- } else { // rightOMOrStr instanceof TemplateMarkupOutputModel
- return EvalUtil.concatMarkupOutputs(parent,
- leftMO,
- (TemplateMarkupOutputModel) rightOMOrStr);
- }
- }
- } catch (NonStringOrTemplateOutputException e) {
- if (leftModel instanceof TemplateHashModel && rightModel instanceof TemplateHashModel) {
- if (leftModel instanceof TemplateHashModelEx && rightModel instanceof TemplateHashModelEx) {
- TemplateHashModelEx leftModelEx = (TemplateHashModelEx) leftModel;
- TemplateHashModelEx rightModelEx = (TemplateHashModelEx) rightModel;
- if (leftModelEx.size() == 0) {
- return rightModelEx;
- } else if (rightModelEx.size() == 0) {
- return leftModelEx;
- } else {
- return new ConcatenatedHashEx(leftModelEx, rightModelEx);
- }
- } else {
- return new ConcatenatedHash((TemplateHashModel) leftModel,
- (TemplateHashModel) rightModel);
- }
- } else {
- throw e;
- }
- }
- }
- }
-
- static TemplateModel _evalOnNumbers(Environment env, TemplateObject parent, Number first, Number second)
- throws TemplateException {
- ArithmeticEngine ae = EvalUtil.getArithmeticEngine(env, parent);
- return new SimpleNumber(ae.add(first, second));
- }
-
- @Override
- boolean isLiteral() {
- return constantValue != null || (left.isLiteral() && right.isLiteral());
- }
-
- @Override
- protected Expression deepCloneWithIdentifierReplaced_inner(
- String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) {
- return new AddConcatExpression(
- left.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState),
- right.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState));
- }
-
- @Override
- public String getCanonicalForm() {
- return left.getCanonicalForm() + " + " + right.getCanonicalForm();
- }
-
- @Override
- String getNodeTypeSymbol() {
- return "+";
- }
-
- @Override
- int getParameterCount() {
- return 2;
- }
-
- @Override
- Object getParameterValue(int idx) {
- return idx == 0 ? left : right;
- }
-
- @Override
- ParameterRole getParameterRole(int idx) {
- return ParameterRole.forBinaryOperatorOperand(idx);
- }
-
- private static final class ConcatenatedSequence
- implements
- TemplateSequenceModel {
- private final TemplateSequenceModel left;
- private final TemplateSequenceModel right;
-
- ConcatenatedSequence(TemplateSequenceModel left, TemplateSequenceModel right) {
- this.left = left;
- this.right = right;
- }
-
- public int size()
- throws TemplateModelException {
- return left.size() + right.size();
- }
-
- public TemplateModel get(int i)
- throws TemplateModelException {
- int ls = left.size();
- return i < ls ? left.get(i) : right.get(i - ls);
- }
- }
-
- private static class ConcatenatedHash
- implements TemplateHashModel {
- protected final TemplateHashModel left;
- protected final TemplateHashModel right;
-
- ConcatenatedHash(TemplateHashModel left, TemplateHashModel right) {
- this.left = left;
- this.right = right;
- }
-
- public TemplateModel get(String key)
- throws TemplateModelException {
- TemplateModel model = right.get(key);
- return (model != null) ? model : left.get(key);
- }
-
- public boolean isEmpty()
- throws TemplateModelException {
- return left.isEmpty() && right.isEmpty();
- }
- }
-
- private static final class ConcatenatedHashEx
- extends ConcatenatedHash
- implements TemplateHashModelEx {
- private CollectionAndSequence keys;
- private CollectionAndSequence values;
- private int size;
-
- ConcatenatedHashEx(TemplateHashModelEx left, TemplateHashModelEx right) {
- super(left, right);
- }
-
- public int size() throws TemplateModelException {
- initKeys();
- return size;
- }
-
- public TemplateCollectionModel keys()
- throws TemplateModelException {
- initKeys();
- return keys;
- }
-
- public TemplateCollectionModel values()
- throws TemplateModelException {
- initValues();
- return values;
- }
-
- private void initKeys()
- throws TemplateModelException {
- if (keys == null) {
- HashSet keySet = new HashSet();
- SimpleSequence keySeq = new SimpleSequence(32);
- addKeys(keySet, keySeq, (TemplateHashModelEx) this.left);
- addKeys(keySet, keySeq, (TemplateHashModelEx) this.right);
- size = keySet.size();
- keys = new CollectionAndSequence(keySeq);
- }
- }
-
- private static void addKeys(Set set, SimpleSequence keySeq, TemplateHashModelEx hash)
- throws TemplateModelException {
- TemplateModelIterator it = hash.keys().iterator();
- while (it.hasNext()) {
- TemplateScalarModel tsm = (TemplateScalarModel) it.next();
- if (set.add(tsm.getAsString())) {
- // The first occurence of the key decides the index;
- // this is consisten with stuff like java.util.LinkedHashSet.
- keySeq.add(tsm);
- }
- }
- }
-
- private void initValues()
- throws TemplateModelException {
- if (values == null) {
- SimpleSequence seq = new SimpleSequence(size());
- // Note: size() invokes initKeys() if needed.
-
- int ln = keys.size();
- for (int i = 0; i < ln; i++) {
- seq.add(get(((TemplateScalarModel) keys.get(i)).getAsString()));
- }
- values = new CollectionAndSequence(seq);
- }
- }
- }
-
-}
diff --git a/src/main/java/freemarker/core/AliasTargetTemplateValueFormatException.java b/src/main/java/freemarker/core/AliasTargetTemplateValueFormatException.java
deleted file mode 100644
index bf37e66..0000000
--- a/src/main/java/freemarker/core/AliasTargetTemplateValueFormatException.java
+++ /dev/null
@@ -1,36 +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 freemarker.core;
-
-/**
- * Can't create a template format that the template format refers to (typically thrown by alias template formats).
- *
- * @since 2.3.24
- */
-class AliasTargetTemplateValueFormatException extends TemplateValueFormatException {
-
- public AliasTargetTemplateValueFormatException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public AliasTargetTemplateValueFormatException(String message) {
- super(message);
- }
-
-}
diff --git a/src/main/java/freemarker/core/AliasTemplateDateFormatFactory.java b/src/main/java/freemarker/core/AliasTemplateDateFormatFactory.java
... 189202 lines suppressed ...