Skip to content

Commit

Permalink
修正DiskFileItem.finalize没有调用super.finalize可能造成的小问题;
Browse files Browse the repository at this point in the history
升级pom.xml中的jetty插件版本。
  • Loading branch information
Michael Zhou committed Nov 8, 2012
1 parent 7c9a84e commit f451a09
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<spring-version>3.1.1.RELEASE</spring-version>
<springext-plugin-version>1.0</springext-plugin-version>
<maven-util-version>1.0</maven-util-version>
<jetty-version>6.1.22</jetty-version>
<jetty-version>8.1.7.v20120910</jetty-version>
<project.build.sourceEncoding>${java.encoding}</project.build.sourceEncoding>
<gpg.skip>true</gpg.skip>
</properties>
Expand Down Expand Up @@ -670,7 +670,7 @@
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<stopKey>citrus</stopKey>
<stopPort>9999</stopPort>
Expand Down Expand Up @@ -743,7 +743,7 @@
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-version}</version>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ public DiskFileItem(String fieldName, String contentType, boolean isFormField, S

/** Removes the file contents from the temporary storage. */
@Override
protected void finalize() {
File outputFile = dfos.getFile();
protected void finalize() throws Throwable {
try {
File outputFile = dfos.getFile();

if (outputFile != null && outputFile.exists()) {
outputFile.delete();
if (outputFile != null && outputFile.exists()) {
outputFile.delete();
}
} finally {
super.finalize();
}
}
}

0 comments on commit f451a09

Please sign in to comment.