You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/06/27 21:20:52 UTC

[GitHub] [solr] epugh opened a new pull request, #922: SOLR-162680: toString is not required when crafting a string message

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

   https://issues.apache.org/jira/browse/SOLR-162680
   
   # Description
   
   We sprinkle in a lot of our messages in the tests a lot of `.toString()`, however we don't need them.  They make the methods longer to read.
   
   # Solution
   
   Strip out toString() that aren't needed.
   
   # Tests
   
   Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x ] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [ x] I have created a Jira issue and added the issue ID to my pull request title.
   - [ x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [ x] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


-- 
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] risdenk commented on a diff in pull request #922: SOLR-162680: toString is not required when crafting a string message

Posted by GitBox <gi...@apache.org>.
risdenk commented on code in PR #922:
URL: https://github.com/apache/solr/pull/922#discussion_r908511732


##########
solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java:
##########
@@ -461,7 +461,7 @@ public void testWhiteboxSolrDocumentConversion() {
             new SolrReturnFields(req("fl", allFieldNames + ",bogus1,bogus2,bogus3")))) {
 
       docOut = convertLuceneDocToSolrDoc(docIn, schema, rf);
-      final String debug = rf.toString() + " => " + docOut.toString();
+      final String debug = rf + " => " + docOut.toString();

Review Comment:
   `docOut.toString()` still needed?



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -538,7 +538,7 @@ public void testJsonRangeFacetWithSubFacet() throws Exception {
 
       } catch (AssertionError | RuntimeException ae) {
         throw new AssertionError(
-            solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+            solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   `rsp.toString()` still needed?



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -239,7 +239,7 @@ public void testSimpleRangeFacetsOfSymmetricRates() throws Exception {
           }
         } catch (AssertionError | RuntimeException ae) {
           throw new AssertionError(
-              solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+              solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   `rsp.toString()` still needed?



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -615,7 +615,7 @@ public void testJsonRangeFacetAsSubFacet() throws Exception {
         }
       } catch (AssertionError | RuntimeException ae) {
         throw new AssertionError(
-            solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+            solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   `rsp.toString()` still needed?



##########
solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java:
##########
@@ -435,7 +435,7 @@ public void testWhiteboxSolrDocumentConversion() {
             new SolrReturnFields(req("fl", "id,xxx:[geo f=store],uniq,foo_2_s1,subword")),
             new SolrReturnFields(req("fl", "id,xxx:subword,uniq,yyy:foo_2_s1,[geo f=store]")))) {
       docOut = convertLuceneDocToSolrDoc(docIn, schema, rf);
-      final String debug = rf.toString() + " => " + docOut.toString();
+      final String debug = rf + " => " + docOut.toString();

Review Comment:
   `docOut.toString()` still needed?



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -181,7 +181,7 @@ public void testSimpleRangeFacetsOfSymmetricRates() throws Exception {
           }
         } catch (AssertionError | RuntimeException ae) {
           throw new AssertionError(
-              solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+              solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   `rsp.toString()` still needed?



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -306,7 +306,7 @@ public void testFacetRangeOfAsymmetricRates() throws Exception {
         }
       } catch (AssertionError | RuntimeException ae) {
         throw new AssertionError(
-            solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+            solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   `rsp.toString()` still needed?



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -365,7 +365,7 @@ public void testJsonFacetRangeOfAsymmetricRates() throws Exception {
         }
       } catch (AssertionError | RuntimeException ae) {
         throw new AssertionError(
-            solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+            solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   `rsp.toString()` still needed?



##########
solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.java:
##########
@@ -173,7 +173,7 @@ public void testInclude_Lower() throws Exception {
 
           } catch (AssertionError | RuntimeException ae) {
             throw new AssertionError(
-                solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+                solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   `rsp.toString()` still needed?



-- 
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 #922: SOLR-162680: toString is not required when crafting a string message

Posted by GitBox <gi...@apache.org>.
epugh merged PR #922:
URL: https://github.com/apache/solr/pull/922


-- 
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] cpoerschke commented on a diff in pull request #922: SOLR-162680: toString is not required when crafting a string message

Posted by GitBox <gi...@apache.org>.
cpoerschke commented on code in PR #922:
URL: https://github.com/apache/solr/pull/922#discussion_r908710916


##########
solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorRandomCloud.java:
##########
@@ -262,9 +262,7 @@ public void testRandomUpdates() throws Exception {
         }
       }
       assertEquals(
-          "expected error count sanity check: " + req.toString(),
-          expectedErrorsCount,
-          expectedErrors.size());
+          "expected error count sanity check: " + req, expectedErrorsCount, expectedErrors.size());

Review Comment:
   ```suggestion
             "expected error count check: " + req, expectedErrorsCount, expectedErrors.size());
   ```



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -538,7 +538,7 @@ public void testJsonRangeFacetWithSubFacet() throws Exception {
 
       } catch (AssertionError | RuntimeException ae) {
         throw new AssertionError(
-            solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+            solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
               solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.java:
##########
@@ -173,7 +173,7 @@ public void testInclude_Lower() throws Exception {
 
           } catch (AssertionError | RuntimeException ae) {
             throw new AssertionError(
-                solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+                solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
                   solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.java:
##########
@@ -220,7 +220,7 @@ public void testInclude_Lower_Gap2() throws Exception {
 
           } catch (AssertionError | RuntimeException ae) {
             throw new AssertionError(
-                solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+                solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
                   solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -181,7 +181,7 @@ public void testSimpleRangeFacetsOfSymmetricRates() throws Exception {
           }
         } catch (AssertionError | RuntimeException ae) {
           throw new AssertionError(
-              solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+              solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
                 solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java:
##########
@@ -435,7 +435,7 @@ public void testWhiteboxSolrDocumentConversion() {
             new SolrReturnFields(req("fl", "id,xxx:[geo f=store],uniq,foo_2_s1,subword")),
             new SolrReturnFields(req("fl", "id,xxx:subword,uniq,yyy:foo_2_s1,[geo f=store]")))) {
       docOut = convertLuceneDocToSolrDoc(docIn, schema, rf);
-      final String debug = rf.toString() + " => " + docOut.toString();
+      final String debug = rf + " => " + docOut.toString();

Review Comment:
   ```suggestion
         final String debug = rf + " => " + docOut;
   ```



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -365,7 +365,7 @@ public void testJsonFacetRangeOfAsymmetricRates() throws Exception {
         }
       } catch (AssertionError | RuntimeException ae) {
         throw new AssertionError(
-            solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+            solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
               solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -306,7 +306,7 @@ public void testFacetRangeOfAsymmetricRates() throws Exception {
         }
       } catch (AssertionError | RuntimeException ae) {
         throw new AssertionError(
-            solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+            solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
               solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -615,7 +615,7 @@ public void testJsonRangeFacetAsSubFacet() throws Exception {
         }
       } catch (AssertionError | RuntimeException ae) {
         throw new AssertionError(
-            solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+            solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
               solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.java:
##########
@@ -267,7 +267,7 @@ public void testInclude_Lower_Gap2_hardend() throws Exception {
 
           } catch (AssertionError | RuntimeException ae) {
             throw new AssertionError(
-                solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+                solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
                   solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/search/facet/RangeFacetCloudTest.java:
##########
@@ -327,7 +327,7 @@ public void testInclude_Upper() throws Exception {
 
         } catch (AssertionError | RuntimeException ae) {
           throw new AssertionError(
-              solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+              solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
                 solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/PurgeGraphTest.java:
##########
@@ -46,9 +46,7 @@ public void setUpRepo() throws Exception {
     repository = new LocalFileSystemRepository();
     baseLocationUri =
         repository.createDirectoryURI(
-            createTempDir("backup_files_" + UUID.randomUUID().toString())
-                .toAbsolutePath()
-                .toString());
+            createTempDir("backup_files_" + UUID.randomUUID()).toAbsolutePath().toString());

Review Comment:
   Did you mean to remove the `toString` here?
   ```suggestion
               createTempDir("backup_files_" + UUID.randomUUID()).toAbsolutePath());
   ```



##########
solr/core/src/test/org/apache/solr/search/ReturnFieldsTest.java:
##########
@@ -461,7 +461,7 @@ public void testWhiteboxSolrDocumentConversion() {
             new SolrReturnFields(req("fl", allFieldNames + ",bogus1,bogus2,bogus3")))) {
 
       docOut = convertLuceneDocToSolrDoc(docIn, schema, rf);
-      final String debug = rf.toString() + " => " + docOut.toString();
+      final String debug = rf + " => " + docOut.toString();

Review Comment:
   ```suggestion
         final String debug = rf + " => " + docOut;
   ```



##########
solr/core/src/test/org/apache/solr/search/CurrencyRangeFacetCloudTest.java:
##########
@@ -239,7 +239,7 @@ public void testSimpleRangeFacetsOfSymmetricRates() throws Exception {
           }
         } catch (AssertionError | RuntimeException ae) {
           throw new AssertionError(
-              solrQuery.toString() + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);
+              solrQuery + " -> " + rsp.toString() + " ===> " + ae.getMessage(), ae);

Review Comment:
   ```suggestion
                 solrQuery + " -> " + rsp + " ===> " + ae.getMessage(), ae);
   ```



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