mikemccand commented on a change in pull request #716: LUCENE-8853: Try parsing 
original file extension from tmp file
URL: https://github.com/apache/lucene-solr/pull/716#discussion_r293311609
 
 

 ##########
 File path: 
lucene/core/src/java/org/apache/lucene/store/FileSwitchDirectory.java
 ##########
 @@ -141,7 +147,14 @@ public static String getExtension(String name) {
     if (i == -1) {
       return "";
     }
-    return name.substring(i+1, name.length());
+    String ext = name.substring(i + 1);
+    if (ext.equals("tmp")) {
+      Matcher matcher = EXT_PATTERN.matcher(name);
+      if (matcher.find()) {
+        return matcher.group(1);
+      }
 
 Review comment:
   Hmm should we throw exception in `else` clause here?  Force callers to use 
consistent `tmp` file naming?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to