You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/05/15 18:38:51 UTC

[GitHub] [commons-configuration] darkma773r commented on a diff in pull request #36: [CONFIGURATION-764] Default date lookup can not work for some specific

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


##########
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:
   One issue I see here is that if we suppress exceptions in the adapter, then legitimate configuration errors will not be propagated. For example, say I have a property like `current date= ${date:not-a-format}`. With the changes here, this would interpolate without error to the string `current date= ${date:not-a-format}` instead of throwing an exception about the invalid format string, as is the current behavior.



-- 
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-unsubscribe@commons.apache.org

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