You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2015/01/21 01:58:01 UTC

incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 166f30b6b -> 2ce460db0


BooleanConverter returns now false if it is not able to identify the value als true ;-)


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db

Branch: refs/heads/master
Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
Parents: 166f30b
Author: Oliver B. Fischer <pl...@apache.org>
Authored: Wed Jan 21 01:57:20 2015 +0100
Committer: Oliver B. Fischer <pl...@apache.org>
Committed: Wed Jan 21 01:57:20 2015 +0100

----------------------------------------------------------------------
 .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
----------------------------------------------------------------------
diff --git a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
index 3533f47..b309631 100644
--- a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
+++ b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
@@ -47,6 +47,6 @@ public class BooleanConverter implements PropertyConverter<Boolean> {
             default:
                 LOG.warning("Unknown boolean value encountered: " + value);
         }
-        return null;
+        return Boolean.FALSE;
     }
 }


Re: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Posted by "Oliver B. Fischer" <o....@swe-blog.net>.
Isn't enough to throw simply an exception that no property adapter has 
been found? I am usually afraid of to long and mostly difficult to read 
exceptions. I think a small and clear error message is enough.

Am 22.01.15 um 17:10 schrieb Mark Struberg:
>> But if no converter is able to convert the value into the requested
>> target type we must throw an exception. We cannot suppress such an error.
>
> Yes, that is my point 4. If no coverter was able to convert it to the required type -> Exception which contains all the supported formats of all PropertyConverters.
>
> LieGrue,
> strub
>
>
>
>
>
>> On Wednesday, 21 January 2015, 22:03, Oliver B. Fischer <o....@swe-blog.net> wrote:
>> But if no converter is able to convert the value into the requested
>> target type we must throw an exception. We cannot suppress such an error.
>>
>> WDYT?
>>
>> Oliver
>>
>> Am 21.01.15 um 17:11 schrieb Mark Struberg:
>> and we are done
>> PropertyAdaptors until one of them could convert it
>> which format they support and log an error or throw an Exception even?
>> <st...@yahoo.de> wrote:
>> none of the
>> in the
>> returning null is
>> identify the
>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
>> ----------------------------------------------------------------------
>> .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2
>> ----------------------------------------------------------------------
>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>> ----------------------------------------------------------------------
>> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>> encountered:
>> -- 
>> N Oliver B. Fischer
>> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
>> P +49 30 44793251
>> M +49 178 7903538
>> E o.b.fischer@swe-blog.net
>> S oliver.b.fischer
>>
>> J oliver.b.fischer@jabber.org
>> X http://xing.to/obf
>>

-- 
N Oliver B. Fischer
A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
P +49 30 44793251
M +49 178 7903538
E o.b.fischer@swe-blog.net
S oliver.b.fischer
J oliver.b.fischer@jabber.org
X http://xing.to/obf


Re: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Posted by Mark Struberg <st...@yahoo.de>.
> But if no converter is able to convert the value into the requested
> target type we must throw an exception. We cannot suppress such an error.


Yes, that is my point 4. If no coverter was able to convert it to the required type -> Exception which contains all the supported formats of all PropertyConverters.

LieGrue,
strub





