[GitHub] commons-io pull request: Added a true iterator based

2015-12-16 Thread thammegowda
GitHub user thammegowda opened a pull request:

https://github.com/apache/commons-io/pull/9

Added a true iterator based

## What is the issue with existing iterator ?
1. The existing `iterateFiles()`  is not really an iterator. It uses an in 
memory list which is problematic when dealing with millions of child files.
2. The existing one blocks till  it traverses the whole tree to build the 
list. 

-- 
## What is good about the new iterator?
1. This one performs depth first traversal on file tree with the help of a 
stack as and when the files are consumed,. So no in memory list.
2. It doesnt block till it read all the file descriptors. You are good to 
consume the moment the first file is read





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

$ git pull https://github.com/thammegowda/commons-io trunk

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

https://github.com/apache/commons-io/pull/9.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 #9


commit 6719879b257d04b39e9acdb3cb89f8bba9b3ecf0
Author: Thamme Gowda N 
Date:   2015-12-16T08:38:43Z

Added a true iterator based

The existing one uses a in memory list which is problematic
 when dealing with millions of child files.
This one performs depth first traversal on file tree
 with the help of a stack.




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

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



[io] Java 7

2015-12-16 Thread Gary Gregory
Hi All:

I was about to add some APIs to FileUtils that work with Java 7 Paths but
[io] is still on Java 6.

Are we OK to move to Java 7?

But maybe we should have a PathUtils instead?

Gary

-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition

JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


[math] AbstractFieldMatrix.checkMultiplicationCompatible() throws exception?

2015-12-16 Thread Ole Ersoy

Hi,

I'm working on making the linear package standalone.  The methods that perform 
precondition checks for matrix operations throw exceptions (See below).  An 
option would be return a boolean instead.  Obviously I would love it if CM 
adopts the code at some point, so I want to check whether changing the 
interface is going to kill kittens.

Cheers,
- Ole

CURRENT
/**
 * Check if a matrix is multiplication compatible with the instance.
 *
 * @param m
 *Matrix to check.
 * @throws DimensionMismatchException
 * if the matrix is not multiplication-compatible with instance.
 */
protected void checkMultiplicationCompatible(final FieldMatrix m) throws 
DimensionMismatchException {
if (getColumnDimension() != m.getRowDimension()) {
throw new DimensionMismatchException(m.getRowDimension(), 
getColumnDimension());
}
}

PROPOSED

/**
 * Check if a matrix is multiplication compatible with the instance.
 *
 * @param m
 *Matrix to check.
 * @return true if the matrix is multiplication compatible, false otherwise.
 */
protected boolean checkMultiplicationCompatible(final FieldMatrix m) {
if (getColumnDimension() != m.getRowDimension()) {
return false;
}
return true;
}



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



Re: [math] AbstractFieldMatrix.checkMultiplicationCompatible() throws exception?

2015-12-16 Thread Ole Ersoy

Actually I think I see why bubbling exceptions is better than performing 
boolean checks...so just ignore, unless there is some merit to it...

Cheers,
Ole

On 12/16/2015 01:08 PM, Ole Ersoy wrote:

Hi,

I'm working on making the linear package standalone.  The methods that perform 
precondition checks for matrix operations throw exceptions (See below).  An 
option would be return a boolean instead.  Obviously I would love it if CM 
adopts the code at some point, so I want to check whether changing the 
interface is going to kill kittens.

Cheers,
- Ole

CURRENT
/**
 * Check if a matrix is multiplication compatible with the instance.
 *
 * @param m
 *Matrix to check.
 * @throws DimensionMismatchException
 * if the matrix is not multiplication-compatible with instance.
 */
protected void checkMultiplicationCompatible(final FieldMatrix m) throws 
DimensionMismatchException {
if (getColumnDimension() != m.getRowDimension()) {
throw new DimensionMismatchException(m.getRowDimension(), 
getColumnDimension());
}
}

PROPOSED

/**
 * Check if a matrix is multiplication compatible with the instance.
 *
 * @param m
 *Matrix to check.
 * @return true if the matrix is multiplication compatible, false otherwise.
 */
protected boolean checkMultiplicationCompatible(final FieldMatrix m) {
if (getColumnDimension() != m.getRowDimension()) {
return false;
}
return true;
}





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



Re: [weaver] Toward a v1.2 release

2015-12-16 Thread Matt Benson
Update: I plan to cut RC1 tomorrow. Stay tuned!

Matt

On Fri, Dec 11, 2015 at 4:55 PM, Matt Benson  wrote:
> Hello all,
>   After having fixed a few problems in the [weaver] component (one
> very large), I'd like to begin the steps toward releasing version 1.2.
> I will be RM. Please speak up if you have any concerns.
>
> Thanks,
> Matt

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



Re: [io] Java 7

2015-12-16 Thread Kristian Rosenvold
I'd still like to make 2.5 a 1.6 release, it shouldnt be that far off. Can
you put it on a branch for now ?
16. des. 2015 18.46 skrev "Gary Gregory" :

> Hi All:
>
> I was about to add some APIs to FileUtils that work with Java 7 Paths but
> [io] is still on Java 6.
>
> Are we OK to move to Java 7?
>
> But maybe we should have a PathUtils instead?
>
> Gary
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> Java Persistence with Hibernate, Second Edition
> 
> JUnit in Action, Second Edition 
> Spring Batch in Action 
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>


