My Error #1010 situation
Asked Answered
H

4

6

Edit 3: Alright, I'm lighting up a Windows Server 2008 R2 VM, installing Flex Builder 3, and seeing if I can get a new project to compile and execute properly. News! I got the IDE up and running in the VM and I STILL got the same exact error after the code compiled without issue! Here comes a big, emphatic double you tee eff.

Edit 2: Since this has gotten to be a pretty long post I'll put this up here. I just went through and deleted each portion of the two problem lines individually and tried to compile after each one, and I got the error every single time. I even deleted everything from within the two DataGridColumns and it still didn't compile, even though commenting out the two empty <mx:DataGridColumn /> lines will let the program load! This is driving me nuts, can anyone shed some light on this for me?
/Edit 2

I have an AIR application which will apparently compile just fine when I hit F5, but before the app has a chance to load I get the following error:

My error message.

By commenting out blocks of code I've narrowed the problem down to two specific lines.

<mx:DataGrid id="grid1" width="100%" height="100%" editable="false">
    <mx:columns>
        <mx:DataGridColumn headerText="Symbol"                      dataField="Symbol"             headerWordWrap="true" width="100" textAlign="left"/>
        <mx:DataGridColumn headerText="Description"                 dataField="FullName"           headerWordWrap="true" width="150" textAlign="left"/>
        <mx:DataGridColumn headerText="Trans"                       dataField="TransactionCode"    headerWordWrap="true" width="75"  textAlign="center"/>
        <mx:DataGridColumn headerText="Quantity"                    dataField="Quantity"           headerWordWrap="true" width="50"  textAlign="right"  labelFunction="formatUtil3"/>
        <mx:DataGridColumn headerText="Execution Date"              dataField="ExecutionDate"      headerWordWrap="true" width="80"  textAlign="center"/>
        <mx:DataGridColumn headerText="Execution Price"             dataField="ExecutionPrice"     headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil1"/>
        <mx:DataGridColumn width="15" backgroundColor="0x888888" dataField="blank1" headerText=""/>
        <mx:DataGridColumn headerText="Previous Business Day"       dataField="PreviousDate"       headerWordWrap="true" width="80"  textAlign="center"                             itemRenderer="PD5"/>
<!---->     <mx:DataGridColumn headerText="Previous Business Day Price" dataField="PreviousDatePrice"  headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil1" itemRenderer="PD5"/>
<!---->     <mx:DataGridColumn headerText="% Difference"                dataField="PreviousDateDelta"  headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil2" itemRenderer="PD5"/>
        <mx:DataGridColumn headerText="Source"                      dataField="PreviousDateSource" headerWordWrap="true" width="100" textAlign="left"                               itemRenderer="PD5"/>
        <mx:DataGridColumn width="15" backgroundColor="0x888888" dataField="blank2" headerText=""/>
        <mx:DataGridColumn headerText="Previous Month End"          dataField="PrevMonthEndDate"   headerWordWrap="true" width="80"  textAlign="center"                             itemRenderer="PME5"/>
        <mx:DataGridColumn headerText="Previous Month End Price"    dataField="PrevMonthEndPrice"  headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil1" itemRenderer="PME5"/>
        <mx:DataGridColumn headerText="% Difference"                dataField="PrevMonthEndDelta"  headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil2" itemRenderer="PME5"/>
        <mx:DataGridColumn headerText="Source"                      dataField="PrevMonthEndSource" headerWordWrap="true" width="100" textAlign="left"                               itemRenderer="PME5"/>
    </mx:columns>
</mx:DataGrid>

The two lines are marked with <!---->. If I comment those two lines out then the app will compile, run, and display properly, but if I leave either of them active I get the error above.

What is going on here?

Edit: Additional code as requested -

<mx:CurrencyFormatter id="format1" precision="5" useNegativeSign="false"/>
<mx:NumberFormatter   id="format2" precision="2"/>

And the functions -

private function formatUtil1(item:Object, column:DataGridColumn):String
{
    var Field:Object = item[column.dataField];
    return format1.format(Field);
}

private function formatUtil2(item:Object, column:DataGridColumn):String
{
    var Field:Object = item[column.dataField];
    return format2.format(Field);
}

Next the .as file for PD5 -

