Examples of IncomingFileTransferException


Examples of org.eclipse.ecf.filetransfer.IncomingFileTransferException

        setInputStream(getMethod.getResponseBodyAsUnzippedStream());
        this.paused = false;
        fireReceiveResumedEvent();
      } else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
        getMethod.releaseConnection();
        throw new IncomingFileTransferException(NLS.bind("File not found: {0}", urlString), code, responseHeaders); //$NON-NLS-1$
      } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
        getMethod.releaseConnection();
        throw new IncomingFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized, code, responseHeaders);
      } else if (code == HttpURLConnection.HTTP_FORBIDDEN) {
        getMethod.releaseConnection();
        throw new IncomingFileTransferException("Forbidden", code, responseHeaders); //$NON-NLS-1$
      } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
        getMethod.releaseConnection();
        throw new IncomingFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code, responseHeaders);
      } else {
        getMethod.releaseConnection();
        throw new IncomingFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code, responseHeaders);
      }
      Trace.exiting(Activator.PLUGIN_ID, DebugOptions.METHODS_EXITING, this.getClass(), "openStreamsForResume", Boolean.TRUE); //$NON-NLS-1$
      return true;
    } catch (final Exception e) {
      Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "openStreamsForResume", e); //$NON-NLS-1$
      if (code == -1) {
        if (!isDone()) {
          setDoneException(e);
        }
      } else {
        setDoneException((e instanceof IncomingFileTransferException) ? e : new IncomingFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code, responseHeaders));
      }
      fireTransferReceiveDoneEvent();
      Trace.exiting(Activator.PLUGIN_ID, DebugOptions.METHODS_EXITING, this.getClass(), "openStreamsForResume", Boolean.FALSE); //$NON-NLS-1$
      return false;
    }
View Full Code Here

Examples of org.eclipse.ecf.filetransfer.IncomingFileTransferException

      fireReceiveStartEvent();
    } catch (final Exception e) {
      channel = null;
      username = null;
      throw new IncomingFileTransferException(NLS.bind(
          Messages.ScpRetrieveFileTransfer_EXCEPTION_CONNECTING,
          getRemoteFileURL().toString()), e);
    }

  }
View Full Code Here

Examples of org.eclipse.ecf.filetransfer.IncomingFileTransferException

                    }
                  }
                }
              });
            } catch (final FileNotFoundException e) {
              throw new IncomingFileTransferException(
                  "Exception opening file for writing", e);
            }
          }

          public IFileTransferInfo getFileTransferInfo() {
            return fileTransferInfo;
          }

          public ID getRequesterID() {
            return createIDFromName(request.getRequestor());
          }

          public void reject() {
            request.reject();
          }

          public boolean requestAccepted() {
            return requestAccepted;
          }

          public String toString() {
            final StringBuffer buf = new StringBuffer(
                "FileTransferRequestEvent[");
            buf.append("requester=").append(getRequesterID());
            buf.append(";requestAccepted=").append(
                requestAccepted());
            buf.append(";transferInfo=")
                .append(getFileTransferInfo()).append("]");
            return buf.toString();
          }

          public IIncomingFileTransfer accept(
              OutputStream outputStream,
              IFileTransferListener listener)
              throws IncomingFileTransferException {
            if (requestAccepted)
              throw new IncomingFileTransferException(
                  "Incoming request previously accepted");
            if (outputStream == null)
              throw new IncomingFileTransferException(
                  "outputStream cannot be null");
            incoming = request.accept();
            requestAccepted = true;
            try {
              return new XMPPIncomingFileTransfer(IDFactory
                  .getDefault().createStringID(
                      request.getStreamID()), request
                  .getFileName(), incoming.recieveFile(),
                  outputStream, request.getFileSize(),
                  listener);
            } catch (final Exception e) {
              throw new IncomingFileTransferException(
                  "Exception receiving file", e);
            }
          }
        });
  }
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.