+
+ private static class ConsumerHolder implements Consumer<Throwable> {
+
+ private Throwable throwable;
+
+ @Override
+ public void accept(Throwable t) {
+ throwable = t;
+ }
+
+ public Throwable getThrowable() {
+ return throwable;
+ }
+
+ }
+
+ public static String performFileImport(String base64, String name) throws Throwable {
+ byte[] bytes = Base64.decode(base64);
+ Path file = Activator.getModelsFolder().resolve(name);
+ Files.write(file, bytes);
+
+ ConsumerHolder holder = new ConsumerHolder();
+ String result = performFileImport(file, Optional.of(holder));
+ if (holder.getThrowable() != null)
+ throw holder.getThrowable();
+ return result;
+ }