> On Wednesday, 21 January 2015, 22:03, Oliver B. Fischer <o....@swe-blog.net> wrote:
> > Ok, we can return null. I will change the BooleanConverter to return null.
> 
> But if no converter is able to convert the value into the requested 
> target type we must throw an exception. We cannot suppress such an error.
> 
> WDYT?
> 
> Oliver
> 
> Am 21.01.15 um 17:11 schrieb Mark Struberg:
>>  To make it more clear how we envisioned the PropertyAdaptors to work:
>> 
>> 
>>  E.g. we have Configuration.current().get("mykey", Boolean.class);
>>  This would result in the following steps
>> 
>>  1.) look up 'mykey' in all PropertySources.
>>  2.) if nothing was found (val == null || null.isEmpty()) -> return null; 
> and we are done
>>  3.) if something was found -> try to convert. Iterate over all 
> PropertyAdaptors until one of them could convert it
>>  4.) if the value could not get converted -> ask all PropertyAdaptors 
> which format they support and log an error or throw an Exception even?
>> 
>>  LieGrue,
>>  strub
>> 
>> 
>> 
>> 
>>>  On Wednesday, 21 January 2015, 16:45, Mark Struberg 
> <st...@yahoo.de> wrote:
>>>>  +1 please revert. This is a kind of fall-through loop. And only if 
> none of the
>>>  PropertyAdapters knows the format we need to log some warning.
>>> 
>>>  LieGrue,
>>>  strub
>>> 
>>> 
>>> 
>>> 
>>>>    On Wednesday, 21 January 2015, 14:29, Anatole Tresch
>>>  <at...@gmail.com> wrote:
>>>>    >T his is not a valid change. There might be other converters 
> in the
>>>  chain that
>>>>    will never be executed if returning a non null result! So 
> returning null is
>>>  a
>>>>    must.
>>>> 
>>>>    -
>>>>    Anatole Tresch
>>>>    Glärnischweg 10
>>>>    8620 Wetzikon
>>>>    Tel +41 (43) 317 05 30
>>>>    -
>>>>    Send from Mobile
>>>> 
>>>> 
>>>>>     Am 21.01.2015 um 01:58 schrieb plexus@apache.org:
>>>>> 
>>>>>     Repository: incubator-tamaya
>>>>>     Updated Branches:
>>>>>      refs/heads/master 166f30b6b -> 2ce460db0
>>>>> 
>>>>> 
>>>>>     BooleanConverter returns now false if it is not able to 
> identify the
>>>  value
>>>>    als true ;-)
>>>>> 
>>>>>     Project: 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
>>>>>     Commit:
>>>>   
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
>>>>>     Tree:
>>>  http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
>>>>>     Diff:
>>>  http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db
>>>>>     Branch: refs/heads/master
>>>>>     Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
>>>>>     Parents: 166f30b
>>>>>     Author: Oliver B. Fischer <pl...@apache.org>
>>>>>     Authored: Wed Jan 21 01:57:20 2015 +0100
>>>>>     Committer: Oliver B. Fischer <pl...@apache.org>
>>>>>     Committed: Wed Jan 21 01:57:20 2015 +0100
>>>>> 
>>>>>     
> ----------------------------------------------------------------------
>>>>>     
> .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2
>>>  +-
>>>>>     1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>     
> ----------------------------------------------------------------------
>>>>> 
>>>>> 
>>>>> 
>>> 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>>     
> ----------------------------------------------------------------------
>>>>>     diff --git
>>> 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>> 
>>> 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>>     index 3533f47..b309631 100644
>>>>>     ---
>>> 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>>     +++
>>> 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>>     @@ -47,6 +47,6 @@ public class BooleanConverter implements
>>>>    PropertyConverter<Boolean> {
>>>>>                 default:
>>>>>                     LOG.warning("Unknown boolean value 
> encountered:
>>>  "
>>>>    + value);
>>>>>             }
>>>>>     -        return null;
>>>>>     +        return Boolean.FALSE;
>>>>>         }
>>>>>     }
>>>>> 
> 
> -- 
> N Oliver B. Fischer
> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
> P +49 30 44793251
> M +49 178 7903538
> E o.b.fischer@swe-blog.net
> S oliver.b.fischer
> 
> J oliver.b.fischer@jabber.org
> X http://xing.to/obf
>

Re: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Posted by Anatole Tresch <at...@gmail.com>.
That is currently the case afaik. Test to validate this must though be written...

-
Anatole Tresch
Glärnischweg 10
8620 Wetzikon
Tel +41 (43) 317 05 30
-
Send from Mobile

