[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2019-04-15 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16817851#comment-16817851
 ] 

ASF subversion and git services commented on LUCENE-8146:
-

Commit eece619111f8334248346513fb1b7766f21fef74 in lucene-solr's branch 
refs/heads/jira/LUCENE-8738 from Uwe Schindler
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=eece619 ]

LUCENE-8738: Downgrade Maven Surefire back to 2.17 (see LUCENE-8146), still 
works with Java 11 and Maven 3.5+


> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch, 
> LUCENE-8146_v2.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-02-01 Thread Julien Massenet (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348517#comment-16348517
 ] 

Julien Massenet commented on LUCENE-8146:
-

There is, in the form of the ticket that introduced the (intentional) change in 
the first place (linked in the ticket already):

https://issues.apache.org/jira/browse/SUREFIRE-649.

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch, 
> LUCENE-8146_v2.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-02-01 Thread Robert Muir (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348507#comment-16348507
 ] 

Robert Muir commented on LUCENE-8146:
-

Is there a bug in the maven bugtracker for this problem? I don't like the idea 
that, because maven fucked up, now lucene can never rely on the existence of a 
system property. We should do the patch as a temporary measure, but not 
permanent. Its just for a couple months or so until they have new versions of 
their code everywhere.

Also keep in mind lucene reads from system properties in other places too, 
StringHelper is just used early so it gets a lot of heat from people when they 
do stupid shit (such as use maven, or try to run lucene on android, or 
whatever).

 

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch, 
> LUCENE-8146_v2.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-02-01 Thread Uwe Schindler (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348281#comment-16348281
 ] 

Uwe Schindler commented on LUCENE-8146:
---

As a side-note: The access to sysprp from a static initializer in Lucene's Core 
classes should be guarded by AccessController.doPrivileged() as a system 
property called "test." is not enabled by default through securtty manager. 
Maybe also add a try/catch. But that's a separate issue. As it is a static 
initializer, any failure (like this one) will cause Lucene to not work at all!

I just noticed this, comments about this [~rcmuir]?

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch, 
> LUCENE-8146_v2.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-02-01 Thread Dawid Weiss (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348279#comment-16348279
 ] 

Dawid Weiss commented on LUCENE-8146:
-

Ugh. Sorry Julien. Your (smaller) patch looks good to me.



> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch, 
> LUCENE-8146_v2.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-02-01 Thread Uwe Schindler (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348273#comment-16348273
 ] 

Uwe Schindler commented on LUCENE-8146:
---

Hi,
the Surefire bug (I call it a bug, because there is no way to explicitely pass 
a non-existent property, the whole ANT build infrstratcture depends on sysprops 
being set or not as true/false). There are other system properties in Lucene's 
test that should be non-existent if undefined!!!

Maven surefire should fix their bugs and allow to unset a property if it is 
empty. Just switching from one way to another way is horrible. It's only Maven 
that is affected by this, Ant works fine and Gradle, too. With this change it 
is for example impossible to execute Lucene's tests without using a security 
manager, because you cannot simply unset the security manager property (the ANT 
build can do this). In Maven it would pass an empty string and that would 
enable the security manager with default implementation, breaking everything!

About your patch: You can still move the code to a common location, but please, 
please don't create new public classes because of that! Just add it as a method 
to TestUtils - done. There is no need to add a separate class.

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch, 
> LUCENE-8146_v2.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-02-01 Thread Julien Massenet (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348253#comment-16348253
 ] 

Julien Massenet commented on LUCENE-8146:
-

Dawid and Robert: this was actually not new code - this is just code that was 
already present in the code-base, just duplicated:
 * 
