Package org.apache.commons.vfs

Examples of org.apache.commons.vfs.FileSystemException


        // String uri = url.getURI();

        final boolean ok = resource.moveMethod(newfile.getName().getPath());
        if (!ok)
        {
            throw new FileSystemException("vfs.provider.webdav/rename-file.error", resource.getStatusMessage());
        }

        // reread allowed methods
        reattach();
    }
View Full Code Here


            doDetach();
            doAttach();
        }
        catch (Exception e)
        {
            throw new FileSystemException(e);
        }
    }
View Full Code Here

    /**
     * Lists the children of the file.
     */
    protected String[] doListChildren() throws Exception
    {
        throw new FileSystemException("Not implemented.");
    }
View Full Code Here

      {
        // A '..' element - remove the previous element
        if (startElem == startFirstElem)
        {
          // Previous element is missing
          throw new FileSystemException(
              "vfs.provider/invalid-relative-path.error");
        }

        // Find start of previous element
        int pos = startElem - 2;
View Full Code Here

      {
        continue;
      }
      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

      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

            }
            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

                               
                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

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

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

            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

TOP

Related Classes of org.apache.commons.vfs.FileSystemException

Copyright © 2018 www.massapicom. 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.