Package jcifs.smb

Examples of jcifs.smb.SmbException


  protected static boolean fileIsDirectory(SmbFile file)
    throws SmbException
  {
    int totalTries = 0;
    int retriesRemaining = 3;
    SmbException currentException = null;
    while (retriesRemaining > 0 && totalTries < 5)
    {
      retriesRemaining--;
      totalTries++;
      try
View Full Code Here


  protected static long fileLastModified(SmbFile file)
    throws SmbException
  {
    int totalTries = 0;
    int retriesRemaining = 3;
    SmbException currentException = null;
    while (retriesRemaining > 0 && totalTries < 5)
    {
      retriesRemaining--;
      totalTries++;
      try
View Full Code Here

  protected static long fileLength(SmbFile file)
    throws SmbException
  {
    int totalTries = 0;
    int retriesRemaining = 3;
    SmbException currentException = null;
    while (retriesRemaining > 0 && totalTries < 5)
    {
      retriesRemaining--;
      totalTries++;
      try
View Full Code Here

  protected static SmbFile[] fileListFiles(SmbFile file, SmbFileFilter filter)
    throws SmbException
  {
    int totalTries = 0;
    int retriesRemaining = 3;
    SmbException currentException = null;
    while (retriesRemaining > 0 && totalTries < 5)
    {
      retriesRemaining--;
      totalTries++;
      try
View Full Code Here

  protected static int getFileType(SmbFile file)
    throws SmbException
  {
    int totalTries = 0;
    int retriesRemaining = 3;
    SmbException currentException = null;
    while (retriesRemaining > 0 && totalTries < 5)
    {
      retriesRemaining--;
      totalTries++;
      try
View Full Code Here

  public void testGetReadableFileException() throws Exception {
    expect(delegate.isDirectory()).andReturn(true).anyTimes();
    expect(delegate.exists()).andReturn(true).anyTimes();
    expect(delegate.canRead()).andReturn(true).anyTimes();
    expect(delegate.getType()).andThrow(new SmbException(1, false));
    try {
      ReadonlyFile<?> f = fst.getReadableFile("smb://root/", null);
      fail("Expected RepositoryDocumentException, but got none.");
    } catch (RepositoryDocumentException expected) {
      // Expected.
View Full Code Here

                      DocumentNotFoundException.class);
  }

  private void checkGeneralError(TestSmbReadonlyFile file, int ntStatus,
      Class<? extends Exception> expectedException) throws Exception {
    SmbException smbException = createNiceMock(SmbException.class);
    expect(smbException.getNtStatus()).andStubReturn(ntStatus);
    replay(smbException);

    try {
      file.detectGeneralErrors(smbException);
      if (expectedException != null) {
View Full Code Here

  /** If repository cannot be contacted throws RepositoryException. */
  private static void staticDetectServerDown(IOException e)
      throws RepositoryException {
    if (!(e instanceof SmbException))
      return;
    SmbException smbe = (SmbException) e;
    // Not 100% sure if identifying all server downs and only server downs.
    boolean badCommunication =
        SmbException.NT_STATUS_UNSUCCESSFUL == smbe.getNtStatus();
    Throwable rootCause = smbe.getRootCause();
    String rootCauseString =
        (null == rootCause) ? "" : " " + smbe.getRootCause().getClass();
    boolean noTransport =
        rootCause instanceof jcifs.util.transport.TransportException;
    LOG.finest("server down variables:" + smbe.getNtStatus() + rootCauseString
        + " " + smbe.getMessage());

    // All pipe instances are busy.
    if (SmbException.NT_STATUS_INSTANCE_NOT_AVAILABLE == smbe.getNtStatus()
        || SmbException.NT_STATUS_PIPE_NOT_AVAILABLE == smbe.getNtStatus()
        || SmbException.NT_STATUS_PIPE_BUSY == smbe.getNtStatus()
        || SmbException.NT_STATUS_REQUEST_NOT_ACCEPTED == smbe.getNtStatus()) {
      throw new RepositoryException("Server busy", smbe);
    }

    // Timeouts waiting for response.
    if (badCommunication && noTransport &&
View Full Code Here

  private static void staticDetectGeneralErrors(IOException e, String path)
      throws RepositoryException {
    if (!(e instanceof SmbException))
      return;
    staticDetectServerDown(e);
    SmbException smbe = (SmbException) e;
    if (smbe.getNtStatus() == SmbException.NT_STATUS_LOGON_FAILURE) {
      throw new InvalidUserException(
          "Please specify correct user name and password for " + path,
          smbe);
    } else if (smbe.getNtStatus() == SmbException.NT_STATUS_ACCESS_DENIED) {
      throw new DocumentAccessException(
          "Access denied for " + path, smbe);
    } else if (smbe.getNtStatus() == SmbException.NT_STATUS_BAD_NETWORK_NAME) {
      throw new DocumentNotFoundException(
          "Path does not exist: " + path, smbe);
    }
  }
View Full Code Here

  protected static boolean fileExists(SmbFile file)
    throws SmbException
  {
    int totalTries = 0;
    int retriesRemaining = 3;
    SmbException currentException = null;
    while (retriesRemaining > 0 && totalTries < 5)
    {
      retriesRemaining--;
      totalTries++;
      try
View Full Code Here

TOP

Related Classes of jcifs.smb.SmbException

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.