File tree Expand file tree Collapse file tree
src/main/java/org/scijava/ops Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,14 +125,19 @@ public void initOpCache() {
125125 }
126126
127127 private void addToCache (OpInfo opInfo , String opNames ) {
128+ String [] parsedOpNames = OpUtils .parseOpNames (opNames );
129+ if (parsedOpNames == null || parsedOpNames .length == 0 ) {
130+ log .error ("Skipping Op " + opInfo .implementationName () + ":\n "
131+ + "Op implementation must provide name." );
132+ return ;
133+ }
128134 if (!opInfo .isValid ()) {
129135 log .error ("Skipping invalid Op " + opInfo .implementationName () + ":\n "
130136 + opInfo .getValidityException ().getMessage ());
131137 return ;
132138 }
133- String [] parsedNames = OpUtils .parseOpNames (opNames );
134- addAliases (parsedNames , opInfo .implementationName ());
135- opCache .add (new PrefixQuery (parsedNames [0 ]), opInfo );
139+ addAliases (parsedOpNames , opInfo .implementationName ());
140+ opCache .add (new PrefixQuery (parsedOpNames [0 ]), opInfo );
136141 }
137142
138143 @ Override
Original file line number Diff line number Diff line change @@ -108,8 +108,15 @@ public static String[] parseOpNames(String names) {
108108 * @return
109109 */
110110 public static String [] parseOpName (String name ) {
111- String [] split = name .split ("\\ ." );
112- return new String [] { name , split [split .length - 1 ] };
111+ if (name == null || name .isEmpty ()) {
112+ return new String []{};
113+ }
114+ if (name .contains ("." )) {
115+ String [] split = name .split ("\\ ." );
116+ return new String [] { name , split [split .length - 1 ] };
117+ } else {
118+ return new String []{name };
119+ }
113120 }
114121
115122 public static List <MemberInstance <?>> inputs (StructInstance <?> op ) {
You can’t perform that action at this time.
0 commit comments