dims 2003/01/05 07:45:05 Modified: java/src/org/apache/axis/attachments AttachmentPart.java ManagedMemoryDataSource.java MultiPartDimeInputStream.java MultiPartRelatedInputStream.java Log: Patch for Bug 13819 - Attachment temp files never get removed Notes: - Now DIME will exhibit same behavior as MIME (file will be created if size > (16 * 1024)) - We still have to fix the bug Revision Changes Path 1.34 +2 -2 xml-axis/java/src/org/apache/axis/attachments/AttachmentPart.java Index: AttachmentPart.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/attachments/AttachmentPart.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- AttachmentPart.java 22 Dec 2002 15:40:26 -0000 1.33 +++ AttachmentPart.java 5 Jan 2003 15:45:05 -0000 1.34 @@ -398,7 +398,7 @@ java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(s.getBytes()); datahandler = new DataHandler(new ManagedMemoryDataSource(bais, - 1024, contentType, true)); + ManagedMemoryDataSource.MAX_MEMORY_DISK_CACHED, contentType, true)); contentObject = object; return; } catch (java.io.IOException io) { @@ -409,7 +409,7 @@ } else if (object instanceof java.io.InputStream) { try { datahandler = new DataHandler(new ManagedMemoryDataSource((java.io.InputStream)object, - 1024, contentType, true)); + ManagedMemoryDataSource.MAX_MEMORY_DISK_CACHED, contentType, true)); contentObject = object; return; } catch (java.io.IOException io) { 1.26 +9 -10 xml-axis/java/src/org/apache/axis/attachments/ManagedMemoryDataSource.java Index: ManagedMemoryDataSource.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/attachments/ManagedMemoryDataSource.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- ManagedMemoryDataSource.java 11 Dec 2002 22:38:08 -0000 1.25 +++ ManagedMemoryDataSource.java 5 Jan 2003 15:45:05 -0000 1.26 @@ -81,11 +81,14 @@ /** Field ss */ java.io.InputStream ss = null; // The incoming source stream. + /** Field MIN_MEMORY_DISK_CACHED */ + public static final int MIN_MEMORY_DISK_CACHED = -1; + /** Field MAX_MEMORY_DISK_CACHED */ - public static final int MAX_MEMORY_DISK_CACHED = -1; + public static final int MAX_MEMORY_DISK_CACHED = 16 * 1024; /** Field maxCached */ - protected int maxCached = 16 * 1024; // max in memory cached. Default. + protected int maxCached = MAX_MEMORY_DISK_CACHED; // max in memory cached. Default. // If set the file the disk is cached to. @@ -120,7 +123,6 @@ /** * Create a new boundary stream; * @param ss is the source input stream that is used to create this data source.. - * @param readbufsz lets you have some control over the amount of buffering. * @param maxCached This is the max memory that is to be used to cache the data. * @param contentType the mime type for this data stream. * by buffering you can some effiency in searching. @@ -136,7 +138,6 @@ /** * Create a new boundary stream; * @param ss is the source input stream that is used to create this data source.. - * @param readbufsz lets you have some control over the amount of buffering. * @param maxCached This is the max memory that is to be used to cache the data. * @param contentType the mime type for this data stream. * by buffering you can some effiency in searching. @@ -155,7 +156,7 @@ this.contentType = contentType; } - if (maxCached < MAX_MEMORY_DISK_CACHED) { + if (maxCached < MIN_MEMORY_DISK_CACHED) { throw new IllegalArgumentException( Messages.getMessage("badMaxCached", "" + maxCached)); } @@ -591,9 +592,8 @@ /** * Read a byte from the stream. - * @param byte to read or -1 if no more data. * - * @return + * @return byte read or -1 if no more data. * * @throws java.io.IOException */ @@ -652,9 +652,8 @@ /** * Skip bytes in the stream. - * @param the number of bytes to skip. - * - * @param skipped + * + * @param skipped the number of bytes to skip. * * @return * 1.16 +1 -1 xml-axis/java/src/org/apache/axis/attachments/MultiPartDimeInputStream.java Index: MultiPartDimeInputStream.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/attachments/MultiPartDimeInputStream.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- MultiPartDimeInputStream.java 11 Dec 2002 22:38:08 -0000 1.15 +++ MultiPartDimeInputStream.java 5 Jan 2003 15:45:05 -0000 1.16 @@ -201,7 +201,7 @@ DataHandler dh = new DataHandler( new ManagedMemoryDataSource(dimeDelimitedStream, - 1024, type, true)); + ManagedMemoryDataSource.MAX_MEMORY_DISK_CACHED, type, true)); AttachmentPart ap = new AttachmentPart(dh); 1.35 +1 -1 xml-axis/java/src/org/apache/axis/attachments/MultiPartRelatedInputStream.java Index: MultiPartRelatedInputStream.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/attachments/MultiPartRelatedInputStream.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- MultiPartRelatedInputStream.java 11 Dec 2002 22:38:08 -0000 1.34 +++ MultiPartRelatedInputStream.java 5 Jan 2003 15:45:05 -0000 1.35 @@ -603,7 +603,7 @@ DataHandler dh = new DataHandler( new ManagedMemoryDataSource( - decodedStream, 1024, contentType, true)); + decodedStream, ManagedMemoryDataSource.MAX_MEMORY_DISK_CACHED, contentType, true)); AttachmentPart ap = new AttachmentPart(dh); if (contentId != null) {