[GitHub] commons-lang issue #259: LANG-1167: Add null filter to ReflectionToStringBui...

2017-03-18 Thread coveralls
Github user coveralls commented on the issue:

https://github.com/apache/commons-lang/pull/259
  

[![Coverage 
Status](https://coveralls.io/builds/10664090/badge)](https://coveralls.io/builds/10664090)

Coverage increased (+0.01%) to 94.559% when pulling 
**e423b0bc2dea4167ad98fffc1afd9243ba73aad6 on MarkDacek:LANG-1167** into 
**bf80b9e2803aa277047951a7251267bfb7097c3b on apache:master**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1167) Add null filter to ReflectionToStringBuilder

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931446#comment-15931446
 ] 

ASF GitHub Bot commented on LANG-1167:
--

Github user coveralls commented on the issue:

https://github.com/apache/commons-lang/pull/259
  

[![Coverage 
Status](https://coveralls.io/builds/10664090/badge)](https://coveralls.io/builds/10664090)

Coverage increased (+0.01%) to 94.559% when pulling 
**e423b0bc2dea4167ad98fffc1afd9243ba73aad6 on MarkDacek:LANG-1167** into 
**bf80b9e2803aa277047951a7251267bfb7097c3b on apache:master**.



> Add null filter to ReflectionToStringBuilder
> 
>
> Key: LANG-1167
> URL: https://issues.apache.org/jira/browse/LANG-1167
> Project: Commons Lang
>  Issue Type: Improvement
>Reporter: Gregory Bonk
>
> I know I can filter out class level fields with accept but it would be nice 
> if there could be an additional configuration where if a field's value is 
> null then it would be skipped.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (LANG-1167) Add null filter to ReflectionToStringBuilder

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931359#comment-15931359
 ] 

ASF GitHub Bot commented on LANG-1167:
--

GitHub user MarkDacek opened a pull request:

https://github.com/apache/commons-lang/pull/259

LANG-1167: Add null filter to ReflectionToStringBuilder

@chtompki 
First attempt at this. In order to avoid a large refactor or breaking 
existing implementations, the boolean has to be a negative (isExcludeNullValues 
instead of appendNullValues). 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/MarkDacek/commons-lang LANG-1167

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-lang/pull/259.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #259


commit 3072c655e0d163f0f38d610c37fd7f3cc727714e
Author: MarkDacek 
Date:   2017-03-06T01:36:39Z

This closes #250

commit 40b8ecd3faa8df655ee8b4141ff309553eccfc88
Author: MarkDacek 
Date:   2017-03-17T21:43:15Z

Merge remote-tracking branch 'APACHE/master'

commit 661d16d190708a1a396d8b75ba10738e4574c11d
Author: MarkDacek 
Date:   2017-03-18T19:47:09Z

LANG-1167: Added isExcludeNullValues to ReflectionToStringBuilder and test

commit 3c2673e82d33b6c9bef3005a896e5b0d52b108dd
Author: MarkDacek 
Date:   2017-03-18T20:00:46Z

LANG-1167: Added more test cases for 
ReflectionToStringBuilderExcludeNullValuesTest




> Add null filter to ReflectionToStringBuilder
> 
>
> Key: LANG-1167
> URL: https://issues.apache.org/jira/browse/LANG-1167
> Project: Commons Lang
>  Issue Type: Improvement
>Reporter: Gregory Bonk
>
> I know I can filter out class level fields with accept but it would be nice 
> if there could be an additional configuration where if a field's value is 
> null then it would be skipped.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] commons-lang pull request #259: LANG-1167: Add null filter to ReflectionToSt...

2017-03-18 Thread MarkDacek
GitHub user MarkDacek opened a pull request:

https://github.com/apache/commons-lang/pull/259

LANG-1167: Add null filter to ReflectionToStringBuilder

@chtompki 
First attempt at this. In order to avoid a large refactor or breaking 
existing implementations, the boolean has to be a negative (isExcludeNullValues 
instead of appendNullValues). 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/MarkDacek/commons-lang LANG-1167

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-lang/pull/259.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #259


commit 3072c655e0d163f0f38d610c37fd7f3cc727714e
Author: MarkDacek 
Date:   2017-03-06T01:36:39Z

This closes #250

commit 40b8ecd3faa8df655ee8b4141ff309553eccfc88
Author: MarkDacek 
Date:   2017-03-17T21:43:15Z

Merge remote-tracking branch 'APACHE/master'

commit 661d16d190708a1a396d8b75ba10738e4574c11d
Author: MarkDacek 
Date:   2017-03-18T19:47:09Z

LANG-1167: Added isExcludeNullValues to ReflectionToStringBuilder and test

commit 3c2673e82d33b6c9bef3005a896e5b0d52b108dd
Author: MarkDacek 
Date:   2017-03-18T20:00:46Z

LANG-1167: Added more test cases for 
ReflectionToStringBuilderExcludeNullValuesTest




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (CONFIGURATION-641) XMLConfiguration.load may throw NPE

