GCLC swt code compliance

This commit is contained in:
2016-06-11 16:35:34 -04:00
parent 04ca80f1b5
commit 801189fdeb
8 changed files with 395 additions and 102 deletions

View File

@@ -76,6 +76,7 @@ of Emmanuel Bigeon. -->
<url>http://www.bigeon.fr/emmanuel</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.scm.id>git.bigeon.net</project.scm.id>
</properties>
<dependencies>
<dependency>
@@ -87,7 +88,7 @@ of Emmanuel Bigeon. -->
<dependency>
<groupId>fr.bigeon</groupId>
<artifactId>gclc</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>fr.bigeon</groupId>
@@ -102,4 +103,8 @@ of Emmanuel Bigeon. -->
</parent>
<name>GCLC Socket</name>
<description>Socket implementation of GCLC</description>
<scm>
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
<tag>HEAD</tag>
</scm>
</project>

View File

@@ -142,34 +142,35 @@ public class SocketConsoleApplicationShell implements Runnable {
* @see java.lang.Runnable#run() */
@Override
public void run() {
// Create the server
try (ServerSocket actualServerSocket = new ServerSocket(port)) {
this.serverSocket = actualServerSocket;
running = true;
// Create the streams
try (PipedOutputStream outStream = new PipedOutputStream();
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(outStream))) {
new OutputStreamWriter(outStream));
InputStreamReader isr = new InputStreamReader(consoleInput);
BufferedReader inBuf = new BufferedReader(isr)) {
consoleInput.connect(outStream);
try (InputStreamReader isr = new InputStreamReader(
consoleInput);
BufferedReader inBuf = new BufferedReader(isr);) {
consoleManager.setInput(inBuf);
runSokectServer(writer);
// Close the application
// Pass command to application
if (app.isRunning()) {
writer.write(applicationShutdown + EOL);
writer.flush();
}
consoleManager.setInput(inBuf);
runSokectServer(writer);
// Close the application
// Pass command to application
if (app.isRunning()) {
writer.write(applicationShutdown + EOL);
writer.flush();
}
}
} catch (final IOException e) {
} catch (
final IOException e) {
LOGGER.log(Level.SEVERE,
"Communication error between client and server", e); //$NON-NLS-1$
}
}
/** @param appTh the application thread
* @param writer the writer to the application
/** @param writer the writer to the application
* @throws IOException if the communication with the client failed */
private void runSokectServer(BufferedWriter writer) throws IOException {
final ConsoleRunnable runnable = new ConsoleRunnable(app,