You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Alex Harui <ah...@adobe.com> on 2013/11/07 23:18:27 UTC

Re: [2/3] git commit: [flex-asjs] [refs/heads/develop] - If bead value is not found, prevent set states from blowing up.

FWIW, I was thinking that this kind of check should be replaced by some
capability in the tool chain to verify a configuration, maybe by marking
some values as required.  In production, you hopefully don't need these
kinds of checks.  I've also floated the idea of "debug-mode" beads which
have more checks than production beads.

Thoughts?
-Alex

On 11/7/13 11:36 AM, "bigosmallm@apache.org" <bi...@apache.org> wrote:

>If bead value is not found, prevent set states from blowing up.
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/425d9613
>Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/425d9613
>Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/425d9613
>
>Branch: refs/heads/develop
>Commit: 425d9613964db13b09d6d80ee1a8d332cf0dcb2c
>Parents: 74c50e4
>Author: Om <bi...@gmail.com>
>Authored: Thu Nov 7 11:16:59 2013 -0800
>Committer: Om <bi...@gmail.com>
>Committed: Thu Nov 7 11:34:41 2013 -0800
>
>----------------------------------------------------------------------
> frameworks/as/src/org/apache/flex/core/ViewBase.as | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/425d9613/frameworks/
>as/src/org/apache/flex/core/ViewBase.as
>----------------------------------------------------------------------
>diff --git a/frameworks/as/src/org/apache/flex/core/ViewBase.as
>b/frameworks/as/src/org/apache/flex/core/ViewBase.as
>index 4e923a1..afeb04d 100644
>--- a/frameworks/as/src/org/apache/flex/core/ViewBase.as
>+++ b/frameworks/as/src/org/apache/flex/core/ViewBase.as
>@@ -81,8 +81,15 @@ package org.apache.flex.core
>         public function set states(value:Array):void
>         {
>             _states = value;
>-            if (getBeadByType(IStatesImpl) == null)
>-                addBead(new (ValuesManager.valuesImpl.getValue(this,
>"iStatesImpl")) as IBead);
>+			try{
>+				if (getBeadByType(IStatesImpl) == null)
>+					addBead(new (ValuesManager.valuesImpl.getValue(this,
>"iStatesImpl")) as IBead);
>+			}
>+			//TODO:  Need to handle this case more gracefully
>+			catch(e:Error)
>+			{
>+				trace(e.message);
>+			}
>             
>         }
>         
>


Re: [2/3] git commit: [flex-asjs] [refs/heads/develop] - If bead value is not found, prevent set states from blowing up.

Posted by Alex Harui <ah...@adobe.com>.

On 11/7/13 4:54 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:

>On Thu, Nov 7, 2013 at 4:41 PM, Alex Harui <ah...@adobe.com> wrote:
>
>>
>>
>> On 11/7/13 4:35 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:
>>
>> >On Thu, Nov 7, 2013 at 2:18 PM, Alex Harui <ah...@adobe.com> wrote:
>> >
>> >> FWIW, I was thinking that this kind of check should be replaced by
>>some
>> >> capability in the tool chain to verify a configuration, maybe by
>>marking
>> >> some values as required.  In production, you hopefully don't need
>>these
>> >> kinds of checks.  I've also floated the idea of "debug-mode" beads
>>which
>> >> have more checks than production beads.
>> >>
>> >> Thoughts?
>> >>
>> >
>> >Personally, I don't like the idea of setting the bead values in CSS.
>>It
>> >makes it hard to enforce these kind of things.  Ideally, the absence
>>of a
>> >bead that the code is looking for should generate a compile error.
>> >
>> >Another way to inject beads would be to use metadata attributes.
>> >Something
>> >along the lines of spark skins' [SkinPart(required="true")] metadata
>> >attribute.  Would this make it easier to do the checks?
>> That would help with the check, but are you also proposing naming the
>> default value in the metadata?
>>
>>
>Yes, setting the default values in metadata would be great.  It is more in
>tune with how Flex works in today.
Maybe I'm not understanding.  SkinPart doesn't set a default value.  Lots
of things are set in defaults.css.  What metadata are you thinking of?

-Alex


Re: [2/3] git commit: [flex-asjs] [refs/heads/develop] - If bead value is not found, prevent set states from blowing up.

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Thu, Nov 7, 2013 at 4:41 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 11/7/13 4:35 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:
>
> >On Thu, Nov 7, 2013 at 2:18 PM, Alex Harui <ah...@adobe.com> wrote:
> >
> >> FWIW, I was thinking that this kind of check should be replaced by some
> >> capability in the tool chain to verify a configuration, maybe by marking
> >> some values as required.  In production, you hopefully don't need these
> >> kinds of checks.  I've also floated the idea of "debug-mode" beads which
> >> have more checks than production beads.
> >>
> >> Thoughts?
> >>
> >
> >Personally, I don't like the idea of setting the bead values in CSS.  It
> >makes it hard to enforce these kind of things.  Ideally, the absence of a
> >bead that the code is looking for should generate a compile error.
> >
> >Another way to inject beads would be to use metadata attributes.
> >Something
> >along the lines of spark skins' [SkinPart(required="true")] metadata
> >attribute.  Would this make it easier to do the checks?
> That would help with the check, but are you also proposing naming the
> default value in the metadata?
>
>
Yes, setting the default values in metadata would be great.  It is more in
tune with how Flex works in today.