package
{
    import mx.controls.Label;
    import mx.controls.listClasses.*;

    public class PD5 extends Label
    {
        private const POSITIVE_COLOR:uint = 0x000000; // Black
        private const NEGATIVE_COLOR:uint = 0xFF0000; // Red 

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            setStyle("color", (data.PreviousDateDelta >= 5 || data.PreviousDateDelta <= -5) ? NEGATIVE_COLOR : POSITIVE_COLOR);
        }
    }
}

And now PME5.as -

package
{
    import mx.controls.Label;
    import mx.controls.listClasses.*;

    public class PME5 extends Label
    {
        private const POSITIVE_COLOR:uint = 0x000000; // Black
        private const NEGATIVE_COLOR:uint = 0xFF0000; // Red

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            setStyle("color", (data.PrevMonthEndDelta >= 5 || data.PrevMonthEndDelta <= -5) ? NEGATIVE_COLOR : POSITIVE_COLOR);
        }
    }
}
Hevesy answered 16/8, 2011 at 20:53 Comment(13)
take out the labelFunctions and see if you compile I have a feeling the undefined reference is in those functions.Algophobia
@Algophobia - Just did, it's not the labelFunctions. Besides, they work in the two lines below the trouble lines.Hevesy
Yeah I didn't see those on the lines after. This is very odd. The only thing I see is the renederer on the lines that worked using the labelfunc formatUtil and formatUtil2 change the renender from PD5 to PME5 and see what happensAlgophobia
@Algophobia - Removing the itemRenderer="PD5" from each line doesn't help either.Hevesy
can you post the PME5, PD5, formatUtil1, and formatUtil2Algophobia
What kind of data (explicit examples would be <3) are in those two fields?Aret
@Sam DeHaan - Both fields display price data in string format.Hevesy
Hmm. Have you tried removing the ternary operators from inside PD5? I've had lots of strange problems with ternary operations in flex.Aret
@Sam DeHaan - If I remove the itemRenderer call from both lines altogether I still have the problem.Hevesy
That seems unlikely, almost impossible. Are you certain your browser isn't caching the SWF? (IE8 does this, the bugger. No idea on other browsers)Aret
@Sam DeHaan - I know, which is why I'm slowly going insane because of this. I've deleted all cookies and temp files several times now, I know the SWF isn't loading a cached version.Hevesy
A question to be sure. If you remove the labelFunction and the itemRenderer and comment in the both lines, all works fine?Exergue
As stated before I've tried running it with empty <mx:DataGridColumn /> lines and it doesn't compile.Hevesy
H
0

Since nothing so far has solved my problem, I decided to sidestep it altogether and port the program in question over to C#. Everything it working well so far.

Lazy answer? Yes.
Lazy solution? Unfortunately no.

Hevesy answered 18/10, 2011 at 14:18 Comment(0)
O
3

Run the application in debug mode. When there is an error, Flex builder (Flash Builder 4.5 is the newest version) will break and take you to the line of code that is causing a problem. This is occuring because some object whose property you are trying to access is actually null.

You can browse up and down the call tree in the debug window (Window menu>debug) and that way you can find out which object is null.

Mostly this is happening because the dataprovider is not complete, i.e. some data is missing. for example one row might not have a previous day business price. If this is the case then you need to handle the null item in your formatUtil functions

var field:Object=item[column.dataField];
if(field!=null) {
    return format1.format(field);
} else {
    return "";
}

EDIT:
Also check these two lines:

setStyle("color", (data.PrevMonthEndDelta >= 5 || data.PrevMonthEndDelta <= -5) ? NEGATIVE_COLOR : POSITIVE_COLOR);

and

setStyle("color", (data.PreviousDateDelta >= 5 || data.PreviousDateDelta <= -5) ? NEGATIVE_COLOR : POSITIVE_COLOR);

It's possible that the error comes from data.PreviousDateDelta or data.PrevMonthEndDelta

Openair answered 12/9, 2011 at 7:4 Comment(5)
I changed my formatUtil functions with no effect, and as covered several times already I can remove the itemRenderer calls from the two problem lines with no effect.Hevesy
Did you run in debug mode? What was the line on which the app broke?Openair
I did, and the errors matched the dialog box I posted in my question. It didn't give me anything new, aside from taking me to the line in question. There aren't any errors from my main .mxml file in the list.Hevesy
...All of them. I think we're experiencing a failure to communicate; none of those error messages correspond to a line of code that I've written, because they all point to classes in the SDK.Hevesy
Just check that PreviousDatePrice and PreviousDateDelta are not null. If they are you might want to put in a default value for them in your classOpenair
A
0

