src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java

changeset 384
8f2986ff0235
parent 368
0989ad8c0860
child 637
9c07ef4934dd
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java	Thu May 30 10:58:13 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java	Wed Jun 12 14:47:09 2013 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -78,20 +78,22 @@
    1.11              try {
    1.12                  String prefix = config.getTempFilePrefix();
    1.13                  String suffix = config.getTempFileSuffix();
    1.14 -                File dir = config.getTempDir();
    1.15 -                File tempFile = (dir == null)
    1.16 -                        ? File.createTempFile(prefix, suffix)
    1.17 -                        : File.createTempFile(prefix, suffix, dir);
    1.18 +                File tempFile = TempFiles.createTempFile(prefix, suffix, config.getTempDir());
    1.19 +                // delete the temp file when VM exits as a last resort for file clean up
    1.20 +                tempFile.deleteOnExit();
    1.21 +                if (LOGGER.isLoggable(Level.FINE)) {
    1.22 +                    LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);
    1.23 +                }
    1.24                  // delete the temp file when VM exits as a last resort for file clean up
    1.25                  tempFile.deleteOnExit();
    1.26                  if (LOGGER.isLoggable(Level.FINE)) {LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);}
    1.27                  dataHead.dataFile = new DataFile(tempFile);
    1.28 -            } catch(IOException ioe) {
    1.29 +            } catch (IOException ioe) {
    1.30                  throw new MIMEParsingException(ioe);
    1.31              }
    1.32  
    1.33              if (dataHead.head != null) {
    1.34 -                for(Chunk c=dataHead.head; c != null; c=c.next) {
    1.35 +                for (Chunk c = dataHead.head; c != null; c = c.next) {
    1.36                      long pointer = c.data.writeTo(dataHead.dataFile);
    1.37                      c.data = new FileData(dataHead.dataFile, pointer, len);
    1.38                  }
    1.39 @@ -101,4 +103,5 @@
    1.40              return new MemoryData(buf, config);
    1.41          }
    1.42      }
    1.43 +
    1.44  }

mercurial