kinow commented on code in PR #36:
URL: 
https://github.com/apache/commons-configuration/pull/36#discussion_r868846177


##########
src/changes/changes.xml:
##########
@@ -46,6 +46,9 @@
        <action issue="CONFIGURATION-805" type="update" dev="ggregory" 
due-to="Roman Zaynetdinov">
          [Javadoc] Specify that typed getList returns null for missing key 
#100.
        </action>
+       <action issue="CONFIGURATION-764" type="update" dev="ningzhangnj"  
due-to="Ning Zhang">
+         Default date lookup can not work for some specific format
+       </action>

Review Comment:
   You can leave `changes.xml` to be updated later by a committer, no need to 
include in this PR :+1: (it's also conflicting with `master` now, so removing 
it from this PR will fix that).



##########
src/main/java/org/apache/commons/configuration2/interpol/StringLookupCatchExceptionAdapter.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.configuration2.interpol;
+
+import org.apache.commons.text.lookup.StringLookup;
+
+/**
+ * Extension of StringLookupAdapter, the difference is return null if catching 
exception during lookup. 
+ *
+ * @since 2.8.0
+ */
+class StringLookupCatchExceptionAdapter extends StringLookupAdapter
+{
+
+    
+    StringLookupCatchExceptionAdapter(final StringLookup stringLookup)
+    {
+        super(stringLookup);
+    }
+
+    @Override
+    public Object lookup(final String key)
+    {
+        try {
+               return super.lookup(key);
+        } catch (Exception e) {
+               return null;
+        }

Review Comment:
   Formatting issues above :point_up: 



##########
src/main/java/org/apache/commons/configuration2/interpol/StringLookupCatchExceptionAdapter.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.configuration2.interpol;
+
+import org.apache.commons.text.lookup.StringLookup;
+
+/**
+ * Extension of StringLookupAdapter, the difference is return null if catching 
exception during lookup. 
+ *
+ * @since 2.8.0
+ */
+class StringLookupCatchExceptionAdapter extends StringLookupAdapter

Review Comment:
   Maybe `StringLookupAdapter` could have a parameter like `suppress=false` 
that's disabled by default? This class is not public, so either way is fine, we 
can improve on it later IMO.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to