Nothing stands out in the code as being bad.
Obviously, this is untested code.
I have a feeling your dataprovider is not complete or missing data. Probably due to 1 of these lines.

// no validation is being done so this can be a failure point
var Field:Object = item[column.dataField];
return format1.format(Field);
return format2.format(Field);

Here is some code you can try to test your dataprovider

import flash.debugger.enterDebugger;

private function formatUtil1(item:Object, column:DataGridColumn):String
{
  try{
    if (item[column.dataField] ){
      var Field:Object = item[column.dataField];
      var retVal:String = format1.format(Field)
      if( retVal == null || retVal == undefined ){
        //return '';
        enterDebugger()
      }
    }else{
      //return '';
      enterDebugger()
    }
  }catch(e:error){
    //return '';
    enterDebugger()
  }
  return retVal;
}

private function formatUtil2(item:Object, column:DataGridColumn):String
{
  try{
    if (item[column.dataField] ){
      var Field:Object = item[column.dataField];
      var retVal:String = format2.format(Field);
      if( retVal == null || retVal == undefined ){
        //return '';
        enterDebugger()
      }
    }else{
      //return '';
      enterDebugger()
    }
  }catch(e:error){
    //return '';
    enterDebugger()
  }
  return retVal;
}

The same thing can be applied to the renderers

package
{
    import mx.controls.Label;
    import mx.controls.listClasses.*;

    public class PME5 extends Label
    {
        private const POSITIVE_COLOR:uint = 0x000000; // Black
        private const NEGATIVE_COLOR:uint = 0xFF0000; // Red

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
// are you 100% sure data.PrevMonthEndDelta exists on the data object????

if (data != null && data.PreviousDateDelta ){
            setStyle("color", (data.PrevMonthEndDelta >= 5 || data.PrevMonthEndDelta <= -5) ? NEGATIVE_COLOR : POSITIVE_COLOR);
}
        }
    }
}
Algophobia answered 17/8, 2011 at 19:41 Comment(10)
I do need to institute some kind of validation in those functions, but the user has to manually initiate any kind of action by the application. This error occurs before the application even actually opens, and there's nothing in the offending DataGridColumns to display until the user hits a "go" button.Hevesy
ah then its the renderer data == null on the first run through, and as such data.PrevMonthEndDelta will not exist. Editing my postAlgophobia
I don't think that's the problem, because it doesn't explain why those very same renderers still work on other lines without issue.Hevesy
I don't know but I do know the first run through on renderers are always null I ran into this beforeJust give it a null test like i postedAlgophobia
Added the null checks, still have the issue.Hevesy
Try not adding a dataprovider lets verify that it is not it.Algophobia
As I indicated before, there is no dataProvider assigned to grid1 until the user starts the process.Hevesy
Inside the render for PD5 you are doing data.PreviousDateDelta it is not renderered yet so you need to do one more test before you can setstyle. if (data != null && data.PreviousDateDelta ) Like I suggested on the second comment on this answer. The column is not rendered yet if you don't believe me put PreviousDateDelta as the first column and take out the render for it and watchAlgophobia
Changed the if(data != null) lines to if(data != null && data.<appropriate reference> != null) in both PD5.as and PDE5.as and I still have the problem.Hevesy
I really don't know. What IDE are you using I will try to mimic your app and see what I get.Algophobia
A
0

