Author: jdillon Date: Thu Feb 1 07:10:43 2007 New Revision: 502239 URL: http://svn.apache.org/viewvc?view=rev&rev=502239 Log: Be a good boy and close the reader Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestResult.groovy Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestResult.groovy URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestResult.groovy?view=diff&rev=502239&r1=502238&r2=502239 ============================================================================== --- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestResult.groovy (original) +++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestResult.groovy Thu Feb 1 07:10:43 2007 @@ -70,38 +70,43 @@ def input = file.newReader() - // Read the header - assert input.readLine() == '#Test Results (version 2)' - - checksum = scanFor(input, '#checksum:').tokenize(':')[1] - log.info "Checksum: $checksum" - - // Read the test description - scanFor(input, '#-----testdescription-----') - desc = loadProperties(input) - - // Read the environment - scanFor(input, '#-----environment-----') - env = loadProperties(input) - - // Read the test result properties - scanFor(input, '#-----testresult-----') - props = loadProperties(input) - - // Load test sections - sections = new LinkedHashMap() - for (name in props['sections'].tokenize()) { - log.info "Section: $name" - sections[name] = new Section(input) + try { + // Read the header + assert input.readLine() == '#Test Results (version 2)' + + checksum = scanFor(input, '#checksum:').tokenize(':')[1] + log.info "Checksum: $checksum" + + // Read the test description + scanFor(input, '#-----testdescription-----') + desc = loadProperties(input) + + // Read the environment + scanFor(input, '#-----environment-----') + env = loadProperties(input) + + // Read the test result properties + scanFor(input, '#-----testresult-----') + props = loadProperties(input) + + // Load test sections + sections = new LinkedHashMap() + for (name in props['sections'].tokenize()) { + log.info "Section: $name" + sections[name] = new Section(input) + } + + // + // NOTE: The next line is probably empty, so we have to check for null + // Not sure if we can expect input.readLine() == '' always here :-\ + // + + status = scanFor(input, 'test result: ').split(' ', 3)[2] + log.info "Status: $status" + } + finally { + input.close() } - - // - // NOTE: The next line is probably empty, so we have to check for null - // Not sure if we can expect input.readLine() == '' always here :-\ - // - - status = scanFor(input, 'test result: ').split(' ', 3)[2] - log.info "Status: $status" } Map loadProperties(BufferedReader input) {