From: Juergen H. <jho...@us...> - 2008-09-18 07:56:51
|
Update of /cvsroot/springframework/spring/src/org/springframework/mail/javamail In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv3575/src/org/springframework/mail/javamail Modified Files: Tag: mbranch-2-0 ConfigurableMimeFileTypeMap.java Log Message: ConfigurableMimeFileTypeMap explicitly closes the InputStream that it uses for "mime.types" resource reading Index: ConfigurableMimeFileTypeMap.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -C2 -d -r1.2 -r1.2.6.1 *** ConfigurableMimeFileTypeMap.java 13 Sep 2005 21:23:18 -0000 1.2 --- ConfigurableMimeFileTypeMap.java 18 Sep 2008 14:56:48 -0000 1.2.6.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 19,22 **** --- 19,23 ---- import java.io.File; import java.io.IOException; + import java.io.InputStream; import javax.activation.FileTypeMap; *************** *** 80,84 **** /** * Specify the <code>Resource</code> from which mappings are loaded. ! * Needs to follow the <code>mime.types<code> file format, as specified * by the Java Activation Framework, containing lines such as:<br> * <code>text/html html htm HTML HTM</code> --- 81,85 ---- /** * Specify the <code>Resource</code> from which mappings are loaded. ! * <p>Needs to follow the <code>mime.types<code> file format, as specified * by the Java Activation Framework, containing lines such as:<br> * <code>text/html html htm HTML HTM</code> *************** *** 123,133 **** } } ! return fileTypeMap; } /** ! * Compile a FileTypeMap from the mappings in the given mapping file and the ! * given mapping entries. ! * <p>Default implementation creates an Activation Framework MimetypesFileTypeMap, * passing in an InputStream from the mapping resource (if any) and registering * the mapping lines programmatically. --- 124,134 ---- } } ! return this.fileTypeMap; } /** ! * Compile a {@link FileTypeMap} from the mappings in the given mapping file ! * and the given mapping entries. ! * <p>The default implementation creates an Activation Framework {@link MimetypesFileTypeMap}, * passing in an InputStream from the mapping resource (if any) and registering * the mapping lines programmatically. *************** *** 140,145 **** */ protected FileTypeMap createFileTypeMap(Resource mappingLocation, String[] mappings) throws IOException { ! MimetypesFileTypeMap fileTypeMap = (mappingLocation != null) ? ! new MimetypesFileTypeMap(mappingLocation.getInputStream()) : new MimetypesFileTypeMap(); if (mappings != null) { for (int i = 0; i < mappings.length; i++) { --- 141,157 ---- */ protected FileTypeMap createFileTypeMap(Resource mappingLocation, String[] mappings) throws IOException { ! MimetypesFileTypeMap fileTypeMap = null; ! if (mappingLocation != null) { ! InputStream is = mappingLocation.getInputStream(); ! try { ! fileTypeMap = new MimetypesFileTypeMap(is); ! } ! finally { ! is.close(); ! } ! } ! else { ! fileTypeMap = new MimetypesFileTypeMap(); ! } if (mappings != null) { for (int i = 0; i < mappings.length; i++) { |