2017-03-18 Thread Oliver Heger (JIRA)

[ 
https://issues.apache.org/jira/browse/CONFIGURATION-641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931240#comment-15931240
 ] 

Oliver Heger commented on CONFIGURATION-641:


The support for reading configuration data from streams via builders is 
probably not ideal. Do you want to open a new ticket to address this? We can 
then discuss there what could be done to improve the situation. (At least the 
documentation could be improved as you already pointed out.)

> XMLConfiguration.load may throw NPE
> ---
>
> Key: CONFIGURATION-641
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-641
> Project: Commons Configuration
>  Issue Type: Bug
>Affects Versions: 2.1
> Environment: Java 8 / Linux
>Reporter: Claude Warren
> Fix For: 2.1.1
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I expect that 
> {noformat}
> URL url = Test.class.getResource( "/Test.xml");   
> XMLConfiguration config = new XMLConfiguration();
> config.read( url.openStream());
> {noformat}
> Would read the XML file.  However it will throw a NPE at line 967
> {noformat}
>  private void load(InputSource source) throws ConfigurationException
> {
> try
> {
> URL sourceURL = locator.getSourceURL(); // <- NPE here
> if (sourceURL != null)
> {
> source.setSystemId(sourceURL.toString());
> }
> {noformat}
> I believe that testing for locator == null first will solve the problem as 
> the rest of the code in the method does not appear to use it.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] commons-lang issue #256: fix for LANG-1310

2017-03-18 Thread drajakumar
Github user drajakumar commented on the issue:

https://github.com/apache/commons-lang/pull/256
  
the comment on indentation from@jvz is fixed now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1310) MethodUtils.invokeMethod throws ArrayStoreException

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931194#comment-15931194
 ] 

ASF GitHub Bot commented on LANG-1310:
--

Github user drajakumar commented on the issue:

https://github.com/apache/commons-lang/pull/256
  
the comment on indentation from@jvz is fixed now.


> MethodUtils.invokeMethod throws ArrayStoreException
> ---
>
> Key: LANG-1310
> URL: https://issues.apache.org/jira/browse/LANG-1310
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.reflect.*
>Affects Versions: 3.5
>Reporter: Eickvonder
>
> Since release 3.5 and due to the changes of LANG-1115 an ArrayStoreException 
> occurs on MethodUtils.invokeMethod if using varargs arguments and smaller 
> types than the method defines (e.g. int vs long).
> {code}
>   @Test
>   public void testMethodUtilsInvokeMethodVarArgs () throws Exception {
> MyObject object = new MyObject ();
> MethodUtils.invokeMethod (object, "doSomething", 1);
>   }
>   public static class MyObject {
> public void doSomething (long... args) {
>   System.out.println ("doSomething");
> }
>   }
> {code}
> throws 
> {code}
> java.lang.ArrayStoreException
>   at java.lang.System.arraycopy(Native Method)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.getVarArgs(MethodUtils.java:497)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.toVarArgs(MethodUtils.java:463)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:234)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:270)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:147)
> {code}
> In 3.4. a NoSuchMethodException had been thrown, but in 3.5 the code now 
> finds the matching method but fails then with above exception.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (LANG-1310) MethodUtils.invokeMethod throws ArrayStoreException

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931192#comment-15931192
 ] 

ASF GitHub Bot commented on LANG-1310:
--

Github user coveralls commented on the issue:

https://github.com/apache/commons-lang/pull/256
  

[![Coverage 
Status](https://coveralls.io/builds/10660236/badge)](https://coveralls.io/builds/10660236)

Coverage increased (+0.04%) to 94.571% when pulling 
**2ef748c444b50ccce4819d876225cd134a903139 on drajakumar:master** into 
**39a2a6fa38c5e4d1293e00f98a89698a962d6775 on apache:master**.



> MethodUtils.invokeMethod throws ArrayStoreException
> ---
>
> Key: LANG-1310
> URL: https://issues.apache.org/jira/browse/LANG-1310
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.reflect.*
>Affects Versions: 3.5
>Reporter: Eickvonder
>
> Since release 3.5 and due to the changes of LANG-1115 an ArrayStoreException 
> occurs on MethodUtils.invokeMethod if using varargs arguments and smaller 
> types than the method defines (e.g. int vs long).
> {code}
>   @Test
>   public void testMethodUtilsInvokeMethodVarArgs () throws Exception {
> MyObject object = new MyObject ();
> MethodUtils.invokeMethod (object, "doSomething", 1);
>   }
>   public static class MyObject {
> public void doSomething (long... args) {
>   System.out.println ("doSomething");
> }
>   }
> {code}
> throws 
> {code}
> java.lang.ArrayStoreException
>   at java.lang.System.arraycopy(Native Method)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.getVarArgs(MethodUtils.java:497)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.toVarArgs(MethodUtils.java:463)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:234)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:270)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:147)
> {code}
> In 3.4. a NoSuchMethodException had been thrown, but in 3.5 the code now 
> finds the matching method but fails then with above exception.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] commons-lang issue #256: fix for LANG-1310

