[logback-dev] [JIRA] Created: (LBCORE-122) Joran IncludeAction does not close the input file stream in case of SaxParseException

Michael Franz (JIRA) noreply-jira at qos.ch
Mon Oct 12 16:58:44 CEST 2009


Joran IncludeAction does not close the input file stream in case of SaxParseException
-------------------------------------------------------------------------------------

                 Key: LBCORE-122
                 URL: http://jira.qos.ch/browse/LBCORE-122
             Project: logback-core
          Issue Type: Bug
          Components: Joran
    Affects Versions: 0.9.17
            Reporter: Michael Franz
            Assignee: Logback dev list


If parsing include file for a Joran configuration fails e.g. with a SaxParseException then the include file stream is not closed immediately. Depending on the operation system fixing the configuration file requires to stop the Java VM or perhaps to run the garbage collector explicitly. 

>From IncludeAction.java:
    InputStream in = getInputStream(ec, attributes);

    try {
      if (in != null) {
        parseAndRecord(in, recorder);
        in.close();
      }
    } catch (JoranException e) {
      addError("Error while parsing  " + attributeInUse, e);
    } catch (IOException e) {
      // called if in.close did not work
    }

The in.close() should be called in a finally block, so the the stream is ensured to be closed.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list