[OLINGO-792] Improve URI parser error message
This commit is contained in:
parent
26c923b6f3
commit
d0b225bf18
|
@ -662,9 +662,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
|
||||
// do a check for bound functions (which requires a parameter list)
|
||||
if (ctx.vlNVO.size() == 0) {
|
||||
throw wrap(new UriParserSemanticException("Expected function parameters for '" + fullBindingTypeName.toString()
|
||||
+ "'",
|
||||
UriParserSemanticException.MessageKeys.FUNCTION_PARAMETERS_EXPECTED, fullBindingTypeName.toString()));
|
||||
throw wrap(new UriParserSemanticException("Unknown type for type cast " + fullFilterName.toString()
|
||||
+ " not found", UriParserSemanticException.MessageKeys.UNKNOWN_TYPE , fullFilterName.toString()));
|
||||
}
|
||||
|
||||
context.contextReadingFunctionParameters = true;
|
||||
|
|
|
@ -48,6 +48,8 @@ public class UriParserSemanticException extends UriParserException {
|
|||
FUNCTION_PARAMETERS_EXPECTED,
|
||||
/** parameter: resource part */
|
||||
UNKNOWN_PART,
|
||||
/** parameter: type */
|
||||
UNKNOWN_TYPE,
|
||||
/** parameter: expression */
|
||||
ONLY_FOR_TYPED_PARTS,
|
||||
/** parameter: entity type name */
|
||||
|
|
|
@ -50,6 +50,7 @@ UriParserSemanticException.FUNCTION_PARAMETERS_EXPECTED=Function parameters expe
|
|||
UriParserSemanticException.UNKNOWN_PART=The part '%1$s' is not defined.
|
||||
UriParserSemanticException.ONLY_FOR_TYPED_PARTS='%1$s' is only allowed for typed parts.
|
||||
UriParserSemanticException.UNKNOWN_ENTITY_TYPE=The entity type '%1$s' is not defined.
|
||||
UriParserSemanticException.UNKNOWN_TYPE=The type of the type cast '%1$s' is not defined.
|
||||
UriParserSemanticException.ONLY_FOR_COLLECTIONS='%1$s' is only allowed for collections.
|
||||
UriParserSemanticException.ONLY_FOR_ENTITY_TYPES='%1$s' is only allowed for entity types.
|
||||
UriParserSemanticException.ONLY_FOR_STRUCTURAL_TYPES='%1$s' is only allowed for structural types.
|
||||
|
|
|
@ -5442,7 +5442,7 @@ public class TestFullResourcePath {
|
|||
.isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
|
||||
|
||||
testUri.runEx("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav")
|
||||
.isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_PARAMETERS_EXPECTED);
|
||||
.isExSemantic(UriParserSemanticException.MessageKeys.UNKNOWN_TYPE);
|
||||
|
||||
// $ref
|
||||
testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyCompTwoPrim/$ref")
|
||||
|
@ -5563,7 +5563,13 @@ public class TestFullResourcePath {
|
|||
testUri.runEx("AIRTESAllPrimParam/FICRTString()").isExSemantic(MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS);
|
||||
testUri.runEx("AIRTESAllPrimParam/AIRTString").isExSemantic(MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void invalidTypeCast() {
|
||||
testUri.runEx("ESAllPrim/namespace.Invalid").isExSemantic(MessageKeys.UNKNOWN_TYPE);
|
||||
testUri.runEx("ESAllPrim(0)/namespace.Invalid").isExSemantic(MessageKeys.UNKNOWN_TYPE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void navPropertySameNameAsEntitySet() throws Exception {
|
||||
testUri.run("ESNavProp(1)/ESNavProp(2)/ESNavProp(3)/ESNavProp")
|
||||
|
|
Loading…
Reference in New Issue