You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "renatoh (via GitHub)" <gi...@apache.org> on 2023/08/10 09:11:59 UTC

[GitHub] [solr] renatoh opened a new pull request, #1834: Cleaning up old code to prevent warnings

renatoh opened a new pull request, #1834:
URL: https://github.com/apache/solr/pull/1834

   Reading through the code in org.apache.solr.cli, I realized there are quite some warnings, which can be easily cleaned up


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] epugh commented on pull request #1834: Cleaning up old code to prevent warnings

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1834:
URL: https://github.com/apache/solr/pull/1834#issuecomment-1693381033

   Please do!  The improvement in the 9x line (as well as main) to the code quality has been huge, but there is so much more to do.   


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] epugh commented on pull request #1834: Cleaning up old code to prevent warnings

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1834:
URL: https://github.com/apache/solr/pull/1834#issuecomment-1688684161

   @renatoh can you check the precommit failure?   It's a weird one where we can't do waht the warning tells us to do....   Please ping me if I don't get this merged after you get precommit fixed.


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] epugh commented on pull request #1834: Cleaning up old code to prevent warnings

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1834:
URL: https://github.com/apache/solr/pull/1834#issuecomment-1688716006

   Actually, I went ahead and fixed the precommit...   going to run the tests and merge.


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] epugh commented on pull request #1834: Cleaning up old code to prevent warnings

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1834:
URL: https://github.com/apache/solr/pull/1834#issuecomment-1689819425

   Thanks for these updates!  For staight up code refactorings we don't normally do a CHANGES.txt entry, but I very much appreciate the contribution.


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] epugh merged pull request #1834: Cleaning up old code to prevent warnings

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh merged PR #1834:
URL: https://github.com/apache/solr/pull/1834


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] renatoh commented on a diff in pull request #1834: Cleaning up old code to prevent warnings

Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on code in PR #1834:
URL: https://github.com/apache/solr/pull/1834#discussion_r1290046082


##########
solr/core/src/java/org/apache/solr/cli/SimplePostTool.java:
##########
@@ -544,14 +537,20 @@ public int postFiles(File[] files, int startIndexInArgs, OutputStream out, Strin
     reset();
     int filesPosted = 0;
     for (File srcFile : files) {
-      boolean isValidPath = checkIsValidPath(srcFile);
-      if (isValidPath && srcFile.isDirectory() && srcFile.canRead()) {
-        filesPosted += postDirectory(srcFile, out, type);
-      } else if (isValidPath && srcFile.isFile() && srcFile.canRead()) {
-        filesPosted += postFiles(new File[] {srcFile}, out, type);
-      } else {
-        filesPosted += handleGlob(srcFile, out, type);
-      }
+      filesPosted = getFilesPosted(out, type, filesPosted, srcFile);

Review Comment:
   true, 'out' passed in to getFilesPosted is always 0 hence it does not need be past in. will fix it. thanks



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] renatoh commented on pull request #1834: Cleaning up old code to prevent warnings

Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #1834:
URL: https://github.com/apache/solr/pull/1834#issuecomment-1690421787

   your are welcome. looking at the source code I am seeing a lot of potential for small refactoring.
   most of them just to clean up the code and reduce the number of warnings, but some of them could even give a small performance benefit.
   if this kind of refactoring is appreciated I am happy to do some more:)


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] renatoh commented on pull request #1834: Cleaning up old code to prevent warnings

Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #1834:
URL: https://github.com/apache/solr/pull/1834#issuecomment-1688753168

   I am a bit confused, so why would we need an assert at a place where it is impossible for the Socket to be null?


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] epugh commented on pull request #1834: Cleaning up old code to prevent warnings

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1834:
URL: https://github.com/apache/solr/pull/1834#issuecomment-1689818267

   > I am a bit confused, so why would we need an assert at a place where it is impossible for the Socket to be null?
   
   Because otherwise precommit fails ;-).   We really should figure out why Precommit fails, and get the underlying problem fixed, maybe for another PR?.  I'm going to go ahead and get this merged as tests passed locally for me.


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] renatoh commented on a diff in pull request #1834: Cleaning up old code to prevent warnings

Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on code in PR #1834:
URL: https://github.com/apache/solr/pull/1834#discussion_r1290046082


##########
solr/core/src/java/org/apache/solr/cli/SimplePostTool.java:
##########
@@ -544,14 +537,20 @@ public int postFiles(File[] files, int startIndexInArgs, OutputStream out, Strin
     reset();
     int filesPosted = 0;
     for (File srcFile : files) {
-      boolean isValidPath = checkIsValidPath(srcFile);
-      if (isValidPath && srcFile.isDirectory() && srcFile.canRead()) {
-        filesPosted += postDirectory(srcFile, out, type);
-      } else if (isValidPath && srcFile.isFile() && srcFile.canRead()) {
-        filesPosted += postFiles(new File[] {srcFile}, out, type);
-      } else {
-        filesPosted += handleGlob(srcFile, out, type);
-      }
+      filesPosted = getFilesPosted(out, type, filesPosted, srcFile);

Review Comment:
   true, 'out' passed in to getFilesPosted is always 0 hence it does not need be posted in. will fix it. thanks



##########
solr/core/src/java/org/apache/solr/cli/AssertTool.java:
##########
@@ -30,6 +30,7 @@
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.request.HealthCheckRequest;
+import org.apache.solr.client.solrj.response.CollectionAdminResponse;

Review Comment:
   nope, not needed anymore, will remove the unused imports.



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] epugh commented on a diff in pull request #1834: Cleaning up old code to prevent warnings

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #1834:
URL: https://github.com/apache/solr/pull/1834#discussion_r1290029229


##########
solr/core/src/java/org/apache/solr/cli/AssertTool.java:
##########
@@ -30,6 +30,7 @@
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.request.HealthCheckRequest;
+import org.apache.solr.client.solrj.response.CollectionAdminResponse;

Review Comment:
   is this import needed?



##########
solr/core/src/java/org/apache/solr/cli/SimplePostTool.java:
##########
@@ -544,14 +537,20 @@ public int postFiles(File[] files, int startIndexInArgs, OutputStream out, Strin
     reset();
     int filesPosted = 0;
     for (File srcFile : files) {
-      boolean isValidPath = checkIsValidPath(srcFile);
-      if (isValidPath && srcFile.isDirectory() && srcFile.canRead()) {
-        filesPosted += postDirectory(srcFile, out, type);
-      } else if (isValidPath && srcFile.isFile() && srcFile.canRead()) {
-        filesPosted += postFiles(new File[] {srcFile}, out, type);
-      } else {
-        filesPosted += handleGlob(srcFile, out, type);
-      }
+      filesPosted = getFilesPosted(out, type, filesPosted, srcFile);

Review Comment:
   this nesting seems a bit odd...   I would expect this entire method to return all the files posted from the source `files` and not pass in and out the counter....



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org