2017-03-18 Thread coveralls
Github user coveralls commented on the issue:

https://github.com/apache/commons-lang/pull/256
  

[![Coverage 
Status](https://coveralls.io/builds/10660236/badge)](https://coveralls.io/builds/10660236)

Coverage increased (+0.04%) to 94.571% when pulling 
**2ef748c444b50ccce4819d876225cd134a903139 on drajakumar:master** into 
**39a2a6fa38c5e4d1293e00f98a89698a962d6775 on apache:master**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1310) MethodUtils.invokeMethod throws ArrayStoreException

2017-03-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15931188#comment-15931188
 ] 

ASF GitHub Bot commented on LANG-1310:
--

Github user Claudenw commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/256#discussion_r106778971
  
--- Diff: 
src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java ---
@@ -357,16 +369,23 @@ public void testInvokeMethod() throws Exception {
 assertEquals("foo(int)", MethodUtils.invokeMethod(testBean, "foo",
 NumberUtils.BYTE_ONE));
 assertEquals("foo(double)", MethodUtils.invokeMethod(testBean, 
"foo",
-NumberUtils.LONG_ONE));
-assertEquals("foo(double)", MethodUtils.invokeMethod(testBean, 
"foo",
 NumberUtils.DOUBLE_ONE));
 assertEquals("foo(String...)", MethodUtils.invokeMethod(testBean, 
"foo",
 "a", "b", "c"));
 assertEquals("foo(String...)", MethodUtils.invokeMethod(testBean, 
"foo",
 "a", "b", "c"));
 assertEquals("foo(int, String...)", 
MethodUtils.invokeMethod(testBean, "foo",
 5, "a", "b", "c"));
-
+assertEquals("foo(long...)", MethodUtils.invokeMethod(testBean, 
"foo",
+1L, 2L));
+
+try {
+MethodUtils.invokeMethod(testBean, "foo",
+1, 2);
+fail("should throw NoSuchMethodException");
+} catch (final NoSuchMethodException e) {
--- End diff --

I find that the expect exception works well only with very short tests.  In 
this case if any of the earlier method calls throws the NoSuchMethodException 
the test will not fail.  In my opinion the current construct is the better one.


> MethodUtils.invokeMethod throws ArrayStoreException
> ---
>
> Key: LANG-1310
> URL: https://issues.apache.org/jira/browse/LANG-1310
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.reflect.*
>Affects Versions: 3.5
>Reporter: Eickvonder
>
> Since release 3.5 and due to the changes of LANG-1115 an ArrayStoreException 
> occurs on MethodUtils.invokeMethod if using varargs arguments and smaller 
> types than the method defines (e.g. int vs long).
> {code}
>   @Test
>   public void testMethodUtilsInvokeMethodVarArgs () throws Exception {
> MyObject object = new MyObject ();
> MethodUtils.invokeMethod (object, "doSomething", 1);
>   }
>   public static class MyObject {
> public void doSomething (long... args) {
>   System.out.println ("doSomething");
> }
>   }
> {code}
> throws 
> {code}
> java.lang.ArrayStoreException
>   at java.lang.System.arraycopy(Native Method)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.getVarArgs(MethodUtils.java:497)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.toVarArgs(MethodUtils.java:463)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:234)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:270)
>   at 
> org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:147)
> {code}
> In 3.4. a NoSuchMethodException had been thrown, but in 3.5 the code now 
> finds the matching method but fails then with above exception.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] commons-lang pull request #256: fix for LANG-1310

2017-03-18 Thread Claudenw
Github user Claudenw commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/256#discussion_r106778971
  
--- Diff: 
src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java ---
@@ -357,16 +369,23 @@ public void testInvokeMethod() throws Exception {
 assertEquals("foo(int)", MethodUtils.invokeMethod(testBean, "foo",
 NumberUtils.BYTE_ONE));
 assertEquals("foo(double)", MethodUtils.invokeMethod(testBean, 
"foo",
-NumberUtils.LONG_ONE));
-assertEquals("foo(double)", MethodUtils.invokeMethod(testBean, 
"foo",
 NumberUtils.DOUBLE_ONE));
 assertEquals("foo(String...)", MethodUtils.invokeMethod(testBean, 
"foo",
 "a", "b", "c"));
 assertEquals("foo(String...)", MethodUtils.invokeMethod(testBean, 
"foo",
 "a", "b", "c"));
 assertEquals("foo(int, String...)", 
MethodUtils.invokeMethod(testBean, "foo",
 5, "a", "b", "c"));
-
+assertEquals("foo(long...)", MethodUtils.invokeMethod(testBean, 
"foo",
+1L, 2L));
+
+try {
+MethodUtils.invokeMethod(testBean, "foo",
+1, 2);
+fail("should throw NoSuchMethodException");
+} catch (final NoSuchMethodException e) {
--- End diff --

I find that the expect exception works well only with very short tests.  In 
this case if any of the earlier method calls throws the NoSuchMethodException 
the test will not fail.  In my opinion the current construct is the better one.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---