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 2020/02/26 19:27:47 UTC
[myfaces] branch master updated: cosmetics
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/master by this push:
new 8feed51 cosmetics
8feed51 is described below
commit 8feed516dd43bcb8852377295db68898fd13d917
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Wed Feb 26 20:27:41 2020 +0100
cosmetics
---
.../config/DefaultFacesConfigurationProvider.java | 40 +++++++++-------------
1 file changed, 17 insertions(+), 23 deletions(-)
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 e5ae14c..62c17c3 100644
--- a/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
+++ b/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
@@ -290,23 +290,15 @@ public class DefaultFacesConfigurationProvider extends FacesConfigurationProvide
{
validateFacesConfig(ectx, url);
}
- InputStream stream = null;
- try
+
+ try (InputStream stream = openStreamWithoutCache(url))
{
- stream = openStreamWithoutCache(url);
if (log.isLoggable(Level.FINE))
{
log.fine("Reading config: " + url.toExternalForm());
}
appConfigResources.add(getUnmarshaller(ectx).getFacesConfig(stream, url.toExternalForm()));
}
- finally
- {
- if (stream != null)
- {
- stream.close();
- }
- }
}
}
catch (Throwable e)
@@ -331,20 +323,22 @@ public class DefaultFacesConfigurationProvider extends FacesConfigurationProvide
{
validateFacesConfig(ectx, url);
}
- }
- InputStream stream = ectx.getResourceAsStream(systemId);
- if (stream == null)
- {
- log.severe("Faces config resource " + systemId + " not found");
- continue;
}
-
- if (log.isLoggable(Level.INFO))
+
+ try (InputStream stream = ectx.getResourceAsStream(systemId))
{
- log.info("Reading config " + systemId);
+ if (stream == null)
+ {
+ log.severe("Faces config resource " + systemId + " not found");
+ continue;
+ }
+
+ if (log.isLoggable(Level.INFO))
+ {
+ log.info("Reading config " + systemId);
+ }
+ appConfigResources.add(getUnmarshaller(ectx).getFacesConfig(stream, systemId));
}
- appConfigResources.add(getUnmarshaller(ectx).getFacesConfig(stream, systemId));
- stream.close();
}
}
catch (Throwable e)
@@ -575,7 +569,7 @@ public class DefaultFacesConfigurationProvider extends FacesConfigurationProvide
!webDirPath.equals("/WEB-INF/classes/"))
{
String flowName = webDirPath.substring(9, webDirPath.length() - 1);
- String filePath = webDirPath+flowName+"-flow.xml";
+ String filePath = webDirPath + flowName + "-flow.xml";
if (!contextSpecifiedList.contains(filePath))
{
try
@@ -601,7 +595,7 @@ public class DefaultFacesConfigurationProvider extends FacesConfigurationProvide
{
// Look on /<flowName>/<flowName>-flow.xml
String flowName = dirPath.substring(1, dirPath.length() - 1);
- String filePath = dirPath+flowName+"-flow.xml";
+ String filePath = dirPath + flowName + "-flow.xml";
if (!contextSpecifiedList.contains(filePath))
{
try