[https://github.com/apache/lucene-solr/blob/branch_7x/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java#L174]
 * 
[https://github.com/apache/lucene-solr/blob/branch_7x/solr/core/src/java/org/apache/solr/core/BlobRepository.java#L56]
 * 
[https://github.com/apache/lucene-solr/blob/branch_7x/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java#L138]

I only added a class in an effort to reduce the duplication, but I did not 
introduce that behavior (of using Random instead of the RandomizedContext).

I've attached a newer patch version which copy-paste the changes at all 
affected locations instead. It is still using Random directly, as it was before.

 

For reference, here is the stacktrace you get when you encounter the issue:
{code:java}
breakingTest(org.apache.lucene.seed_issue.SomeClassUsingStringHelperTest)  Time 
elapsed: 0.006 s  <<< ERROR!
java.lang.ExceptionInInitializerError
    at 
org.apache.lucene.seed_issue.SomeClassUsingStringHelperTest.breakingTest(SomeClassUsingStringHelperTest.java:10)
Caused by: java.lang.NumberFormatException: For input string: ""
    at 
org.apache.lucene.seed_issue.SomeClassUsingStringHelperTest.breakingTest(SomeClassUsingStringHelperTest.java:10){code}
(So no reference to the class in question, which made tracking down the issue 
painful)

 

I didn't check the RandomizedRunner part, but one think to note in this case: 
it seems like any error that would happen in RandomizedRunner would only affect 
the Lucene unit tests or clients using the test framework, no ? Whereas the 
problem with {{tests.seed}} parsing & {{StringHelper}} happens in production 
code, so it impacts client code that depend on Lucene, even if it doesn't use 
its test framework.

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch, 
> LUCENE-8146_v2.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-01-31 Thread Dawid Weiss (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347537#comment-16347537
 ] 

Dawid Weiss commented on LUCENE-8146:
-

Btw. I agree with Robert that the simplest fix (for now at least) is to adjust 
StringUtils to what he suggested (this is consistent with what randomized 
runner does too).

https://github.com/randomizedtesting/randomizedtesting/blob/master/randomized-runner/src/main/java/com/carrotsearch/randomizedtesting/RandomizedRunner.java#L349

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-01-31 Thread Uwe Schindler (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347241#comment-16347241
 ] 

Uwe Schindler commented on LUCENE-8146:
---

Nevertheless, the issue should better be solved in Surefire (ideally) or if not 
possible in randomizedrunner's SeedProvider.

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-01-31 Thread Uwe Schindler (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347237#comment-16347237
 ] 

Uwe Schindler commented on LUCENE-8146:
---

Thanks' Dawid. That was my first idea: User Randomizedrunner in Maven instead 
of Surefire (like other projects do).

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-01-31 Thread Dawid Weiss (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347235#comment-16347235
 ] 

Dawid Weiss commented on LUCENE-8146:
-

What's the full stack trace for this {{ExceptionInInitializerError}}?

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-01-31 Thread Dawid Weiss (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347232#comment-16347232
 ] 

Dawid Weiss commented on LUCENE-8146:
-

{code}
+  /**
+   * Get a Random instance, seeded with the external seed if available.
+   */
+  public static Random getSeededRandom() {
+String seed = SeedProvider.getExternalSeed();
+Random random;
+if (seed == null) {
+  random = new Random();
+} else {
+  random = new Random(seed.hashCode());
+}
+return random;
+  }
+}
{code}

Please, don't. The Random instance to be used should be acquired from 
{{RandomizedContext}} and this context is initialized based on the system 
property (and much earlier before the tests or Lucene code is first entered). 
There are things that depend on the seed (such as the order of tests) that this 
property controls.

A better patch would be to replace surefire with the runner from 
{{randomizedtesting}} package; this would make the tests consistent with ANT.

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-01-31 Thread Robert Muir (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347225#comment-16347225
 ] 

Robert Muir commented on LUCENE-8146:
-

Well I'd probably feel different if it was more minimal. This patch adds new 
public classes and abstractions... why are those needed?

Isn't all that is needed a change from:
{code}
String prop = System.getProperty("tests.seed");
if (prop != null) {
{code}

to

{code}
String prop = System.getProperty("tests.seed", "");
if (!prop.isEmpty()) {
{code}

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien Massenet
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-01-31 Thread Julien MASSENET (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347129#comment-16347129
 ] 

Julien MASSENET commented on LUCENE-8146:
-

The patch itself is minimal, but I'll understand if the issue is just closed as 
is - you're right that it's not a Lucene issue. On the other hand, the Lucene 
maven build would also be impacted if the surefire version is ever bumped up, 
as it will break with the same error.

I'm just throwing that out there since I spent about 30 minutes figuring out 
why my build was failing after upgrading all my dependencies (that including 
Lucene and other the surefire plugin). Even if the ticket is closed, it might 
help the next user encountering the same problem.

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien MASSENET
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (LUCENE-8146) Unit tests using StringHelper fail with ExceptionInInitializerError for maven surefire >= 2.18

2018-01-31 Thread Robert Muir (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-8146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347065#comment-16347065
 ] 

Robert Muir commented on LUCENE-8146:
-

{quote}
There was a change in Surefire's behavior starting with 2.18: when a property 
is empty, instead of not sending it to the test runner, it will be sent with an 
empty value.
{quote}

This seems like the bug that needs to be fixed. I don't think lucene should 
suffer the leniency/complexity because of it.

> Unit tests using StringHelper fail with ExceptionInInitializerError for maven 
> surefire >= 2.18
> --
>
> Key: LUCENE-8146
> URL: https://issues.apache.org/jira/browse/LUCENE-8146
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 7.2.1
>Reporter: Julien MASSENET
>Priority: Minor
> Attachments: LUCENE-8146-seed_issue.tar.gz, LUCENE-8146_v1.patch
>
>
> This happens when multiple conditions are met:
>  * The client code is built with Maven
>  * To execute its unit tests, the client code relies on the 
> {{maven-surefire-plugin}}, with a version greater than 2.17 (last working 
> version)
>  * The client code uses the {{org.apache.lucene.util.StringHelper}} class 
> (even transitively)
>  * The client is configured as with the standard Lucene maven build (i.e. it 
> is possible to fix the test seed using the {{tests.seed}} property)
> There was a change in Surefire's behavior starting with 2.18: when a property 
> is empty, instead of not sending it to the test runner, it will be sent with 
> an empty value.
> This behavior can be observed with the attached sample project:
>  * {{mvn test}}: fails with a {{java.lang.ExceptionInInitializerError}}
>  * {{mvn test -Dtests.seed=123456}}: succeeds because the property is set to 
> a real value
>  * {{mvn test -Dsurefire.version=2.17}}: succeeds because the surefire 
> version is lower than 2.18
> Attached is a patch (built against \{{branch_7x}}) that centralizes accesses 
> to the {{tests.seed}} system property; it also makes sure that if it is 
> empty, it is treated as absent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org