Modified: websites/production/commons/content/proper/commons-text/jacoco/org.apache.commons.text/StrSubstitutor.java.html ============================================================================== --- websites/production/commons/content/proper/commons-text/jacoco/org.apache.commons.text/StrSubstitutor.java.html (original) +++ websites/production/commons/content/proper/commons-text/jacoco/org.apache.commons.text/StrSubstitutor.java.html Sun Mar 12 02:08:01 2017 @@ -152,7 +152,7 @@ public class StrSubstitutor { */ private StrMatcher suffixMatcher; /** - * Stores the default variable value delimiter + * Stores the default variable value delimiter. */ private StrMatcher valueDelimiterMatcher; /** @@ -195,8 +195,11 @@ public class StrSubstitutor { * @return the result of the replace operation * @throws IllegalArgumentException if the prefix or suffix is null */ - public static <V> String replace(final Object source, final Map<String, V> valueMap, final String prefix, final String suffix) { -<span class="fc" id="L199"> return new StrSubstitutor(valueMap, prefix, suffix).replace(source);</span> + public static <V> String replace(final Object source, + final Map<String, V> valueMap, + final String prefix, + final String suffix) { +<span class="fc" id="L202"> return new StrSubstitutor(valueMap, prefix, suffix).replace(source);</span> } /** @@ -208,17 +211,17 @@ public class StrSubstitutor { * @return the result of the replace operation */ public static String replace(final Object source, final Properties valueProperties) { -<span class="pc bpc" id="L211" title="1 of 2 branches missed."> if (valueProperties == null) {</span> -<span class="nc" id="L212"> return source.toString();</span> +<span class="pc bpc" id="L214" title="1 of 2 branches missed."> if (valueProperties == null) {</span> +<span class="nc" id="L215"> return source.toString();</span> } -<span class="fc" id="L214"> final Map<String,String> valueMap = new HashMap<>();</span> -<span class="fc" id="L215"> final Enumeration<?> propNames = valueProperties.propertyNames();</span> -<span class="fc bfc" id="L216" title="All 2 branches covered."> while (propNames.hasMoreElements()) {</span> -<span class="fc" id="L217"> final String propName = (String)propNames.nextElement();</span> -<span class="fc" id="L218"> final String propValue = valueProperties.getProperty(propName);</span> -<span class="fc" id="L219"> valueMap.put(propName, propValue);</span> -<span class="fc" id="L220"> }</span> -<span class="fc" id="L221"> return StrSubstitutor.replace(source, valueMap);</span> +<span class="fc" id="L217"> final Map<String, String> valueMap = new HashMap<>();</span> +<span class="fc" id="L218"> final Enumeration<?> propNames = valueProperties.propertyNames();</span> +<span class="fc bfc" id="L219" title="All 2 branches covered."> while (propNames.hasMoreElements()) {</span> +<span class="fc" id="L220"> final String propName = (String) propNames.nextElement();</span> +<span class="fc" id="L221"> final String propValue = valueProperties.getProperty(propName);</span> +<span class="fc" id="L222"> valueMap.put(propName, propValue);</span> +<span class="fc" id="L223"> }</span> +<span class="fc" id="L224"> return StrSubstitutor.replace(source, valueMap);</span> } /** @@ -229,7 +232,7 @@ public class StrSubstitutor { * @return the result of the replace operation */ public static String replaceSystemProperties(final Object source) { -<span class="fc" id="L232"> return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);</span> +<span class="fc" id="L235"> return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);</span> } //----------------------------------------------------------------------- @@ -238,8 +241,8 @@ public class StrSubstitutor { * and the escaping character. */ public StrSubstitutor() { -<span class="fc" id="L241"> this((StrLookup<?>) null, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);</span> -<span class="fc" id="L242"> }</span> +<span class="fc" id="L244"> this((StrLookup<?>) null, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);</span> +<span class="fc" id="L245"> }</span> /** * Creates a new instance and initializes it. Uses defaults for variable @@ -249,8 +252,8 @@ public class StrSubstitutor { * @param valueMap the map with the variables' values, may be null */ public <V> StrSubstitutor(final Map<String, V> valueMap) { -<span class="fc" id="L252"> this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);</span> -<span class="fc" id="L253"> }</span> +<span class="fc" id="L255"> this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);</span> +<span class="fc" id="L256"> }</span> /** * Creates a new instance and initializes it. Uses a default escaping character. @@ -262,8 +265,8 @@ public class StrSubstitutor { * @throws IllegalArgumentException if the prefix or suffix is null */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix) { -<span class="fc" id="L265"> this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE);</span> -<span class="fc" id="L266"> }</span> +<span class="fc" id="L268"> this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE);</span> +<span class="fc" id="L269"> }</span> /** * Creates a new instance and initializes it. @@ -277,8 +280,8 @@ public class StrSubstitutor { */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape) { -<span class="fc" id="L280"> this(StrLookup.mapLookup(valueMap), prefix, suffix, escape);</span> -<span class="fc" id="L281"> }</span> +<span class="fc" id="L283"> this(StrLookup.mapLookup(valueMap), prefix, suffix, escape);</span> +<span class="fc" id="L284"> }</span> /** * Creates a new instance and initializes it. @@ -293,8 +296,8 @@ public class StrSubstitutor { */ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape, final String valueDelimiter) { -<span class="fc" id="L296"> this(StrLookup.mapLookup(valueMap), prefix, suffix, escape, valueDelimiter);</span> -<span class="fc" id="L297"> }</span> +<span class="fc" id="L299"> this(StrLookup.mapLookup(valueMap), prefix, suffix, escape, valueDelimiter);</span> +<span class="fc" id="L300"> }</span> /** * Creates a new instance and initializes it. @@ -302,8 +305,8 @@ public class StrSubstitutor { * @param variableResolver the variable resolver, may be null */ public StrSubstitutor(final StrLookup<?> variableResolver) { -<span class="fc" id="L305"> this(variableResolver, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);</span> -<span class="fc" id="L306"> }</span> +<span class="fc" id="L308"> this(variableResolver, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);</span> +<span class="fc" id="L309"> }</span> /** * Creates a new instance and initializes it. @@ -315,13 +318,13 @@ public class StrSubstitutor { * @throws IllegalArgumentException if the prefix or suffix is null */ public StrSubstitutor(final StrLookup<?> variableResolver, final String prefix, final String suffix, -<span class="fc" id="L318"> final char escape) {</span> -<span class="fc" id="L319"> this.setVariableResolver(variableResolver);</span> -<span class="fc" id="L320"> this.setVariablePrefix(prefix);</span> -<span class="fc" id="L321"> this.setVariableSuffix(suffix);</span> -<span class="fc" id="L322"> this.setEscapeChar(escape);</span> -<span class="fc" id="L323"> this.setValueDelimiterMatcher(DEFAULT_VALUE_DELIMITER);</span> -<span class="fc" id="L324"> }</span> +<span class="fc" id="L321"> final char escape) {</span> +<span class="fc" id="L322"> this.setVariableResolver(variableResolver);</span> +<span class="fc" id="L323"> this.setVariablePrefix(prefix);</span> +<span class="fc" id="L324"> this.setVariableSuffix(suffix);</span> +<span class="fc" id="L325"> this.setEscapeChar(escape);</span> +<span class="fc" id="L326"> this.setValueDelimiterMatcher(DEFAULT_VALUE_DELIMITER);</span> +<span class="fc" id="L327"> }</span> /** * Creates a new instance and initializes it. @@ -334,13 +337,13 @@ public class StrSubstitutor { * @throws IllegalArgumentException if the prefix or suffix is null */ public StrSubstitutor(final StrLookup<?> variableResolver, final String prefix, final String suffix, -<span class="fc" id="L337"> final char escape, final String valueDelimiter) {</span> -<span class="fc" id="L338"> this.setVariableResolver(variableResolver);</span> -<span class="fc" id="L339"> this.setVariablePrefix(prefix);</span> -<span class="fc" id="L340"> this.setVariableSuffix(suffix);</span> -<span class="fc" id="L341"> this.setEscapeChar(escape);</span> -<span class="fc" id="L342"> this.setValueDelimiter(valueDelimiter);</span> -<span class="fc" id="L343"> }</span> +<span class="fc" id="L340"> final char escape, final String valueDelimiter) {</span> +<span class="fc" id="L341"> this.setVariableResolver(variableResolver);</span> +<span class="fc" id="L342"> this.setVariablePrefix(prefix);</span> +<span class="fc" id="L343"> this.setVariableSuffix(suffix);</span> +<span class="fc" id="L344"> this.setEscapeChar(escape);</span> +<span class="fc" id="L345"> this.setValueDelimiter(valueDelimiter);</span> +<span class="fc" id="L346"> }</span> /** * Creates a new instance and initializes it. @@ -354,8 +357,8 @@ public class StrSubstitutor { public StrSubstitutor( final StrLookup<?> variableResolver, final StrMatcher prefixMatcher, final StrMatcher suffixMatcher, final char escape) { -<span class="fc" id="L357"> this(variableResolver, prefixMatcher, suffixMatcher, escape, DEFAULT_VALUE_DELIMITER);</span> -<span class="fc" id="L358"> }</span> +<span class="fc" id="L360"> this(variableResolver, prefixMatcher, suffixMatcher, escape, DEFAULT_VALUE_DELIMITER);</span> +<span class="fc" id="L361"> }</span> /** * Creates a new instance and initializes it. @@ -369,13 +372,13 @@ public class StrSubstitutor { */ public StrSubstitutor( final StrLookup<?> variableResolver, final StrMatcher prefixMatcher, final StrMatcher suffixMatcher, -<span class="fc" id="L372"> final char escape, final StrMatcher valueDelimiterMatcher) {</span> -<span class="fc" id="L373"> this.setVariableResolver(variableResolver);</span> -<span class="fc" id="L374"> this.setVariablePrefixMatcher(prefixMatcher);</span> -<span class="fc" id="L375"> this.setVariableSuffixMatcher(suffixMatcher);</span> -<span class="fc" id="L376"> this.setEscapeChar(escape);</span> -<span class="fc" id="L377"> this.setValueDelimiterMatcher(valueDelimiterMatcher);</span> -<span class="fc" id="L378"> }</span> +<span class="fc" id="L375"> final char escape, final StrMatcher valueDelimiterMatcher) {</span> +<span class="fc" id="L376"> this.setVariableResolver(variableResolver);</span> +<span class="fc" id="L377"> this.setVariablePrefixMatcher(prefixMatcher);</span> +<span class="fc" id="L378"> this.setVariableSuffixMatcher(suffixMatcher);</span> +<span class="fc" id="L379"> this.setEscapeChar(escape);</span> +<span class="fc" id="L380"> this.setValueDelimiterMatcher(valueDelimiterMatcher);</span> +<span class="fc" id="L381"> }</span> //----------------------------------------------------------------------- /** @@ -386,14 +389,14 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final String source) { -<span class="fc bfc" id="L389" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L390"> return null;</span> +<span class="fc bfc" id="L392" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L393"> return null;</span> } -<span class="fc" id="L392"> final StrBuilder buf = new StrBuilder(source);</span> -<span class="fc bfc" id="L393" title="All 2 branches covered."> if (substitute(buf, 0, source.length()) == false) {</span> -<span class="fc" id="L394"> return source;</span> +<span class="fc" id="L395"> final StrBuilder buf = new StrBuilder(source);</span> +<span class="fc bfc" id="L396" title="All 2 branches covered."> if (!substitute(buf, 0, source.length())) {</span> +<span class="fc" id="L397"> return source;</span> } -<span class="fc" id="L396"> return buf.toString();</span> +<span class="fc" id="L399"> return buf.toString();</span> } /** @@ -409,14 +412,14 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final String source, final int offset, final int length) { -<span class="fc bfc" id="L412" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L413"> return null;</span> +<span class="fc bfc" id="L415" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L416"> return null;</span> } -<span class="fc" id="L415"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> -<span class="fc bfc" id="L416" title="All 2 branches covered."> if (substitute(buf, 0, length) == false) {</span> -<span class="fc" id="L417"> return source.substring(offset, offset + length);</span> +<span class="fc" id="L418"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> +<span class="fc bfc" id="L419" title="All 2 branches covered."> if (!substitute(buf, 0, length)) {</span> +<span class="fc" id="L420"> return source.substring(offset, offset + length);</span> } -<span class="fc" id="L419"> return buf.toString();</span> +<span class="fc" id="L422"> return buf.toString();</span> } //----------------------------------------------------------------------- @@ -429,12 +432,12 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final char[] source) { -<span class="fc bfc" id="L432" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L433"> return null;</span> +<span class="fc bfc" id="L435" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L436"> return null;</span> } -<span class="fc" id="L435"> final StrBuilder buf = new StrBuilder(source.length).append(source);</span> -<span class="fc" id="L436"> substitute(buf, 0, source.length);</span> -<span class="fc" id="L437"> return buf.toString();</span> +<span class="fc" id="L438"> final StrBuilder buf = new StrBuilder(source.length).append(source);</span> +<span class="fc" id="L439"> substitute(buf, 0, source.length);</span> +<span class="fc" id="L440"> return buf.toString();</span> } /** @@ -451,12 +454,12 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final char[] source, final int offset, final int length) { -<span class="fc bfc" id="L454" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L455"> return null;</span> +<span class="fc bfc" id="L457" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L458"> return null;</span> } -<span class="fc" id="L457"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> -<span class="fc" id="L458"> substitute(buf, 0, length);</span> -<span class="fc" id="L459"> return buf.toString();</span> +<span class="fc" id="L460"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> +<span class="fc" id="L461"> substitute(buf, 0, length);</span> +<span class="fc" id="L462"> return buf.toString();</span> } //----------------------------------------------------------------------- @@ -469,12 +472,12 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final StringBuffer source) { -<span class="fc bfc" id="L472" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L473"> return null;</span> +<span class="fc bfc" id="L475" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L476"> return null;</span> } -<span class="fc" id="L475"> final StrBuilder buf = new StrBuilder(source.length()).append(source);</span> -<span class="fc" id="L476"> substitute(buf, 0, buf.length());</span> -<span class="fc" id="L477"> return buf.toString();</span> +<span class="fc" id="L478"> final StrBuilder buf = new StrBuilder(source.length()).append(source);</span> +<span class="fc" id="L479"> substitute(buf, 0, buf.length());</span> +<span class="fc" id="L480"> return buf.toString();</span> } /** @@ -491,12 +494,12 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final StringBuffer source, final int offset, final int length) { -<span class="fc bfc" id="L494" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L495"> return null;</span> +<span class="fc bfc" id="L497" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L498"> return null;</span> } -<span class="fc" id="L497"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> -<span class="fc" id="L498"> substitute(buf, 0, length);</span> -<span class="fc" id="L499"> return buf.toString();</span> +<span class="fc" id="L500"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> +<span class="fc" id="L501"> substitute(buf, 0, length);</span> +<span class="fc" id="L502"> return buf.toString();</span> } /** @@ -508,10 +511,10 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final CharSequence source) { -<span class="pc bpc" id="L511" title="1 of 2 branches missed."> if (source == null) {</span> -<span class="nc" id="L512"> return null;</span> +<span class="pc bpc" id="L514" title="1 of 2 branches missed."> if (source == null) {</span> +<span class="nc" id="L515"> return null;</span> } -<span class="fc" id="L514"> return replace(source, 0, source.length());</span> +<span class="fc" id="L517"> return replace(source, 0, source.length());</span> } /** @@ -528,12 +531,12 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final CharSequence source, final int offset, final int length) { -<span class="pc bpc" id="L531" title="1 of 2 branches missed."> if (source == null) {</span> -<span class="nc" id="L532"> return null;</span> +<span class="pc bpc" id="L534" title="1 of 2 branches missed."> if (source == null) {</span> +<span class="nc" id="L535"> return null;</span> } -<span class="fc" id="L534"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> -<span class="fc" id="L535"> substitute(buf, 0, length);</span> -<span class="fc" id="L536"> return buf.toString();</span> +<span class="fc" id="L537"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> +<span class="fc" id="L538"> substitute(buf, 0, length);</span> +<span class="fc" id="L539"> return buf.toString();</span> } //----------------------------------------------------------------------- @@ -546,12 +549,12 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final StrBuilder source) { -<span class="fc bfc" id="L549" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L550"> return null;</span> +<span class="fc bfc" id="L552" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L553"> return null;</span> } -<span class="fc" id="L552"> final StrBuilder buf = new StrBuilder(source.length()).append(source);</span> -<span class="fc" id="L553"> substitute(buf, 0, buf.length());</span> -<span class="fc" id="L554"> return buf.toString();</span> +<span class="fc" id="L555"> final StrBuilder buf = new StrBuilder(source.length()).append(source);</span> +<span class="fc" id="L556"> substitute(buf, 0, buf.length());</span> +<span class="fc" id="L557"> return buf.toString();</span> } /** @@ -568,12 +571,12 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final StrBuilder source, final int offset, final int length) { -<span class="fc bfc" id="L571" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L572"> return null;</span> +<span class="fc bfc" id="L574" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L575"> return null;</span> } -<span class="fc" id="L574"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> -<span class="fc" id="L575"> substitute(buf, 0, length);</span> -<span class="fc" id="L576"> return buf.toString();</span> +<span class="fc" id="L577"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> +<span class="fc" id="L578"> substitute(buf, 0, length);</span> +<span class="fc" id="L579"> return buf.toString();</span> } //----------------------------------------------------------------------- @@ -586,12 +589,12 @@ public class StrSubstitutor { * @return the result of the replace operation */ public String replace(final Object source) { -<span class="fc bfc" id="L589" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L590"> return null;</span> +<span class="fc bfc" id="L592" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L593"> return null;</span> } -<span class="fc" id="L592"> final StrBuilder buf = new StrBuilder().append(source);</span> -<span class="fc" id="L593"> substitute(buf, 0, buf.length());</span> -<span class="fc" id="L594"> return buf.toString();</span> +<span class="fc" id="L595"> final StrBuilder buf = new StrBuilder().append(source);</span> +<span class="fc" id="L596"> substitute(buf, 0, buf.length());</span> +<span class="fc" id="L597"> return buf.toString();</span> } //----------------------------------------------------------------------- @@ -604,10 +607,10 @@ public class StrSubstitutor { * @return true if altered */ public boolean replaceIn(final StringBuffer source) { -<span class="fc bfc" id="L607" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L608"> return false;</span> +<span class="fc bfc" id="L610" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L611"> return false;</span> } -<span class="fc" id="L610"> return replaceIn(source, 0, source.length());</span> +<span class="fc" id="L613"> return replaceIn(source, 0, source.length());</span> } /** @@ -624,15 +627,15 @@ public class StrSubstitutor { * @return true if altered */ public boolean replaceIn(final StringBuffer source, final int offset, final int length) { -<span class="fc bfc" id="L627" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L628"> return false;</span> +<span class="fc bfc" id="L630" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L631"> return false;</span> } -<span class="fc" id="L630"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> -<span class="pc bpc" id="L631" title="1 of 2 branches missed."> if (substitute(buf, 0, length) == false) {</span> -<span class="nc" id="L632"> return false;</span> +<span class="fc" id="L633"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> +<span class="pc bpc" id="L634" title="1 of 2 branches missed."> if (!substitute(buf, 0, length)) {</span> +<span class="nc" id="L635"> return false;</span> } -<span class="fc" id="L634"> source.replace(offset, offset + length, buf.toString());</span> -<span class="fc" id="L635"> return true;</span> +<span class="fc" id="L637"> source.replace(offset, offset + length, buf.toString());</span> +<span class="fc" id="L638"> return true;</span> } //----------------------------------------------------------------------- @@ -645,10 +648,10 @@ public class StrSubstitutor { * @return true if altered */ public boolean replaceIn(final StringBuilder source) { -<span class="pc bpc" id="L648" title="1 of 2 branches missed."> if (source == null) {</span> -<span class="nc" id="L649"> return false;</span> +<span class="pc bpc" id="L651" title="1 of 2 branches missed."> if (source == null) {</span> +<span class="nc" id="L652"> return false;</span> } -<span class="fc" id="L651"> return replaceIn(source, 0, source.length());</span> +<span class="fc" id="L654"> return replaceIn(source, 0, source.length());</span> } /** @@ -665,15 +668,15 @@ public class StrSubstitutor { * @return true if altered */ public boolean replaceIn(final StringBuilder source, final int offset, final int length) { -<span class="pc bpc" id="L668" title="1 of 2 branches missed."> if (source == null) {</span> -<span class="nc" id="L669"> return false;</span> +<span class="pc bpc" id="L671" title="1 of 2 branches missed."> if (source == null) {</span> +<span class="nc" id="L672"> return false;</span> } -<span class="fc" id="L671"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> -<span class="pc bpc" id="L672" title="1 of 2 branches missed."> if (substitute(buf, 0, length) == false) {</span> -<span class="nc" id="L673"> return false;</span> +<span class="fc" id="L674"> final StrBuilder buf = new StrBuilder(length).append(source, offset, length);</span> +<span class="pc bpc" id="L675" title="1 of 2 branches missed."> if (!substitute(buf, 0, length)) {</span> +<span class="nc" id="L676"> return false;</span> } -<span class="fc" id="L675"> source.replace(offset, offset + length, buf.toString());</span> -<span class="fc" id="L676"> return true;</span> +<span class="fc" id="L678"> source.replace(offset, offset + length, buf.toString());</span> +<span class="fc" id="L679"> return true;</span> } //----------------------------------------------------------------------- @@ -685,10 +688,10 @@ public class StrSubstitutor { * @return true if altered */ public boolean replaceIn(final StrBuilder source) { -<span class="fc bfc" id="L688" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L689"> return false;</span> +<span class="fc bfc" id="L691" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L692"> return false;</span> } -<span class="fc" id="L691"> return substitute(source, 0, source.length());</span> +<span class="fc" id="L694"> return substitute(source, 0, source.length());</span> } /** @@ -704,10 +707,10 @@ public class StrSubstitutor { * @return true if altered */ public boolean replaceIn(final StrBuilder source, final int offset, final int length) { -<span class="fc bfc" id="L707" title="All 2 branches covered."> if (source == null) {</span> -<span class="fc" id="L708"> return false;</span> +<span class="fc bfc" id="L710" title="All 2 branches covered."> if (source == null) {</span> +<span class="fc" id="L711"> return false;</span> } -<span class="fc" id="L710"> return substitute(source, offset, length);</span> +<span class="fc" id="L713"> return substitute(source, offset, length);</span> } //----------------------------------------------------------------------- @@ -726,7 +729,7 @@ public class StrSubstitutor { * @return true if altered */ protected boolean substitute(final StrBuilder buf, final int offset, final int length) { -<span class="fc bfc" id="L729" title="All 2 branches covered."> return substitute(buf, offset, length, null) > 0;</span> +<span class="fc bfc" id="L732" title="All 2 branches covered."> return substitute(buf, offset, length, null) > 0;</span> } /** @@ -742,139 +745,146 @@ public class StrSubstitutor { * represents a boolean flag as to whether any change occurred. */ private int substitute(final StrBuilder buf, final int offset, final int length, List<String> priorVariables) { -<span class="fc" id="L745"> final StrMatcher pfxMatcher = getVariablePrefixMatcher();</span> -<span class="fc" id="L746"> final StrMatcher suffMatcher = getVariableSuffixMatcher();</span> -<span class="fc" id="L747"> final char escape = getEscapeChar();</span> -<span class="fc" id="L748"> final StrMatcher valueDelimMatcher = getValueDelimiterMatcher();</span> -<span class="fc" id="L749"> final boolean substitutionInVariablesEnabled = isEnableSubstitutionInVariables();</span> - -<span class="fc bfc" id="L751" title="All 2 branches covered."> final boolean top = priorVariables == null;</span> -<span class="fc" id="L752"> boolean altered = false;</span> -<span class="fc" id="L753"> int lengthChange = 0;</span> -<span class="fc" id="L754"> char[] chars = buf.buffer;</span> -<span class="fc" id="L755"> int bufEnd = offset + length;</span> -<span class="fc" id="L756"> int pos = offset;</span> -<span class="fc bfc" id="L757" title="All 2 branches covered."> while (pos < bufEnd) {</span> -<span class="fc" id="L758"> final int startMatchLen = pfxMatcher.isMatch(chars, pos, offset,</span> +<span class="fc" id="L748"> final StrMatcher pfxMatcher = getVariablePrefixMatcher();</span> +<span class="fc" id="L749"> final StrMatcher suffMatcher = getVariableSuffixMatcher();</span> +<span class="fc" id="L750"> final char escape = getEscapeChar();</span> +<span class="fc" id="L751"> final StrMatcher valueDelimMatcher = getValueDelimiterMatcher();</span> +<span class="fc" id="L752"> final boolean substitutionInVariablesEnabled = isEnableSubstitutionInVariables();</span> + +<span class="fc bfc" id="L754" title="All 2 branches covered."> final boolean top = priorVariables == null;</span> +<span class="fc" id="L755"> boolean altered = false;</span> +<span class="fc" id="L756"> int lengthChange = 0;</span> +<span class="fc" id="L757"> char[] chars = buf.buffer;</span> +<span class="fc" id="L758"> int bufEnd = offset + length;</span> +<span class="fc" id="L759"> int pos = offset;</span> +<span class="fc bfc" id="L760" title="All 2 branches covered."> while (pos < bufEnd) {</span> +<span class="fc" id="L761"> final int startMatchLen = pfxMatcher.isMatch(chars, pos, offset,</span> bufEnd); -<span class="fc bfc" id="L760" title="All 2 branches covered."> if (startMatchLen == 0) {</span> -<span class="fc" id="L761"> pos++;</span> +<span class="fc bfc" id="L763" title="All 2 branches covered."> if (startMatchLen == 0) {</span> +<span class="fc" id="L764"> pos++;</span> } else { // found variable start marker -<span class="fc bfc" id="L764" title="All 4 branches covered."> if (pos > offset && chars[pos - 1] == escape) {</span> +<span class="fc bfc" id="L767" title="All 4 branches covered."> if (pos > offset && chars[pos - 1] == escape) {</span> // escaped -<span class="fc bfc" id="L766" title="All 2 branches covered."> if (preserveEscapes) {</span> -<span class="fc" id="L767"> pos++;</span> -<span class="fc" id="L768"> continue;</span> +<span class="fc bfc" id="L769" title="All 2 branches covered."> if (preserveEscapes) {</span> +<span class="fc" id="L770"> pos++;</span> +<span class="fc" id="L771"> continue;</span> } -<span class="fc" id="L770"> buf.deleteCharAt(pos - 1);</span> -<span class="fc" id="L771"> chars = buf.buffer; // in case buffer was altered</span> -<span class="fc" id="L772"> lengthChange--;</span> -<span class="fc" id="L773"> altered = true;</span> -<span class="fc" id="L774"> bufEnd--;</span> +<span class="fc" id="L773"> buf.deleteCharAt(pos - 1);</span> +<span class="fc" id="L774"> chars = buf.buffer; // in case buffer was altered</span> +<span class="fc" id="L775"> lengthChange--;</span> +<span class="fc" id="L776"> altered = true;</span> +<span class="fc" id="L777"> bufEnd--;</span> } else { // find suffix -<span class="fc" id="L777"> final int startPos = pos;</span> -<span class="fc" id="L778"> pos += startMatchLen;</span> -<span class="fc" id="L779"> int endMatchLen = 0;</span> -<span class="fc" id="L780"> int nestedVarCount = 0;</span> -<span class="fc bfc" id="L781" title="All 2 branches covered."> while (pos < bufEnd) {</span> -<span class="fc bfc" id="L782" title="All 2 branches covered."> if (substitutionInVariablesEnabled</span> -<span class="fc bfc" id="L783" title="All 2 branches covered."> && (endMatchLen = pfxMatcher.isMatch(chars,</span> - pos, offset, bufEnd)) != 0) { +<span class="fc" id="L780"> final int startPos = pos;</span> +<span class="fc" id="L781"> pos += startMatchLen;</span> +<span class="fc" id="L782"> int endMatchLen = 0;</span> +<span class="fc" id="L783"> int nestedVarCount = 0;</span> +<span class="fc bfc" id="L784" title="All 2 branches covered."> while (pos < bufEnd) {</span> +<span class="fc bfc" id="L785" title="All 2 branches covered."> if (substitutionInVariablesEnabled</span> +<span class="fc bfc" id="L786" title="All 2 branches covered."> && pfxMatcher.isMatch(chars,</span> + pos, offset, bufEnd) != 0) { // found a nested variable start -<span class="fc" id="L786"> nestedVarCount++;</span> -<span class="fc" id="L787"> pos += endMatchLen;</span> -<span class="fc" id="L788"> continue;</span> +<span class="fc" id="L789"> endMatchLen = pfxMatcher.isMatch(chars,</span> + pos, offset, bufEnd); +<span class="fc" id="L791"> nestedVarCount++;</span> +<span class="fc" id="L792"> pos += endMatchLen;</span> +<span class="fc" id="L793"> continue;</span> } -<span class="fc" id="L791"> endMatchLen = suffMatcher.isMatch(chars, pos, offset,</span> +<span class="fc" id="L796"> endMatchLen = suffMatcher.isMatch(chars, pos, offset,</span> bufEnd); -<span class="fc bfc" id="L793" title="All 2 branches covered."> if (endMatchLen == 0) {</span> -<span class="fc" id="L794"> pos++;</span> +<span class="fc bfc" id="L798" title="All 2 branches covered."> if (endMatchLen == 0) {</span> +<span class="fc" id="L799"> pos++;</span> } else { // found variable end marker -<span class="fc bfc" id="L797" title="All 2 branches covered."> if (nestedVarCount == 0) {</span> -<span class="fc" id="L798"> String varNameExpr = new String(chars, startPos</span> +<span class="fc bfc" id="L802" title="All 2 branches covered."> if (nestedVarCount == 0) {</span> +<span class="fc" id="L803"> String varNameExpr = new String(chars, startPos</span> + startMatchLen, pos - startPos - startMatchLen); -<span class="fc bfc" id="L801" title="All 2 branches covered."> if (substitutionInVariablesEnabled) {</span> -<span class="fc" id="L802"> final StrBuilder bufName = new StrBuilder(varNameExpr);</span> -<span class="fc" id="L803"> substitute(bufName, 0, bufName.length());</span> -<span class="fc" id="L804"> varNameExpr = bufName.toString();</span> +<span class="fc bfc" id="L806" title="All 2 branches covered."> if (substitutionInVariablesEnabled) {</span> +<span class="fc" id="L807"> final StrBuilder bufName = new StrBuilder(varNameExpr);</span> +<span class="fc" id="L808"> substitute(bufName, 0, bufName.length());</span> +<span class="fc" id="L809"> varNameExpr = bufName.toString();</span> } -<span class="fc" id="L806"> pos += endMatchLen;</span> -<span class="fc" id="L807"> final int endPos = pos;</span> +<span class="fc" id="L811"> pos += endMatchLen;</span> +<span class="fc" id="L812"> final int endPos = pos;</span> -<span class="fc" id="L809"> String varName = varNameExpr;</span> -<span class="fc" id="L810"> String varDefaultValue = null;</span> +<span class="fc" id="L814"> String varName = varNameExpr;</span> +<span class="fc" id="L815"> String varDefaultValue = null;</span> -<span class="fc bfc" id="L812" title="All 2 branches covered."> if (valueDelimMatcher != null) {</span> -<span class="fc" id="L813"> final char [] varNameExprChars = varNameExpr.toCharArray();</span> -<span class="fc" id="L814"> int valueDelimiterMatchLen = 0;</span> -<span class="fc bfc" id="L815" title="All 2 branches covered."> for (int i = 0; i < varNameExprChars.length; i++) {</span> - // if there's any nested variable when nested variable substitution disabled, then stop resolving name and default value. -<span class="fc bfc" id="L817" title="All 2 branches covered."> if (!substitutionInVariablesEnabled</span> -<span class="fc bfc" id="L818" title="All 2 branches covered."> && pfxMatcher.isMatch(varNameExprChars, i, i, varNameExprChars.length) != 0) {</span> -<span class="fc" id="L819"> break;</span> +<span class="fc bfc" id="L817" title="All 2 branches covered."> if (valueDelimMatcher != null) {</span> +<span class="fc" id="L818"> final char [] varNameExprChars = varNameExpr.toCharArray();</span> +<span class="fc" id="L819"> int valueDelimiterMatchLen = 0;</span> +<span class="fc bfc" id="L820" title="All 2 branches covered."> for (int i = 0; i < varNameExprChars.length; i++) {</span> + // if there's any nested variable when nested variable substitution disabled, + // then stop resolving name and default value. +<span class="fc bfc" id="L823" title="All 2 branches covered."> if (!substitutionInVariablesEnabled</span> +<span class="fc bfc" id="L824" title="All 2 branches covered."> && pfxMatcher.isMatch(varNameExprChars,</span> + i, + i, + varNameExprChars.length) != 0) { +<span class="fc" id="L828"> break;</span> } -<span class="fc bfc" id="L821" title="All 2 branches covered."> if ((valueDelimiterMatchLen = valueDelimMatcher.isMatch(varNameExprChars, i)) != 0) {</span> -<span class="fc" id="L822"> varName = varNameExpr.substring(0, i);</span> -<span class="fc" id="L823"> varDefaultValue = varNameExpr.substring(i + valueDelimiterMatchLen);</span> -<span class="fc" id="L824"> break;</span> +<span class="fc bfc" id="L830" title="All 2 branches covered."> if (valueDelimMatcher.isMatch(varNameExprChars, i) != 0) {</span> +<span class="fc" id="L831"> valueDelimiterMatchLen = valueDelimMatcher.isMatch(varNameExprChars, i);</span> +<span class="fc" id="L832"> varName = varNameExpr.substring(0, i);</span> +<span class="fc" id="L833"> varDefaultValue = varNameExpr.substring(i + valueDelimiterMatchLen);</span> +<span class="fc" id="L834"> break;</span> } } } // on the first call initialize priorVariables -<span class="fc bfc" id="L830" title="All 2 branches covered."> if (priorVariables == null) {</span> -<span class="fc" id="L831"> priorVariables = new ArrayList<>();</span> -<span class="fc" id="L832"> priorVariables.add(new String(chars,</span> +<span class="fc bfc" id="L840" title="All 2 branches covered."> if (priorVariables == null) {</span> +<span class="fc" id="L841"> priorVariables = new ArrayList<>();</span> +<span class="fc" id="L842"> priorVariables.add(new String(chars,</span> offset, length)); } // handle cyclic substitution -<span class="fc" id="L837"> checkCyclicSubstitution(varName, priorVariables);</span> -<span class="fc" id="L838"> priorVariables.add(varName);</span> +<span class="fc" id="L847"> checkCyclicSubstitution(varName, priorVariables);</span> +<span class="fc" id="L848"> priorVariables.add(varName);</span> // resolve the variable -<span class="fc" id="L841"> String varValue = resolveVariable(varName, buf,</span> +<span class="fc" id="L851"> String varValue = resolveVariable(varName, buf,</span> startPos, endPos); -<span class="fc bfc" id="L843" title="All 2 branches covered."> if (varValue == null) {</span> -<span class="fc" id="L844"> varValue = varDefaultValue;</span> +<span class="fc bfc" id="L853" title="All 2 branches covered."> if (varValue == null) {</span> +<span class="fc" id="L854"> varValue = varDefaultValue;</span> } -<span class="fc bfc" id="L846" title="All 2 branches covered."> if (varValue != null) {</span> +<span class="fc bfc" id="L856" title="All 2 branches covered."> if (varValue != null) {</span> // recursive replace -<span class="fc" id="L848"> final int varLen = varValue.length();</span> -<span class="fc" id="L849"> buf.replace(startPos, endPos, varValue);</span> -<span class="fc" id="L850"> altered = true;</span> -<span class="fc" id="L851"> int change = substitute(buf, startPos,</span> +<span class="fc" id="L858"> final int varLen = varValue.length();</span> +<span class="fc" id="L859"> buf.replace(startPos, endPos, varValue);</span> +<span class="fc" id="L860"> altered = true;</span> +<span class="fc" id="L861"> int change = substitute(buf, startPos,</span> varLen, priorVariables); -<span class="fc" id="L853"> change = change</span> +<span class="fc" id="L863"> change = change</span> + varLen - (endPos - startPos); -<span class="fc" id="L855"> pos += change;</span> -<span class="fc" id="L856"> bufEnd += change;</span> -<span class="fc" id="L857"> lengthChange += change;</span> -<span class="fc" id="L858"> chars = buf.buffer; // in case buffer was</span> +<span class="fc" id="L865"> pos += change;</span> +<span class="fc" id="L866"> bufEnd += change;</span> +<span class="fc" id="L867"> lengthChange += change;</span> +<span class="fc" id="L868"> chars = buf.buffer; // in case buffer was</span> // altered } // remove variable from the cyclic stack -<span class="fc" id="L863"> priorVariables</span> -<span class="fc" id="L864"> .remove(priorVariables.size() - 1);</span> -<span class="fc" id="L865"> break;</span> +<span class="fc" id="L873"> priorVariables</span> +<span class="fc" id="L874"> .remove(priorVariables.size() - 1);</span> +<span class="fc" id="L875"> break;</span> } -<span class="fc" id="L867"> nestedVarCount--;</span> -<span class="fc" id="L868"> pos += endMatchLen;</span> +<span class="fc" id="L877"> nestedVarCount--;</span> +<span class="fc" id="L878"> pos += endMatchLen;</span> } } } } -<span class="fc" id="L873"> }</span> -<span class="fc bfc" id="L874" title="All 2 branches covered."> if (top) {</span> -<span class="fc bfc" id="L875" title="All 2 branches covered."> return altered ? 1 : 0;</span> +<span class="fc" id="L883"> }</span> +<span class="fc bfc" id="L884" title="All 2 branches covered."> if (top) {</span> +<span class="fc bfc" id="L885" title="All 2 branches covered."> return altered ? 1 : 0;</span> } -<span class="fc" id="L877"> return lengthChange;</span> +<span class="fc" id="L887"> return lengthChange;</span> } /** @@ -884,15 +894,15 @@ public class StrSubstitutor { * @param priorVariables the list of prior variables */ private void checkCyclicSubstitution(final String varName, final List<String> priorVariables) { -<span class="fc bfc" id="L887" title="All 2 branches covered."> if (priorVariables.contains(varName) == false) {</span> -<span class="fc" id="L888"> return;</span> +<span class="fc bfc" id="L897" title="All 2 branches covered."> if (!priorVariables.contains(varName)) {</span> +<span class="fc" id="L898"> return;</span> } -<span class="fc" id="L890"> final StrBuilder buf = new StrBuilder(256);</span> -<span class="fc" id="L891"> buf.append("Infinite loop in property interpolation of ");</span> -<span class="fc" id="L892"> buf.append(priorVariables.remove(0));</span> -<span class="fc" id="L893"> buf.append(": ");</span> -<span class="fc" id="L894"> buf.appendWithSeparators(priorVariables, "->");</span> -<span class="fc" id="L895"> throw new IllegalStateException(buf.toString());</span> +<span class="fc" id="L900"> final StrBuilder buf = new StrBuilder(256);</span> +<span class="fc" id="L901"> buf.append("Infinite loop in property interpolation of ");</span> +<span class="fc" id="L902"> buf.append(priorVariables.remove(0));</span> +<span class="fc" id="L903"> buf.append(": ");</span> +<span class="fc" id="L904"> buf.appendWithSeparators(priorVariables, "->");</span> +<span class="fc" id="L905"> throw new IllegalStateException(buf.toString());</span> } /** @@ -912,12 +922,15 @@ public class StrSubstitutor { * @param endPos the end position of the variable including the suffix, valid * @return the variable's value or <b>null</b> if the variable is unknown */ - protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) { -<span class="fc" id="L916"> final StrLookup<?> resolver = getVariableResolver();</span> -<span class="fc bfc" id="L917" title="All 2 branches covered."> if (resolver == null) {</span> -<span class="fc" id="L918"> return null;</span> + protected String resolveVariable(final String variableName, + final StrBuilder buf, + final int startPos, + final int endPos) { +<span class="fc" id="L929"> final StrLookup<?> resolver = getVariableResolver();</span> +<span class="fc bfc" id="L930" title="All 2 branches covered."> if (resolver == null) {</span> +<span class="fc" id="L931"> return null;</span> } -<span class="fc" id="L920"> return resolver.lookup(variableName);</span> +<span class="fc" id="L933"> return resolver.lookup(variableName);</span> } // Escape @@ -928,7 +941,7 @@ public class StrSubstitutor { * @return the character used for escaping variable references */ public char getEscapeChar() { -<span class="fc" id="L931"> return this.escapeChar;</span> +<span class="fc" id="L944"> return this.escapeChar;</span> } /** @@ -939,8 +952,8 @@ public class StrSubstitutor { * @param escapeCharacter the escape character (0 for disabling escaping) */ public void setEscapeChar(final char escapeCharacter) { -<span class="fc" id="L942"> this.escapeChar = escapeCharacter;</span> -<span class="fc" id="L943"> }</span> +<span class="fc" id="L955"> this.escapeChar = escapeCharacter;</span> +<span class="fc" id="L956"> }</span> // Prefix //----------------------------------------------------------------------- @@ -954,7 +967,7 @@ public class StrSubstitutor { * @return the prefix matcher in use */ public StrMatcher getVariablePrefixMatcher() { -<span class="fc" id="L957"> return prefixMatcher;</span> +<span class="fc" id="L970"> return prefixMatcher;</span> } /** @@ -969,11 +982,11 @@ public class StrSubstitutor { * @throws IllegalArgumentException if the prefix matcher is null */ public StrSubstitutor setVariablePrefixMatcher(final StrMatcher prefixMatcher) { -<span class="fc bfc" id="L972" title="All 2 branches covered."> if (prefixMatcher == null) {</span> -<span class="fc" id="L973"> throw new IllegalArgumentException("Variable prefix matcher must not be null!");</span> +<span class="fc bfc" id="L985" title="All 2 branches covered."> if (prefixMatcher == null) {</span> +<span class="fc" id="L986"> throw new IllegalArgumentException("Variable prefix matcher must not be null!");</span> } -<span class="fc" id="L975"> this.prefixMatcher = prefixMatcher;</span> -<span class="fc" id="L976"> return this;</span> +<span class="fc" id="L988"> this.prefixMatcher = prefixMatcher;</span> +<span class="fc" id="L989"> return this;</span> } /** @@ -987,7 +1000,7 @@ public class StrSubstitutor { * @return this, to enable chaining */ public StrSubstitutor setVariablePrefix(final char prefix) { -<span class="fc" id="L990"> return setVariablePrefixMatcher(StrMatcher.charMatcher(prefix));</span> +<span class="fc" id="L1003"> return setVariablePrefixMatcher(StrMatcher.charMatcher(prefix));</span> } /** @@ -1001,10 +1014,10 @@ public class StrSubstitutor { * @throws IllegalArgumentException if the prefix is null */ public StrSubstitutor setVariablePrefix(final String prefix) { -<span class="fc bfc" id="L1004" title="All 2 branches covered."> if (prefix == null) {</span> -<span class="fc" id="L1005"> throw new IllegalArgumentException("Variable prefix must not be null!");</span> +<span class="fc bfc" id="L1017" title="All 2 branches covered."> if (prefix == null) {</span> +<span class="fc" id="L1018"> throw new IllegalArgumentException("Variable prefix must not be null!");</span> } -<span class="fc" id="L1007"> return setVariablePrefixMatcher(StrMatcher.stringMatcher(prefix));</span> +<span class="fc" id="L1020"> return setVariablePrefixMatcher(StrMatcher.stringMatcher(prefix));</span> } // Suffix @@ -1019,7 +1032,7 @@ public class StrSubstitutor { * @return the suffix matcher in use */ public StrMatcher getVariableSuffixMatcher() { -<span class="fc" id="L1022"> return suffixMatcher;</span> +<span class="fc" id="L1035"> return suffixMatcher;</span> } /** @@ -1034,11 +1047,11 @@ public class StrSubstitutor { * @throws IllegalArgumentException if the suffix matcher is null */ public StrSubstitutor setVariableSuffixMatcher(final StrMatcher suffixMatcher) { -<span class="fc bfc" id="L1037" title="All 2 branches covered."> if (suffixMatcher == null) {</span> -<span class="fc" id="L1038"> throw new IllegalArgumentException("Variable suffix matcher must not be null!");</span> +<span class="fc bfc" id="L1050" title="All 2 branches covered."> if (suffixMatcher == null) {</span> +<span class="fc" id="L1051"> throw new IllegalArgumentException("Variable suffix matcher must not be null!");</span> } -<span class="fc" id="L1040"> this.suffixMatcher = suffixMatcher;</span> -<span class="fc" id="L1041"> return this;</span> +<span class="fc" id="L1053"> this.suffixMatcher = suffixMatcher;</span> +<span class="fc" id="L1054"> return this;</span> } /** @@ -1052,7 +1065,7 @@ public class StrSubstitutor { * @return this, to enable chaining */ public StrSubstitutor setVariableSuffix(final char suffix) { -<span class="fc" id="L1055"> return setVariableSuffixMatcher(StrMatcher.charMatcher(suffix));</span> +<span class="fc" id="L1068"> return setVariableSuffixMatcher(StrMatcher.charMatcher(suffix));</span> } /** @@ -1066,10 +1079,10 @@ public class StrSubstitutor { * @throws IllegalArgumentException if the suffix is null */ public StrSubstitutor setVariableSuffix(final String suffix) { -<span class="fc bfc" id="L1069" title="All 2 branches covered."> if (suffix == null) {</span> -<span class="fc" id="L1070"> throw new IllegalArgumentException("Variable suffix must not be null!");</span> +<span class="fc bfc" id="L1082" title="All 2 branches covered."> if (suffix == null) {</span> +<span class="fc" id="L1083"> throw new IllegalArgumentException("Variable suffix must not be null!");</span> } -<span class="fc" id="L1072"> return setVariableSuffixMatcher(StrMatcher.stringMatcher(suffix));</span> +<span class="fc" id="L1085"> return setVariableSuffixMatcher(StrMatcher.stringMatcher(suffix));</span> } // Variable Default Value Delimiter @@ -1086,7 +1099,7 @@ public class StrSubstitutor { * @return the variable default value delimiter matcher in use, may be null */ public StrMatcher getValueDelimiterMatcher() { -<span class="fc" id="L1089"> return valueDelimiterMatcher;</span> +<span class="fc" id="L1102"> return valueDelimiterMatcher;</span> } /** @@ -1103,8 +1116,8 @@ public class StrSubstitutor { * @return this, to enable chaining */ public StrSubstitutor setValueDelimiterMatcher(final StrMatcher valueDelimiterMatcher) { -<span class="fc" id="L1106"> this.valueDelimiterMatcher = valueDelimiterMatcher;</span> -<span class="fc" id="L1107"> return this;</span> +<span class="fc" id="L1119"> this.valueDelimiterMatcher = valueDelimiterMatcher;</span> +<span class="fc" id="L1120"> return this;</span> } /** @@ -1118,7 +1131,7 @@ public class StrSubstitutor { * @return this, to enable chaining */ public StrSubstitutor setValueDelimiter(final char valueDelimiter) { -<span class="fc" id="L1121"> return setValueDelimiterMatcher(StrMatcher.charMatcher(valueDelimiter));</span> +<span class="fc" id="L1134"> return setValueDelimiterMatcher(StrMatcher.charMatcher(valueDelimiter));</span> } /** @@ -1135,11 +1148,11 @@ public class StrSubstitutor { * @return this, to enable chaining */ public StrSubstitutor setValueDelimiter(final String valueDelimiter) { -<span class="fc bfc" id="L1138" title="All 4 branches covered."> if (valueDelimiter == null || valueDelimiter.length() == 0) {</span> -<span class="fc" id="L1139"> setValueDelimiterMatcher(null);</span> -<span class="fc" id="L1140"> return this;</span> +<span class="fc bfc" id="L1151" title="All 4 branches covered."> if (valueDelimiter == null || valueDelimiter.length() == 0) {</span> +<span class="fc" id="L1152"> setValueDelimiterMatcher(null);</span> +<span class="fc" id="L1153"> return this;</span> } -<span class="fc" id="L1142"> return setValueDelimiterMatcher(StrMatcher.stringMatcher(valueDelimiter));</span> +<span class="fc" id="L1155"> return setValueDelimiterMatcher(StrMatcher.stringMatcher(valueDelimiter));</span> } // Resolver @@ -1150,7 +1163,7 @@ public class StrSubstitutor { * @return the VariableResolver */ public StrLookup<?> getVariableResolver() { -<span class="fc" id="L1153"> return this.variableResolver;</span> +<span class="fc" id="L1166"> return this.variableResolver;</span> } /** @@ -1159,8 +1172,8 @@ public class StrSubstitutor { * @param variableResolver the VariableResolver */ public void setVariableResolver(final StrLookup<?> variableResolver) { -<span class="fc" id="L1162"> this.variableResolver = variableResolver;</span> -<span class="fc" id="L1163"> }</span> +<span class="fc" id="L1175"> this.variableResolver = variableResolver;</span> +<span class="fc" id="L1176"> }</span> // Substitution support in variable names //----------------------------------------------------------------------- @@ -1170,7 +1183,7 @@ public class StrSubstitutor { * @return the substitution in variable names flag */ public boolean isEnableSubstitutionInVariables() { -<span class="fc" id="L1173"> return enableSubstitutionInVariables;</span> +<span class="fc" id="L1186"> return enableSubstitutionInVariables;</span> } /** @@ -1183,17 +1196,17 @@ public class StrSubstitutor { */ public void setEnableSubstitutionInVariables( final boolean enableSubstitutionInVariables) { -<span class="fc" id="L1186"> this.enableSubstitutionInVariables = enableSubstitutionInVariables;</span> -<span class="fc" id="L1187"> }</span> +<span class="fc" id="L1199"> this.enableSubstitutionInVariables = enableSubstitutionInVariables;</span> +<span class="fc" id="L1200"> }</span> /** * Returns the flag controlling whether escapes are preserved during * substitution. - * + * * @return the preserve escape flag */ public boolean isPreserveEscapes() { -<span class="fc" id="L1196"> return preserveEscapes;</span> +<span class="fc" id="L1209"> return preserveEscapes;</span> } /** @@ -1204,11 +1217,11 @@ public class StrSubstitutor { * character is removed during substitution (e.g. * <code>$${this-is-escaped}</code> becomes * <code>${this-is-escaped}</code>). The default value is <b>false</b> - * + * * @param preserveEscapes true if escapes are to be preserved */ public void setPreserveEscapes(final boolean preserveEscapes) { -<span class="fc" id="L1211"> this.preserveEscapes = preserveEscapes;</span> -<span class="fc" id="L1212"> }</span> +<span class="fc" id="L1224"> this.preserveEscapes = preserveEscapes;</span> +<span class="fc" id="L1225"> }</span> } </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.8.201612092310</span></div></body></html> \ No newline at end of file