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" /> <Package name="ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation" />
<Bug pattern="NM_CONFUSING" /> <Bug pattern="NM_CONFUSING" />
</Match> </Match>
<Match>
<Package name="ch.ethz.seb.sebserver" />
<Bug pattern="REC_CATCH_EXCEPTION" />
</Match>

View file

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

View file

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

View file

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

View file

@ -62,10 +62,6 @@ public class TableFilter<ROW extends Entity> {
layout.center = false; layout.center = false;
layout.fill = true; layout.fill = true;
this.composite.setLayout(layout); 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; this.entityTable = entityTable;
buildComponents(); buildComponents();
} }
@ -356,12 +352,14 @@ public class TableFilter<ROW extends Entity> {
@Override @Override
FilterComponent reset() { FilterComponent reset() {
try { if (this.selector != null) {
final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue); try {
this.selector.setDate(parse.getYear(), parse.getMonthOfYear() - 1, parse.getDayOfMonth()); final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue);
} catch (final Exception e) { this.selector.setDate(parse.getYear(), parse.getMonthOfYear() - 1, parse.getDayOfMonth());
final org.joda.time.DateTime now = org.joda.time.DateTime.now(DateTimeZone.UTC); } catch (final Exception e) {
this.selector.setDate(now.getYear(), now.getMonthOfYear() - 1, now.getDayOfMonth()); 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; return this;
} }
@ -429,13 +427,28 @@ public class TableFilter<ROW extends Entity> {
@Override @Override
FilterComponent reset() { FilterComponent reset() {
final org.joda.time.DateTime now = org.joda.time.DateTime.now(DateTimeZone.UTC); final org.joda.time.DateTime now = org.joda.time.DateTime.now(DateTimeZone.UTC);
try { if (this.fromSelector != null) {
final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue); try {
this.fromSelector.setDate(parse.getYear(), parse.getMonthOfYear() - 1, parse.getDayOfMonth()); final org.joda.time.DateTime parse = org.joda.time.DateTime.parse(this.attribute.initValue);
} catch (final Exception e) {
this.fromSelector.setDate(now.getYear(), now.getMonthOfYear() - 1, now.getDayOfMonth()); 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; return this;
} }

View file

@ -165,7 +165,7 @@ INSERT IGNORE INTO configuration_attribute VALUES
(203, 'URLFilterRules.active', 'CHECKBOX', 202, null, null, null, 'true'), (203, 'URLFilterRules.active', 'CHECKBOX', 202, null, null, null, 'true'),
(204, 'URLFilterRules.regex', 'CHECKBOX', 202, null, null, null, 'false'), (204, 'URLFilterRules.regex', 'CHECKBOX', 202, null, null, null, 'false'),
(205, 'URLFilterRules.expression', 'TEXT_FIELD', 202, null, null, null, ''), (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'), (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), (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'), (203, 'URLFilterRules.active', 'CHECKBOX', 202, null, null, null, 'true'),
(204, 'URLFilterRules.regex', 'CHECKBOX', 202, null, null, null, 'false'), (204, 'URLFilterRules.regex', 'CHECKBOX', 202, null, null, null, 'false'),
(205, 'URLFilterRules.expression', 'TEXT_FIELD', 202, null, null, null, ''), (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'), (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), (220, 'proxies', 'COMPOSITE_TABLE', null, 'active,TABLE_ENTRY|autoDiscovery,autoConfiguration,http,https,ftp,socks,rtsp', null, null, null),