>  >
> >Or more simpler, maybe we have default empty IBeads available so that
> >things at least don't blow up.  But I am guessing that this approach might
> >only delay the blow up of the code to a later stage.
> I guess I'm wondering how easy it is to screw up your config such that we
> need a lot of runtime protection for this.  How did you get into this
> error in the first place?
>
>
I wouldnt say it is very easy, but definitely possible.  And a pain to
debug.  I am not sure how I got into that situation.  It was probably the
IFlexInfo issue I had earlier.  I will check if I can repro this again.

Thanks,
Om

Re: [2/3] git commit: [flex-asjs] [refs/heads/develop] - If bead value is not found, prevent set states from blowing up.

Posted by Alex Harui <ah...@adobe.com>.

On 11/7/13 4:35 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:

>On Thu, Nov 7, 2013 at 2:18 PM, Alex Harui <ah...@adobe.com> wrote:
>
>> FWIW, I was thinking that this kind of check should be replaced by some
>> capability in the tool chain to verify a configuration, maybe by marking
>> some values as required.  In production, you hopefully don't need these
>> kinds of checks.  I've also floated the idea of "debug-mode" beads which
>> have more checks than production beads.
>>
>> Thoughts?
>>
>
>Personally, I don't like the idea of setting the bead values in CSS.  It
>makes it hard to enforce these kind of things.  Ideally, the absence of a
>bead that the code is looking for should generate a compile error.
>
>Another way to inject beads would be to use metadata attributes.
>Something
>along the lines of spark skins' [SkinPart(required="true")] metadata
>attribute.  Would this make it easier to do the checks?
That would help with the check, but are you also proposing naming the
default value in the metadata?

>
>Or more simpler, maybe we have default empty IBeads available so that
>things at least don't blow up.  But I am guessing that this approach might
>only delay the blow up of the code to a later stage.
I guess I'm wondering how easy it is to screw up your config such that we
need a lot of runtime protection for this.  How did you get into this
error in the first place?


Re: [2/3] git commit: [flex-asjs] [refs/heads/develop] - If bead value is not found, prevent set states from blowing up.

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Thu, Nov 7, 2013 at 2:18 PM, Alex Harui <ah...@adobe.com> wrote:

> FWIW, I was thinking that this kind of check should be replaced by some
> capability in the tool chain to verify a configuration, maybe by marking
> some values as required.  In production, you hopefully don't need these
> kinds of checks.  I've also floated the idea of "debug-mode" beads which
> have more checks than production beads.
>
> Thoughts?
>

Personally, I don't like the idea of setting the bead values in CSS.  It
makes it hard to enforce these kind of things.  Ideally, the absence of a
bead that the code is looking for should generate a compile error.

Another way to inject beads would be to use metadata attributes.  Something
along the lines of spark skins' [SkinPart(required="true")] metadata
attribute.  Would this make it easier to do the checks?

Or more simpler, maybe we have default empty IBeads available so that
things at least don't blow up.  But I am guessing that this approach might
only delay the blow up of the code to a later stage.

Thanks,
Om



> -Alex
>
> On 11/7/13 11:36 AM, "bigosmallm@apache.org" <bi...@apache.org>
> wrote:
>
> >If bead value is not found, prevent set states from blowing up.
> >
> >
> >Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> >Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/425d9613
> >Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/425d9613
> >Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/425d9613
> >
> >Branch: refs/heads/develop
> >Commit: 425d9613964db13b09d6d80ee1a8d332cf0dcb2c
> >Parents: 74c50e4
> >Author: Om <bi...@gmail.com>
> >Authored: Thu Nov 7 11:16:59 2013 -0800
> >Committer: Om <bi...@gmail.com>
> >Committed: Thu Nov 7 11:34:41 2013 -0800
> >
> >----------------------------------------------------------------------
> > frameworks/as/src/org/apache/flex/core/ViewBase.as | 11 +++++++++--
> > 1 file changed, 9 insertions(+), 2 deletions(-)
> >----------------------------------------------------------------------
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/425d9613/frameworks/
> >as/src/org/apache/flex/core/ViewBase.as
> >----------------------------------------------------------------------
> >diff --git a/frameworks/as/src/org/apache/flex/core/ViewBase.as
> >b/frameworks/as/src/org/apache/flex/core/ViewBase.as
> >index 4e923a1..afeb04d 100644
> >--- a/frameworks/as/src/org/apache/flex/core/ViewBase.as
> >+++ b/frameworks/as/src/org/apache/flex/core/ViewBase.as
> >@@ -81,8 +81,15 @@ package org.apache.flex.core
> >         public function set states(value:Array):void
> >         {
> >             _states = value;
> >-            if (getBeadByType(IStatesImpl) == null)
> >-                addBead(new (ValuesManager.valuesImpl.getValue(this,
> >"iStatesImpl")) as IBead);
> >+                      try{
> >+                              if (getBeadByType(IStatesImpl) == null)
> >+                                      addBead(new
> (ValuesManager.valuesImpl.getValue(this,
> >"iStatesImpl")) as IBead);
> >+                      }
> >+                      //TODO:  Need to handle this case more gracefully
> >+                      catch(e:Error)
> >+                      {
> >+                              trace(e.message);
> >+                      }
> >
> >         }
> >
> >
>
>