This compiles fine here. Did not change anything but added default data.

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Script>
        <![CDATA[
            private function formatUtil1(item:Object, column:DataGridColumn):String
            {
                var Field:Object = item[column.dataField];
                return format1.format(Field);
            }

            private function formatUtil2(item:Object, column:DataGridColumn):String
            {
                var Field:Object = item[column.dataField];
                return format2.format(Field);
            }

            private function formatUtil3(item:Object, column:DataGridColumn):String
            {
                return formatUtil2(item, column);
            }
        ]]>
    </fx:Script>

    <fx:Declarations>
        <mx:NumberFormatter   id="format2" precision="2"/>
        <mx:CurrencyFormatter id="format1" precision="5" useNegativeSign="false"/>
    </fx:Declarations>

    <mx:DataGrid id="grid1" width="100%" height="100%" editable="false">

        <mx:ArrayCollection>
            <mx:source>
                <fx:Object
                    Symbol="€"
                    FullName="Name"
                    TransactionCode="121345"
                    Quantity="10"
                    ExecutionDate="10.10.2011"
                    ExecutionPrice="1.5"

                    PreviousDate="09.10.2011"
                    PreviousDatePrice="1.4"
                    PreviousDateDelta="10"
                    PreviousDateSource="0.1"

                    PrevMonthEndDate="0.1"
                    PrevMonthEndPrice="0.1"
                    PrevMonthEndDelta="-10"
                    PrevMonthEndSource="0.1"
                />
                <fx:Object
                    Symbol="€"
                    FullName="Name2"
                    TransactionCode="121345"
                    Quantity="10"
                    ExecutionDate="10.10.2011"
                    ExecutionPrice="1.5"

                    PreviousDate="09.10.2011"
                    PreviousDatePrice="1.4"
                    PreviousDateDelta="4"
                    PreviousDateSource="0.1"

                    PrevMonthEndDate="0.1"
                    PrevMonthEndPrice="0.1"
                    PrevMonthEndDelta="4"
                    PrevMonthEndSource="0.1"
                />
            </mx:source>
      </mx:ArrayCollection>

        <mx:columns>
            <mx:DataGridColumn headerText="Symbol"                      dataField="Symbol"             headerWordWrap="true" width="100" textAlign="left"/>
            <mx:DataGridColumn headerText="Description"                 dataField="FullName"           headerWordWrap="true" width="150" textAlign="left"/>
            <mx:DataGridColumn headerText="Trans"                       dataField="TransactionCode"    headerWordWrap="true" width="75"  textAlign="center"/>
            <mx:DataGridColumn headerText="Quantity"                    dataField="Quantity"           headerWordWrap="true" width="50"  textAlign="right"  labelFunction="formatUtil3"/>
            <mx:DataGridColumn headerText="Execution Date"              dataField="ExecutionDate"      headerWordWrap="true" width="80"  textAlign="center"/>
            <mx:DataGridColumn headerText="Execution Price"             dataField="ExecutionPrice"     headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil1"/>
            <mx:DataGridColumn width="15" backgroundColor="0x888888"    dataField="blank1" headerText=""/>
            <mx:DataGridColumn headerText="Previous Business Day"       dataField="PreviousDate"       headerWordWrap="true" width="80"  textAlign="center"                             itemRenderer="tmp.PD5"/>


            <mx:DataGridColumn headerText="Previous Business Day Price" dataField="PreviousDatePrice"  headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil1" itemRenderer="tmp.PD5"/>
            <mx:DataGridColumn headerText="% Difference"                dataField="PreviousDateDelta"  headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil2" itemRenderer="tmp.PD5"/>


            <mx:DataGridColumn headerText="Source"                      dataField="PreviousDateSource" headerWordWrap="true" width="100" textAlign="left"                               itemRenderer="tmp.PD5"/>
            <mx:DataGridColumn width="15" backgroundColor="0x888888"    dataField="blank2" headerText=""/>
            <mx:DataGridColumn headerText="Previous Month End"          dataField="PrevMonthEndDate"   headerWordWrap="true" width="80"  textAlign="center"                             itemRenderer="tmp.PME5"/>
            <mx:DataGridColumn headerText="Previous Month End Price"    dataField="PrevMonthEndPrice"  headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil1" itemRenderer="tmp.PME5"/>
            <mx:DataGridColumn headerText="% Difference"                dataField="PrevMonthEndDelta"  headerWordWrap="true" width="65"  textAlign="right"  labelFunction="formatUtil2" itemRenderer="tmp.PME5"/>
            <mx:DataGridColumn headerText="Source"                      dataField="PrevMonthEndSource" headerWordWrap="true" width="100" textAlign="left"                               itemRenderer="tmp.PME5"/>
        </mx:columns>
    </mx:DataGrid>


</s:Application>
About answered 9/9, 2011 at 8:57 Comment(0)
H
0

Since nothing so far has solved my problem, I decided to sidestep it altogether and port the program in question over to C#. Everything it working well so far.

Lazy answer? Yes.
Lazy solution? Unfortunately no.

Hevesy answered 18/10, 2011 at 14:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.