You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2020/05/01 13:23:08 UTC
[GitHub] [jena] afs commented on a change in pull request #669: JENA-1837: MaxBasicQueries
afs commented on a change in pull request #669:
URL: https://github.com/apache/jena/pull/669#discussion_r418538368
##########
File path: jena-text/src/main/java/org/apache/jena/query/text/assembler/TextIndexLuceneAssembler.java
##########
@@ -94,7 +94,17 @@ public TextIndex open(Assembler a, Resource root, Mode mode) {
}
isMultilingualSupport = mlsNode.asLiteral().getBoolean();
}
-
+
+ int maxBasicQueries = 1024;
+ Statement maxBasicQueriesStatement = root.getProperty(pMaxBasicQueries);
+ if (null != maxBasicQueriesStatement) {
+ RDFNode mbqNode = maxBasicQueriesStatement.getObject();
+ if (! mbqNode.isLiteral()) {
+ throw new TextIndexException("text:maxBasicQueries property must be a int : " + mbqNode);
Review comment:
Good point - this gives a basic warning for the first method call in `maxBasicQueries = mbqNode.asLiteral().getInt()`
`getInt` also parses xsd:String as a 32-bit integer (all the `get` do similar)
Having both the `isLiteral` test and the try-catch means better error messages.
The whole block could be wrapped in a try-catch for robustness. I'll add it in the post-merge work.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org