> Am 21.01.2015 um 22:01 schrieb Oliver B. Fischer <o....@swe-blog.net>:
> 
> Ok, we can return null. I will change the BooleanConverter to return null.
> 
> But if no converter is able to convert the value into the requested target type we must throw an exception. We cannot suppress such an error.
> 
> WDYT?
> 
> Oliver
> 
>> Am 21.01.15 um 17:11 schrieb Mark Struberg:
>> To make it more clear how we envisioned the PropertyAdaptors to work:
>> 
>> 
>> E.g. we have Configuration.current().get("mykey", Boolean.class);
>> This would result in the following steps
>> 
>> 1.) look up 'mykey' in all PropertySources.
>> 2.) if nothing was found (val == null || null.isEmpty()) -> return null; and we are done
>> 3.) if something was found -> try to convert. Iterate over all PropertyAdaptors until one of them could convert it
>> 4.) if the value could not get converted -> ask all PropertyAdaptors which format they support and log an error or throw an Exception even?
>> 
>> LieGrue,
>> strub
>> 
>> 
>> 
>> 
>>>> On Wednesday, 21 January 2015, 16:45, Mark Struberg <st...@yahoo.de> wrote:
>>>> +1 please revert. This is a kind of fall-through loop. And only if none of the
>>> PropertyAdapters knows the format we need to log some warning.
>>> 
>>> LieGrue,
>>> strub
>>> 
>>> 
>>> 
>>> 
>>>>>  On Wednesday, 21 January 2015, 14:29, Anatole Tresch
>>>> <at...@gmail.com> wrote:
>>>>  >T his is not a valid change. There might be other converters in the
>>> chain that
>>>>  will never be executed if returning a non null result! So returning null is
>>> a
>>>>  must.
>>>> 
>>>>  -
>>>>  Anatole Tresch
>>>>  Glärnischweg 10
>>>>  8620 Wetzikon
>>>>  Tel +41 (43) 317 05 30
>>>>  -
>>>>  Send from Mobile
>>>> 
>>>> 
>>>>>   Am 21.01.2015 um 01:58 schrieb plexus@apache.org:
>>>>> 
>>>>>   Repository: incubator-tamaya
>>>>>   Updated Branches:
>>>>>    refs/heads/master 166f30b6b -> 2ce460db0
>>>>> 
>>>>> 
>>>>>   BooleanConverter returns now false if it is not able to identify the
>>> value
>>>>  als true ;-)
>>>>> 
>>>>>   Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
>>>>>   Commit:
>>>>  http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
>>>>>   Tree:
>>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
>>>>>   Diff:
>>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db
>>>>>   Branch: refs/heads/master
>>>>>   Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
>>>>>   Parents: 166f30b
>>>>>   Author: Oliver B. Fischer <pl...@apache.org>
>>>>>   Authored: Wed Jan 21 01:57:20 2015 +0100
>>>>>   Committer: Oliver B. Fischer <pl...@apache.org>
>>>>>   Committed: Wed Jan 21 01:57:20 2015 +0100
>>>>> 
>>>>>   ----------------------------------------------------------------------
>>>>>   .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2
>>> +-
>>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>   ----------------------------------------------------------------------
>>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>>   ----------------------------------------------------------------------
>>>>>   diff --git
>>> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>> 
>>> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>>   index 3533f47..b309631 100644
>>>>>   ---
>>> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>>   +++
>>> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>>   @@ -47,6 +47,6 @@ public class BooleanConverter implements
>>>>  PropertyConverter<Boolean> {
>>>>>               default:
>>>>>                   LOG.warning("Unknown boolean value encountered:
>>> "
>>>>  + value);
>>>>>           }
>>>>>   -        return null;
>>>>>   +        return Boolean.FALSE;
>>>>>       }
>>>>>   }
> 
> -- 
> N Oliver B. Fischer
> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
> P +49 30 44793251
> M +49 178 7903538
> E o.b.fischer@swe-blog.net
> S oliver.b.fischer
> J oliver.b.fischer@jabber.org
> X http://xing.to/obf
> 

Re: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Posted by "Oliver B. Fischer" <o....@swe-blog.net>.
Ok, we can return null. I will change the BooleanConverter to return null.

But if no converter is able to convert the value into the requested 
target type we must throw an exception. We cannot suppress such an error.

WDYT?

Oliver

