Dear users, Please note that, from Monday, August 16, 2019, RSA keys shorter than 2048bit will no longer be accepted for security reasons. Please update your keys as needed before this date. If you need assistance with regard to this process, please contact sia@list.lu

Thank you for your understanding.

Commit 6612cb82 authored by Valérie Maquil's avatar Valérie Maquil

support for base64 images

parent c912aa61
......@@ -155,6 +155,8 @@ public class EquationSystemBuilder {
String unit = output.getChildText(Externalization.UNIT_ELEMENT);
if (Strings.isNullOrEmpty(unit))
unit = output.getAttributeValue(Externalization.UNIT_ELEMENT);
if (Strings.isNullOrEmpty(unit))
unit = "";
if (Strings.isNullOrEmpty(name)) {
throw new EquationSystemException("For each output the name needs to be defined!"); //$NON-NLS-1$
......@@ -198,9 +200,13 @@ public class EquationSystemBuilder {
if (Strings.isNullOrEmpty(parameterName))
parameterName = parameter.getAttributeValue(Externalization.NAME_ELEMENT);
String parameterUnit = parameter.getChildText(Externalization.UNIT_ELEMENT);
if (Strings.isNullOrEmpty(parameterUnit))
parameterUnit = parameter.getAttributeValue(Externalization.UNIT_ELEMENT);
if (Strings.isNullOrEmpty(parameterUnit))
parameterUnit = "";
_equationParameters.add(parameterName);
if (parameterDependencies.containsKey(parameterName)) {
......
......@@ -25,8 +25,10 @@ import com.google.common.base.Strings;
import org.jdom2.Element;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.Base64;
import java.util.LinkedHashSet;
import javax.imageio.ImageIO;
......@@ -108,7 +110,21 @@ public abstract class BaseConditionalCoronaBuilder<B extends BaseConditionalCoro
} catch (IllegalArgumentException iae) {
throw new BuildException("The image could not be read from the provided location. The location should be given as absolute path, i.e.: \"C:\\My Image\\image.jpeg\"!", iae); //$NON-NLS-1$
} catch (IOException ioe) {
throw new BuildException("The image could not be read!", ioe); //$NON-NLS-1$
// throw new BuildException("The image could not be read!", ioe); //$NON-NLS-1$
}
try {
final Element imageBase64Node = element.getChild(Externalization.IMAGE_BASE64_ELEMENT);
if ((null != imageBase64Node) && (imageBase64Node.getText() != "")) {
final String[] tokens = (imageBase64Node.getText()).split(",");
System.out.println(tokens[1]);
byte[] imageByte;
imageByte = Base64.getDecoder().decode(tokens[1]);
final ByteArrayInputStream bis = new ByteArrayInputStream(imageByte);
image = ImageIO.read(bis);
}
} catch (final IOException e1) {
throw new BuildException("The Base64 image could not be read!", e1); //$NON-NLS-1$
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment