[SYNCOPE-1266] fixes the clone method of the BinaryFieldPanel
authorfmartelli <fabio.martelli@gmail.com>
Tue, 30 Jan 2018 15:44:51 +0000 (16:44 +0100)
committerfmartelli <fabio.martelli@gmail.com>
Tue, 30 Jan 2018 15:45:43 +0000 (16:45 +0100)
client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java

index e77fce2..a1311a0 100644 (file)
@@ -84,9 +84,19 @@ public class BinaryFieldPanel extends FieldPanel<String> {
 
     private final Bytes maxUploadSize;
 
-    public BinaryFieldPanel(final String id, final String name, final IModel<String> model, final String mimeType,
+    private final IModel<String> model;
+
+    private final String fileKey;
+
+    public BinaryFieldPanel(
+            final String id,
+            final String name,
+            final IModel<String> model,
+            final String mimeType,
             final String fileKey) {
         super(id, name, model);
+        this.model = model;
+        this.fileKey = fileKey;
         this.mimeType = mimeType;
 
         previewer = PREVIEW_UTILS.getPreviewer(mimeType);
@@ -253,7 +263,8 @@ public class BinaryFieldPanel extends FieldPanel<String> {
 
     @Override
     public BinaryFieldPanel clone() {
-        return (BinaryFieldPanel) super.clone();
+        LOG.info("Custom clone for binary field panel...");
+        return new BinaryFieldPanel(getId(), this.name, this.model, this.mimeType, this.fileKey);
     }
 
     @Override