[jira] [Commented] (LANG-1392) StringUtils.firstNonBlank and firstNonEmpty

2018-04-20 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1392:
--

Github user garydgregory commented on the issue:

https://github.com/apache/commons-lang/pull/325
  
Your proposal is fine, my suggestion currently falls in the YAGNI category.



> StringUtils.firstNonBlank and firstNonEmpty
> ---
>
> Key: LANG-1392
> URL: https://issues.apache.org/jira/browse/LANG-1392
> Project: Commons Lang
>  Issue Type: New Feature
>Reporter: Jeffrey P Nelson
>Priority: Major
>
> 2 new methods in *StringUtils* that for retrieving the first *CharSequence* 
> in a list that is not blank or not empty. These will follow the same pattern 
> as is used in *ObjectUtils.firstNonNull(T ... values)*



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


[GitHub] commons-lang issue #325: LANG-1392 methods for getting first non empty or no...

2018-04-20 Thread garydgregory
Github user garydgregory commented on the issue:

https://github.com/apache/commons-lang/pull/325
  
Your proposal is fine, my suggestion currently falls in the YAGNI category.



---


[jira] [Commented] (DBUTILS-124) Introduce SPI to add more column, property handlers

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/DBUTILS-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16446246#comment-16446246
 ] 

ASF GitHub Bot commented on DBUTILS-124:


Github user hdevalke closed the pull request at:

https://github.com/apache/commons-dbutils/pull/3


> Introduce SPI to add more column, property handlers
> ---
>
> Key: DBUTILS-124
> URL: https://issues.apache.org/jira/browse/DBUTILS-124
> Project: Commons DbUtils
>  Issue Type: New Feature
>Reporter: Carl Hall
>Assignee: Carl Hall
>Priority: Major
> Fix For: 1.7
>
>
> The column types and property types handled by {{BeanProcessor}} are hard 
> coded to the processor.  We already use a common return type, so we could add 
> a services approach using the spi built into the jdk.  This should also allow 
> other types to be handled outside of {{commons-dbutils}}.



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


[jira] [Commented] (LANG-1392) StringUtils.firstNonBlank and firstNonEmpty

2018-04-20 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1392:
--

Github user jeffnelson commented on the issue:

https://github.com/apache/commons-lang/pull/325
  
@garydgregory - if you want me to refactor as such, I can. But I modeled 
the implementations of these 2 new methods after the existing 
`ObjectUtils.firstNonNull(Object T ... values)` 
https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/ObjectUtils.java#L125-L134

What I've submitted so far seemed like an obvious implementation choice 
since it is consistent with other similar existing code.


> StringUtils.firstNonBlank and firstNonEmpty
> ---
>
> Key: LANG-1392
> URL: https://issues.apache.org/jira/browse/LANG-1392
> Project: Commons Lang
>  Issue Type: New Feature
>Reporter: Jeffrey P Nelson
>Priority: Major
>
> 2 new methods in *StringUtils* that for retrieving the first *CharSequence* 
> in a list that is not blank or not empty. These will follow the same pattern 
> as is used in *ObjectUtils.firstNonNull(T ... values)*



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


[GitHub] commons-lang issue #325: LANG-1392 methods for getting first non empty or no...

2018-04-20 Thread jeffnelson
Github user jeffnelson commented on the issue:

https://github.com/apache/commons-lang/pull/325
  
@garydgregory - if you want me to refactor as such, I can. But I modeled 
the implementations of these 2 new methods after the existing 
`ObjectUtils.firstNonNull(Object T ... values)` 
https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/ObjectUtils.java#L125-L134

What I've submitted so far seemed like an obvious implementation choice 
since it is consistent with other similar existing code.


---


[jira] [Commented] (LANG-1392) StringUtils.firstNonBlank and firstNonEmpty

2018-04-20 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1392:
--

Github user garydgregory commented on the issue:

https://github.com/apache/commons-lang/pull/325
  
Thank you for your PR. It feels to me like this new API should be built on 
top of a more generate "getting Nth non empty or non blank value"


