From 38639e18aa966edd604a7fd3455ebac4e94565ac Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 21 Oct 2022 18:46:53 -0700 Subject: [PATCH 01/29] Bump up version. --- pom.xml | 4 ++-- wise-ui/pom.xml | 2 +- wise-webapp/pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index b6bf10ca..a13d0a64 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 5.0.13-SNAPSHOT + 5.0.15-SNAPSHOT ${project.basedir}/wise-webapps @@ -16,7 +16,7 @@ org.wisemapping wisemapping WiseMapping Project - 5.0.13-SNAPSHOT + 5.0.15-SNAPSHOT pom diff --git a/wise-ui/pom.xml b/wise-ui/pom.xml index 9350db06..b20a3c3c 100644 --- a/wise-ui/pom.xml +++ b/wise-ui/pom.xml @@ -12,7 +12,7 @@ org.wisemapping wisemapping ../pom.xml - 5.0.13-SNAPSHOT + 5.0.15-SNAPSHOT diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 0f170990..46fc7997 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -8,7 +8,7 @@ org.wisemapping wisemapping ../pom.xml - 5.0.13-SNAPSHOT + 5.0.15-SNAPSHOT From 4ee62035b8ac44f1fbcd203cc939dd7f4f8f0fe7 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 21 Oct 2022 18:58:36 -0700 Subject: [PATCH 02/29] Update spring framework version. --- wise-webapp/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 46fc7997..1dcec920 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -12,9 +12,9 @@ - 5.3.22 + 5.3.23 5.6.2 - 5.6.11.Final + 5.6.12.Final 6.0.21.Final 5.6.1 From 6cd0f635d505089378649188eec5c9e700dbd08c Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 21 Oct 2022 23:06:04 -0700 Subject: [PATCH 03/29] Fix deleted object would be re-saved by cascade (remove deleted object from associations): [com.wisemapping.model.Collaboration#1651889] --- .../com/wisemapping/model/Collaboration.java | 11 ++++--- .../java/com/wisemapping/model/Label.java | 30 +++++++++++-------- .../java/com/wisemapping/model/Mindmap.java | 4 ++- .../security/aop/ViewBaseSecurityAdvise.java | 1 - .../service/MindmapServiceImpl.java | 6 ++-- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java b/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java index 7446b6f5..630776f9 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java @@ -26,6 +26,7 @@ import org.jetbrains.annotations.Nullable; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.util.Objects; @Entity @Table(name = "COLLABORATION") @@ -127,16 +128,14 @@ public class Collaboration implements Serializable { Collaboration that = (Collaboration) o; if (id != that.id) return false; - if (collaborator != null ? !collaborator.equals(that.collaborator) : that.collaborator != null) return false; - if (mindMap != null ? !mindMap.equals(that.mindMap) : that.mindMap != null) return false; + if (!Objects.equals(collaborator, that.collaborator)) return false; + if (!Objects.equals(mindMap, that.mindMap)) return false; return role == that.role; } @Override public int hashCode() { - int result = id ^ (id >>> 32); - result = 31 * result + (role != null ? role.hashCode() : 0); - result = 31 * result + (mindMap != null ? mindMap.hashCode() : 0); - return result; + //https://thorben-janssen.com/ultimate-guide-to-implementing-equals-and-hashcode-with-hibernate/ + return 13; } } diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Label.java b/wise-webapp/src/main/java/com/wisemapping/model/Label.java index 95e80415..6126560d 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Label.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Label.java @@ -24,6 +24,7 @@ import org.jetbrains.annotations.Nullable; import javax.persistence.*; import java.io.Serializable; +import java.util.Objects; @Entity @Table(name = "LABEL") @@ -34,17 +35,22 @@ public class Label implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; - @NotNull private String title; - @NotNull private String color; - @Nullable private String iconName; + @NotNull + private String title; + @NotNull + private String color; + @Nullable + private String iconName; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name="creator_id",nullable = true,unique = true) - @NotNull private User creator; + @JoinColumn(name = "creator_id", nullable = true, unique = true) + @NotNull + private User creator; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name="parent_label_id",nullable = true) - @Nullable private Label parent; + @JoinColumn(name = "parent_label_id", nullable = true) + @Nullable + private Label parent; public void setParent(@Nullable Label parent) { this.parent = parent; @@ -104,17 +110,15 @@ public class Label implements Serializable { if (this == o) return true; if (!(o instanceof Label)) return false; - Label label = (Label) o; - + final Label label = (Label) o; return id == label.id && creator.getId() == label.creator.getId() - && !(parent != null ? !parent.equals(label.parent) : label.parent != null); + && Objects.equals(parent, label.parent); } @Override public int hashCode() { - long result = id; - result = 31 * result + title.hashCode(); - result = 31 * result + (creator!=null?creator.hashCode():0); + long result = title.hashCode(); + result = 31 * result + (creator != null ? creator.hashCode() : 0); result = 31 * result + (parent != null ? parent.hashCode() : 0); return (int) result; } diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java index d3cdf366..0b2052ff 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java @@ -146,7 +146,9 @@ public class Mindmap implements Serializable { } public void removedCollaboration(@NotNull Collaboration collaboration) { - collaborations.remove(collaboration); + // https://stackoverflow.com/questions/25125210/hibernate-persistentset-remove-operation-not-working + this.collaborations.remove(collaboration); + collaboration.setMindMap(null); } public void removedCollaboration(@NotNull Set collaborations) { diff --git a/wise-webapp/src/main/java/com/wisemapping/security/aop/ViewBaseSecurityAdvise.java b/wise-webapp/src/main/java/com/wisemapping/security/aop/ViewBaseSecurityAdvise.java index c9807d61..52c59944 100755 --- a/wise-webapp/src/main/java/com/wisemapping/security/aop/ViewBaseSecurityAdvise.java +++ b/wise-webapp/src/main/java/com/wisemapping/security/aop/ViewBaseSecurityAdvise.java @@ -38,7 +38,6 @@ public class ViewBaseSecurityAdvise @Override protected boolean isAllowed(@Nullable User user, Mindmap map) { - System.out.println("VIEWWWWWWWWWWWWW"); return getMindmapService().hasPermissions(user, map, CollaborationRole.VIEWER); } diff --git a/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java b/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java index 8207a662..7a4a763f 100755 --- a/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java @@ -143,15 +143,13 @@ public class MindmapServiceImpl public void removeCollaboration(@NotNull Mindmap mindmap, @NotNull Collaboration collaboration) throws CollaborationException { // remove collaborator association final Mindmap mindMap = collaboration.getMindMap(); - final Set collaborations = mindMap.getCollaborations(); - final User creator = mindMap.getCreator(); if (creator.identityEquality(collaboration.getCollaborator())) { throw new CollaborationException("User is the creator and must have ownership permissions.Creator Email:" + mindMap.getCreator().getEmail() + ",Collaborator:" + collaboration.getCollaborator().getEmail()); } // When you delete an object from hibernate you have to delete it from *all* collections it exists in... - collaborations.remove(collaboration); + mindMap.removedCollaboration(collaboration); mindmapManager.removeCollaboration(collaboration); } @@ -249,7 +247,7 @@ public class MindmapServiceImpl @Override public void revertChange(@NotNull Mindmap mindmap, int historyId) - throws WiseMappingException, IOException { + throws WiseMappingException { final MindMapHistory history = mindmapManager.getHistory(historyId); mindmap.setZippedXml(history.getZippedXml()); updateMindmap(mindmap, true); From 24e2ba93f3b243b5a0aefd12900ba9d2d4f96528 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 24 Oct 2022 19:02:41 -0700 Subject: [PATCH 04/29] Fix encoding on map title. --- .../mysql-init/0002create-schemas.sql | 11 -------- .../com/wisemapping/model/Collaboration.java | 2 -- .../com/wisemapping/model/Collaborator.java | 2 +- .../java/com/wisemapping/model/Mindmap.java | 27 +++++++------------ 4 files changed, 11 insertions(+), 31 deletions(-) diff --git a/distribution/mysql-init/0002create-schemas.sql b/distribution/mysql-init/0002create-schemas.sql index eba00226..51d391ba 100644 --- a/distribution/mysql-init/0002create-schemas.sql +++ b/distribution/mysql-init/0002create-schemas.sql @@ -113,17 +113,6 @@ CREATE TABLE COLLABORATION ( ) CHARACTER SET utf8; -CREATE TABLE TAG ( - id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) - CHARACTER SET utf8 NOT NULL, - user_id INTEGER NOT NULL, - FOREIGN KEY (user_id) REFERENCES USER (colaborator_id) - ON DELETE CASCADE - ON UPDATE NO ACTION -) - CHARACTER SET utf8; - CREATE TABLE ACCESS_AUDITORY ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, login_date DATE, diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java b/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java index 630776f9..40d892b8 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java @@ -19,8 +19,6 @@ package com.wisemapping.model; -import org.hibernate.annotations.Fetch; -import org.hibernate.annotations.FetchMode; import org.jetbrains.annotations.Nullable; import javax.persistence.*; diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java b/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java index bf1d1c2e..02e507b7 100755 --- a/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java @@ -105,7 +105,7 @@ public class Collaborator implements Serializable { int id = this.getId(); String email = this.getEmail(); - int result = (int) (id ^ (id >>> 32)); + int result = id ^ (id >>> 32); result = 31 * result + (email != null ? email.hashCode() : 0); return result; } diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java index 0b2052ff..e134d514 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java @@ -83,13 +83,9 @@ public class Mindmap implements Serializable { @Basic(fetch = FetchType.LAZY) private byte[] zippedXml; - //~ Constructors ......................................................................................... - public Mindmap() { } - //~ Methods .............................................................................................. - public void setUnzipXml(@NotNull byte[] value) { try { final byte[] zip = ZipUtils.bytesToZip(value); @@ -318,11 +314,20 @@ public class Mindmap implements Serializable { final StringBuilder result = new StringBuilder(); result.append(""); result.append(""); return result.toString(); } + static private String escapeXmlAttribute(String attValue) { + // Hack: Find out of the box function. + String result = attValue.replace("&", "&"); + result = result.replace("<", "<"); + result = result.replace("gt", ">"); + result = result.replace("\"", """); + return result; + } + public Mindmap shallowClone() { final Mindmap result = new Mindmap(); result.setDescription(this.getDescription()); @@ -353,18 +358,6 @@ public class Mindmap implements Serializable { return false; } - @Nullable - public Label findLabel(int labelId) { - Label result = null; - for (Label label : this.labels) { - if (label.getId() == labelId) { - result = label; - break; - } - } - return result; - } - public void removeLabel(@NotNull final Label label) { this.labels.remove(label); } From 59d7ffd9c5d22e622fa0f87cd5fe4404aeed0aaa Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Fri, 28 Oct 2022 01:45:18 +0000 Subject: [PATCH 05/29] Fix creation table issue. --- config/database/postgres/create-schemas.sql | 24 ++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/config/database/postgres/create-schemas.sql b/config/database/postgres/create-schemas.sql index acc839bd..d9190c7c 100644 --- a/config/database/postgres/create-schemas.sql +++ b/config/database/postgres/create-schemas.sql @@ -27,14 +27,6 @@ CREATE TABLE LABEL ( --FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) ); -CREATE TABLE R_LABEL_MINDMAP ( - mindmap_id INTEGER NOT NULL, - label_id INTEGER NOT NULL, - PRIMARY KEY (mindmap_id, label_id), - FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id), - FOREIGN KEY (label_id) REFERENCES LABEL (id) ON DELETE CASCADE ON UPDATE NO ACTION -); - CREATE TABLE MINDMAP ( id SERIAL NOT NULL PRIMARY KEY, title VARCHAR(255) NOT NULL, @@ -44,11 +36,17 @@ CREATE TABLE MINDMAP ( creation_date TIMESTAMP, edition_date TIMESTAMP, creator_id INTEGER NOT NULL, - tags VARCHAR(1014), last_editor_id INTEGER NOT NULL --, --FOREIGN KEY(creator_id) REFERENCES "USER"(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION ); +CREATE TABLE R_LABEL_MINDMAP ( + mindmap_id INTEGER NOT NULL, + label_id INTEGER NOT NULL, + PRIMARY KEY (mindmap_id, label_id), + FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id), + FOREIGN KEY (label_id) REFERENCES LABEL (id) ON DELETE CASCADE ON UPDATE NO ACTION +); CREATE TABLE MINDMAP_HISTORY (id SERIAL NOT NULL PRIMARY KEY, @@ -77,14 +75,6 @@ CREATE TABLE COLLABORATION ( FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id) ON DELETE CASCADE ON UPDATE NO ACTION ); -CREATE TABLE TAG ( - id SERIAL NOT NULL PRIMARY KEY, - name VARCHAR(255) NOT NULL, - user_id INTEGER NOT NULL --, ---FOREIGN KEY(user_id) REFERENCES "USER"(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION -); - - CREATE TABLE ACCESS_AUDITORY ( id SERIAL NOT NULL PRIMARY KEY, login_date DATE, From 17e04a6f3f808a2d501eca08de92707d2f16e124 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Fri, 28 Oct 2022 01:54:48 +0000 Subject: [PATCH 06/29] README.md edited online with Bitbucket --- distribution/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/README.md b/distribution/README.md index fe858c97..add8f187 100644 --- a/distribution/README.md +++ b/distribution/README.md @@ -42,7 +42,7 @@ Depending on the database your want to configure, you can create initialization The next step is configure the WiseMapping for the database and credentials. Download `app.properties` configuration file and configure the required sections: -> $ curl https://bitbucket.org/wisemapping/wisemapping-open-source/raw/644b7078d790220c7844b732a83d45495f11d64e/wise-webapp/src/main/webapp/WEB-INF/app.properties +> $ curl https://bitbucket.org/wisemapping/wisemapping-open-source/src/master/wise-webapp/src/main/webapp/WEB-INF/app.properties ### Starting the application From 6c78eb078f61eaf98302e1c8ef235abf20abd8e2 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Fri, 28 Oct 2022 02:07:39 +0000 Subject: [PATCH 07/29] Update JDBC drivers. --- wise-webapp/pom.xml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 1dcec920..84cb1981 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -294,12 +294,19 @@ mysql mysql-connector-java - 5.1.5 + 8.0.31 + + + org.postgresql + postgresql + 42.5.0 + + org.hsqldb hsqldb - 2.6.1 + 2.7.1 From 49732ec06d99031fd182d9b7ec39112a1d68c044 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 27 Oct 2022 19:47:51 -0700 Subject: [PATCH 08/29] Update mysql driver version --- wise-webapp/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 84cb1981..bfcba7c9 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -195,7 +195,7 @@ mysql mysql-connector-java - 8.0.28 + 8.0.31 runtime @@ -350,7 +350,7 @@ mysql mysql-connector-java - 5.1.5 + 8.0.31 From 23b0f7351e32102ed4b4548266e061ca3e5e3751 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 27 Oct 2022 20:28:37 -0700 Subject: [PATCH 09/29] Resolve several critical vulnerabilities. --- wise-webapp/pom.xml | 32 ++++++++++--------- .../listener/UnlockOnExpireListener.java | 6 ++-- .../wisemapping/mail/NotificationService.java | 5 +-- .../wisemapping/rest/AccountController.java | 4 --- .../com/wisemapping/rest/BaseController.java | 5 +-- .../wisemapping/rest/MindmapController.java | 5 +-- .../com/wisemapping/rest/UserController.java | 5 +-- .../security/LegacyPasswordEncoder.java | 6 ++-- .../wisemapping/service/LockManagerImpl.java | 11 ++++--- .../wisemapping/service/RecaptchaService.java | 6 ++-- 10 files changed, 48 insertions(+), 37 deletions(-) diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index bfcba7c9..84b00d9f 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 wise-webapp war @@ -219,10 +220,9 @@ 3.9.9 - log4j - log4j - 1.2.17 - compile + org.apache.logging.log4j + log4j-core + 2.19.0 @@ -240,7 +240,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.1 + 2.13.4.2 @@ -296,7 +296,7 @@ mysql-connector-java 8.0.31 - + org.postgresql postgresql @@ -505,13 +505,13 @@ - - - - - - - + + + + + + + default-report verify @@ -566,7 +566,9 @@ true false 200 - ${integrationTestArgLine} -Ddatabase.base.url=${project.build.directory} -Djetty.port=8080 + ${integrationTestArgLine} -Ddatabase.base.url=${project.build.directory} + -Djetty.port=8080 + diff --git a/wise-webapp/src/main/java/com/wisemapping/listener/UnlockOnExpireListener.java b/wise-webapp/src/main/java/com/wisemapping/listener/UnlockOnExpireListener.java index f49eeab1..008c8155 100644 --- a/wise-webapp/src/main/java/com/wisemapping/listener/UnlockOnExpireListener.java +++ b/wise-webapp/src/main/java/com/wisemapping/listener/UnlockOnExpireListener.java @@ -24,8 +24,10 @@ import com.wisemapping.model.User; import com.wisemapping.security.Utils; import com.wisemapping.service.LockManager; import com.wisemapping.service.MindmapService; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -34,7 +36,7 @@ import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; public class UnlockOnExpireListener implements HttpSessionListener { - private static final Logger logger = Logger.getLogger(UnlockOnExpireListener.class); + private static final Logger logger = LogManager.getLogger(); @Override public void sessionCreated(@NotNull HttpSessionEvent event) { diff --git a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java index 1a7aaf6c..ce52f098 100644 --- a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java +++ b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java @@ -24,7 +24,8 @@ import com.wisemapping.model.Mindmap; import com.wisemapping.model.User; import com.wisemapping.rest.model.RestLogItem; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.springframework.beans.factory.annotation.Autowired; @@ -42,7 +43,7 @@ import java.util.Map; import java.util.stream.Collectors; final public class NotificationService { - final private static Logger logger = Logger.getLogger(Mailer.class); + final private static Logger logger = LogManager.getLogger(); private ResourceBundleMessageSource messageSource; @Autowired diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java index d6f0921b..2601a934 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java @@ -24,14 +24,11 @@ import com.wisemapping.model.Collaboration; import com.wisemapping.model.Label; import com.wisemapping.model.Mindmap; import com.wisemapping.model.User; -import com.wisemapping.rest.model.RestLogItem; import com.wisemapping.rest.model.RestUser; import com.wisemapping.security.Utils; import com.wisemapping.service.LabelService; import com.wisemapping.service.MindmapService; import com.wisemapping.service.UserService; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; @@ -41,7 +38,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; -import javax.servlet.http.HttpServletRequest; import java.util.List; @Controller diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java index 5c9f0fde..2eadc4a9 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java @@ -24,7 +24,8 @@ import com.wisemapping.model.User; import com.wisemapping.rest.model.RestErrors; import com.wisemapping.security.Utils; import com.wisemapping.service.RegistrationException; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -42,7 +43,7 @@ import java.util.Locale; public class BaseController { - final private Logger logger = Logger.getLogger(BaseController.class); + final private Logger logger = LogManager.getLogger(); @Qualifier("messageSource") @Autowired diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java index 416233f8..2b01d6ec 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -25,7 +25,8 @@ import com.wisemapping.security.Utils; import com.wisemapping.service.*; import com.wisemapping.validator.MapInfoValidator; import org.apache.commons.validator.routines.EmailValidator; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -46,7 +47,7 @@ import java.util.stream.Collectors; @Controller public class MindmapController extends BaseController { - final Logger logger = Logger.getLogger(MindmapController.class); + final Logger logger = LogManager.getLogger(); private static final String LATEST_HISTORY_REVISION = "latest"; diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/UserController.java b/wise-webapp/src/main/java/com/wisemapping/rest/UserController.java index 2574ae79..0b7a1ec1 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/UserController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/UserController.java @@ -26,7 +26,8 @@ import com.wisemapping.rest.model.RestUserRegistration; import com.wisemapping.service.*; import com.wisemapping.validator.Messages; import com.wisemapping.validator.UserValidator; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -57,7 +58,7 @@ public class UserController extends BaseController { @Value("${accounts.exclusion.domain:''}") private String domainBanExclusion; - private static final Logger logger = Logger.getLogger(UserController.class); + private static final Logger logger = LogManager.getLogger(); private static final String REAL_IP_ADDRESS_HEADER = "X-Real-IP"; @RequestMapping(method = RequestMethod.POST, value = "/users", produces = {"application/json"}) diff --git a/wise-webapp/src/main/java/com/wisemapping/security/LegacyPasswordEncoder.java b/wise-webapp/src/main/java/com/wisemapping/security/LegacyPasswordEncoder.java index eb89d119..45ac1c39 100755 --- a/wise-webapp/src/main/java/com/wisemapping/security/LegacyPasswordEncoder.java +++ b/wise-webapp/src/main/java/com/wisemapping/security/LegacyPasswordEncoder.java @@ -18,7 +18,9 @@ package com.wisemapping.security; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import org.springframework.security.crypto.codec.Base64; import org.springframework.security.crypto.codec.Hex; import org.springframework.security.crypto.codec.Utf8; @@ -29,7 +31,7 @@ import java.security.NoSuchAlgorithmException; public class LegacyPasswordEncoder implements PasswordEncoder { - final private static Logger logger = Logger.getLogger(LegacyPasswordEncoder.class); + final private static Logger logger = LogManager.getLogger(); public static final String ENC_PREFIX = "ENC:"; private final ShaPasswordEncoder sha1Encoder = new ShaPasswordEncoder(); diff --git a/wise-webapp/src/main/java/com/wisemapping/service/LockManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/service/LockManagerImpl.java index b7247559..526ec36f 100644 --- a/wise-webapp/src/main/java/com/wisemapping/service/LockManagerImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/LockManagerImpl.java @@ -23,18 +23,21 @@ import com.wisemapping.exceptions.LockException; import com.wisemapping.model.CollaborationRole; import com.wisemapping.model.Mindmap; import com.wisemapping.model.User; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; -import java.util.*; +import java.util.Map; +import java.util.Set; +import java.util.Timer; +import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; class LockManagerImpl implements LockManager { private static final int ONE_MINUTE_MILLISECONDS = 1000 * 60; private final Map lockInfoByMapId; private final static Timer expirationTimer = new Timer(); - final private static Logger logger = Logger.getLogger(LockManagerImpl.class); + final private static Logger logger = LogManager.getLogger(); @Override public boolean isLocked(@NotNull Mindmap mindmap) { diff --git a/wise-webapp/src/main/java/com/wisemapping/service/RecaptchaService.java b/wise-webapp/src/main/java/com/wisemapping/service/RecaptchaService.java index 2064734d..e947090f 100644 --- a/wise-webapp/src/main/java/com/wisemapping/service/RecaptchaService.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/RecaptchaService.java @@ -17,13 +17,15 @@ */ package com.wisemapping.service; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import com.fasterxml.jackson.databind.ObjectMapper; import com.wisemapping.validator.Messages; import org.apache.commons.lang.StringUtils; import org.apache.http.NameValuePair; import org.apache.http.client.fluent.Form; import org.apache.http.client.fluent.Request; -import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; import javax.validation.constraints.NotNull; @@ -35,7 +37,7 @@ import java.util.Map; public class RecaptchaService { - final private static Logger logger = Logger.getLogger(RecaptchaService.class); + final private static Logger logger = LogManager.getLogger(); final private static String GOOGLE_RECAPTCHA_VERIFY_URL = "https://www.google.com/recaptcha/api/siteverify"; From 52d6a12e0f4857d7ed9cf3c5dc838c8e9f40f957 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 27 Oct 2022 20:34:46 -0700 Subject: [PATCH 10/29] Update docker base image. --- distribution/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/Dockerfile b/distribution/Dockerfile index dd487f39..44df2990 100644 --- a/distribution/Dockerfile +++ b/distribution/Dockerfile @@ -2,7 +2,7 @@ # Based on ubuntu:latest, installs WiseMapping (http://ww.wisemapping.org) # Based info setup ... -FROM tomcat:9.0-jdk17-openjdk +FROM tomcat:9.0-jdk8 LABEL maintainer="Paulo Gustavo Veiga " # Build variables ... From 16ac1c468d81bf592fef38252ec2f2b9e69a7674 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 27 Oct 2022 20:43:15 -0700 Subject: [PATCH 11/29] Revert "Update docker base image." This reverts commit 52d6a12e0f4857d7ed9cf3c5dc838c8e9f40f957. --- distribution/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/Dockerfile b/distribution/Dockerfile index 44df2990..dd487f39 100644 --- a/distribution/Dockerfile +++ b/distribution/Dockerfile @@ -2,7 +2,7 @@ # Based on ubuntu:latest, installs WiseMapping (http://ww.wisemapping.org) # Based info setup ... -FROM tomcat:9.0-jdk8 +FROM tomcat:9.0-jdk17-openjdk LABEL maintainer="Paulo Gustavo Veiga " # Build variables ... From 35d8e19c3c6afbc505c4451d73b62dd9dbce5cce Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 27 Oct 2022 20:44:55 -0700 Subject: [PATCH 12/29] Revert "Revert "Update docker base image."" This reverts commit 16ac1c468d81bf592fef38252ec2f2b9e69a7674. --- distribution/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/Dockerfile b/distribution/Dockerfile index dd487f39..44df2990 100644 --- a/distribution/Dockerfile +++ b/distribution/Dockerfile @@ -2,7 +2,7 @@ # Based on ubuntu:latest, installs WiseMapping (http://ww.wisemapping.org) # Based info setup ... -FROM tomcat:9.0-jdk17-openjdk +FROM tomcat:9.0-jdk8 LABEL maintainer="Paulo Gustavo Veiga " # Build variables ... From 11dba85641a85558d97f2d163ab04b27cc919105 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 27 Oct 2022 22:47:21 -0700 Subject: [PATCH 13/29] Update to tomcat 10 base image. --- distribution/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/distribution/Dockerfile b/distribution/Dockerfile index 44df2990..e185fa35 100644 --- a/distribution/Dockerfile +++ b/distribution/Dockerfile @@ -2,7 +2,7 @@ # Based on ubuntu:latest, installs WiseMapping (http://ww.wisemapping.org) # Based info setup ... -FROM tomcat:9.0-jdk8 +FROM tomcat:jdk17 LABEL maintainer="Paulo Gustavo Veiga " # Build variables ... @@ -31,6 +31,9 @@ RUN sed -i 's|\ |' \ /usr/local/tomcat/conf/server.xml +RUN sed -i 's||\ + |' \ + /usr/local/tomcat/conf/context.xml # Copy default HSQL DB for testing ... RUN mkdir -p ${DB_BASE_DIR}/db COPY db/ ${DB_BASE_DIR}/db From 34b00a8a7f917f3d14c37721e56d73a72061957b Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sat, 12 Nov 2022 14:12:19 -0800 Subject: [PATCH 14/29] Add missing password encodder object. --- .../src/main/webapp/WEB-INF/wisemapping-security-ldap.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml index 297e8432..12691441 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml @@ -7,6 +7,7 @@ http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> + From 4f701d0b7432386d1fcf9d85ed5ed216c81fc853 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 14 Nov 2022 20:18:34 -0800 Subject: [PATCH 15/29] Fix lighthouse usability errors. --- .../src/main/webapp/jsp/mindmapViewonly.jsp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp b/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp index 0a0ade84..ecbec84f 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp @@ -5,7 +5,7 @@ - + @@ -76,12 +76,12 @@
- -
- - - - + + +
+ +
+
@@ -93,14 +93,14 @@
- -
-
From ea071562ca532e26b408428c08e23b22c8bee6cc Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sat, 19 Nov 2022 11:36:09 -0800 Subject: [PATCH 16/29] Fix zoom and center rendering. --- .../src/main/webapp/jsp/mindmapViewonly.jsp | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp b/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp index ecbec84f..ae49871e 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp @@ -76,37 +76,36 @@
- -
+
+
- - - - -
- :${mindmap.creator.fullName} - :${mindmap.title} -
- - - -
-
- - -
- -
-
-
-
+ + + + +
+ :${mindmap.creator.fullName} + :${mindmap.title} +
+ + + +
+
+ + +
+ +
+
+
- + + diff --git a/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp b/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp index cb956bab..07d70e7c 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp @@ -89,7 +89,7 @@ :${mindmap.title}
- +
diff --git a/wise-webapp/src/main/webapp/jsp/reactInclude.jsp b/wise-webapp/src/main/webapp/jsp/reactInclude.jsp index 756d7c10..b5763b25 100644 --- a/wise-webapp/src/main/webapp/jsp/reactInclude.jsp +++ b/wise-webapp/src/main/webapp/jsp/reactInclude.jsp @@ -47,8 +47,8 @@
- - + + From f6a8cbdf389d074a9caaf02ea2b04422a170b03d Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 20 Nov 2022 07:38:36 -0800 Subject: [PATCH 21/29] Optimize font loading. --- wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp | 4 +--- wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp | 5 ++--- wise-webapp/src/main/webapp/jsp/reactInclude.jsp | 4 +--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index d069aba1..3e6fa9c6 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -15,9 +15,7 @@ - - - + <%@ include file="/jsp/pageHeaders.jsf" %> Loading ... | WiseMapping diff --git a/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp b/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp index 07d70e7c..2f25673e 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapViewonly.jsp @@ -11,11 +11,10 @@ - - + + ${mindmap.title} | <spring:message code="SITE.TITLE"/> - <%@ include file="/jsp/pageHeaders.jsf" %> - - - - -