SonarQube fixes

master
Markus Kreth 7 years ago
parent 7cec6e7824
commit 107d18bcc2
  1. 24
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/business/EventBusiness.java
  2. 6
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/BaseEntity.java
  3. 2
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/EventGrid.java
  4. 4
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonGrid.java

@ -50,15 +50,17 @@ public class EventBusiness {
"Loading events from Google Calendar, forceRefresh={}", "Loading events from Google Calendar, forceRefresh={}",
forceRefresh); forceRefresh);
BufferedWriter out = null;
List<ClubEvent> list = new ArrayList<>(); List<ClubEvent> list = new ArrayList<>();
try { File f = new File("google_events.json");
if (f.exists()) {
File f = new File("google_events.json"); try {
Files.delete(f.toPath()); Files.delete(f.toPath());
out = new BufferedWriter(new FileWriter(f)); } catch (IOException e) {
log.error("Error deleting file " + f.getAbsolutePath(), e);
}
}
try (BufferedWriter out = new BufferedWriter(new FileWriter(f))) {
String remoteHost = "localhost"; String remoteHost = "localhost";
CalendarAdapter adapter = new CalendarAdapter(); CalendarAdapter adapter = new CalendarAdapter();
@ -80,14 +82,6 @@ public class EventBusiness {
} catch (GeneralSecurityException | IOException } catch (GeneralSecurityException | IOException
| InterruptedException e) { | InterruptedException e) {
log.error("Error loading events from google.", e); log.error("Error loading events from google.", e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
log.error("Error writing File", e);
}
}
} }
return Collections.unmodifiableList(list); return Collections.unmodifiableList(list);

@ -38,7 +38,7 @@ public abstract class BaseEntity {
} }
public void setChanged(Date changed) { public void setChanged(Date changed) {
this.changed = changed; this.changed = new Date(changed.getTime());
} }
public Date getCreated() { public Date getCreated() {
@ -46,7 +46,7 @@ public abstract class BaseEntity {
} }
public void setCreated(Date created) { public void setCreated(Date created) {
this.created = created; this.created = new Date(created.getTime());
} }
public Date getDeleted() { public Date getDeleted() {
@ -54,7 +54,7 @@ public abstract class BaseEntity {
} }
public void setDeleted(Date deleted) { public void setDeleted(Date deleted) {
this.deleted = deleted; this.deleted = new Date(deleted.getTime());
} }
@Override @Override

@ -10,7 +10,7 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent;
public class EventGrid extends Grid<ClubEvent> { public class EventGrid extends Grid<ClubEvent> {
private static final long serialVersionUID = -5435770187868470290L; private static final long serialVersionUID = -5435770187868470290L;
private final DateTimeFormatter df = DateTimeFormatter private transient final DateTimeFormatter df = DateTimeFormatter
.ofLocalizedDate(FormatStyle.MEDIUM); .ofLocalizedDate(FormatStyle.MEDIUM);
public EventGrid() { public EventGrid() {

@ -40,7 +40,7 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person;
public class PersonGrid extends CustomComponent { public class PersonGrid extends CustomComponent {
private static final long serialVersionUID = -8148097982839343673L; private static final long serialVersionUID = -8148097982839343673L;
private final Logger log = LoggerFactory.getLogger(getClass()); private transient final Logger log = LoggerFactory.getLogger(getClass());
private final DateFormat birthFormat = DateFormat private final DateFormat birthFormat = DateFormat
.getDateInstance(DateFormat.MEDIUM); .getDateInstance(DateFormat.MEDIUM);
@ -52,7 +52,7 @@ public class PersonGrid extends CustomComponent {
private final TextField textTitle; private final TextField textTitle;
private ClosedFunction closedFunction = null; private transient ClosedFunction closedFunction = null;
private ConfigurableFilterDataProvider<Person, Void, SerializablePredicate<Person>> dataProvider; private ConfigurableFilterDataProvider<Person, Void, SerializablePredicate<Person>> dataProvider;
private Boolean selectedOnlyFilter; private Boolean selectedOnlyFilter;
private Set<GroupDef> groupMemberFilter; private Set<GroupDef> groupMemberFilter;

Loading…
Cancel
Save