> StringUtils.firstNonBlank and firstNonEmpty
> ---
>
> Key: LANG-1392
> URL: https://issues.apache.org/jira/browse/LANG-1392
> Project: Commons Lang
>  Issue Type: New Feature
>Reporter: Jeffrey P Nelson
>Priority: Major
>
> 2 new methods in *StringUtils* that for retrieving the first *CharSequence* 
> in a list that is not blank or not empty. These will follow the same pattern 
> as is used in *ObjectUtils.firstNonNull(T ... values)*



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


[GitHub] commons-lang issue #325: LANG-1392 methods for getting first non empty or no...

2018-04-20 Thread garydgregory
Github user garydgregory commented on the issue:

https://github.com/apache/commons-lang/pull/325
  
Thank you for your PR. It feels to me like this new API should be built on 
top of a more generate "getting Nth non empty or non blank value"


---


[jira] [Closed] (DBCP-488) NPE for org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS.setConnectionProperties(null)

2018-04-20 Thread Gary Gregory (JIRA)

 [ 
https://issues.apache.org/jira/browse/DBCP-488?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory closed DBCP-488.
-
   Resolution: Fixed
Fix Version/s: 2.3.0

In git master.

> NPE for 
> org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS.setConnectionProperties(null)
> 
>
> Key: DBCP-488
> URL: https://issues.apache.org/jira/browse/DBCP-488
> Project: Commons DBCP
>  Issue Type: Improvement
>Affects Versions: 2.2.0
>Reporter: Gary Gregory
>Assignee: Gary Gregory
>Priority: Major
> Fix For: 2.3.0
>
>
> The method cal 
> {{org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS.setConnectionProperties(null)}}
>  throws an NPE.



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


[jira] [Created] (DBCP-488) NPE for org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS.setConnectionProperties(null)

2018-04-20 Thread Gary Gregory (JIRA)
Gary Gregory created DBCP-488:
-

 Summary: NPE for 
org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS.setConnectionProperties(null)
 Key: DBCP-488
 URL: https://issues.apache.org/jira/browse/DBCP-488
 Project: Commons DBCP
  Issue Type: Improvement
Affects Versions: 2.2.0
Reporter: Gary Gregory
Assignee: Gary Gregory


The method cal 
{{org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS.setConnectionProperties(null)}}
 throws an NPE.



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


[jira] [Commented] (LANG-1392) StringUtils.firstNonBlank and firstNonEmpty

2018-04-20 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LANG-1392:
--

Github user coveralls commented on the issue:

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

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

Coverage decreased (-0.01%) to 95.131% when pulling 
**40ed18e6065811af60125257fa5c8d3b7208aff8 on 
jeffnelson:first-non-empty-blank-string-utils** into 
**8e3ec1722bc5c70ea932b13ec1b564950c623e77 on apache:master**.



> StringUtils.firstNonBlank and firstNonEmpty
> ---
>
> Key: LANG-1392
> URL: https://issues.apache.org/jira/browse/LANG-1392
> Project: Commons Lang
>  Issue Type: New Feature
>Reporter: Jeffrey P Nelson
>Priority: Major
>
> 2 new methods in *StringUtils* that for retrieving the first *CharSequence* 
> in a list that is not blank or not empty. These will follow the same pattern 
> as is used in *ObjectUtils.firstNonNull(T ... values)*



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


[GitHub] commons-lang issue #325: LANG-1392 methods for getting first non empty or no...

2018-04-20 Thread coveralls
Github user coveralls commented on the issue:

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

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

Coverage decreased (-0.01%) to 95.131% when pulling 
**40ed18e6065811af60125257fa5c8d3b7208aff8 on 
jeffnelson:first-non-empty-blank-string-utils** into 
**8e3ec1722bc5c70ea932b13ec1b564950c623e77 on apache:master**.



---


[jira] [Closed] (LANG-1393) Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)

