Hi everybody,
 
I have the problem with ArgoUML extension that I'm developing for my research. 
It uses commons-net to upload an ArgoUML project (.zargo archive) and its 
diagrams as png pictures to the remote FTP server. Its works fine in case FTP 
client and FTP server are on the same PC. Today, I have tried to test it with 
my students in a LAN and I had a situation that only few students could upload 
their projects to the server. Most of the uploaded projects had failed. Some of 
them have size 0 KB, some of them has several KBs size, but seems to be 
damaged. The pictures are also unreadable in most cases or in some cases only 
upper part of the picture is uploaded.
 
Do you have any idea what is the problem? Is it possible to use FTP client for 
this, and if not what could be better solution? 
 
The code is given bellow. 
 
Zoran
 
public static void uploadFileToRepository(File file,String fName){
     String fileName=null;
   
    try{
 int bufferSize=8192;
 ftp.setFileType(FTP.IMAGE_FILE_TYPE);
  
 if (fName.equals(".png")){
      fileName=file.getName();
 ftp.changeWorkingDirectory("/images");
 }else if (fName.equals(".zargo")){
    
      try{
     
fileName="Project_"+ProjectUtility.getCurrentProject().getProjectId()+".zargo";
     }catch(Exception e){
      ProjectUtility.getNewProject().setProjectValues();
      try{
      
fileName="Project_"+ProjectUtility.getCurrentProject().getProjectId()+".zargo";
      }catch(Exception ee){
       DepthsExceptionMessage.showExceptionMessage("Problem to create 
project"+ee.getMessage()+"\n\n"+ee.getCause());
      }
     }
     ftp.changeWorkingDirectory("/projects");
 }
    InputStream fis = new FileInputStream(file);
 OutputStream os = ftp.storeFileStream(fileName);
 
 int bytesRead = -1;
  
     final byte[] buffer = new byte[bufferSize];
   
     while ((bytesRead = fis.read(buffer)) != -1)
     {
         os.write(buffer, 0, bytesRead);
     }
     os.flush();
     os.close();
 
 }catch(IOException ioe){
  
DepthsExceptionMessage.showExceptionMessage(ioe.getMessage()+"\n\n"+ioe..getCause());
    }catch(Exception e){
     LOG.debug("Exception:"+e.getClass().getName());
     
DepthsExceptionMessage.showExceptionMessage(e.getMessage()+"\n\n"+e.getCause()+"\n\n");
    }
    
}

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=1201052

To unsubscribe from this discussion, e-mail: 
[[email protected]].

Reply via email to