whitlock    2003/02/19 08:08:33

  Modified:    java/test/mime MimeImpl.java
               java/src/org/apache/wsif/util/jms JMS2HTTPBridge.java
  Log:
  16993: Mime/Jms fixes
  
  Revision  Changes    Path
  1.8       +8 -6      xml-axis-wsif/java/test/mime/MimeImpl.java
  
  Index: MimeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/mime/MimeImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MimeImpl.java     20 Jan 2003 14:34:09 -0000      1.7
  +++ MimeImpl.java     19 Feb 2003 16:08:33 -0000      1.8
  @@ -90,7 +90,7 @@
   
       public DataHandler stringToDataHandler(String buff) {
           try {
  -            FileDataSource fds = getTempFile();
  +            FileDataSource fds = getTempFile("txt");
               fds.getOutputStream().write(buff.getBytes());
               DataHandler dh = new DataHandler(fds);
               return dh;
  @@ -115,7 +115,7 @@
   
       public DataHandler stringToPlainText(String buff) {
           try {
  -            FileDataSource fds = getTempFile();
  +            FileDataSource fds = getTempFile("txt");
               fds.getOutputStream().write(buff.getBytes());
               return new DataHandler(fds);
           } catch (IOException ioe) {
  @@ -145,9 +145,10 @@
   //            }
   //            Thread.sleep(t);
   
  -            FileDataSource fds = getTempFile();
  +            FileDataSource fds = getTempFile("jpg");
               fds.getOutputStream().write(bBuff);
  -            return new DataHandler(fds);
  +            DataHandler dh = new DataHandler(fds);
  +            return dh;
           } catch (Exception e) {
               e.printStackTrace();
               return null;
  @@ -273,8 +274,9 @@
   
       /* ***************** UTILITY METHODS *************** */
       
  -    private FileDataSource getTempFile() throws IOException {
  -        File f = File.createTempFile("WSIFMimeTest", "txt");
  +    private FileDataSource getTempFile(String type) throws IOException {
  +        File f = File.createTempFile("WSIFMimeTest", "."+type);
  +        System.out.println("MimeImpl getTempFile name="+f.getName());
           f.deleteOnExit();
           return new FileDataSource(f);
       }
  
  
  
  1.12      +3 -1      
xml-axis-wsif/java/src/org/apache/wsif/util/jms/JMS2HTTPBridge.java
  
  Index: JMS2HTTPBridge.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/JMS2HTTPBridge.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JMS2HTTPBridge.java       14 Feb 2003 15:22:49 -0000      1.11
  +++ JMS2HTTPBridge.java       19 Feb 2003 16:08:33 -0000      1.12
  @@ -760,8 +760,10 @@
               out = new BufferedOutputStream(out, 8 * 1024);
               ByteArrayOutputStream out1 = new ByteArrayOutputStream();
               out1.write(
  -                (header.toString() + body).getBytes(
  +                header.toString().getBytes(
                       HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING));
  +            out1.write(body.getBytes());
  +
               if (verbose)
                   System.out.println(
                       "JMS2HTTPBridge writeToSocket " + out1.toString());
  
  
  


Reply via email to