Examples of FileSystemException


Examples of org.apache.commons.vfs.FileSystemException

      final char ch = buffer.charAt(index);
      if (ch == '%')
      {
        if (count < 3)
        {
          throw new FileSystemException(
              "vfs.provider/invalid-escape-sequence.error",
              buffer.substring(index, index + count));
        }

        // Decode
        int dig1 = Character.digit(buffer.charAt(index + 1), 16);
        int dig2 = Character.digit(buffer.charAt(index + 2), 16);
        if (dig1 == -1 || dig2 == -1)
        {
          throw new FileSystemException(
              "vfs.provider/invalid-escape-sequence.error",
              buffer.substring(index, index + 3));
        }
        char value = (char) (dig1 << 4 | dig2);
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

            }
            return fs.resolveFile(url.getPath());
        }
        catch (final MalformedURLException e)
        {
            throw new FileSystemException("vfs.provider.url/badly-formed-uri.error", uri, e);
        }
    }
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

                               
                try {
                SocketFactory socketFactory = (SocketFactory) Class.forName(System.getProperty("org.apache.commons.net.socketFactory")).newInstance();
                client.setSocketFactory(socketFactory);
                } catch(Throwable t) {
                  throw new FileSystemException(t);
                }
              }
                client.connect(hostname, port);

                int reply = client.getReplyCode();
                if (!FTPReply.isPositiveCompletion(reply))
                {
                    throw new FileSystemException("vfs.provider.ftp/connect-rejected.error", hostname);
                }

                // Login
                if (!client.login(username, password))
                {
                    throw new FileSystemException("vfs.provider.ftp/login.error", new Object[]{hostname, username}, null);
                }

                // Set binary mode
                if (!client.setFileType(FTP.BINARY_FILE_TYPE))
                {
                    throw new FileSystemException("vfs.provider.ftp/set-binary.error", hostname);
                }

                // Set dataTimeout value
                Integer dataTimeout = FtpFileSystemConfigBuilder.getInstance().getDataTimeout(fileSystemOptions);
                if (dataTimeout != null)
                {
                    client.setDataTimeout(dataTimeout.intValue());
                }

                // Change to root by default
                // All file operations a relative to the filesystem-root
                // String root = getRoot().getName().getPath();

                Boolean userDirIsRoot = FtpFileSystemConfigBuilder.getInstance().getUserDirIsRoot(fileSystemOptions);
                if (workingDirectory != null && (userDirIsRoot == null || !userDirIsRoot.booleanValue()))
                {
                    if (!client.changeWorkingDirectory(workingDirectory))
                    {
                        throw new FileSystemException("vfs.provider.ftp/change-work-directory.error", workingDirectory);
                    }
                }

                Boolean passiveMode = FtpFileSystemConfigBuilder.getInstance().getPassiveMode(fileSystemOptions);
                if (passiveMode != null && passiveMode.booleanValue())
                {
                    client.enterLocalPassiveMode();
                }
            }
            catch (final IOException e)
            {
                if (client.isConnected())
                {
                    client.disconnect();
                }
                throw e;
            }

            return client;
        }
        catch (final Exception exc)
        {
            throw new FileSystemException("vfs.provider.ftp/connect.error", new Object[]{hostname}, exc);
        }
    }
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

        else if (this.fileInfo.isSymbolicLink())
        {
            return getLinkDestination().getType();
        }

        throw new FileSystemException("vfs.provider.ftp/get-type.error", getName());
    }
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

            ftpFs.putClient(ftpClient);
        }

        if (!ok)
        {
            throw new FileSystemException("vfs.provider.ftp/delete-file.error", getName());
        }
        this.fileInfo = null;
        children = EMPTY_FTP_FILE_MAP;
    }
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

            ftpFs.putClient(ftpClient);
        }

        if (!ok)
        {
            throw new FileSystemException("vfs.provider.ftp/rename-file.error", new Object[]{getName().toString(), newfile});
        }
        this.fileInfo = null;
        children = EMPTY_FTP_FILE_MAP;
    }
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

            ftpFs.putClient(client);
        }

        if (!ok)
        {
            throw new FileSystemException("vfs.provider.ftp/create-folder.error", getName());
        }
    }
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

            out = client.storeFileStream(relPath);
        }

        if (out == null)
        {
            throw new FileSystemException("vfs.provider.ftp/output-error.debug", new Object[]
                {
                    this.getName(),
                    client.getReplyString()
                });
        }
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

    {
        final FtpClient client = ftpFs.getClient();
        final InputStream instr = client.retrieveFileStream(relPath, filePointer);
        if (instr == null)
        {
            throw new FileSystemException("vfs.provider.ftp/input-error.debug", new Object[]
                {
                    this.getName(),
                    client.getReplyString()
                });
        }
View Full Code Here

Examples of org.apache.commons.vfs.FileSystemException

                ftpFs.putClient(client);
            }

            if (!ok)
            {
                throw new FileSystemException("vfs.provider.ftp/finish-get.error", getName());
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.