ptupitsyn commented on code in PR #7310:
URL: https://github.com/apache/ignite-3/pull/7310#discussion_r2650510621


##########
modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/InputStreamCollectorImpl.java:
##########
@@ -54,13 +54,20 @@ public InputStreamCollectorImpl(TempStorage tempStorage) {
 
     @Override
     public void addInputStream(String filename, InputStream is) {
-        collect.put(filename, tempStorage.store(filename, 
is).whenComplete((path, throwable) -> {
-            try {
-                is.close();
-            } catch (IOException e) {
-                LOG.error("Error when closing input stream.", e);
-            }
-        }));
+        if (collect.containsKey(filename)) {

Review Comment:
   `put` returns previous value, we can use that to detect duplicates.



##########
modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/InputStreamCollectorImpl.java:
##########
@@ -54,13 +54,20 @@ public InputStreamCollectorImpl(TempStorage tempStorage) {
 
     @Override
     public void addInputStream(String filename, InputStream is) {
-        collect.put(filename, tempStorage.store(filename, 
is).whenComplete((path, throwable) -> {
-            try {
-                is.close();
-            } catch (IOException e) {
-                LOG.error("Error when closing input stream.", e);
-            }
-        }));
+        if (collect.containsKey(filename)) {
+            closeStream(is);
+            throw new DuplicateFilenamesException("Duplicate filename: " + 
filename);

Review Comment:
   What about case-insensitive filesystems, what happens there if the file 
names are different only by letter case?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to