You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2019/12/09 13:42:48 UTC
[myfaces] branch 2.3.x updated: MYFACES-4313
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch 2.3.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/2.3.x by this push:
new 12ef10a MYFACES-4313
12ef10a is described below
commit 12ef10adccd2cf6f4e18c6547c35f1737b736b9a
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Mon Dec 9 14:42:41 2019 +0100
MYFACES-4313
---
.../config/DefaultFacesConfigurationProvider.java | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java b/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
index 667b7b3..d8b0e16 100644
--- a/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
+++ b/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
@@ -18,6 +18,7 @@
*/
package org.apache.myfaces.config;
+import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import org.apache.myfaces.config.annotation.AnnotationConfigurator;
import org.apache.myfaces.config.element.FacesConfig;
@@ -393,6 +394,28 @@ public class DefaultFacesConfigurationProvider extends FacesConfigurationProvide
{
try
{
+ // skip parsing/validating a empty faces-config.xml to avoid warn/error logs
+ try (InputStream stream = ectx.getResourceAsStream(DEFAULT_FACES_CONFIG))
+ {
+ if (stream != null)
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = stream.read(buffer)) != -1)
+ {
+ out.write(buffer, 0, length);
+ }
+ out.flush();
+
+ String content = new String(out.toByteArray());
+ if (content.trim().isEmpty())
+ {
+ return new FacesConfigImpl();
+ }
+ }
+ }
+
FacesConfig webAppConfig = null;
// web application config
if (MyfacesConfig.getCurrentInstance(ectx).isValidateXML())