Sonar fixes

master
Markus Kreth 7 years ago
parent 99cc213ef1
commit b43b04e37e
  1. 29
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/Person.java
  2. 13
      src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/navigation/HeadView.java

@ -35,6 +35,7 @@ public class Person extends BaseEntity implements Serializable {
public static final String SESSION_LOGIN = "SESSION_LOGIN_USER";
public static final String QUERY_FINDALL = "Person.findAll";
public static final String QUERY_FINDLOGIN = "Person.findLogin";
private static final long serialVersionUID = -8361264400619997123L;
@ -42,9 +43,11 @@ public class Person extends BaseEntity implements Serializable {
private LocalDate birth;
private String prename;
private String surname;
private String username;
private String password;
private Integer gender;
@ -131,7 +134,8 @@ public class Person extends BaseEntity implements Serializable {
public void setGender(Gender gender) {
if (gender == null) {
this.gender = null;
} else {
}
else {
this.gender = gender.getId();
}
}
@ -252,7 +256,8 @@ public class Person extends BaseEntity implements Serializable {
public void setPersongroups(Collection<GroupDef> persongroups) {
if (persongroups instanceof Set) {
this.groups = (Set<GroupDef>) persongroups;
} else {
}
else {
this.groups = new HashSet<>(persongroups);
}
}
@ -265,7 +270,7 @@ public class Person extends BaseEntity implements Serializable {
}
public void removePersongroup(GroupDef persongroup) {
if (this.groups == null) {
if (this.groups != null) {
this.groups.remove(persongroup);
}
}
@ -362,42 +367,48 @@ public class Person extends BaseEntity implements Serializable {
if (other.birth != null) {
return false;
}
} else if (!birth.equals(other.birth)) {
}
else if (!birth.equals(other.birth)) {
return false;
}
if (groups == null) {
if (other.groups != null) {
return false;
}
} else if (!groups.equals(other.groups)) {
}
else if (!groups.equals(other.groups)) {
return false;
}
if (password == null) {
if (other.password != null) {
return false;
}
} else if (!password.equals(other.password)) {
}
else if (!password.equals(other.password)) {
return false;
}
if (prename == null) {
if (other.prename != null) {
return false;
}
} else if (!prename.equals(other.prename)) {
}
else if (!prename.equals(other.prename)) {
return false;
}
if (surname == null) {
if (other.surname != null) {
return false;
}
} else if (!surname.equals(other.surname)) {
}
else if (!surname.equals(other.surname)) {
return false;
}
if (username == null) {
if (other.username != null) {
return false;
}
} else if (!username.equals(other.username)) {
}
else if (!username.equals(other.username)) {
return false;
}
return true;

@ -233,7 +233,7 @@ public class HeadView extends HorizontalLayout {
private AbstractComponent createEmbedded(String title, JasperPrint print) throws IOException {
PipedInputStream in = new PipedInputStream();
final PipedInputStream in = new PipedInputStream();
final PipedOutputStream out = new PipedOutputStream(in);
final StreamResource resource = new StreamResource(() -> in, title);
@ -243,23 +243,28 @@ public class HeadView extends HorizontalLayout {
c.setSizeFull();
ExecutorService exec = Executors.newSingleThreadExecutor();
try {
exec.execute(() -> {
try {
JasperExportManager.exportReportToPdfStream(print, out);
}
catch (JRException e) {
log.error("Error on Export to Pdf.", e);
throw new RuntimeException(e);
throw new RuntimeException("Error on Export to Pdf.", e);
}
finally {
}
});
}
finally {
try {
out.close();
in.close();
}
catch (IOException e) {
log.warn("Error closing Jasper output stream.", e);
}
}
});
exec.shutdown();
return c;
}

Loading…
Cancel
Save