Am 21.01.15 um 17:11 schrieb Mark Struberg:
> To make it more clear how we envisioned the PropertyAdaptors to work:
>
>
> E.g. we have Configuration.current().get("mykey", Boolean.class);
> This would result in the following steps
>
> 1.) look up 'mykey' in all PropertySources.
> 2.) if nothing was found (val == null || null.isEmpty()) -> return null; and we are done
> 3.) if something was found -> try to convert. Iterate over all PropertyAdaptors until one of them could convert it
> 4.) if the value could not get converted -> ask all PropertyAdaptors which format they support and log an error or throw an Exception even?
>
> LieGrue,
> strub
>
>
>
>
>> On Wednesday, 21 January 2015, 16:45, Mark Struberg <st...@yahoo.de> wrote:
>>> +1 please revert. This is a kind of fall-through loop. And only if none of the
>> PropertyAdapters knows the format we need to log some warning.
>>
>> LieGrue,
>> strub
>>
>>
>>
>>
>>>   On Wednesday, 21 January 2015, 14:29, Anatole Tresch
>> <at...@gmail.com> wrote:
>>>   >T his is not a valid change. There might be other converters in the
>> chain that
>>>   will never be executed if returning a non null result! So returning null is
>> a
>>>   must.
>>>
>>>   -
>>>   Anatole Tresch
>>>   Glärnischweg 10
>>>   8620 Wetzikon
>>>   Tel +41 (43) 317 05 30
>>>   -
>>>   Send from Mobile
>>>
>>>
>>>>    Am 21.01.2015 um 01:58 schrieb plexus@apache.org:
>>>>
>>>>    Repository: incubator-tamaya
>>>>    Updated Branches:
>>>>     refs/heads/master 166f30b6b -> 2ce460db0
>>>>
>>>>
>>>>    BooleanConverter returns now false if it is not able to identify the
>> value
>>>   als true ;-)
>>>>
>>>>    Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
>>>>    Commit:
>>>   http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
>>>>    Tree:
>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
>>>>    Diff:
>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db
>>>>    Branch: refs/heads/master
>>>>    Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
>>>>    Parents: 166f30b
>>>>    Author: Oliver B. Fischer <pl...@apache.org>
>>>>    Authored: Wed Jan 21 01:57:20 2015 +0100
>>>>    Committer: Oliver B. Fischer <pl...@apache.org>
>>>>    Committed: Wed Jan 21 01:57:20 2015 +0100
>>>>
>>>>    ----------------------------------------------------------------------
>>>>    .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2
>> +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>    ----------------------------------------------------------------------
>>>>
>>>>
>>>>
>> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>    ----------------------------------------------------------------------
>>>>    diff --git
>> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>
>> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>    index 3533f47..b309631 100644
>>>>    ---
>> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>    +++
>> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>>    @@ -47,6 +47,6 @@ public class BooleanConverter implements
>>>   PropertyConverter<Boolean> {
>>>>                default:
>>>>                    LOG.warning("Unknown boolean value encountered:
>> "
>>>   + value);
>>>>            }
>>>>    -        return null;
>>>>    +        return Boolean.FALSE;
>>>>        }
>>>>    }
>>>>

-- 
N Oliver B. Fischer
A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
P +49 30 44793251
M +49 178 7903538
E o.b.fischer@swe-blog.net
S oliver.b.fischer
J oliver.b.fischer@jabber.org
X http://xing.to/obf


RE: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Posted by "Tresch, Anatole " <an...@credit-suisse.com>.
Hi is also how it is implemented currently, despite point 4: currently it throws an exception, but we do not have finished discussion how to provide the supported formats:

a) implement a second (optional) format
b) define/add an annotation
c) add an additional method (loosing functional interface property ;( )
d) ...?

Ideas, comments?

-----Original Message-----
From: Mark Struberg [mailto:struberg@yahoo.de] 
Sent: Mittwoch, 21. Januar 2015 17:11
To: dev@tamaya.incubator.apache.org; Mark Struberg
Subject: Re: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

To make it more clear how we envisioned the PropertyAdaptors to work:


E.g. we have Configuration.current().get("mykey", Boolean.class);
This would result in the following steps

1.) look up 'mykey' in all PropertySources.
2.) if nothing was found (val == null || null.isEmpty()) -> return null; and we are done
3.) if something was found -> try to convert. Iterate over all PropertyAdaptors until one of them could convert it
4.) if the value could not get converted -> ask all PropertyAdaptors which format they support and log an error or throw an Exception even?

LieGrue,
strub 




