Skip to content

Commit b591ed4

Browse files
committed
AdaptedScriptLanguage: handle null PluginInfo
This can happen with wrapped ScriptEngineFactories, since the ScriptLanguageIndex wraps them using the appropriate AdaptedScriptLanguage constructor. In that case, there is no associated PluginInfo, and getLanguageName should simply delegate to the adapted ScriptEngineFactory's language name.
1 parent 271128e commit b591ed4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/scijava/script/AdaptedScriptLanguage.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import javax.script.ScriptEngineFactory;
3838
import javax.script.ScriptEngineManager;
3939

40+
import org.scijava.plugin.PluginInfo;
41+
4042
/**
4143
* Abstract superclass for {@link ScriptLanguage} implementations which adapt an
4244
* existing {@link ScriptEngineFactory}.
@@ -100,7 +102,9 @@ public List<String> getNames() {
100102

101103
@Override
102104
public String getLanguageName() {
103-
final String name = getInfo().getName();
105+
final PluginInfo<?> info = getInfo();
106+
if (info == null) return null;
107+
final String name = info.getName();
104108
return name != null ? name : base.getLanguageName();
105109
}
106110

0 commit comments

Comments
 (0)