This allows the same try/catch to handle parsing the command list,
push certificate and push options. Any errors will be caught and
handled by the same catch block, as the client is in the same state.
Change-Id: I13a66f9100e2dc8ca8f72cd701a5bd44d093ec84
}
}
pushCert = certParser.build();
+ if (hasCommands()) {
+ readPostCommands(pckIn);
+ }
} catch (PackProtocolException e) {
if (sideBand) {
try {
return new ReceiveCommand(oldId, newId, name);
}
+ /**
+ * @param in
+ * request stream.
+ * @throws IOException
+ * request line cannot be read.
+ */
+ void readPostCommands(PacketLineIn in) throws IOException {
+ // Do nothing by default.
+ }
+
/** Enable capabilities based on a previously read capabilities line. */
protected void enableCapabilities() {
sideBand = isCapabilityEnabled(CAPABILITY_SIDE_BAND_64K);
super.enableCapabilities();
}
- private void readPushOptions() throws IOException {
- pushOptions = new ArrayList<>(4);
- for (;;) {
- String option = pckIn.readString();
- if (option == PacketLineIn.END) {
- break;
+ @Override
+ void readPostCommands(PacketLineIn in) throws IOException {
+ if (usePushOptions) {
+ pushOptions = new ArrayList<>(4);
+ for (;;) {
+ String option = in.readString();
+ if (option == PacketLineIn.END) {
+ break;
+ }
+ pushOptions.add(option);
}
- pushOptions.add(option);
}
}
return;
recvCommands();
if (hasCommands()) {
- if (usePushOptions) {
- readPushOptions();
- }
-
Throwable unpackError = null;
if (needPack()) {
try {