The Unified and Autonomous Development Platform
Fix the issue that ClassCastException being thrown when edit a code comment reply
robin shine4ca6c50fd671
diff --git a/commons.util/src/main/java/com/pmease/commons/util/ClassUtils.java b/commons.util/src/main/java/com/pmease/commons/util/ClassUtils.javaindex 8b54d97c35..dc767d2878 100644--- a/commons.util/src/main/java/com/pmease/commons/util/ClassUtils.java+++ b/commons.util/src/main/java/com/pmease/commons/util/ClassUtils.java@@ -120,10 +120,11 @@ public class ClassUtils extends org.apache.commons.lang3.ClassUtils {return locator.getClassLoader().getResourceAsStream(locator.getPackage().getName().replace(".", "/") + "/" + path);}- public static Class<?> unproxy(Class<?> clazz) {- Class<?> superClass = clazz;+ @SuppressWarnings("unchecked")+ public static <T> Class<T> unproxy(Class<T> clazz) {+ Class<T> superClass = clazz;while (ProxyFactory.isProxyClass(superClass))- superClass = clazz.getSuperclass();+ superClass = (Class<T>) clazz.getSuperclass();return superClass;}}diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdown/markdown.css b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdown/markdown.cssindex 456ec3b5af..92181b1559 100644--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdown/markdown.css+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdown/markdown.css@@ -1,3 +1,6 @@+.md-preview {+ overflow: auto;+}.md-preview .emoji {width: 20px;height: 20px;diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Depot.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Depot.javaindex e1f882c438..ec02cb95c3 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Depot.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Depot.java@@ -128,6 +128,8 @@ public class Depot extends AbstractEntity implements AccountBelonging {@Column(nullable=false)private String name;+ @Lob+ @Column(nullable=false, length=65535)private String description;private boolean publicRead;diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentPanel.javaindex b00ed712f0..b5e4e96748 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentPanel.java@@ -33,6 +33,7 @@ import org.apache.wicket.request.resource.CssResourceReference;import org.hibernate.StaleStateException;import com.pmease.commons.hibernate.dao.Dao;+import com.pmease.commons.util.ClassUtils;import com.pmease.commons.wicket.ajaxlistener.ConfirmLeaveListener;import com.pmease.commons.wicket.ajaxlistener.ConfirmListener;import com.pmease.commons.wicket.behavior.markdown.AttachmentSupport;@@ -793,7 +794,7 @@ public abstract class CodeCommentPanel extends Panel {final Long id;ActivityIdentity(CodeCommentActivity activity) {- this.clazz = activity.getClass();+ this.clazz = ClassUtils.unproxy(activity.getClass());this.id = activity.getId();}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment.cssindex e066d70e07..6cfa32d041 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment.css@@ -1,77 +1,81 @@-.code-comment .md-preview {- font-size: inherit;- line-height: inherit;-}-.code-comment>.section {- position: relative;- margin-left: -12px;- padding-left: 12px;- border-left: 4px solid white;-}-.code-comment>.section>.detail, .code-comment>.section>form {- padding-bottom: 8px;- margin-bottom: 8px;- border-bottom: 1px solid #EEE;-}-.code-comment>.section.new {- border-left: 4px solid #4667EE;-}-.code-comment>.section>.user-avatar {- position: absolute;- left: 12px;- top: 0;-}-.code-comment>.section>.user-avatar img {- width: 32px;- height: 32px;-}-.code-comment>.section>.detail {- padding-left: 40px;-}-.code-comment>.section>.detail>.head .user-name {- color: #999;-}-.code-comment>.section>.detail>.head .user-name:hover {- color: #333;-}-.code-comment>.section>.detail>.head .activity {- font-size: 12px;- color: #999;-}-.code-comment>.section>.detail>.head .compare-context {- color: #666;- font-size: 14px;- line-height: 12px;- margin-left: 8px;-}-.code-comment>.section>.detail>.body {- padding-top: 8px;-}-.code-comment>.section>.detail>.body>.feedback .alert {- margin-bottom: 0;-}-.code-comment>.section>.detail>.body .no-note {- font-style: italic;- margin-bottom: 10px;-}-.code-comment>.section>.detail>.foot a {- font-size: 12px;- color: #999;-}-.code-comment>.section>.detail>.foot a:hover {- font-size: 12px;- color: #333;-}-.code-comment>.section>.detail>.foot .middot:before {- vertical-align: 25%;- color: #999;-}-.code-comment>.add-reply {- margin-top: 16px;-}-.code-comment>.add-reply a {- color: #999;-}-.code-comment>.add-reply a:hover {- color: inherit;+.code-comment .md-preview {+ font-size: inherit;+ line-height: inherit;+}+.code-comment>.section {+ position: relative;+ margin-left: -12px;+ padding-left: 12px;+ border-left: 4px solid white;+}+.code-comment>.section>.detail, .code-comment>.section>form {+ padding-bottom: 8px;+ margin-bottom: 8px;+ border-bottom: 1px solid #EEE;+}+.code-comment>.section.new {+ border-left: 4px solid #4667EE;+}+.code-comment>.section>.user-avatar {+ position: absolute;+ left: 12px;+ top: 0;+}+.code-comment>.section>.user-avatar img {+ width: 32px;+ height: 32px;+}+.code-comment>.section>.detail {+ padding-left: 40px;+}+.code-comment>.section>.detail>.head .user-name {+ color: #999;+}+.code-comment>.section>.detail>.head .user-name:hover {+ color: #333;+}+.code-comment>.section>.detail>.head .activity {+ font-size: 12px;+ margin-top: 2px;+ color: #999;+}+.code-comment>.section>.detail>.head .compare-context {+ color: #666;+ font-size: 14px;+ line-height: 12px;+ margin-left: 8px;+}+.code-comment>.section>.detail>.body {+ padding-top: 8px;+}+.code-comment>.section>.detail>.body>.feedback .alert {+ margin-bottom: 0;+}+.code-comment>.section>.detail>.body .no-note {+ font-style: italic;+ margin-bottom: 10px;+}+.code-comment>.section>.detail>.foot {+ margin-top: 4px;+}+.code-comment>.section>.detail>.foot a {+ font-size: 12px;+ color: #999;+}+.code-comment>.section>.detail>.foot a:hover {+ font-size: 12px;+ color: #333;+}+.code-comment>.section>.detail>.foot .middot:before {+ vertical-align: 25%;+ color: #999;+}+.code-comment>.add-reply {+ margin-top: 16px;+}+.code-comment>.add-reply a {+ color: #999;+}+.code-comment>.add-reply a:hover {+ color: inherit;}\ No newline at end of file