Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 63025 invoked from network); 30 Aug 2002 04:23:11 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 30 Aug 2002 04:23:11 -0000 Received: (qmail 14224 invoked by uid 97); 30 Aug 2002 04:23:47 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 14209 invoked by uid 97); 30 Aug 2002 04:23:46 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 14197 invoked by uid 98); 30 Aug 2002 04:23:46 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Subject: [HttpClient][PATCH] Fix candidate for Bug 11052 From: Ryan Lubke To: commons-dev@jakarta.apache.org Content-Type: multipart/mixed; boundary="=-UfSkPToH1BkVuUkILi9m" X-Mailer: Ximian Evolution 1.0.8 Date: 30 Aug 2002 00:18:17 -0400 Message-Id: <1030681099.1557.24.camel@rivendell> Mime-Version: 1.0 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --=-UfSkPToH1BkVuUkILi9m Content-Type: text/plain Content-Transfer-Encoding: 7bit Attached is a crack at corrected the bug oulined in 11052 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11052) Basically adds two new methods: - setDeleteOnRecycle(boolean delete) - getDeleteOnRecycle() The primary logic still remains that all temp files created, no matter what will always be deleted on VM exit, but user can call setDeleteOnRecycle to true so that when the recycle() method is called the temp file will be removed. Thoughts? Comments? -rl --=-UfSkPToH1BkVuUkILi9m Content-Disposition: attachment; filename=GetMethod.java.patch Content-Transfer-Encoding: quoted-printable Content-Type: text/x-patch; name=GetMethod.java.patch; charset=ISO-8859-1 Index: GetMethod.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/= httpclient/methods/GetMethod.java,v retrieving revision 1.15 diff -u -r1.15 GetMethod.java --- GetMethod.java 8 Aug 2002 21:51:36 -0000 1.15 +++ GetMethod.java 30 Aug 2002 04:17:35 -0000 @@ -203,6 +203,13 @@ */ protected String tempFile =3D null; =20 + /** + * Determines if temporary files should be deleted when the method + * is recycled or not. + * By default, temporary files are only deleted on VM exit. + */ + protected boolean delete =3D false; + =20 // ------------------------------------------------------------- Prope= rties =20 @@ -324,6 +331,8 @@ =20 super.recycle(); this.memoryData =3D null; + if (delete)=20 + this.fileData.delete(); this.fileData =3D null; setFollowRedirects(true); } @@ -402,6 +411,32 @@ return new ByteArrayInputStream(memoryData); } } + } + + /** + * Determines if temporary files are deleted when the method + * is recycled. + * + * @param delete - if true, the temporary file generated will + * be removed after a call to recycle, otherwise + * the temporary file will remain until VM exit. + * @since 2.0 + */ + public void setDeleteOnRecycle(boolean delete) { + checkNotUsed(); + this.delete =3D delete; + } + + + /** + * Returns the value of the delete on recycle flag. + * + * @return current value of delete + * + * @since 2.0 + */ + public boolean getDeleteOnRecycle() { + return delete; } =20 =20 --=-UfSkPToH1BkVuUkILi9m Content-Type: text/plain; charset=us-ascii -- To unsubscribe, e-mail: For additional commands, e-mail: --=-UfSkPToH1BkVuUkILi9m--