2018-04-20 Thread Gary Gregory (JIRA)

 [ 
https://issues.apache.org/jira/browse/LANG-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory closed LANG-1393.
--
Resolution: Fixed

In git master.

> Add API SystemUtils.String getEnvironmentVariable(final String name, final 
> String defaultValue)
> ---
>
> Key: LANG-1393
> URL: https://issues.apache.org/jira/browse/LANG-1393
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.*
>Reporter: Gary Gregory
>Assignee: Gary Gregory
>Priority: Major
> Fix For: 3.8
>
>
> Add API in {{SystemUtils}}:
> {{String getEnvironmentVariable(final String name, final String 
> defaultValue)}}
> Javadoc:
> {code:java}
>     /**
>  * 
>  * Gets an environment variable, defaulting to {@code defaultValue} if 
> the variable cannot be read.
>  * 
>  * 
>  * If a {@code SecurityException} is caught, the return value is {@code 
> defaultValue} and a message is written to
>  * {@code System.err}.
>  * 
>  *
>  * @param name
>  *    the environment variable name
>  * @param defaultValue
>  *    the default value
>  * @return the environment variable value or {@code defaultValue} if a 
> security problem occurs
>  * @since 3.8
>  */
>     public static String getEnvironmentVariable(final String name, final 
> String defaultValue) 
> {code}



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


[jira] [Updated] (LANG-1393) Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)

2018-04-20 Thread Gary Gregory (JIRA)

 [ 
https://issues.apache.org/jira/browse/LANG-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory updated LANG-1393:
---
Description: 
Add API in {{SystemUtils}}:

{{String getEnvironmentVariable(final String name, final String defaultValue)}}

Javadoc:
{code:java}
    /**
 * 
 * Gets an environment variable, defaulting to {@code defaultValue} if the 
variable cannot be read.
 * 
 * 
 * If a {@code SecurityException} is caught, the return value is {@code 
defaultValue} and a message is written to
 * {@code System.err}.
 * 
 *
 * @param name
 *    the environment variable name
 * @param defaultValue
 *    the default value
 * @return the environment variable value or {@code defaultValue} if a 
security problem occurs
 * @since 3.8
 */
    public static String getEnvironmentVariable(final String name, final String 
defaultValue) 
{code}

  was:
Add API in {{SystemUtils}}:

{{String getEnvironmentVariable(final String name, final String defaultValue)}}

Javadoc:
{code:java}
    /**
 * 
 * Gets an environment variable, defaulting to {@code defaultValue} if the 
variable cannot be read.
 * 
 * 
 * If a {@code SecurityException} is caught, the return value is {@code 
defaultValue} and a message is written to
 * {@code System.err}.
 * 
 *
 * @param name
 *    the environment variable name
 * @param defaultValue
 *    the default value
 * @return the environment variable value or {@code defaultValue} if a 
security problem occurs
 * @since 3.7
 */
    public static String getEnvironmentVariable(final String name, final String 
defaultValue) 
{code}


> Add API SystemUtils.String getEnvironmentVariable(final String name, final 
> String defaultValue)
> ---
>
> Key: LANG-1393
> URL: https://issues.apache.org/jira/browse/LANG-1393
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.*
>Reporter: Gary Gregory
>Assignee: Gary Gregory
>Priority: Major
> Fix For: 3.8
>
>
> Add API in {{SystemUtils}}:
> {{String getEnvironmentVariable(final String name, final String 
> defaultValue)}}
> Javadoc:
> {code:java}
>     /**
>  * 
>  * Gets an environment variable, defaulting to {@code defaultValue} if 
> the variable cannot be read.
>  * 
>  * 
>  * If a {@code SecurityException} is caught, the return value is {@code 
> defaultValue} and a message is written to
>  * {@code System.err}.
>  * 
>  *
>  * @param name
>  *    the environment variable name
>  * @param defaultValue
>  *    the default value
>  * @return the environment variable value or {@code defaultValue} if a 
> security problem occurs
>  * @since 3.8
>  */
>     public static String getEnvironmentVariable(final String name, final 
> String defaultValue) 
> {code}



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


[jira] [Updated] (LANG-1393) Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)