> On Wednesday, 21 January 2015, 16:45, Mark Struberg <st...@yahoo.de> wrote:
> > +1 please revert. This is a kind of fall-through loop. And only if none of the 
> PropertyAdapters knows the format we need to log some warning.
> 
> LieGrue,
> strub
> 
> 
> 
> 
>>  On Wednesday, 21 January 2015, 14:29, Anatole Tresch 
> <at...@gmail.com> wrote:
>>  >T his is not a valid change. There might be other converters in the 
> chain that 
>>  will never be executed if returning a non null result! So returning null is 
> a 
>>  must.
>> 
>>  -
>>  Anatole Tresch
>>  Glärnischweg 10
>>  8620 Wetzikon
>>  Tel +41 (43) 317 05 30
>>  -
>>  Send from Mobile
>> 
>> 
>>>   Am 21.01.2015 um 01:58 schrieb plexus@apache.org:
>>> 
>>>   Repository: incubator-tamaya
>>>   Updated Branches:
>>>    refs/heads/master 166f30b6b -> 2ce460db0
>>> 
>>> 
>>>   BooleanConverter returns now false if it is not able to identify the 
> value 
>>  als true ;-)
>>> 
>>> 
>>>   Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
>>>   Commit: 
>>  http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
>>>   Tree: 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
>>>   Diff: 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db
>>> 
>>>   Branch: refs/heads/master
>>>   Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
>>>   Parents: 166f30b
>>>   Author: Oliver B. Fischer <pl...@apache.org>
>>>   Authored: Wed Jan 21 01:57:20 2015 +0100
>>>   Committer: Oliver B. Fischer <pl...@apache.org>
>>>   Committed: Wed Jan 21 01:57:20 2015 +0100
>>> 
>>>   ----------------------------------------------------------------------
>>>   .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2 
> +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>   ----------------------------------------------------------------------
>>> 
>>> 
>>> 
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   ----------------------------------------------------------------------
>>>   diff --git 
>> 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java 
> 
>> 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   index 3533f47..b309631 100644
>>>   --- 
>> 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   +++ 
>> 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   @@ -47,6 +47,6 @@ public class BooleanConverter implements 
>>  PropertyConverter<Boolean> {
>>>               default:
>>>                   LOG.warning("Unknown boolean value encountered: 
> " 
>>  + value);
>>>           }
>>>   -        return null;
>>>   +        return Boolean.FALSE;
>>>       }
>>>   }
>>> 
>> 
>

Re: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Posted by Mark Struberg <st...@yahoo.de>.
To make it more clear how we envisioned the PropertyAdaptors to work:


E.g. we have Configuration.current().get("mykey", Boolean.class);
This would result in the following steps

1.) look up 'mykey' in all PropertySources.
2.) if nothing was found (val == null || null.isEmpty()) -> return null; and we are done
3.) if something was found -> try to convert. Iterate over all PropertyAdaptors until one of them could convert it
4.) if the value could not get converted -> ask all PropertyAdaptors which format they support and log an error or throw an Exception even?

LieGrue,
strub 




> On Wednesday, 21 January 2015, 16:45, Mark Struberg <st...@yahoo.de> wrote:
> > +1 please revert. This is a kind of fall-through loop. And only if none of the 
> PropertyAdapters knows the format we need to log some warning.
> 
> LieGrue,
> strub
> 
> 
> 
> 
>>  On Wednesday, 21 January 2015, 14:29, Anatole Tresch 
> <at...@gmail.com> wrote:
>>  >T his is not a valid change. There might be other converters in the 
> chain that 
>>  will never be executed if returning a non null result! So returning null is 
> a 
>>  must.
>> 
>>  -
>>  Anatole Tresch
>>  Glärnischweg 10
>>  8620 Wetzikon
>>  Tel +41 (43) 317 05 30
>>  -
>>  Send from Mobile
>> 
>> 
>>>   Am 21.01.2015 um 01:58 schrieb plexus@apache.org:
>>> 
>>>   Repository: incubator-tamaya
>>>   Updated Branches:
>>>    refs/heads/master 166f30b6b -> 2ce460db0
>>> 
>>> 
>>>   BooleanConverter returns now false if it is not able to identify the 
> value 
>>  als true ;-)
>>> 
>>> 
>>>   Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
>>>   Commit: 
>>  http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
>>>   Tree: 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
>>>   Diff: 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db
>>> 
>>>   Branch: refs/heads/master
>>>   Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
>>>   Parents: 166f30b
>>>   Author: Oliver B. Fischer <pl...@apache.org>
>>>   Authored: Wed Jan 21 01:57:20 2015 +0100
>>>   Committer: Oliver B. Fischer <pl...@apache.org>
>>>   Committed: Wed Jan 21 01:57:20 2015 +0100
>>> 
>>>   ----------------------------------------------------------------------
>>>   .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2 
> +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>   ----------------------------------------------------------------------
>>> 
>>> 
>>> 
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   ----------------------------------------------------------------------
>>>   diff --git 
>> 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java 
> 
>> 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   index 3533f47..b309631 100644
>>>   --- 
>> 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   +++ 
>> 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   @@ -47,6 +47,6 @@ public class BooleanConverter implements 
>>  PropertyConverter<Boolean> {
>>>               default:
>>>                   LOG.warning("Unknown boolean value encountered: 
> " 
>>  + value);
>>>           }
>>>   -        return null;
>>>   +        return Boolean.FALSE;
>>>       }
>>>   }
>>> 
>> 
>

