diff -r 7386eca865e1 -r 8f2986ff0235 src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java --- a/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java Thu May 30 10:58:13 2013 -0700 +++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java Wed Jun 12 14:47:09 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,20 +78,22 @@ try { String prefix = config.getTempFilePrefix(); String suffix = config.getTempFileSuffix(); - File dir = config.getTempDir(); - File tempFile = (dir == null) - ? File.createTempFile(prefix, suffix) - : File.createTempFile(prefix, suffix, dir); + File tempFile = TempFiles.createTempFile(prefix, suffix, config.getTempDir()); + // delete the temp file when VM exits as a last resort for file clean up + tempFile.deleteOnExit(); + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile); + } // delete the temp file when VM exits as a last resort for file clean up tempFile.deleteOnExit(); if (LOGGER.isLoggable(Level.FINE)) {LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);} dataHead.dataFile = new DataFile(tempFile); - } catch(IOException ioe) { + } catch (IOException ioe) { throw new MIMEParsingException(ioe); } if (dataHead.head != null) { - for(Chunk c=dataHead.head; c != null; c=c.next) { + for (Chunk c = dataHead.head; c != null; c = c.next) { long pointer = c.data.writeTo(dataHead.dataFile); c.data = new FileData(dataHead.dataFile, pointer, len); } @@ -101,4 +103,5 @@ return new MemoryData(buf, config); } } + }