Reduced "potential null pointer access" errors

Signed-off-by: Titouan Vervack <titouan.vervack@sigasi.com>
This commit is contained in:
Titouan Vervack 2018-06-05 18:11:37 +02:00
parent a3d6588be6
commit 63c4439ad4
3 changed files with 6 additions and 25 deletions

View file

@ -588,6 +588,9 @@ public class MergeableManifest implements Cloneable {
continue;
}
} else {
if (lastline == null) {
throw new IOException("misplaced continuation line");
}
// continuation line
byte[] buf = new byte[lastline.length + len - 1];
System.arraycopy(lastline, 0, buf, 0, lastline.length);
@ -1104,7 +1107,7 @@ public class MergeableManifest implements Cloneable {
int i = 0;
if (lbuf[0] == ' ') {
// continuation of previous line
if (name == null) {
if (name == null || lastline == null) {
throw new IOException("misplaced continuation line");
}
lineContinued = true;

View file

@ -718,7 +718,7 @@ class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
}
val classifier = type?.classifier
val feature = if(classifier instanceof EClass) classifier.getEStructuralFeature('name')
feature instanceof EAttribute && !feature.many && feature?.EType?.instanceClass !== null && String.isAssignableFrom(feature.EType.instanceClass)
feature instanceof EAttribute && !feature.many && feature.EType.instanceClass !== null && String.isAssignableFrom(feature.EType.instanceClass)
}
def compileAbstractCompletionContributor(Grammar grammar) {

View file

@ -2306,29 +2306,7 @@ public class IdeaPluginGenerator extends AbstractStubGeneratingFragment {
_xifexpression = ((EClass)classifier).getEStructuralFeature("name");
}
final EStructuralFeature feature = _xifexpression;
boolean _and = false;
boolean _and_1 = false;
if (!((feature instanceof EAttribute) && (!feature.isMany()))) {
_and_1 = false;
} else {
EClassifier _eType = null;
if (feature!=null) {
_eType=feature.getEType();
}
Class<?> _instanceClass = null;
if (_eType!=null) {
_instanceClass=_eType.getInstanceClass();
}
boolean _tripleNotEquals = (_instanceClass != null);
_and_1 = _tripleNotEquals;
}
if (!_and_1) {
_and = false;
} else {
boolean _isAssignableFrom = String.class.isAssignableFrom(feature.getEType().getInstanceClass());
_and = _isAssignableFrom;
}
_xblockexpression = _and;
_xblockexpression = ((((feature instanceof EAttribute) && (!feature.isMany())) && (feature.getEType().getInstanceClass() != null)) && String.class.isAssignableFrom(feature.getEType().getInstanceClass()));
}
return _xblockexpression;
}