Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.TransportException


    } catch (NotSupportedException err) {
      throw err;
    } catch (TransportException err) {
      throw err;
    } catch (IOException err) {
      throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err);
    }
  }
View Full Code Here


      case HttpURLConnection.HTTP_NOT_FOUND:
        break;

      default:
        throw new TransportException(uri, MessageFormat.format(
            JGitText.get().cannotReadHEAD, status, conn.getResponseMessage()));
      }
    }

    WalkFetchConnection wfc = new WalkFetchConnection(this, d);
View Full Code Here

    } catch (NotSupportedException err) {
      throw err;
    } catch (TransportException err) {
      throw err;
    } catch (IOException err) {
      throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err);
    }
  }
View Full Code Here

              MessageFormat.format(JGitText.get().uriNotFound, u));

        case HttpURLConnection.HTTP_UNAUTHORIZED:
          authMethod = HttpAuthMethod.scanResponse(conn);
          if (authMethod == HttpAuthMethod.NONE)
            throw new TransportException(uri, MessageFormat.format(
                JGitText.get().authenticationNotSupported, uri));
          if (1 < authAttempts
              || !authMethod.authorize(uri,
                  getCredentialsProvider())) {
            throw new TransportException(uri,
                JGitText.get().notAuthorized);
          }
          authAttempts++;
          continue;

        case HttpURLConnection.HTTP_FORBIDDEN:
          throw new TransportException(uri, MessageFormat.format(
              JGitText.get().serviceNotPermitted, service));

        default:
          String err = status + " " + conn.getResponseMessage(); //$NON-NLS-1$
          throw new TransportException(uri, err);
        }
      }
    } catch (NotSupportedException e) {
      throw e;
    } catch (TransportException e) {
      throw e;
    } catch (IOException e) {
      throw new TransportException(uri, MessageFormat.format(JGitText.get().cannotOpenService, service), e);
    }
  }
View Full Code Here

    return input;
  }

  IOException wrongContentType(String expType, String actType) {
    final String why = MessageFormat.format(JGitText.get().expectedReceivedContentType, expType, actType);
    return new TransportException(uri, why);
  }
View Full Code Here

    // as a pkt-line stream.
    //
    final byte[] magic = new byte[5];
    IO.readFully(in, magic, 0, magic.length);
    if (magic[4] != '#') {
      throw new TransportException(uri, MessageFormat.format(
          JGitText.get().expectedPktLineWithService, RawParseUtils.decode(magic)));
    }

    final PacketLineIn pckIn = new PacketLineIn(new UnionInputStream(
        new ByteArrayInputStream(magic), in));
    final String exp = "# service=" + service; //$NON-NLS-1$
    final String act = pckIn.readString();
    if (!exp.equals(act)) {
      throw new TransportException(uri, MessageFormat.format(
          JGitText.get().expectedGot, exp, act));
    }

    while (pckIn.readString() != PacketLineIn.END) {
      // for now, ignore the remaining header lines
View Full Code Here

      if (conn == null) {
        // Output hasn't started yet, because everything fit into
        // our request buffer. Send with a Content-Length header.
        //
        if (out.length() == 0) {
          throw new TransportException(uri,
              JGitText.get().startingReadStageWithoutWrittenRequestDataPendingIsNotSupported);
        }

        // Try to compress the content, but only if that is smaller.
        TemporaryBuffer buf = new TemporaryBuffer.Heap(http.postBuffer);
        try {
          GZIPOutputStream gzip = new GZIPOutputStream(buf);
          out.writeTo(gzip, null);
          gzip.close();
          if (out.length() < buf.length())
            buf = out;
        } catch (IOException err) {
          // Most likely caused by overflowing the buffer, meaning
          // its larger if it were compressed. Don't compress.
          buf = out;
        }

        openStream();
        if (buf != out)
          conn.setRequestProperty(HDR_CONTENT_ENCODING, ENCODING_GZIP);
        conn.setFixedLengthStreamingMode((int) buf.length());
        final OutputStream httpOut = conn.getOutputStream();
        try {
          buf.writeTo(httpOut, null);
        } finally {
          httpOut.close();
        }
      }

      out.reset();

      final int status = HttpSupport.response(conn);
      if (status != HttpURLConnection.HTTP_OK) {
        throw new TransportException(uri, status + " " //$NON-NLS-1$
            + conn.getResponseMessage());
      }

      final String contentType = conn.getContentType();
      if (!conn.getContentType().contains(responseType)) {
View Full Code Here

   * @throws TransportException
   *             if operation was already marked as started.
   */
  protected void markStartedOperation() throws TransportException {
    if (startedOperation)
      throw new TransportException(
          JGitText.get().onlyOneOperationCallPerConnectionIsSupported);
    startedOperation = true;
  }
View Full Code Here

        br.close();
      }
    } catch (FileNotFoundException notPacked) {
      // Perhaps it wasn't worthwhile, or is just an older repository.
    } catch (IOException e) {
      throw new TransportException(getURI(), JGitText.get().errorInPackedRefs, e);
    }
  }
View Full Code Here

        }
        continue;
      }
      if (line.charAt(0) == '^') {
        if (last == null)
          throw new TransportException(JGitText.get().peeledLineBeforeRef);
        final ObjectId id = ObjectId.fromString(line.substring(1));
        last = new ObjectIdRef.PeeledTag(Ref.Storage.PACKED, last
            .getName(), last.getObjectId(), id);
        avail.put(last.getName(), last);
        continue;
      }

      final int sp = line.indexOf(' ');
      if (sp < 0)
        throw new TransportException(MessageFormat.format(JGitText.get().unrecognizedRef, line));
      final ObjectId id = ObjectId.fromString(line.substring(0, sp));
      final String name = line.substring(sp + 1);
      if (peeled)
        last = new ObjectIdRef.PeeledNonTag(Ref.Storage.PACKED, name, id);
      else
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.errors.TransportException

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.