From 8f6d5356f3cb7f8e800541fe6d46911bd46c0247 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 10 Apr 2014 18:58:09 -0400
Subject: [PATCH] Get the command context with an accessor instead of direct field access
---
src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java | 44 +++++++++++++++++++++++---------------------
1 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java b/src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java
index 44618f3..3d2c68b 100644
--- a/src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java
+++ b/src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java
@@ -19,27 +19,29 @@
import org.apache.sshd.server.Environment;
-public abstract class SshCommand extends BaseCommand {
- protected PrintWriter stdout;
- protected PrintWriter stderr;
+import ro.fortsoft.pf4j.ExtensionPoint;
- @Override
- public void start(Environment env) throws IOException {
- startThread(new CommandRunnable() {
- @Override
- public void run() throws Exception {
- parseCommandLine();
- stdout = toPrintWriter(out);
- stderr = toPrintWriter(err);
- try {
- SshCommand.this.run();
- } finally {
- stdout.flush();
- stderr.flush();
- }
- }
- });
- }
+public abstract class SshCommand extends BaseCommand implements ExtensionPoint {
+ protected PrintWriter stdout;
+ protected PrintWriter stderr;
- protected abstract void run() throws UnloggedFailure, Failure, Exception;
+ @Override
+ public void start(Environment env) throws IOException {
+ startThread(new CommandRunnable() {
+ @Override
+ public void run() throws Exception {
+ parseCommandLine();
+ stdout = toPrintWriter(out);
+ stderr = toPrintWriter(err);
+ try {
+ SshCommand.this.run();
+ } finally {
+ stdout.flush();
+ stderr.flush();
+ }
+ }
+ });
+ }
+
+ protected abstract void run() throws UnloggedFailure, Failure, Exception;
}
--
Gitblit v1.9.1