Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 80624 invoked by uid 500); 12 Sep 2002 20:30:51 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 80615 invoked by uid 500); 12 Sep 2002 20:30:50 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 12 Sep 2002 20:30:50 -0000 Message-ID: <20020912203050.28297.qmail@icarus.apache.org> From: rsitze@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/src/org/apache/axis/configuration EngineConfigurationFactoryServlet.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N rsitze 2002/09/12 13:30:50 Modified: java/src/org/apache/axis/configuration EngineConfigurationFactoryServlet.java Log: Restored original (beta-3) logic. Flow is confusing, but correct IF a read/write file is desired for servlet. Revision Changes Path 1.12 +32 -19 xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryServlet.java Index: EngineConfigurationFactoryServlet.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryServlet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- EngineConfigurationFactoryServlet.java 12 Sep 2002 19:12:20 -0000 1.11 +++ EngineConfigurationFactoryServlet.java 12 Sep 2002 20:30:50 -0000 1.12 @@ -144,37 +144,50 @@ * @return a server EngineConfiguration */ private static EngineConfiguration getServerEngineConfig(ServletContext ctx) { + /** + * Flow can be confusing. Here is the logic: + * 1) Make all attempts to open resource IF it exists + * - If it exists as a file, open as file (r/w) + * - If not a file, it may still be accessable as a stream (r) + * (env will handle security checks). + * 2) If it doesn't exist, allow it to be opened/created + * + * Now, the way this is done below is: + * a) If the file does NOT exist, attempt to open as a stream (r) + * b) Open named file (opens existing file, creates if not avail). + */ + /* * Use the WEB-INF directory * (so the config files can't get snooped by a browser) */ String appWebInfPath = "/WEB-INF"; - String realWebInfPath = ctx.getRealPath(appWebInfPath); - FileProvider config = null; - if (realWebInfPath != null && - (new File(realWebInfPath, SERVER_CONFIG_FILE)).exists()) { + String realWebInfPath = ctx.getRealPath(appWebInfPath); + if (realWebInfPath == null) { + File configFile = new File(realWebInfPath, SERVER_CONFIG_FILE); + if (!configFile.exists()) { + InputStream is = ctx.getResourceAsStream(appWebInfPath + "/" + SERVER_CONFIG_FILE); + if (is != null) { + // FileProvider assumes responsibility for 'is': + // do NOT call is.close(). + config = new FileProvider(is); + } + + if (config == null) { + log.error(Messages.getMessage("servletEngineWebInfError01", + configFile.toString())); + } + } + } + + if (config == null) { try { config = new FileProvider(realWebInfPath, SERVER_CONFIG_FILE); } catch (ConfigurationException e) { log.error(Messages.getMessage("servletEngineWebInfError00"), e); - } - } - - if (config == null) { - String appServerConfigFileName = appWebInfPath + "/" + SERVER_CONFIG_FILE; - InputStream is = ctx.getResourceAsStream(appServerConfigFileName); - if (is != null) { - // FileProvider assumes responsibility for 'is': - // do NOT call is.close(). - config = new FileProvider(is); - } - - if (config == null) { - log.error(Messages.getMessage("servletEngineWebInfError01", - appServerConfigFileName)); } }