@@ -178,8 +178,8 @@ private Map<String, Sequence> getOptions(final Sequence parameter) throws XPathE
178
178
}
179
179
options .put (EXCLUDES_OPT , seq );
180
180
181
- checkOption (optionsMap , PRUNE_OPT , options , Type .BOOLEAN );
182
- checkOption (optionsMap , AFTER_OPT , options , Type .DATE_TIME , Type . DATE_TIME_STAMP );
181
+ checkOption (optionsMap , PRUNE_OPT , Type .BOOLEAN , options );
182
+ checkOption (optionsMap , AFTER_OPT , Type .DATE_TIME , options );
183
183
} else if (parameter .itemAt (0 ).getType () == Type .DATE_TIME ) {
184
184
options .put (AFTER_OPT , parameter );
185
185
} else {
@@ -192,43 +192,25 @@ private Map<String, Sequence> getOptions(final Sequence parameter) throws XPathE
192
192
private void checkOption (
193
193
final AbstractMapType optionsMap ,
194
194
final String name ,
195
- final Map < String , Sequence > options ,
196
- final int ... expectedTypes
195
+ final int expectedType ,
196
+ final Map < String , Sequence > options
197
197
) throws XPathException {
198
198
final Sequence p = optionsMap .get (new StringValue (this , name ));
199
199
200
200
if (p .isEmpty ()) {
201
201
return ; // nothing to do, continue
202
202
}
203
203
204
- if (p .hasMany () || !isExpectedType (p .getItemType (), expectedTypes )) {
204
+ if (p .hasMany () || !Type . subTypeOf (p .getItemType (),expectedType )) {
205
205
throw new XPathException (this , ErrorCodes .XPTY0004 ,
206
206
"Invalid value type for option \" " + name + "\" , expected " +
207
- formatTypes ( expectedTypes ) + " got " +
207
+ Type . getTypeName ( expectedType ) + " got " +
208
208
Type .getTypeName (p .itemAt (0 ).getType ()));
209
209
}
210
210
211
211
options .put (name , p );
212
212
}
213
213
214
- private boolean isExpectedType (final int actualType , final int ... expectedTypes ) {
215
- for (int type : expectedTypes ) {
216
- if (type == actualType ) {
217
- return true ;
218
- }
219
- }
220
- return false ;
221
- }
222
-
223
- private String formatTypes (final int ... expectedTypes ) {
224
- StringBuilder buff = new StringBuilder (Type .getTypeName (expectedTypes [0 ]));
225
- for (int i = 1 ; i < expectedTypes .length ; i ++) {
226
- buff .append (", " );
227
- buff .append (Type .getTypeName (expectedTypes [i ]));
228
- }
229
- return buff .toString ();
230
- }
231
-
232
214
private Sequence startSync (
233
215
final String target ,
234
216
final String collectionPath ,
0 commit comments