tests and PMD and coverage

This commit is contained in:
anhefti 2019-09-11 12:59:43 +02:00
parent f0fcbefdbb
commit 99d2faf97d
9 changed files with 29 additions and 32 deletions

View file

@ -15,6 +15,8 @@
<rule ref="category/java/errorprone.xml" >
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="NullAssignment"/>
</rule>
</ruleset>

14
pom.xml
View file

@ -173,14 +173,6 @@
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>
<exclude>ch/ethz/seb/sebserver/gui/content/**/*</exclude>
<exclude>ch/ethz/seb/sebserver/gui/form/**/*</exclude>
<exclude>ch/ethz/seb/sebserver/gui/table/**/*</exclude>
<exclude>ch/ethz/seb/sebserver/gui/widget/**/*</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
@ -198,9 +190,9 @@
</execution>
</executions>
<configuration>
<includes>
<include>ch/ethz/seb/sebserver/*</include>
</includes>
<!-- <includes> -->
<!-- <include>ch/ethz/seb/sebserver/*</include> -->
<!-- </includes> -->
<excludes>
<exclude>ch/ethz/seb/sebserver/gui/content/**/*</exclude>
<exclude>ch/ethz/seb/sebserver/gui/form/**/*</exclude>

View file

@ -207,8 +207,8 @@ public final class Result<T> {
throw new IllegalArgumentException("Use flatMap instead!");
}
return Result.of(result);
} catch (final Throwable t) {
return Result.ofError(t);
} catch (final Exception e) {
return Result.ofError(e);
}
} else {
return Result.ofError(this.error);
@ -230,8 +230,8 @@ public final class Result<T> {
if (this.error == null) {
try {
return mapf.apply(this.value);
} catch (final Throwable t) {
return Result.ofError(t);
} catch (final Exception e) {
return Result.ofError(e);
}
} else {
return Result.ofError(this.error);

View file

@ -151,6 +151,7 @@ public abstract class AbstractTableFieldBuilder implements InputFieldBuilder {
}
default: {
item.setText(cellIndex, getValue(attribute, tableValue));
break;
}
}
}

View file

@ -145,6 +145,8 @@ public class ViewGridBuilder {
break;
}
default: {
// do nothing
break;
}
}
} catch (final ArrayIndexOutOfBoundsException e) {

View file

@ -120,7 +120,7 @@ public class ComposerServiceImpl implements ComposerService {
try {
composer.compose(pageContext);
PageService.updateScrolledComposite(pageContext.getParent());
} catch (final Throwable e) {
} catch (final Exception e) {
log.error("Failed to compose: {}, pageContext: {}", name, pageContext, e);
}

View file

@ -143,10 +143,10 @@ public final class PageAction {
PageAction.this.pageContext.notifyError("action.error.unexpected.message", restCallError);
}
return Result.ofError(restCallError);
} catch (final Throwable t) {
log.error("Failed to execute action: {}", PageAction.this, t);
PageAction.this.pageContext.notifyError("action.error.unexpected.message", t);
return Result.ofError(t);
} catch (final Exception e) {
log.error("Failed to execute action: {}", PageAction.this, e);
PageAction.this.pageContext.notifyError("action.error.unexpected.message", e);
return Result.ofError(e);
}
}

View file

@ -327,10 +327,10 @@ public class PageContextImpl implements PageContext {
if (returnCode == SWT.OK) {
try {
this.onOK.accept(true);
} catch (final Throwable t) {
} catch (final Exception e) {
log.error(
"Unexpected on confirm callback execution. This should not happen, plase secure the given onOK Runnable",
t);
e);
this.onOK.accept(false);
}
}

View file

@ -115,11 +115,11 @@ public abstract class RestCall<T> {
return handleRestCallError(responseEntity);
}
} catch (final Throwable t) {
final RestCallError restCallError = new RestCallError("Unexpected error while rest call", t);
} catch (final Exception e) {
final RestCallError restCallError = new RestCallError("Unexpected error while rest call", e);
try {
final String responseBody = ((RestClientResponseException) t).getResponseBodyAsString();
final String responseBody = ((RestClientResponseException) e).getResponseBodyAsString();
restCallError.errors.addAll(RestCall.this.jsonMapper.readValue(
responseBody,
@ -127,16 +127,16 @@ public abstract class RestCall<T> {
}));
} catch (final ClassCastException cce) {
log.error("Unexpected error-response while webservice API call for: {}", builder, t);
restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(t));
log.error("Unexpected error-response while webservice API call for: {}", builder, e);
restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(e));
} catch (final RuntimeException re) {
log.error("Unexpected runtime error while webservice API call for: {}", builder, re);
log.error("Unexpected runtime error cause: ", t);
log.error("Unexpected runtime error cause: ", e);
restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(re));
} catch (final Exception e) {
log.error("Unexpected error while webservice API call for: {}", builder, e);
log.error("Unexpected error cause: ", t);
restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(e));
} catch (final Exception ee) {
log.error("Unexpected error while webservice API call for: {}", builder, ee);
log.error("Unexpected error cause: ", e);
restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(ee));
}
return Result.ofError(restCallError);