Line data Source code
1 : // Copyright (C) 2018 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.sshd.commands; 16 : 17 : import com.google.gerrit.sshd.AbstractGitCommand; 18 : import java.io.IOException; 19 : import org.eclipse.jgit.transport.PacketLineOut; 20 : import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; 21 : 22 : /* Receive command when running in slave mode. */ 23 0 : public class ReceiveSlaveMode extends AbstractGitCommand { 24 : @Override 25 : protected void runImpl() throws UnloggedFailure, IOException { 26 0 : ServiceNotEnabledException ex = new ServiceNotEnabledException(); 27 : 28 0 : PacketLineOut packetOut = new PacketLineOut(out); 29 0 : packetOut.setFlushOnEnd(true); 30 0 : packetOut.writeString("ERR " + ex.getMessage()); 31 0 : packetOut.end(); 32 : 33 0 : throw die(ex); 34 : } 35 : }