Hello some body can check my error, i am trying to send over my field who’s have my BASE64 String image but I do not know if using the field group have the string but when i execute the DpiEdit.jjava show me the error…
package ezmovil.net.dpitest.web.dpi;
import com.haulmont.cuba.core.app.FileStorageService;
import com.haulmont.cuba.core.entity.FileDescriptor;
import com.haulmont.cuba.core.global.FileStorageException;
import com.haulmont.cuba.gui.components.AbstractEditor;
import com.haulmont.cuba.gui.components.Embedded;
import com.haulmont.cuba.gui.components.TextField;
import com.haulmont.cuba.gui.data.Datasource;
import ezmovil.net.dpitest.entity.Dpi;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.ByteArrayInputStream;
import java.nio.charset.Charset;
import java.util.Base64;
import java.util.Map;
import static com.haulmont.cuba.gui.components.KeyCombination.Key.R;
public class DpiEdit extends AbstractEditor<Dpi> {
    final Charset UTF8_CHARSET = Charset.forName("UTF-8");
    @Inject
    private Datasource<Dpi> dpiDs;
    @Inject
    private Embedded embedded;
    @Named("dpiFieldGroup.base64foto")
    private TextField base64fotoField;
    @Override
    public void init(Map<String, Object> params) {
        showEmbeeded();
    }
    private void showEmbeeded(){
        String base64AsString = base64fotoField.getValue();
        byte[] imageAsBytes = null;
        imageAsBytes = base64AsString.getBytes();
        imageAsBytes = dpiDs.getItem().getBase64foto().getBytes();
        //String encoded = java.util.Base64.getEncoder().encodeToString(stringAsBytes);
        if (imageAsBytes != null) {
            showNotification("Visible true.", NotificationType.HUMANIZED);
            embedded.setVisible(true);
            //embedded.setSource("foto.jpg", new ByteArrayInputStream(imageAsBytes));
            //embedded.setType(Embedded.Type.IMAGE);
        } else {
            showNotification("Visible false.", NotificationType.HUMANIZED);
            embedded.setVisible(false);
        }
    }
    String decodeUTF8(byte[] bytes){
        return new String(bytes, UTF8_CHARSET);
    }
    byte[] encodeUTF8(String string){
        return string.getBytes(UTF8_CHARSET);
    }
}
layout>
        <hbox spacing="true">
            <scrollBox id="scrollBox"
                       height="201px">
                <fieldGroup id="dpiFieldGroup"
                            border="visible"
                            datasource="dpiDs"
                            editable="false"
                            height="200px">
                    <column width="250px">
                        <field id="cui"/>
                        <field id="name1"/>
                        <field id="name2"/>
                        <field id="last1"/>
                        <field id="last2"/>
                        <field id="lastmarried"/>
                        <field id="genero"/>
                        <field id="municipio"/>
                        <field id="depto"/>
                        <field id="pais"/>
                        <field id="fecnac"/>
                        <field id="emision"/>
                        <field id="vencimiento"/>
                        <field id="estadocivil"/>
                        <field id="municipioDpi"/>
                        <field id="deptoDpi"/>
                        <field id="paisDpi"/>
                        <field id="lee"/>
                        <field id="escribe"/>
                        <field id="libro"/>
                        <field id="folio"/>
                        <field id="partida"/>
                        <field id="mrz2"/>
                        <field id="base64foto"/>
                        <field id="pathFoto"/>
                        <field id="base64Firma"/>
                        <field id="pathFirma"/>
                    </column>
                </fieldGroup>
            </scrollBox>
            <embedded id="embedded"
                      height="200px"
                      width="200px"/>
        </hbox>