Re: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Posted by Mark Struberg <st...@yahoo.de>.
+1 please revert. This is a kind of fall-through loop. And only if none of the PropertyAdapters knows the format we need to log some warning.

LieGrue,
strub



> On Wednesday, 21 January 2015, 14:29, Anatole Tresch <at...@gmail.com> wrote:
> >T his is not a valid change. There might be other converters in the chain that 
> will never be executed if returning a non null result! So returning null is a 
> must.
> 
> -
> Anatole Tresch
> Glärnischweg 10
> 8620 Wetzikon
> Tel +41 (43) 317 05 30
> -
> Send from Mobile
> 
> 
>>  Am 21.01.2015 um 01:58 schrieb plexus@apache.org:
>> 
>>  Repository: incubator-tamaya
>>  Updated Branches:
>>   refs/heads/master 166f30b6b -> 2ce460db0
>> 
>> 
>>  BooleanConverter returns now false if it is not able to identify the value 
> als true ;-)
>> 
>> 
>>  Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
>>  Commit: 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
>>  Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
>>  Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db
>> 
>>  Branch: refs/heads/master
>>  Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
>>  Parents: 166f30b
>>  Author: Oliver B. Fischer <pl...@apache.org>
>>  Authored: Wed Jan 21 01:57:20 2015 +0100
>>  Committer: Oliver B. Fischer <pl...@apache.org>
>>  Committed: Wed Jan 21 01:57:20 2015 +0100
>> 
>>  ----------------------------------------------------------------------
>>  .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>  ----------------------------------------------------------------------
>> 
>> 
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>  ----------------------------------------------------------------------
>>  diff --git 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>  index 3533f47..b309631 100644
>>  --- 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>  +++ 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>  @@ -47,6 +47,6 @@ public class BooleanConverter implements 
> PropertyConverter<Boolean> {
>>              default:
>>                  LOG.warning("Unknown boolean value encountered: " 
> + value);
>>          }
>>  -        return null;
>>  +        return Boolean.FALSE;
>>      }
>>  }
>> 
>

Re: incubator-tamaya git commit: BooleanConverter returns now false if it is not able to identify the value als true ; -)

Posted by Anatole Tresch <at...@gmail.com>.
This is not a valid change. There might be other converters in the chain that will never be executed if returning a non null result! So returning null is a must.

-
Anatole Tresch
Glärnischweg 10
8620 Wetzikon
Tel +41 (43) 317 05 30
-
Send from Mobile

> Am 21.01.2015 um 01:58 schrieb plexus@apache.org:
> 
> Repository: incubator-tamaya
> Updated Branches:
>  refs/heads/master 166f30b6b -> 2ce460db0
> 
> 
> BooleanConverter returns now false if it is not able to identify the value als true ;-)
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
> Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
> Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
> Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db
> 
> Branch: refs/heads/master
> Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
> Parents: 166f30b
> Author: Oliver B. Fischer <pl...@apache.org>
> Authored: Wed Jan 21 01:57:20 2015 +0100
> Committer: Oliver B. Fischer <pl...@apache.org>
> Committed: Wed Jan 21 01:57:20 2015 +0100
> 
> ----------------------------------------------------------------------
> .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
> ----------------------------------------------------------------------
> diff --git a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
> index 3533f47..b309631 100644
> --- a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
> +++ b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
> @@ -47,6 +47,6 @@ public class BooleanConverter implements PropertyConverter<Boolean> {
>             default:
>                 LOG.warning("Unknown boolean value encountered: " + value);
>         }
> -        return null;
> +        return Boolean.FALSE;
>     }
> }
>