2018-04-20 Thread Gary Gregory (JIRA)

 [ 
https://issues.apache.org/jira/browse/LANG-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory updated LANG-1393:
---
Description: 
Add API in {{SystemUtils}}:

{{String getEnvironmentVariable(final String name, final String defaultValue)}}

Javadoc:
{code:java}
    /**
 * 
 * Gets an environment variable, defaulting to {@code defaultValue} if the 
variable cannot be read.
 * 
 * 
 * If a {@code SecurityException} is caught, the return value is {@code 
defaultValue} and a message is written to
 * {@code System.err}.
 * 
 *
 * @param name
 *    the environment variable name
 * @param defaultValue
 *    the default value
 * @return the environment variable value or {@code defaultValue} if a 
security problem occurs
 * @since 3.7
 */
    public static String getEnvironmentVariable(final String name, final String 
defaultValue) 
{code}

  was:
Add API in {{SystemUtils}}:

{{String getEnvironmentVariable(final String name, final String defaultValue)}}

Javadoc:

{code:java}
    /**
 * 
 * Gets an environment variable, defaulting to {@code defaultValue} if the 
variable cannot be read.
 * 
 * 
 * If a {@code SecurityException} is caught, the return value is {@code 
defaultValue} and a message is written to
 * {@code System.err}.
 * 
 *
 * @param name
 *    the environment variable name
 * @param defaultValue
 *    the default value
 * @return the environment variable value or \{@code defaultValue} if a 
security problem occurs
 * @since 3.7
 */
    public static String getEnvironmentVariable(final String name, final String 
defaultValue) 
{code}


> Add API SystemUtils.String getEnvironmentVariable(final String name, final 
> String defaultValue)
> ---
>
> Key: LANG-1393
> URL: https://issues.apache.org/jira/browse/LANG-1393
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.*
>Reporter: Gary Gregory
>Assignee: Gary Gregory
>Priority: Major
> Fix For: 3.8
>
>
> Add API in {{SystemUtils}}:
> {{String getEnvironmentVariable(final String name, final String 
> defaultValue)}}
> Javadoc:
> {code:java}
>     /**
>  * 
>  * Gets an environment variable, defaulting to {@code defaultValue} if 
> the variable cannot be read.
>  * 
>  * 
>  * If a {@code SecurityException} is caught, the return value is {@code 
> defaultValue} and a message is written to
>  * {@code System.err}.
>  * 
>  *
>  * @param name
>  *    the environment variable name
>  * @param defaultValue
>  *    the default value
>  * @return the environment variable value or {@code defaultValue} if a 
> security problem occurs
>  * @since 3.7
>  */
>     public static String getEnvironmentVariable(final String name, final 
> String defaultValue) 
> {code}



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


[jira] [Created] (LANG-1393) Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)

2018-04-20 Thread Gary Gregory (JIRA)
Gary Gregory created LANG-1393:
--

 Summary: Add API SystemUtils.String getEnvironmentVariable(final 
String name, final String defaultValue)
 Key: LANG-1393
 URL: https://issues.apache.org/jira/browse/LANG-1393
 Project: Commons Lang
  Issue Type: Improvement
  Components: lang.*
Reporter: Gary Gregory
Assignee: Gary Gregory
 Fix For: 3.8


Add API in {{SystemUtils}}:

{{String getEnvironmentVariable(final String name, final String defaultValue)}}

Javadoc:

{code:java}
    /**
 * 
 * Gets an environment variable, defaulting to {@code defaultValue} if the 
variable cannot be read.
 * 
 * 
 * If a {@code SecurityException} is caught, the return value is {@code 
defaultValue} and a message is written to
 * {@code System.err}.
 * 
 *
 * @param name
 *    the environment variable name
 * @param defaultValue
 *    the default value
 * @return the environment variable value or \{@code defaultValue} if a 
security problem occurs
 * @since 3.7
 */
    public static String getEnvironmentVariable(final String name, final String 
defaultValue) 
{code}



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


[jira] [Commented] (CSV-224) Some Multi Iterator Parsing Peek Sequences Incorrectly Consume Elements

2018-04-20 Thread David Warshaw (JIRA)

[ 
https://issues.apache.org/jira/browse/CSV-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445748#comment-16445748
 ] 

David Warshaw commented on CSV-224:
---

cc [~garydgregory]

