diff options
author | Ed Merks | 2019-03-12 09:29:52 +0000 |
---|---|---|
committer | Ed Merks | 2019-03-12 09:29:52 +0000 |
commit | 77d979cf8559a26ca05db28af555bc3e7fcf2c71 (patch) | |
tree | 43c3f9343f030c03139c9f23c1acc90d7b1916f5 | |
parent | 2c1e6677bfc5e610b4a54f1dc7674f26b5cd066e (diff) | |
download | org.eclipse.emf-77d979cf8559a26ca05db28af555bc3e7fcf2c71.tar.gz org.eclipse.emf-77d979cf8559a26ca05db28af555bc3e7fcf2c71.tar.xz org.eclipse.emf-77d979cf8559a26ca05db28af555bc3e7fcf2c71.zip |
2 files changed, 14 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend b/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend index 7422e4a3d..d0a52d283 100644 --- a/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend +++ b/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.xtend @@ -145,7 +145,8 @@ class XcoreGenerator implements IGenerator { EcoreUtil::setAnnotation(target, GenModelPackage::eNS_URI, key, extractBody(appendable.toString)) } catch (Throwable throwable) { - EcoreUtil::setAnnotation(target, GenModelPackage::eNS_URI, key, "throw new <%java.lang.Error%>(\"Unresolved compilation problems: " + CodeGenUtil.unicodeEscapeEncode(throwable.message) + "\");"); + val message = if (throwable.message === null) "throw new <%java.lang.Error%>(\"Unresolved compilation problem\");" else "throw new <%java.lang.Error%>(\"Unresolved compilation problems: " + CodeGenUtil.unicodeEscapeEncode(throwable.message) + "\");" + EcoreUtil::setAnnotation(target, GenModelPackage::eNS_URI, key, message) } } diff --git a/plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java b/plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java index 5839719fb..29d79d72f 100644 --- a/plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java +++ b/plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java @@ -181,10 +181,18 @@ public class XcoreGenerator implements IGenerator { } catch (final Throwable _t) { if (_t instanceof Throwable) { final Throwable throwable = (Throwable)_t; - String _unicodeEscapeEncode = CodeGenUtil.unicodeEscapeEncode(throwable.getMessage()); - String _plus = ("throw new <%java.lang.Error%>(\"Unresolved compilation problems: " + _unicodeEscapeEncode); - String _plus_1 = (_plus + "\");"); - EcoreUtil.setAnnotation(target, GenModelPackage.eNS_URI, key, _plus_1); + String _xifexpression = null; + String _message = throwable.getMessage(); + boolean _tripleEquals = (_message == null); + if (_tripleEquals) { + _xifexpression = "throw new <%java.lang.Error%>(\"Unresolved compilation problem\");"; + } else { + String _unicodeEscapeEncode = CodeGenUtil.unicodeEscapeEncode(throwable.getMessage()); + String _plus = ("throw new <%java.lang.Error%>(\"Unresolved compilation problems: " + _unicodeEscapeEncode); + _xifexpression = (_plus + "\");"); + } + final String message = _xifexpression; + EcoreUtil.setAnnotation(target, GenModelPackage.eNS_URI, key, message); } else { throw Exceptions.sneakyThrow(_t); } |