Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.PackProtocolException


        if (!wantSatisfied(obj))
          return false;
      }
      return true;
    } catch (IOException e) {
      throw new PackProtocolException(JGitText.get().internalRevisionError, e);
    }
  }
View Full Code Here


  private void readStatusReport(final Map<String, RemoteRefUpdate> refUpdates)
      throws IOException {
    final String unpackLine = readStringLongTimeout();
    if (!unpackLine.startsWith("unpack ")) //$NON-NLS-1$
      throw new PackProtocolException(uri, MessageFormat.format(JGitText.get().unexpectedReportLine, unpackLine));
    final String unpackStatus = unpackLine.substring("unpack ".length()); //$NON-NLS-1$
    if (!unpackStatus.equals("ok")) //$NON-NLS-1$
      throw new TransportException(uri, MessageFormat.format(
          JGitText.get().errorOccurredDuringUnpackingOnTheRemoteEnd, unpackStatus));

    String refLine;
    while ((refLine = pckIn.readString()) != PacketLineIn.END) {
      boolean ok = false;
      int refNameEnd = -1;
      if (refLine.startsWith("ok ")) { //$NON-NLS-1$
        ok = true;
        refNameEnd = refLine.length();
      } else if (refLine.startsWith("ng ")) { //$NON-NLS-1$
        ok = false;
        refNameEnd = refLine.indexOf(" ", 3); //$NON-NLS-1$
      }
      if (refNameEnd == -1)
        throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedReportLine2
            , uri, refLine));
      final String refName = refLine.substring(3, refNameEnd);
      final String message = (ok ? null : refLine
          .substring(refNameEnd + 1));

      final RemoteRefUpdate rru = refUpdates.get(refName);
      if (rru == null)
        throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedRefReport, uri, refName));
      if (ok) {
        rru.setStatus(Status.OK);
      } else {
        rru.setStatus(Status.REJECTED_OTHER_REASON);
        rru.setMessage(message);
      }
    }
    for (final RemoteRefUpdate rru : refUpdates.values()) {
      if (rru.getStatus() == Status.AWAITING_REPORT)
        throw new PackProtocolException(MessageFormat.format(
            JGitText.get().expectedReportForRefNotReceived , uri, rru.getRemoteName()));
    }
  }
View Full Code Here

    }
    available(avail);
  }

  private PackProtocolException duplicateAdvertisement(final String name) {
    return new PackProtocolException(transport.uri,
        MessageFormat.format(JGitText.get().duplicateAdvertisementsOf, name));
  }
View Full Code Here

      }

      if (line.length() < 83) {
        final String m = JGitText.get().errorInvalidProtocolWantedOldNewRef;
        sendError(m);
        throw new PackProtocolException(m);
      }

      final ObjectId oldId = ObjectId.fromString(line.substring(0, 40));
      final ObjectId newId = ObjectId.fromString(line.substring(41, 81));
      final String name = line.substring(82);
View Full Code Here

    if (statelessRPC && multiAck != MultiAck.DETAILED) {
      // Our stateless RPC implementation relies upon the detailed
      // ACK status to tell us common objects for reuse in future
      // requests.  If its not enabled, we can't talk to the peer.
      //
      throw new PackProtocolException(uri, MessageFormat.format(
          JGitText.get().statelessRPCRequiresOptionToBeEnabled,
          OPTION_MULTI_ACK_DETAILED));
    }

    return line.toString();
View Full Code Here

        additionalHaves.add(id);
      } else if (name.endsWith("^{}")) { //$NON-NLS-1$
        name = name.substring(0, name.length() - 3);
        final Ref prior = avail.get(name);
        if (prior == null)
          throw new PackProtocolException(uri, MessageFormat.format(
              JGitText.get().advertisementCameBefore, name, name));

        if (prior.getPeeledObjectId() != null)
          throw duplicateAdvertisement(name + "^{}"); //$NON-NLS-1$
View Full Code Here

    b.append(option);
    return true;
  }

  private PackProtocolException duplicateAdvertisement(final String name) {
    return new PackProtocolException(uri, MessageFormat.format(JGitText.get().duplicateAdvertisementsOf, name));
  }
View Full Code Here

        continue;
      case CH_ERROR:
        eof = true;
        throw new TransportException(PFX_REMOTE + readString(available));
      default:
        throw new PackProtocolException(
            MessageFormat.format(JGitText.get().invalidChannel,
                Integer.valueOf(channel)));
      }
    }
  }
View Full Code Here

        clientShallowCommits.add(ObjectId.fromString(line.substring(8)));
        continue;
      }

      if (!line.startsWith("want ") || line.length() < 45)
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line));

      if (isFirst && line.length() > 45) {
        String opt = line.substring(45);
        if (opt.startsWith(" "))
          opt = opt.substring(1);
View Full Code Here

          pckOut.writeString("ACK " + last.name() + "\n");

        return true;

      } else {
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "have", line));
      }
    }
  }
View Full Code Here

TOP

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

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.