> Some Multi Iterator Parsing Peek Sequences Incorrectly Consume Elements
> ---
>
> Key: CSV-224
> URL: https://issues.apache.org/jira/browse/CSV-224
> Project: Commons CSV
>  Issue Type: Bug
>  Components: Parser
>Affects Versions: 1.5
>Reporter: David Warshaw
>Priority: Minor
>
> Repeated calls to CSVParser Iterable return new Iterators that each reference 
> the same underlying parser lexer. Within the scope of a single Iterator, row 
> peeking with Iterator.hasNext() works as intended. When row peeking with 
> Iterator.hasNext() under circumstances that create a new Iterator, an element 
> is consumed by the iterator which cannot be accessed by subsequent, newly 
> created Iterators and Iterator.next()s. Effectively, the record Iterator and 
> the lexer get out of sequence. See snippet below.
> The "right thing" is keeping the Iterator in sequence with the lexer, and 
> since this is reading from a buffer, there seem to me to be only two 
> resolutions:
>  # One lexer, one Iterator.
>  # New Iterators, but peeking with hasNext doesn't advance the lexer.
>  
> If there's a consensus on one of these, I can put up a PR.
>  
> {code:java}
>   @Test
>   public void newIteratorSameLexer() throws Exception {
>     String fiveRows = "1\n2\n3\n4\n5\n";
>     System.out.println("Enhanced for loop, no peeking:");
>     CSVParser parser =
>         new CSVParser(new BufferedReader(new StringReader(fiveRows)), 
> CSVFormat.DEFAULT);
>     int recordNumber = 0;
>     for (CSVRecord record : parser) {
>       recordNumber++;
>       System.out.println(recordNumber + " -> " + record.get(0));
>       if (recordNumber >= 2) {
>         break;
>       }
>     }
>     // CSVParser.iterator() returns a new iterator, but the lexer isn't reset 
> so we can pick up
>     // where we left off.
>     for (CSVRecord record : parser) {
>       recordNumber++;
>       System.out.println(recordNumber + " -> " + record.get(0));
>     }
>     // Enhanced for loop, no peeking:
>     // 1 -> 1
>     // 2 -> 2
>     // 3 -> 3
>     // 4 -> 4
>     // 5 -> 5
>     System.out.println("\nEnhanced for loop, with peek:");
>     parser = new CSVParser(new BufferedReader(new StringReader(fiveRows)), 
> CSVFormat.DEFAULT);
>     recordNumber = 0;
>     for (CSVRecord record : parser) {
>       recordNumber++;
>       System.out.println(recordNumber + " -> " + record.get(0));
>       if (recordNumber >= 2) {
>         break;
>       }
>     }
>     // CSVParser.iterator() returns a new iterator, but we call hasNext 
> before next, so we queue
>     // one element for consumption. This element is discarded by the new 
> iterator, even though the
>     // lexer has advanced a row, so we've consumed an element with the peek!
>     System.out.println("hasNext(): " + parser.iterator().hasNext());
>     for (CSVRecord record : parser) {
>       recordNumber++;
>       System.out.println(recordNumber + " -> " + record.get(0));
>     }
>     // Enhanced for loop, with peek:
>     // 1 -> 1
>     // 2 -> 2
>     // hasNext(): true
>     // 3 -> 4
>     // 4 -> 5
>     System.out.println("\nIterator while, with peek:");
>     parser = new CSVParser(new BufferedReader(new StringReader(fiveRows)), 
> CSVFormat.DEFAULT);
>     recordNumber = 0;
>     Iterator iter = parser.iterator();
>     while (iter.hasNext()) {
>       CSVRecord record = iter.next();
>       recordNumber++;
>       System.out.println(recordNumber + " -> " + record.get(0));
>       if (recordNumber >= 2) {
>         break;
>       }
>     }
>     // When we use the same iterator, iterator and lexer are in sequence.
>     System.out.println("hasNext(): " + iter.hasNext());
>     while (iter.hasNext()) {
>       CSVRecord record = iter.next();
>       recordNumber++;
>       System.out.println(recordNumber + " -> " + record.get(0));
>     }
>     // Iterator while, with peek:
>     // 1 -> 1
>     // 2 -> 2
>     // hasNext(): true
>     // 3 -> 3
>     // 4 -> 4
>     // 5 -> 5
>   }{code}



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