From b4f8e8152671f07ff71b42b9b35dbc438ddf76c7 Mon Sep 17 00:00:00 2001
From: kaloyane <kaloyane>
Date: Wed, 12 Oct 2011 16:26:33 +0000
Subject: [PATCH] bugfix: unicode characters in Material Chooser should not
 show up as escaped HTML

SVN: 23309
---
 .../application/ui/field/MaterialChooserField.java | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/field/MaterialChooserField.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/field/MaterialChooserField.java
index b0fb4f396f5..16fd50b2a53 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/field/MaterialChooserField.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/field/MaterialChooserField.java
@@ -24,8 +24,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewConte
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.DisposableEntityChooser;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material.MaterialBrowserGrid;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.FieldUtil;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.lang.StringEscapeUtils;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType;
 
 /**
@@ -75,16 +75,8 @@ public class MaterialChooserField extends ChosenEntitySetter<Material>
     @Override
     public String renderEntity(Material materialOrNull)
     {
-        MaterialIdentifier chosenMaterial = createIdentifier(materialOrNull);
-        return chosenMaterial.print();
-    }
-
-    private static MaterialIdentifier createIdentifier(Material material)
-    {
-        MaterialIdentifier ident = new MaterialIdentifier();
-        ident.setCode(material.getCode());
-        ident.setTypeCode(material.getMaterialType().getCode());
-        return ident;
+        String identifier = materialOrNull.getIdentifier();
+        return StringEscapeUtils.unescapeHtml(identifier);
     }
 
     private MaterialChooserField(boolean mandatory, MaterialType materialTypeOrNull,
-- 
GitLab