bug fixes

This commit is contained in:
anhefti 2019-08-29 16:47:12 +02:00
parent c0f30b8510
commit e4d9961d94
7 changed files with 42 additions and 20 deletions

View file

@ -19,7 +19,10 @@
<Package name="ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation" />
<Bug pattern="NM_CONFUSING" />
</Match>
<Match>
<Package name="ch.ethz.seb.sebserver" />
<Bug pattern="REC_CATCH_EXCEPTION" />
</Match>

View file

@ -304,6 +304,10 @@
<artifactId>jncryptor</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
<!-- Testing -->
<dependency>

View file

@ -178,7 +178,7 @@ public class LmsSetupForm implements TemplateComposer {
.addField(FormBuilder.text(
Domain.LMS_SETUP.ATTR_LMS_CLIENTNAME,
FORM_CLIENTNAME_LMS_TEXT_KEY,
(lmsSetup.getLmsAuthName() != null) ? lmsSetup.getLmsAuthName().toString() : null))
(lmsSetup.getLmsAuthName() != null) ? lmsSetup.getLmsAuthName() : null))
.addField(FormBuilder.text(
Domain.LMS_SETUP.ATTR_LMS_CLIENTSECRET,
FORM_SECRET_LMS_TEXT_KEY)

View file

@ -14,6 +14,7 @@ import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.CheckReturnValue;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@ -174,6 +175,7 @@ public class FormBuilder {
return this;
}
@CheckReturnValue
public <T extends Entity> FormHandle<T> build() {
return buildFor(null);
}

View file

@ -62,10 +62,6 @@ public class TableFilter<ROW extends Entity> {
layout.center = false;
layout.fill = true;
this.composite.setLayout(layout);
// TODO just for debugging, remove when tested
// this.composite.setBackground(new Color(entityTable.composite.getDisplay(), new RGB(0, 0, 200)));
this.entityTable = entityTable;
buildComponents();
}
@ -356,12 +352,14 @@ public class TableFilter<ROW extends Entity> {
@Override
FilterComponent reset() {
try {
final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue);
this.selector.setDate(parse.getYear(), parse.getMonthOfYear() - 1, parse.getDayOfMonth());
} catch (final Exception e) {
final org.joda.time.DateTime now = org.joda.time.DateTime.now(DateTimeZone.UTC);
this.selector.setDate(now.getYear(), now.getMonthOfYear() - 1, now.getDayOfMonth());
if (this.selector != null) {
try {
final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue);
this.selector.setDate(parse.getYear(), parse.getMonthOfYear() - 1, parse.getDayOfMonth());
} catch (final Exception e) {
final org.joda.time.DateTime now = org.joda.time.DateTime.now(DateTimeZone.UTC);
this.selector.setDate(now.getYear(), now.getMonthOfYear() - 1, now.getDayOfMonth());
}
}
return this;
}
@ -429,13 +427,28 @@ public class TableFilter<ROW extends Entity> {
@Override
FilterComponent reset() {
final org.joda.time.DateTime now = org.joda.time.DateTime.now(DateTimeZone.UTC);
try {
final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue);
this.fromSelector.setDate(parse.getYear(), parse.getMonthOfYear() - 1, parse.getDayOfMonth());
} catch (final Exception e) {
this.fromSelector.setDate(now.getYear(), now.getMonthOfYear() - 1, now.getDayOfMonth());
if (this.fromSelector != null) {
try {
final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue);
this.fromSelector.setDate(
parse.getYear(),
parse.getMonthOfYear() - 1,
parse.getDayOfMonth());
} catch (final Exception e) {
this.fromSelector.setDate(
now.getYear(),
now.getMonthOfYear() - 1,
now.getDayOfMonth());
}
}
if (this.toSelector != null) {
this.toSelector.setDate(
now.getYear(),
now.getMonthOfYear() - 1,
now.getDayOfMonth());
}
this.toSelector.setDate(now.getYear(), now.getMonthOfYear() - 1, now.getDayOfMonth());
return this;
}

View file

@ -165,7 +165,7 @@ INSERT IGNORE INTO configuration_attribute VALUES
(203, 'URLFilterRules.active', 'CHECKBOX', 202, null, null, null, 'true'),
(204, 'URLFilterRules.regex', 'CHECKBOX', 202, null, null, null, 'false'),
(205, 'URLFilterRules.expression', 'TEXT_FIELD', 202, null, null, null, ''),
(206, 'URLFilterRules.action', 'SINGLE_SELECTION', 202, '0,1', null, null, ''),
(206, 'URLFilterRules.action', 'SINGLE_SELECTION', 202, '0,1', null, null, '0'),
(210, 'proxySettingsPolicy', 'RADIO_SELECTION', null, '0,1', null, null, '0'),
(220, 'proxies', 'COMPOSITE_TABLE', null, 'active,TABLE_ENTRY|autoDiscovery,autoConfiguration,http,https,ftp,socks,rtsp', null, null, null),

View file

@ -139,7 +139,7 @@ INSERT IGNORE INTO configuration_attribute VALUES
(203, 'URLFilterRules.active', 'CHECKBOX', 202, null, null, null, 'true'),
(204, 'URLFilterRules.regex', 'CHECKBOX', 202, null, null, null, 'false'),
(205, 'URLFilterRules.expression', 'TEXT_FIELD', 202, null, null, null, ''),
(206, 'URLFilterRules.action', 'SINGLE_SELECTION', 202, '0,1', null, null, ''),
(206, 'URLFilterRules.action', 'SINGLE_SELECTION', 202, '0,1', null, null, '0'),
(210, 'proxySettingsPolicy', 'RADIO_SELECTION', null, '0,1', null, null, '0'),
(220, 'proxies', 'COMPOSITE_TABLE', null, 'active,TABLE_ENTRY|autoDiscovery,autoConfiguration,http,https,ftp,socks,rtsp', null, null, null),