You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2021/06/15 06:01:06 UTC

[commons-text] branch master updated: Renaming variable to not use restricted identifier Modified variable name from 'var' to 'key' to avoid confusion in future

This is an automated email from the ASF dual-hosted git repository.

kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new 6967b34  Renaming variable to not use restricted identifier Modified variable name from 'var' to 'key' to avoid confusion in future
     new 38eb800  Merge pull request #239 from fykidwai/master
6967b34 is described below

commit 6967b34de5857ce6aca70f260300749865f75e67
Author: Faiz Kidwai <f....@gmail.com>
AuthorDate: Mon Jun 14 23:29:47 2021 +0530

    Renaming variable to not use restricted identifier
    Modified variable name from 'var' to 'key' to avoid confusion in future
---
 .../commons/text/lookup/InterpolatorStringLookup.java    | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/commons/text/lookup/InterpolatorStringLookup.java b/src/main/java/org/apache/commons/text/lookup/InterpolatorStringLookup.java
index 3e02f60..476ea14 100644
--- a/src/main/java/org/apache/commons/text/lookup/InterpolatorStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/InterpolatorStringLookup.java
@@ -115,19 +115,19 @@ class InterpolatorStringLookup extends AbstractStringLookup {
      * the prefix stripped to the lookup object registered for this prefix. If no prefix can be found or if the
      * associated lookup object cannot resolve this variable, the default lookup object will be used.
      *
-     * @param var the name of the variable whose value is to be looked up
+     * @param key the name of the variable whose value is to be looked up
      * @return The value of this variable or <b>null</b> if it cannot be resolved
      */
     @Override
-    public String lookup(String var) {
-        if (var == null) {
+    public String lookup(String key) {
+        if (key == null) {
             return null;
         }
 
-        final int prefixPos = var.indexOf(PREFIX_SEPARATOR);
+        final int prefixPos = key.indexOf(PREFIX_SEPARATOR);
         if (prefixPos >= 0) {
-            final String prefix = toKey(var.substring(0, prefixPos));
-            final String name = var.substring(prefixPos + 1);
+            final String prefix = toKey(key.substring(0, prefixPos));
+            final String name = key.substring(prefixPos + 1);
             final StringLookup lookup = stringLookupMap.get(prefix);
             String value = null;
             if (lookup != null) {
@@ -137,10 +137,10 @@ class InterpolatorStringLookup extends AbstractStringLookup {
             if (value != null) {
                 return value;
             }
-            var = var.substring(prefixPos + 1);
+            key = key.substring(prefixPos + 1);
         }
         if (defaultStringLookup != null) {
-            return defaultStringLookup.lookup(var);
+            return defaultStringLookup.lookup(key);
         }
         return null;
     }