Skip to content

Commit

Permalink
Processed remarks made by Fried Hoeben.
Browse files Browse the repository at this point in the history
And some indentation.
  • Loading branch information
amolenaar committed Jun 6, 2016
1 parent 47393df commit d68ed4f
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 42 deletions.
14 changes: 5 additions & 9 deletions src/fitnesse/FitNesseServer.java
Expand Up @@ -2,6 +2,7 @@
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse;

import java.io.IOException;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.logging.Level;
Expand All @@ -21,17 +22,12 @@ public FitNesseServer(FitNesseContext context, ExecutorService executorService)
}

@Override
public void serve(Socket s) {
public void serve(Socket s) throws IOException {
serve(s, 10000);
}

public void serve(Socket s, long requestTimeout) {
try {
FitNesseExpediter sender = new FitNesseExpediter(s, context, executorService, requestTimeout);
executorService.submit(sender);
}
catch (Exception e) {
LOG.log(Level.SEVERE, "Error while serving socket " + s, e);
}
public void serve(Socket s, long requestTimeout) throws IOException {
FitNesseExpediter sender = new FitNesseExpediter(s, context, executorService, requestTimeout);
executorService.submit(sender);
}
}
4 changes: 3 additions & 1 deletion src/fitnesse/responders/ErrorResponder.java
Expand Up @@ -2,6 +2,8 @@
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.responders;

import java.io.UnsupportedEncodingException;

import fitnesse.FitNesseContext;
import fitnesse.Responder;
import fitnesse.http.Request;
Expand Down Expand Up @@ -48,7 +50,7 @@ public static String makeExceptionString(Throwable e) {
StringBuilder buffer = new StringBuilder();
buffer.append(e.toString()).append("\n");
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
buffer.append("\t" + stackTraceElement).append("\n");
buffer.append("\t").append(stackTraceElement).append("\n");
}

return buffer.toString();
Expand Down
2 changes: 1 addition & 1 deletion src/fitnesse/socketservice/SocketService.java
Expand Up @@ -69,7 +69,7 @@ private void serviceThread() {
LOG.log(Level.SEVERE, "Can't create new thread. Out of Memory. Aborting.", e);
System.exit(99);
} catch (SocketException sox) {
running = false; // do nothing
running = false;
} catch (IOException e) {
LOG.log(Level.SEVERE, "I/O exception in service thread", e);
}
Expand Down
8 changes: 6 additions & 2 deletions src/fitnesse/testsystems/fit/FitTestSystem.java
Expand Up @@ -50,6 +50,7 @@ public void runTests(TestPage pageToTest) throws TestExecutionException {
else
client.send(html);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
exceptionOccurred(e);
throw new TestExecutionException("Testing has been interrupted", e);
} catch (IOException e) {
Expand Down Expand Up @@ -101,8 +102,11 @@ public void testComplete(TestSummary testSummary) {

@Override
public void exceptionOccurred(Throwable t) {
client.kill();
testSystemStopped(t);
try {
client.kill();
} finally {
testSystemStopped(t);
}
}

private void testSystemStarted(TestSystem testSystem) {
Expand Down
12 changes: 6 additions & 6 deletions src/fitnesse/testsystems/slim/tables/DecisionTable.java
Expand Up @@ -35,14 +35,14 @@ public List<SlimAssertion> getAssertions() throws TestExecutionException {
ScenarioTable scenario = getTestContext().getScenario(scenarioName);
if (scenario != null) {
return new ScenarioCaller().call(scenario);
} else{
} else {
scenarioName =getFixtureName();
scenario = getTestContext().getScenario(scenarioName);
if (scenario != null) {
return new ScenarioCallerWithConstuctorParameters().call(scenario);
}else{
return new FixtureCaller().call(getFixtureName());
}
if (scenario != null) {
return new ScenarioCallerWithConstuctorParameters().call(scenario);
} else {
return new FixtureCaller().call(getFixtureName());
}
}
}

Expand Down
47 changes: 24 additions & 23 deletions src/fitnesse/testsystems/slim/tables/SlimTable.java
Expand Up @@ -125,10 +125,10 @@ public void setFixtureName(String name){
}

protected String getFixtureName() {
if (fixtureName == null){
if (fixtureName == null) {
String tableHeader = table.getCellContents(0, 0);
fixtureName = getFixtureName(tableHeader);
}
}
return Disgracer.disgraceClassName(fixtureName);
}

Expand Down Expand Up @@ -417,30 +417,31 @@ class ReturnedSymbolExpectation extends ReturnedValueExpectation {
private String symbolName;
private String assignToName = null;
public ReturnedSymbolExpectation(int col, int row, String symbolName) {
super(col, row);
super(col, row);
this.symbolName = symbolName;
}
public ReturnedSymbolExpectation(int col, int row, String symbolName, String assignToName) {
super(col, row);
}

public ReturnedSymbolExpectation(int col, int row, String symbolName, String assignToName) {
super(col, row);
this.symbolName = symbolName;
this.assignToName = assignToName;
}

@Override
public TestResult evaluateExpectation(Object returnValue) {
String value = getSymbol(this.symbolName);
return super.evaluateExpectation(value);
}

@Override
protected SlimTestResult createEvaluationMessage(String actual, String expected) {
if (assignToName != null){
setSymbol(assignToName, actual);
return SlimTestResult.plain(String.format("$%s<-[%s]", assignToName, actual));
}else{
return super.createEvaluationMessage(actual, expected);
}
}
}

@Override
public TestResult evaluateExpectation(Object returnValue) {
String value = getSymbol(this.symbolName);
return super.evaluateExpectation(value);
}

@Override
protected SlimTestResult createEvaluationMessage(String actual, String expected) {
if (assignToName != null) {
setSymbol(assignToName, actual);
return SlimTestResult.plain(String.format("$%s<-[%s]", assignToName, actual));
}else{
return super.createEvaluationMessage(actual, expected);
}
}
}

class RejectedValueExpectation extends ReturnedValueExpectation {
Expand Down

0 comments on commit d68ed4f

Please sign in to comment.