gd-spb-e1m commented on a change in pull request #538: LUCENE-8640: added 
changes for the validation of valid dateString
URL: https://github.com/apache/lucene-solr/pull/538#discussion_r249542268
 
 

 ##########
 File path: 
lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/DateRangePrefixTree.java
 ##########
 @@ -500,4 +516,18 @@ public Calendar parseCalendar(String str) throws 
ParseException {
     throw new ParseException("Improperly formatted date: "+str, offset);
   }
 
+  private  void isValidDateDelimeter(String str, int offset, char delim) {
+    if(str.charAt(offset) != delim) {
+      throw new IllegalArgumentException("Not the valid delimeter for 
Position"+offset);
+    }
+  }
+
+  private int parseIntegerAndValidate(String  str, int offset, int min, int 
max) {
+    int val = Integer.parseInt(str.substring(offset, offset+2));
+    if((val < min ) || (val>max)) {
+      throw new IllegalArgumentException("Not valid date.");
 
 Review comment:
   I suppose expected and actual character might be reported here, assuming 
enclosing ParseException report whole input string and the position.  The same 
is applicable to IAE above. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to