Re: svn commit: r1589446 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/time/FastDateParser.java test/java/org/apache/commons/lang3/time/FastDateParserTest.java

2014-04-23 Thread sebb
On 23 April 2014 21:19, Honton, Charles  wrote:
> TextStrategy is used for:
> E - DAY_OF_WEEK
> G - ERA
> M - MONTH
> a - AM_PM

Is that the only possible use of TextStrategy?
What about literal text?

> SimpleDateFormat uses case-insensitive parsing for each of these fields.
> I will add tests for each of those fields in multiple Locales.

Thanks.

> The (?u)(?i) modifier is active just for the duration of the group.

I did not know that.
Eventually found it documented but hidden away in the section on
differences from Perl.

Note: could be written as (?iu)

> Consider the following unit test:
>
> @Test
> public void testCaseSensitiveModifier() throws Exception {
>Pattern aabb = Pattern.compile("((?u)(?i)AA)BB");
>assertTrue(aabb.matcher("aaBB").matches());
>assertTrue(aabb.matcher("AABB").matches());
>assertFalse(aabb.matcher("aabb").matches());
>assertFalse(aabb.matcher("AAbb").matches());
> }
>
> Regards,
> chas
>
>
>
> On 4/23/14, 12:04 PM, "sebb"  wrote:
>
>>On 23 April 2014 17:02,   wrote:
>>> Author: chas
>>> Date: Wed Apr 23 16:02:52 2014
>>> New Revision: 1589446
>>>
>>> URL: http://svn.apache.org/r1589446
>>> Log:
>>> LANG-966 - FastDateParser should be case insensitive
>>>
>>> Modified:
>>>
>>>commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/Fas
>>>tDateParser.java
>>>
>>>commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/Fas
>>>tDateParserTest.java
>>>
>>> Modified:
>>>commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/Fas
>>>tDateParser.java
>>> URL:
>>>http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/
>>>apache/commons/lang3/time/FastDateParser.java?rev=1589446&r1=1589445&r2=1
>>>589446&view=diff
>>>
>>>=
>>>=
>>> ---
>>>commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/Fas
>>>tDateParser.java (original)
>>> +++
>>>commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/Fas
>>>tDateParser.java Wed Apr 23 16:02:52 2014
>>> @@ -25,6 +25,7 @@ import java.text.ParsePosition;
>>>  import java.util.ArrayList;
>>>  import java.util.Calendar;
>>>  import java.util.Date;
>>> +import java.util.HashMap;
>>>  import java.util.List;
>>>  import java.util.Locale;
>>>  import java.util.Map;
>>> @@ -586,6 +587,7 @@ public class FastDateParser implements D
>>>   private static class TextStrategy extends Strategy {
>>>  private final int field;
>>>  private final Map keyValues;
>>> +private final Map lKeyValues;
>>
>>This is an extra data area for ALL Text fields, but is only needed for
>>Month parsing.
>>
>>I think a separate class is needed.
>>
>>>  /**
>>>   * Construct a Strategy that parses a Text field
>>> @@ -596,6 +598,11 @@ public class FastDateParser implements D
>>>  TextStrategy(final int field, final Calendar definingCalendar,
>>>final Locale locale) {
>>>  this.field= field;
>>>  this.keyValues= getDisplayNames(field, definingCalendar,
>>>locale);
>>> +this.lKeyValues= new HashMap();
>>> +
>>> +for(Map.Entry entry :
>>>keyValues.entrySet()) {
>>> +   lKeyValues.put(entry.getKey().toLowerCase(),
>>>entry.getValue());
>>> +}
>>>  }
>>>
>>>  /**
>>> @@ -603,7 +610,7 @@ public class FastDateParser implements D
>>>   */
>>>  @Override
>>>  boolean addRegex(final FastDateParser parser, final
>>>StringBuilder regex) {
>>> -regex.append('(');
>>> +regex.append("((?i)(?u)");
>>>  for(final String textKeyValue : keyValues.keySet()) {
>>>  escapeRegex(regex, textKeyValue, false).append('|');
>>
>>-1
>>
>>AFAICT, this will enable incorrect matching of text fields that are
>>not supposed to be case-blind.
>>Also, the case-blind matching is not disabled at the end of the
>>section, so can affect later matches.
>>
>>Using a separate class for case-blind matching will fix the first
>>issue, and will avoid creating duplicate data unnecessarily.
>>
>>>  }
>>> @@ -616,7 +623,7 @@ public class FastDateParser implements D
>>>   */
>>>  @Override
>>>  void setCalendar(final FastDateParser parser, final Calendar
>>>cal, final String value) {
>>> -final Integer iVal = keyValues.get(value);
>>> +final Integer iVal = lKeyValues.get(value.toLowerCase());
>>>  if(iVal == null) {
>>>  final StringBuilder sb= new StringBuilder(value);
>>>  sb.append(" not in (");
>>>
>>> Modified:
>>>commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/Fas
>>>tDateParserTest.java
>>> URL:
>>>http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/
>>>apache/commons/lang3/time/FastDateParserTest.java?rev=1589446&r1=1589445&
>>>r2=1589446&view=diff
>>>
>>>

Re: svn commit: r1589446 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/time/FastDateParser.java test/java/org/apache/commons/lang3/time/FastDateParserTest.java

2014-04-23 Thread Honton, Charles
TextStrategy is used for:
E - DAY_OF_WEEK
G - ERA
M - MONTH
a - AM_PM 

SimpleDateFormat uses case-insensitive parsing for each of these fields.
I will add tests for each of those fields in multiple Locales.

The (?u)(?i) modifier is active just for the duration of the group.
Consider the following unit test:

@Test
public void testCaseSensitiveModifier() throws Exception {
   Pattern aabb = Pattern.compile("((?u)(?i)AA)BB");
   assertTrue(aabb.matcher("aaBB").matches());
   assertTrue(aabb.matcher("AABB").matches());
   assertFalse(aabb.matcher("aabb").matches());
   assertFalse(aabb.matcher("AAbb").matches());
}

Regards,
chas



On 4/23/14, 12:04 PM, "sebb"  wrote:

>On 23 April 2014 17:02,   wrote:
>> Author: chas
>> Date: Wed Apr 23 16:02:52 2014
>> New Revision: 1589446
>>
>> URL: http://svn.apache.org/r1589446
>> Log:
>> LANG-966 - FastDateParser should be case insensitive
>>
>> Modified:
>> 
>>commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/Fas
>>tDateParser.java
>> 
>>commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/Fas
>>tDateParserTest.java
>>
>> Modified: 
>>commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/Fas
>>tDateParser.java
>> URL: 
>>http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/
>>apache/commons/lang3/time/FastDateParser.java?rev=1589446&r1=1589445&r2=1
>>589446&view=diff
>> 
>>=
>>=
>> --- 
>>commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/Fas
>>tDateParser.java (original)
>> +++ 
>>commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/Fas
>>tDateParser.java Wed Apr 23 16:02:52 2014
>> @@ -25,6 +25,7 @@ import java.text.ParsePosition;
>>  import java.util.ArrayList;
>>  import java.util.Calendar;
>>  import java.util.Date;
>> +import java.util.HashMap;
>>  import java.util.List;
>>  import java.util.Locale;
>>  import java.util.Map;
>> @@ -586,6 +587,7 @@ public class FastDateParser implements D
>>   private static class TextStrategy extends Strategy {
>>  private final int field;
>>  private final Map keyValues;
>> +private final Map lKeyValues;
>
>This is an extra data area for ALL Text fields, but is only needed for
>Month parsing.
>
>I think a separate class is needed.
>
>>  /**
>>   * Construct a Strategy that parses a Text field
>> @@ -596,6 +598,11 @@ public class FastDateParser implements D
>>  TextStrategy(final int field, final Calendar definingCalendar,
>>final Locale locale) {
>>  this.field= field;
>>  this.keyValues= getDisplayNames(field, definingCalendar,
>>locale);
>> +this.lKeyValues= new HashMap();
>> +
>> +for(Map.Entry entry :
>>keyValues.entrySet()) {
>> +   lKeyValues.put(entry.getKey().toLowerCase(),
>>entry.getValue());
>> +}
>>  }
>>
>>  /**
>> @@ -603,7 +610,7 @@ public class FastDateParser implements D
>>   */
>>  @Override
>>  boolean addRegex(final FastDateParser parser, final
>>StringBuilder regex) {
>> -regex.append('(');
>> +regex.append("((?i)(?u)");
>>  for(final String textKeyValue : keyValues.keySet()) {
>>  escapeRegex(regex, textKeyValue, false).append('|');
>
>-1
>
>AFAICT, this will enable incorrect matching of text fields that are
>not supposed to be case-blind.
>Also, the case-blind matching is not disabled at the end of the
>section, so can affect later matches.
>
>Using a separate class for case-blind matching will fix the first
>issue, and will avoid creating duplicate data unnecessarily.
>
>>  }
>> @@ -616,7 +623,7 @@ public class FastDateParser implements D
>>   */
>>  @Override
>>  void setCalendar(final FastDateParser parser, final Calendar
>>cal, final String value) {
>> -final Integer iVal = keyValues.get(value);
>> +final Integer iVal = lKeyValues.get(value.toLowerCase());
>>  if(iVal == null) {
>>  final StringBuilder sb= new StringBuilder(value);
>>  sb.append(" not in (");
>>
>> Modified: 
>>commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/Fas
>>tDateParserTest.java
>> URL: 
>>http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/
>>apache/commons/lang3/time/FastDateParserTest.java?rev=1589446&r1=1589445&
>>r2=1589446&view=diff
>> 
>>=
>>=
>> --- 
>>commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/Fas
>>tDateParserTest.java (original)
>> +++ 
>>commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/Fas
>>tDateParserTest.java Wed Apr 23 16:02:52 2014
>> @@ -540,4 +540,16 @@ public class FastDateParserTest {
>>  final DateParser parser= getInstance(y

Re: [VFS] Next release date

2014-04-23 Thread Gary Gregory
I think you have it summed up, we need to wrap things up and tie up loose
ends.

I've done other releases for Commons so I could do this one as well.

Gary


On Wed, Apr 23, 2014 at 3:58 PM, Bernd Eckenfels wrote:

> Hello,
>
> I can do some preparation work like reviewing the open issue, verifying
> the completeness of the changelog, maybe writing some release/upgrade
> notes and checking the dependency versions.
>
> I dont feel fit in doing the actual release, maybe you can assist me
> with that gary. What else would you need me to do before?
>
> (continue to discuss this on the developer list)
>
> Bernd
>
>
>
>  Am Wed, 23 Apr 2014 11:38:20
> -0400 schrieb Gary Gregory :
>
> > ASAP would be good, but I do not have to time ATM.
> >
> > Gary
> >
> >
> > On Tue, Apr 15, 2014 at 7:06 AM, Edouard Lemaistre <
> > edouard.lemais...@enovea.net> wrote:
> >
> > > Hi, all
> > >
> > > I browse the VFS JIRa release page and no release date is planned.
> > > Have you planned any release soon ? I'm interested by some corrected
> > > issues.
> > >
> > > Kind regards,
> > > --
> > >
> > > Edouard Lemaistre * Technical project manager * Enovea /
> > > CrystalStream *
> > >
> > > 2 ter, rue Georges Charpak * 76130 Mont Saint Aignan  *  France  *
> > > T + 33 (0) 2 32 18 22 01  *  Standard +33 (0) 2 32 18 22 00 *
> > > edouard.lemais...@enovea.net  *
> > >
> > > www.crystalstream.net : Real time Clearing & Order Book solutions
> > > on ETD
> > >
> > > www.crystalrec.com : Multi Asset Reconciliation solution
> > >
> > > www.enovea.net : Corporate site
> > >
> > >
> > > CrystalStream Help Desk :
> > > support.crys...@enovea.net   + (33) 232 182 200
> > >
> >
> >
> >
>
>


-- 
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: [VFS] Next release date

2014-04-23 Thread Bernd Eckenfels
Hello,

I can do some preparation work like reviewing the open issue, verifying
the completeness of the changelog, maybe writing some release/upgrade
notes and checking the dependency versions.

I dont feel fit in doing the actual release, maybe you can assist me
with that gary. What else would you need me to do before?

(continue to discuss this on the developer list)

Bernd



 Am Wed, 23 Apr 2014 11:38:20
-0400 schrieb Gary Gregory :

> ASAP would be good, but I do not have to time ATM.
> 
> Gary
> 
> 
> On Tue, Apr 15, 2014 at 7:06 AM, Edouard Lemaistre <
> edouard.lemais...@enovea.net> wrote:
> 
> > Hi, all
> >
> > I browse the VFS JIRa release page and no release date is planned.
> > Have you planned any release soon ? I'm interested by some corrected
> > issues.
> >
> > Kind regards,
> > --
> >
> > Edouard Lemaistre * Technical project manager * Enovea /
> > CrystalStream *
> >
> > 2 ter, rue Georges Charpak * 76130 Mont Saint Aignan  *  France  *
> > T + 33 (0) 2 32 18 22 01  *  Standard +33 (0) 2 32 18 22 00 *
> > edouard.lemais...@enovea.net  *
> >
> > www.crystalstream.net : Real time Clearing & Order Book solutions
> > on ETD
> >
> > www.crystalrec.com : Multi Asset Reconciliation solution
> >
> > www.enovea.net : Corporate site
> >
> >
> > CrystalStream Help Desk :
> > support.crys...@enovea.net   + (33) 232 182 200
> >
> 
> 
> 


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



Re: svn commit: r1589446 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/time/FastDateParser.java test/java/org/apache/commons/lang3/time/FastDateParserTest.java

2014-04-23 Thread sebb
On 23 April 2014 17:02,   wrote:
> Author: chas
> Date: Wed Apr 23 16:02:52 2014
> New Revision: 1589446
>
> URL: http://svn.apache.org/r1589446
> Log:
> LANG-966 - FastDateParser should be case insensitive
>
> Modified:
> 
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
> 
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
>
> Modified: 
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java?rev=1589446&r1=1589445&r2=1589446&view=diff
> ==
> --- 
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
>  (original)
> +++ 
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
>  Wed Apr 23 16:02:52 2014
> @@ -25,6 +25,7 @@ import java.text.ParsePosition;
>  import java.util.ArrayList;
>  import java.util.Calendar;
>  import java.util.Date;
> +import java.util.HashMap;
>  import java.util.List;
>  import java.util.Locale;
>  import java.util.Map;
> @@ -586,6 +587,7 @@ public class FastDateParser implements D
>   private static class TextStrategy extends Strategy {
>  private final int field;
>  private final Map keyValues;
> +private final Map lKeyValues;

This is an extra data area for ALL Text fields, but is only needed for
Month parsing.

I think a separate class is needed.

>  /**
>   * Construct a Strategy that parses a Text field
> @@ -596,6 +598,11 @@ public class FastDateParser implements D
>  TextStrategy(final int field, final Calendar definingCalendar, final 
> Locale locale) {
>  this.field= field;
>  this.keyValues= getDisplayNames(field, definingCalendar, locale);
> +this.lKeyValues= new HashMap();
> +
> +for(Map.Entry entry : keyValues.entrySet()) {
> +   lKeyValues.put(entry.getKey().toLowerCase(), 
> entry.getValue());
> +}
>  }
>
>  /**
> @@ -603,7 +610,7 @@ public class FastDateParser implements D
>   */
>  @Override
>  boolean addRegex(final FastDateParser parser, final StringBuilder 
> regex) {
> -regex.append('(');
> +regex.append("((?i)(?u)");
>  for(final String textKeyValue : keyValues.keySet()) {
>  escapeRegex(regex, textKeyValue, false).append('|');

-1

AFAICT, this will enable incorrect matching of text fields that are
not supposed to be case-blind.
Also, the case-blind matching is not disabled at the end of the
section, so can affect later matches.

Using a separate class for case-blind matching will fix the first
issue, and will avoid creating duplicate data unnecessarily.

>  }
> @@ -616,7 +623,7 @@ public class FastDateParser implements D
>   */
>  @Override
>  void setCalendar(final FastDateParser parser, final Calendar cal, 
> final String value) {
> -final Integer iVal = keyValues.get(value);
> +final Integer iVal = lKeyValues.get(value.toLowerCase());
>  if(iVal == null) {
>  final StringBuilder sb= new StringBuilder(value);
>  sb.append(" not in (");
>
> Modified: 
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java?rev=1589446&r1=1589445&r2=1589446&view=diff
> ==
> --- 
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
>  (original)
> +++ 
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java
>  Wed Apr 23 16:02:52 2014
> @@ -540,4 +540,16 @@ public class FastDateParserTest {
>  final DateParser parser= getInstance(yMdHmsSZ, REYKJAVIK);
>  assertEquals(REYKJAVIK, parser.getTimeZone());
>  }
> +
> +@Test
> +public void testLang996() throws ParseException {
> +Calendar expected = Calendar.getInstance(NEW_YORK, Locale.US);
> +expected.clear();
> +expected.set(2014, 4, 14);
> +
> +final DateParser fdp = getInstance("ddMMM", NEW_YORK, Locale.US);
> +assertEquals(expected.getTime(), fdp.parse("14may2014"));
> +assertEquals(expected.getTime(), fdp.parse("14MAY2014"));
> +assertEquals(expected.getTime(), fdp.parse("14May2014"));
> +}

Need more tests to show that the parsing of other case-significant
dates is not affected.

>  }
>
>

-
To unsubscribe, e-mail: dev-un

Re: Apache Commons & ApacheCon Europe 2014

2014-04-23 Thread Ate Douma

Hi all,

Sorry for chiming in this late but I definitely think it would be cool, and very 
useful, to organize a dedicated Commons track at the ApacheCon, and promote this 
project as a whole.


Siegfried and I discussed this a bit in Denver, and I also talked about it with 
Rich Bowen if a special Commons track would be feasible for the next ApacheCon.
Rich said he definitely liked the idea and if we come up with a good proposal it 
has much chance of being accepted.


I think there is plenty of activity here in several Commons components to talk 
about. Not all might need a separate full track: combining 2 or 3 smaller 
presentations into one full track slot IMO should be feasible AND actually more 
interesting for the audience.
And if we can come up with some 5, 6 or even more of such short tracks, we can 
combine them together into a proper Apache Commons track.


I think it is important to note that, at least IMO, such presentations not 
necessarily need to cover a formal released component version, but very well may 
(also or alone) present the current state of development, roadmap plans, etc. 
The goal and purpose of such presentations need not just be 'tutorial' or 
'explanatory' style, but also can (and should!) target community building and 
giving potential users some ideas what is or might be in stock in the future.


Anyone seriously scratching an itch here at Commons IMO might have something 
useful to talk about, and hopefully also is interested in talking about it with 
interested peers and community members!


Now, if the upcoming ApacheCon at Budapest in November is feasible for you all 
or not, I cannot say. Even I cannot make a promise for that already this early.


But it would be great to hear who *might* be interested in participating in such 
a Apache Commons track, about what topic/component you'd like to talk about, etc.
Just to determine if this might be a feasible setup, already next ApacheCon or 
maybe sometimes later.


I definitely would like to present again on the SCXML component, its possible 
2.0 release by that time, and/or give an overview of its current status and 
roadmap like I did in Denver.
Doing so in only 15-20 min. would be fine to me, especially if its part of a 
larger Commons track.


So, who else here is potentially interested in doing something similar?

Thanks,

Ate

On 18-04-14 20:47, Siegfried Goeschl wrote:

Hi folks,

so judging from the conversation we have volunteers for Apache Commons VFS :-)

Reclaiming the message thread - who else would like to present his/her pet 
component?

Thanks in advance

Siegfried Goeschl


On 17 Apr 2014, at 17:28, Schalk Cronjé  wrote:


On 17/04/2014 23:45, Mark Fortner wrote:

Schalk,
It's my understanding that new providers in NIO2 are simply added using the
ServiceLoader.

Cheers,

Mark

Hi Mark,

Maybe I should have explained better,

In Apache VFS one can either add custom providers via a 
META-INF/vfs-providers.xml file (behaviour of StandardFileSystemManager). This 
means just compiling a JAR accordingly and have it available on the classpath. 
Let's call this Approach A.

Alternatively one can call addProvider (on DefaultFileSystemManager) directly. 
This is quite useful in certain circumstances to do this programmatically. This 
is Approach B.

With NIO2 loading occurs by providing a 
META-INF/services/java.nio.file.spi.FileSystemProvider file and ServiceLoader 
should take care of it. This is effectively the NIO2 way of Approach A.

What I am saying is that I would like to have an Approach B for NIO2 as well, 
except that I have seen no clear way of accomplishing it. It could just be a 
lack of knowledge on my side.




On Thu, Apr 17, 2014 at 3:31 PM, Schalk Cronj é  wrote:


On 17/04/2014 22:38, Bernd Eckenfels wrote:



  But theoretically both is possible: consume FileSystems as a provider

or implement an adapter which makes a VFS filesystem(manager) to
provide the FileSystem SPI.


I have been playing with that and it looks possible, but it is far from
trivial. The meagre documentation or even lack of published success in
writing NIO2 providers shows that this is a road less travelled. I have
looked at the supplied ZIP example that comes with the JDK and IMHO still
very much prototype code.

  I think VFS has some things going for it that I could not see in NIO2 -
even something as simple as having two schemes for one provider. In
addition, adding providers on the fly is easy in VFS, by just calling
addProvider on FilesystemManager. From my initial investigation I could not
see a clear way of doing the equivalent in NIO2. There will be more things
like these, I am sure.

I am very interesting in where this is going in future and the maintainer
of Groovy VFS, I have a vested interest. I might be interested to go to
Budapest in November if this gets discussed.



--
Schalk W. Cronjé
@ysb33r



-
To unsubscribe, e-mail: dev-unsubscr...@