Re: [io] Java 7

2015-12-16 Thread Gary Gregory
On Wed, Dec 16, 2015 at 9:52 PM, Kristian Rosenvold 
wrote:

> I'd still like to make 2.5 a 1.6 release, it shouldnt be that far off. Can
> you put it on a branch for now ?
>

I'll just wait, unless 2.5 takes too long. No big rush though.

Gary


> 16. des. 2015 18.46 skrev "Gary Gregory" :
>
> > Hi All:
> >
> > I was about to add some APIs to FileUtils that work with Java 7 Paths but
> > [io] is still on Java 6.
> >
> > Are we OK to move to Java 7?
> >
> > But maybe we should have a PathUtils instead?
> >
> > Gary
> >
> > --
> > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> > Java Persistence with Hibernate, Second Edition
> > 
> > JUnit in Action, Second Edition 
> > Spring Batch in Action 
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
> >
>



-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition

JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: [lang] LANG-1192: FastDateFormat support of the week-year component (uppercase 'Y')

2015-12-16 Thread Benedikt Ritter
-1

All Travis builds started failing after this commit [1]

Benedikt

[1] https://travis-ci.org/apache/commons-lang/builds

2015-12-14 1:39 GMT+01:00 :

> Repository: commons-lang
> Updated Branches:
>   refs/heads/master 2ebf9a21d -> 2fa0b168d
>
>
> LANG-1192: FastDateFormat support of the week-year component (uppercase
> 'Y')
>
>
> Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/commons-lang/commit/2fa0b168
> Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/2fa0b168
> Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/2fa0b168
>
> Branch: refs/heads/master
> Commit: 2fa0b168d62a07365b2787d0ed97fa1c2cfb673b
> Parents: 2ebf9a2
> Author: Chas Honton 
> Authored: Sun Dec 13 16:38:35 2015 -0800
> Committer: Chas Honton 
> Committed: Sun Dec 13 16:38:35 2015 -0800
>
> --
>  src/changes/changes.xml |  1 +
>  .../commons/lang3/time/CalendarReflection.java  | 99 
>  .../apache/commons/lang3/time/DateParser.java   | 16 
>  .../commons/lang3/time/FastDateFormat.java  | 11 ++-
>  .../commons/lang3/time/FastDateParser.java  | 32 ---
>  .../commons/lang3/time/FastDatePrinter.java | 54 ---
>  .../apache/commons/lang3/time/WeekYearTest.java | 90 ++
>  7 files changed, 276 insertions(+), 27 deletions(-)
> --
>
>
>
> http://git-wip-us.apache.org/repos/asf/commons-lang/blob/2fa0b168/src/changes/changes.xml
> --
> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> index d4904c4..7a184df 100644
> --- a/src/changes/changes.xml
> +++ b/src/changes/changes.xml
> @@ -22,6 +22,7 @@
>
>
>
> +FastDateFormat support of the week-year component (uppercase
> 'Y')
>  ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1 (correct
> answer should be 0); revert fix for LANG-1077
>  Clarify JavaDoc of
> StringUtils.containsAny()
>  Add StringUtils methods to compare a
> string to multiple strings
>
>
> http://git-wip-us.apache.org/repos/asf/commons-lang/blob/2fa0b168/src/main/java/org/apache/commons/lang3/time/CalendarReflection.java
> --
> diff --git
> a/src/main/java/org/apache/commons/lang3/time/CalendarReflection.java
> b/src/main/java/org/apache/commons/lang3/time/CalendarReflection.java
> new file mode 100644
> index 000..79ebb3f
> --- /dev/null
> +++ b/src/main/java/org/apache/commons/lang3/time/CalendarReflection.java
> @@ -0,0 +1,99 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements.  See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License.  You may obtain a copy of the License at
> + *
> + *  http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.apache.commons.lang3.time;
> +
> +import java.lang.reflect.Method;
> +import java.util.Calendar;
> +import java.util.GregorianCalendar;
> +
> +import org.apache.commons.lang3.exception.ExceptionUtils;
> +
> +/**
> + * Use reflection to access java 1.7 methods in Calendar.  This allows
> compilation with 1.6 compiler.
> + */
> +class CalendarReflection {
> +
> +private static final Method IS_WEEK_DATE_SUPPORTED =
> getCalendarMethod("isWeekDateSupported");
> +private static final Method GET_WEEK_YEAR =
> getCalendarMethod("getWeekYear");
> +
> +private static Method getCalendarMethod(String methodName,
> Class... argTypes) {
> +try {
> +Method m = Calendar.class.getMethod(methodName, argTypes);
> +return m;
> +} catch (Exception e) {
> +return null;
> +}
> +}
> +
> +/**
> + * Does this calendar instance support week date?
> + * @param calendar The calendar instance.
> + * @return false, if runtime is less than java 1.7; otherwise, the
> result of calendar.isWeekDateSupported().
> + */
> +static boolean isWeekDateSupported(Calendar calendar) {
> +try {
> +return IS_WEEK_DATE_SUPPORTED!=null &&
> ((Boolean)IS_WEEK_DATE_SUPPORTED.invoke(calendar)).booleanValue();
> +} catch (Exception e) {
> +return ExceptionUtils.rethrow