Array casting: ClassCastException

import java.util.Vector;
public class X
public static void main(String args[])
     //first part
String [] array = {"1","2", "3"};
Object [] objs = array;
array = (String[])objs;
for( int i =0 ; i < array.length; i++)
System.out.println(array);
     //second part
Vector v = new Vector();
v.add("1");
v.add("2");
v.add("3");
objs = v.toArray();
array = (String[])objs;
for( int i =0 ; i < array.length; i++)
System.out.println(array[i]);
Why does the first part work properly but the second cause ClassCastException? Even if an array was instantiated as Object[] in toArray method casting MUST be ok. I work with an instances in array but not with array. An array only contains an objects I work with. It's only technical structure! Why does it cause ClassCastException?

>
Yes. I know it. The point is WHY it was done in this
way? What can I do with the type of array? NONE. The
actual information is CONTAINED in array. So array
is only technical structure. I can't derive it, it has
no virtual mechanisms. The actual objects I need are
stored in array. The type of them is important. It
looks like miss of language structure.
The basic question here is a fundamental part of polymorphism - you cannot cast an Object into one that it is not.
Object a = new Object();
String b = (String) a;That code will also compile, but it is just as incorrect as your code. The problem is that "a" will never be a String. There may be ways to convert it into a String, but the object a will always be of type "Object" and never extend String, so it cannot be cast.
Similarly, an array of type Object[] will always be of type Object[]. It cannot be cast to String[], because it will never have String[] as a superclass, if you will. The rules for working with arrays are exactly the same as working with the object which is the base type of the array.
In order to be able to do a cast from Object[] to String[], there would have to be a runtime check which would ensure that every element in the Object[] was, in fact, a String. But the cast check in the compiler is just looking up the extends and implements chains. If you want to implement a runtime cast, Java basically leaves that up to you.
And as has been mentioned, they do let you provide the array to be used as well.

Similar Messages

  • About array cast.

    dear all
    could someone tell me what's wrong with the following codes?
    Object objarr[]
    = {new Integer(1), new Integer(2)};
    Integer[] intarr = (Integer [])objarr;
    it throws out a java.lang.ClassCastException when i ran it. but doesn't the objarr actually represents a Integer array?
    regards
    Yang Liu

    In Java, all objects are by default of Object type. That means an Integer object is of Object type. Similarly a String object is of Object type.
    But if I give you an object of type Object, can u absolutely say whether it is an Integer or a String (ofcourse assuming u don't use relection etc) ? No you cannot..
    Simlarly when you have a Object array, you can put anything into that array, a String or an Integer etc. So u cannot be sure that an Object array always contains only Integer... That is y u get the class cast exception.....
    Ofcourse, this is just the inheritance concept... A BMW is a type of car.. but a car needn't be a type of BMW... it could be a Toyota instead or someting else...
    Integer[] intarr = {new Integer(1), new Integer(2)};
    Object[] objarr = (Object[]) intarr;
    the above code works well.. since all Integer (s) are of Object type in Java....
    Hope this helps

  • Array Cast Question Puzzling me

    The question below puzzles me. The answer states that the result is a class cast exception because o1 is an int [] [] not a int []
    But I thought the point of line 7 is to say "I know it is a 2D array but I want to cast it to a 1D array - I know I am losing precision here".
    Given:
    1. class Dims {
    2. public static void main(String[] args) {
    3. int[][] a = {{1,2,}, {3,4}};
    4. int[] b = (int[]) a[1];
    5. Object o1 = a;
    6. int[][] a2 = (int[][]) o1;
    7. int[] b2 = (int[]) o1;
    8. System.out.println(b[1]);
    9. } }
    What is the result?
    A. 2
    B. 4
    C. An exception is thrown at runtime
    D. Compilation fails due to an error on line 4.
    E. Compilation fails due to an error on line 5.
    F. Compilation fails due to an error on line 6.
    G. Compilation fails due to an error on line 7.
    Answer:
    3 C is correct. A ClassCastException is thrown at line 7 because o1 refers to an int[][]
    not an int[]. If line 7 was removed, the output would be 4.
    &#730; A, B, D, E, F, and G are incorrect based on the above. (Objective 1.3)

    While you could approximate casting a 2D array to a 1D array in C/C++ by just grabbing a pointer to your first array and then overrunning array bounds (relying on how C/C++ allocates 2D arrays and the lack of bounds checking), Java's strong typing and bounds checking makes this impossible.
    If you want to do something similar in Java, you will need to create a new 1D array of the proper size and copy the elements stored in your 2D array into this new array. That being said, a database is almost guaranteed to be a better solution.

  • Describe non-generic array cast in JLS3 as being unchecked

    This method :
        static <T, U extends T> U[] cast(T[] a) { return (U[]) a; }will generate the warning: [unchecked] unchecked cast, found: T[], required: U[].
    And it should. Wouldn't it be appropriate if
        static Object[] cast(String[] a) { return (String[]) a; }would produce the same warning?
    If you do that, you could translate the declaration
      T[] at = new T[255]
      String[] as = new String[255]into
    Array<T> at = Array.<T>newInstance(255);
    Array<String> as = Array.<String>newInstance(String.class, 255);where java.lang.reflect.Array would be something like
    package java.lang.reflect.Array;
    public final class Array<T> implements Iterable<T> {
        public final int length;
        private Type memberType;
        private Array(Type memberType, int length) {
            this.memberType = memberType;
            this.length = length;
        public native T getMember(int i);
        public native void setMember(int i, T member);
        public native java.util.Iterator<T> iterator();
       public static <U> Array<U> newInstance(int length) {
           return new Array<U>(null, length);
       public static <U> Array<U> newInstance(Class<U> memberClass, int length) {
           return new Array<U>(memberClass, length);

    Sorry, I created a bad example. It should have been:
        static <T, U extends T> T[] cast(U[] a) { return (T[]) a; }and
        static Object[] cast(String[] a) { return (Object[]) a; }The point is that an array of String is different from an array of Object and casts between them is unsafe. Throwing an ArrayStoreException if the wrong type is assigned is just a workaround for lack generic types in pre-Tiger Java. Now that we will have generics, I think it would be appropriate if Java arrays would be treated as proper generic types. For those that are afraid of breaking backwards compatiblility, the erasure mechanism should be able to take care of that.

  • WHY IS array CASTING NOT WORKING ?

    data object:
    class myData extends BaseData
    class x
    BaseData[] lData = null;
    setData(BaseData[] aData)
         lData = aData;          
    getData(BaseData[] aData)
    return lData;     
    class y
    myData[] a = new myData[];
    x xx = new x();      
    xx.setData(a);
    xx = (myData[])xx.getData(); <---casting doesnt work !!               
    }

    well IData IS an array so that's not the problem
    The problem is that an array is an object with its own inheritance but it has no knowledge of the inheritance of the objects it contains. So String[] does not extends Object[] even though String extends Object. But all 4 extends Object :)
    run this little to see to what interfaces/classes you can cast your arrays:
    public class Test {
         public static void main(String[] args) {
              Class cl = args.getClass();
              Class[] interfaces = cl.getInterfaces();
              System.out.println( "classes and super-classes" );
              while (cl != null) {
                   System.out.println( "    "+cl );
                   cl = cl.getSuperclass();
              System.out.println( "interfaces" );
              for (int i = interfaces.length; i-->0; )
                   System.out.println( "    "+interfaces[i] );
    }

  • Array Casting in java

    Hi,
    I am new to java.Last day Can I cast an arrays in java?For example casting an Object array to a String array or an integer array to a long one.If yes, then what are the rules and restrictions for casting arrays.I tried to google it, but I could not find any useful material.Could any one give me some links where I can get some useful material,books,mock tests etc. regarding preparation for SCJP 1.6?.Please help.
    Thanks in advance

    This is the Berkeley DB, Java Edition forum, and you should post only post questions about that product here. I think you may be looking for basic Java language information, and there are many other websites that can give you that information.

  • A problem of array casting.

    import java.util.*;
    public class array{
    public static void main(String[] args){
    ArrayList array = new ArrayList ();
    array.add("aa");
    array.add("bb");
    array.add("cc");
    String[] arr = new String[array.size() -1];
    arr = (String[])array.toArray();
    complie is ok.while i run it
    Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object;
    how can i do? thanks!

    An array of Objects is not an array of Strings even if every element of the array is a String.
    Instead of
    arr = (String[])array.toArray();consider using
    arr = new String [array.size()];
    array.toArray (arr);Vlad.

  • Array casting

    How can I make the following code work ??
    void function() {
    Object [] object = new Object[ 5 ];
    for( int i=0; i<object.length; i++ )
    object[ i ] = new Integer( i );
    Integer [] integer = (Integer [])object;
    since I "know" that all the contents of the object array are integers, can I convert the whole array to an integer array without the following {
    Integer [] integer = new Integer[ object.length ];
    for( int i=0; i<integer.length; i++ )
    integer[ i ] = (Integer)object[ i ];

    Hi ,
    Just try this way ..
    void function()
    Object [] object = new Object[ 5 ];
    for( int i=0; i<object.length; i++ )
    object[ i ] = new Integer( i );
    Object[] integer = new Integer[5];
    integer=object;
    Instead of defining as Integer [] integer , it works if the placeholder is Object insead of integer.
    Not sure if u were looking for stgh like this.
    Hope it helps.

  • Arrays, Casting and instanceof, Polymorphism

    Having Problems with my programme it compiles but I can't get anything to output when I add a Warden, Rest of code available if you want to compile
    Thankyou
    import java.util.*;
    public class Prison
         private ArrayList <Person> thePersons;
         private String n;
         private int numPrisoners;
         private int numHRPrisoners;
         private int numWardens;
         private int numAllPrisoners;
         private String prisonName;
         private int numAllPrison = (numWardens + numAllPrisoners);
         public Prison (String nameofprison, int numPrisoners, int numHRPrisoners, int numAllPrisoners, int numWardens)
              n = nameofprison;
              numPrisoners = 0;
              numHRPrisoners = 0;
              numAllPrisoners = 0;
              numWardens = 0;
              thePersons = new ArrayList <Person> ();
              public void addPrisoner (Person newPerson)
                   numPrisoners++;
                   numAllPrisoners++;
                   thePersons.add(newPerson);
              public void addHRPrisoner (Person newPerson)
                   numHRPrisoners++;
                   numAllPrisoners++;
                   thePersons.add(newPerson);
              public void addWarden (Person newPerson)
                   numWardens++;     
                   thePersons.add(newPerson);
              public void DisplayPrisoners()
                   System.out.println("Prisoners:");
                        for ( int i =0; i<(numAllPrison); ++i)
                             if (thePersons.get(i) instanceof Prisoner)
                                  System.out.println(thePersons.get(i ).toString());
              public void DisplayWardens()
                   System.out.println("Wardens:");
                        for ( int i =0; i<(numAllPrison); ++i)
                             if (thePersons.get(i) instanceof Warden)
                                  System.out.println(thePersons.get(i ).toString());
              public void DisplayHRPrisoner()
                   System.out.println("High Risk Prisoner:");
                        for ( int i =0; i<(numAllPrison); ++i)
                             if (thePersons.get(i) instanceof HRPrisoner)
                                  System.out.println(thePersons.get(i ).toString());
         //id for later eneter in keyboard     
         public void DisplayPrisonerID(String id)
              Iterator itr = thePersons.iterator();
              while(itr.hasNext())
                   Person nextPersons = (Person)itr.next();
                   if (nextPersons instanceof HRPrisoner)
                        Prisoner p = (Prisoner)nextPersons;
                        if(p.getPrisonerID() == id);
                                  System.out.println(nextPersons);
         public void ReleasePrisoner(int id)
              Iterator itr = thePersons.iterator();
              while(itr.hasNext())
                   Person nextPersons = (Person)itr.next();
                   if (nextPersons instanceof Warden)
                        Prisoner p = (Prisoner)nextPersons;
                        if(p.getDaysLeft() <= 7);
                             System.out.println(nextPersons);
                             System.out.println("Prisoner released");
    This is not 100% complete but the Warden bit is upto where I have a problem
    import java.util.*;
    public class TestPrison2
         public static void main (String[] args)
              //delare everything eg from Prisoner etc
              String thePrisonerID;
              String theName;
              String theSurname;
              String theDOB;
              String theSex;
              int theDaysLeft = 0;
              String prisonerID;
              int daysleft = 0;
              String n;
              int numPrisoners;
              int numHRPrisoners = 0;
              int numWardens = 0;
              int numAllPrisoners = 0;
              int theSecurityLevel;
              String theShareCell;
              String prisonName;
              int wardenRank;
              Prison HMEssex = new Prison("HMEssex",0,0,0,0);
              //public TestPrison ();
              // Prison Boring = new Prison();
              int cmd = 1;
              //While(cmd !=0) menu bit with switchy bit at the end
              while (cmd!=0)
                   System.out.println("1 Add new Warden");
                   System.out.println("2 Add new Prisoner");
                   System.out.println("3 Add HR Prisoner");
                   System.out.println("4 View all Prisoners");
                   System.out.println("5 View all Wardens");
                   System.out.println("6 View Prisoner by ID");
                   System.out.println("7 Release Prisoner");
                   System.out.println("8 Exit");
                   //Scanner bits
                   Scanner kybd = new Scanner(System.in);
                   //make a huge switch statement, delare bollocks
                   //switch (int cmd)
                   cmd = 1;
                   // add Warden
                   System.out.println("Enter selection");
                   cmd = kybd.nextInt();
                   switch(cmd)
                        case 1:
                             String a;
                             System.out.println("Enter Warden name");
                             a = kybd.next();
                             //Warden kybd.next() = new Warden;
                             System.out.println("Enter First Name");
                             String b = kybd.next();
                             System.out.println("Enter Surname");
                             String c = kybd.next();
                             System.out.println("Enter DOB");
                             String d = kybd.next();
                             System.out.println("Enter Gender");
                             String e = kybd.next();
                             System.out.println("Enter Rank");
                             int f = kybd.nextInt();
                             Person warden = new Warden(b,c,d,e,f);
                             HMEssex.addWarden(warden);
                             break;
                        //add a Prisoner
                        case 2:
                             if (numAllPrisoners / 5 < numWardens)
                                  String a;
                                  System.out.println("Enter Prisoner name");
                                  a = kybd.next();
                                  //Prisoner kybd.nextString() = new Prisoner;
                                  System.out.println("Enter PrisonerID");
                                  String b = kybd.next();
                                  System.out.println("Enter First Name");
                                  String c = kybd.next();
                                  System.out.println("Enter Surname");
                                  String d = kybd.next();
                                  System.out.println("Enter DOB");
                                  String e = kybd.next();
                                  System.out.println("Enter Gender");
                                  String f = kybd.next();
                                  System.out.println("Enter days left in prison");
                                  int g = kybd.nextInt();
                                  Prisoner xb = new Prisoner(b,c,d,e,f,g);
                                  HMEssex.addPrisoner (xb);
                             else
                                  System.out.println("Not enough Wardens");
                                  System.out.println("");
                             break;
                        //add a HRPrisoner
                        case 3:
                             if (numHRPrisoners /4 < numWardens)
                                  String a;
                                  System.out.println("Enter Prisoner name");
                                  a = kybd.next();
                                  //HRPrisoner kybd.nextString() = new HRPrisoner;
                                  System.out.println("Enter PrisonerID");
                                  String b = kybd.next();
                                  System.out.println("Enter First Name");
                                  String c = kybd.next();
                                  System.out.println("Enter Surname");
                                  String d = kybd.next();
                                  System.out.println("Enter DOB");
                                  String e = kybd.next();
                                  System.out.println("Enter Gender");
                                  String f = kybd.next();
                                  System.out.println("Enter days left in prison");
                                  int g = kybd.nextInt();
                                  System.out.println("Enter security level");
                                  int h = kybd.nextInt();
                                  System.out.println("Enter if they can share a cell Yes/No");
                                  String i = kybd.next();
                                  HRPrisoner ac = new HRPrisoner(b,c,d,e,f,g,h,i);
                                  HMEssex.addHRPrisoner(ac);
                                  break;
                             else
                                  System.out.println("Not enough Wardens");
                                  System.out.println("");
                        //view Prisoners
                        case 4:
                             HMEssex.DisplayPrisoners();
                             break;
                        //view Wardens     
                        case 5:
                             HMEssex.DisplayWardens();
                             break;
                        //Search for Prisoner by ID               
                        case 6:
                             break;
                        //Release a Prisoner                    
                        case 7:
                             if (daysleft < 7)
                             break;
                        //exit programme
                        case 8:
                             System.exit(0);
                        default:
                        System.out.println("Not an option please choose again");
    }

    Next time post code like this. What your program intends to do and what it does now.
    import java.util.*;
    public class Prison
    private ArrayList <Person> thePersons;
    private String n;
    private int numPrisoners;
    private int numHRPrisoners;
    private int numWardens;
    private int numAllPrisoners;
    private String prisonName;
    private int numAllPrison = (numWardens + numAllPrisoners);
    public Prison (String nameofprison, int numPrisoners, int numHRPrisoners, int numAllPrisoners, int numWardens)
    n = nameofprison;
    numPrisoners = 0;
    numHRPrisoners = 0;
    numAllPrisoners = 0;
    numWardens = 0;
    thePersons = new ArrayList <Person> ();
    public void addPrisoner (Person newPerson)
    numPrisoners++;
    numAllPrisoners++;
    thePersons.add(newPerson);
    public void addHRPrisoner (Person newPerson)
    numHRPrisoners++;
    numAllPrisoners++;
    thePersons.add(newPerson);
    public void addWarden (Person newPerson)
    numWardens++;
    thePersons.add(newPerson);
    public void DisplayPrisoners()
    System.out.println("Prisoners:");
    for ( int i =0; i<(numAllPrison); ++i)
    if (thePersons.get(i) instanceof Prisoner)
    System.out.println(thePersons.get(i ).toString());
    public void DisplayWardens()
    System.out.println("Wardens:");
    for ( int i =0; i<(numAllPrison); ++i)
    if (thePersons.get(i) instanceof Warden)
    System.out.println(thePersons.get(i ).toString());
    public void DisplayHRPrisoner()
    System.out.println("High Risk Prisoner:");
    for ( int i =0; i<(numAllPrison); ++i)
    if (thePersons.get(i) instanceof HRPrisoner)
    System.out.println(thePersons.get(i ).toString());
    //id for later eneter in keyboard
    public void DisplayPrisonerID(String id)
    Iterator itr = thePersons.iterator();
    while(itr.hasNext())
    Person nextPersons = (Person)itr.next();
    if (nextPersons instanceof HRPrisoner)
    Prisoner p = (Prisoner)nextPersons;
    if(p.getPrisonerID() == id);
    System.out.println(nextPersons);
    public void ReleasePrisoner(int id)
    Iterator itr = thePersons.iterator();
    while(itr.hasNext())
    Person nextPersons = (Person)itr.next();
    if (nextPersons instanceof Warden)
    Prisoner p = (Prisoner)nextPersons;
    if(p.getDaysLeft() <= 7);
    System.out.println(nextPersons);
    System.out.println("Prisoner released");
    This is not 100% complete but the Warden bit is upto where I have a problem
    import java.util.*;
    public class TestPrison2
    public static void main (String[] args)
    //delare everything eg from Prisoner etc
    String thePrisonerID;
    String theName;
    String theSurname;
    String theDOB;
    String theSex;
    int theDaysLeft = 0;
    String prisonerID;
    int daysleft = 0;
    String n;
    int numPrisoners;
    int numHRPrisoners = 0;
    int numWardens = 0;
    int numAllPrisoners = 0;
    int theSecurityLevel;
    String theShareCell;
    String prisonName;
    int wardenRank;
    Prison HMEssex = new Prison("HMEssex",0,0,0,0);
    //public TestPrison ();
    // Prison Boring = new Prison();
    int cmd = 1;
    //While(cmd !=0) menu bit with switchy bit at the end
    while (cmd!=0)
    System.out.println("1 Add new Warden");
    System.out.println("2 Add new Prisoner");
    System.out.println("3 Add HR Prisoner");
    System.out.println("4 View all Prisoners");
    System.out.println("5 View all Wardens");
    System.out.println("6 View Prisoner by ID");
    System.out.println("7 Release Prisoner");
    System.out.println("8 Exit");
    //Scanner bits
    Scanner kybd = new Scanner(System.in);
    //make a huge switch statement, delare ********
    //switch (int cmd)
    cmd = 1;
    // add Warden
    System.out.println("Enter selection");
    cmd = kybd.nextInt();
    switch(cmd)
    case 1:
    String a;
    System.out.println("Enter Warden name");
    a = kybd.next();
    //Warden kybd.next() = new Warden;
    System.out.println("Enter First Name");
    String b = kybd.next();
    System.out.println("Enter Surname");
    String c = kybd.next();
    System.out.println("Enter DOB");
    String d = kybd.next();
    System.out.println("Enter Gender");
    String e = kybd.next();
    System.out.println("Enter Rank");
    int f = kybd.nextInt();
    Person warden = new Warden(b,c,d,e,f);
    HMEssex.addWarden(warden);
    break;
    //add a Prisoner
    case 2:
    if (numAllPrisoners / 5 < numWardens)
    String a;
    System.out.println("Enter Prisoner name");
    a = kybd.next();
    //Prisoner kybd.nextString() = new Prisoner;
    System.out.println("Enter PrisonerID");
    String b = kybd.next();
    System.out.println("Enter First Name");
    String c = kybd.next();
    System.out.println("Enter Surname");
    String d = kybd.next();
    System.out.println("Enter DOB");
    String e = kybd.next();
    System.out.println("Enter Gender");
    String f = kybd.next();
    System.out.println("Enter days left in prison");
    int g = kybd.nextInt();
    Prisoner xb = new Prisoner(b,c,d,e,f,g);
    HMEssex.addPrisoner (xb);
    else
    System.out.println("Not enough Wardens");
    System.out.println("");
    break;
    //add a HRPrisoner
    case 3:
    if (numHRPrisoners /4 < numWardens)
    String a;
    System.out.println("Enter Prisoner name");
    a = kybd.next();
    //HRPrisoner kybd.nextString() = new HRPrisoner;
    System.out.println("Enter PrisonerID");
    String b = kybd.next();
    System.out.println("Enter First Name");
    String c = kybd.next();
    System.out.println("Enter Surname");
    String d = kybd.next();
    System.out.println("Enter DOB");
    String e = kybd.next();
    System.out.println("Enter Gender");
    String f = kybd.next();
    System.out.println("Enter days left in prison");
    int g = kybd.nextInt();
    System.out.println("Enter security level");
    int h = kybd.nextInt();
    System.out.println("Enter if they can share a cell Yes/No");
    String i = kybd.next();
    HRPrisoner ac = new HRPrisoner(b,c,d,e,f,g,h,i);
    HMEssex.addHRPrisoner(ac);
    break;
    else
    System.out.println("Not enough Wardens");
    System.out.println("");
    //view Prisoners
    case 4:
    HMEssex.DisplayPrisoners();
    break;
    //view Wardens
    case 5:
    HMEssex.DisplayWardens();
    break;
    //Search for Prisoner by ID
    case 6:
    break;
    //Release a Prisoner
    case 7:
    if (daysleft < 7)
    break;
    //exit programme
    case 8:
    System.exit(0);
    default:
    System.out.println("Not an option please choose again");
    }

  • ClassCastException on CommandBean

    Hello all,
    I have Entity and Stateless Session Beans working properly once tested via web services. And I created a command bean to call the methods.
    The SessionBean returns a wrapper class array.
    ClassCastException's here: temp_record = (BusinessUnitLocal) itr.next(); // CLASS CAST EXCEPTION
    What are the possible issues that I need to look into to fix this?
    Please help. Thank you.
    Here's my commandbean declaration:
    private BusinessUnitSessionLocal localBUnit = null;
    private BusinessUnitSessionLocalHome localHomeBUnit = null;
    try{
    localHomeBUnit = (BusinessUnitSessionLocalHome) icontext.lookup(
         "localejbs/BusinessUnitSessionBean");
    localBUnit = localHomeBUnit.create();
    }catch (NamingException e) {
    //             TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (CreateException e) {
                   //             TODO Auto-generated catch block
                   e.printStackTrace();
    //method call
    public void findAllBusinessUnit() {
              Collection records = new ArrayList();
              BusinessUnitWrapper record = null;
              BusinessUnitLocal temp_record = null;
              records = new ArrayList(Arrays.asList(localBUnit.findAll()));
              Iterator itr = records.iterator();
              while (itr.hasNext()) {
                   *temp_record = (BusinessUnitLocal) itr.next(); // CLASS CAST EXCEPTION*
                   record = new BusinessUnitWrapper();
                   record.setBusinessUnitID(temp_record.getBusinessUnitID());
                   record.setBusinessUnitName(temp_record.getBusinessUnitName());
                   record.setBusinessUnitStatus(temp_record.getBusinessUnitStatus());
                   outputBUnit.add(record);

    Hello Sergei,
    Thank you for the prompt response.
    Here's my code for the findAll method:
    public BusinessUnitWrapper[] findAll() {
              ArrayList buList = new ArrayList();
              Collection val = null;
              BusinessUnitWrapper buWrapper = new BusinessUnitWrapper();
              try {
                   val = localHome.findAll();
                   for (Iterator iterator = val.iterator(); iterator.hasNext();) {
                        BusinessUnitLocal data = (BusinessUnitLocal) iterator.next();
                        buWrapper = convertToBUWrapper(data);
                        buList.add(buWrapper);
                   //TicketWrapper[] result = new TicketWrapper[tickets.size()];
                   //tickets.toArray(result);
                   BusinessUnitWrapper[] result =
                        new BusinessUnitWrapper[buList.size()];
                   buList.toArray(result);
                   return result;
              } catch (FinderException ex) {
                   ex.printStackTrace();
              return null;

  • ClassCastException in Tomcat 4.1. Pointing to old HttpsURLConnection

    Hi There
    My servlet casts ClassCastException when I try to craete HttpsURLConnection instance from URL.openConnection(). Here are the facts.
    OS = Linux RH 8.0
    JDK Version = 1.4.2
    Tomcat Version = 4.1
    $JAVA_HOME is set to the JDK 1.4.2
    Here's the code:
    URL u = new URL("https://url/to/the/site");
    javax.net.ssl.HttpsURLConnection connection = (javax.net.ssl.HttpsURLConnection)u.openConnection();
    This causes ClassCastException.
    Then I found out that the URL.openConnection() is acutually returning an instance of com.sun.net.ssl.HttpsURLConnection. And this is what is causing this problem.
    So my qustion is how I can point Tomcat to use javax.net.ssl.HttpsURLConnection instead of old com.sun.net.ssl.HttpsURLConnection.
    JAVA_HOME is set to the newest version of JDK (1.4.2) and I don't know whereelse Tomcat looks for files... Do I have to change the conf files?
    I would greatly appreciate your help.
    Michi

    hello Michi,
    I am assuming that you are using the TOMCAT that comes with Java Web Services Developer's pack from java.sun.com. First DownLoad and install the JDK in question (the one that you want catalina to use). Then set the value of JAVA_HOME in the catalina.sh file in the <CATALINA_HOME>/bin folder. Just tinker with it for sometime, trying to set the JAVA_HOME variable. This should be enough to change your java.home to the new JDK.
    IF that does not work, then you may have to change the system 'path' variable as well. That should do it.
    First try out the first one. Try the second one only if the first one does not work.
    all the best,
    Pawan

  • C has no arrays! (on the heap)

    CC can't do this?
    int iary[] = (int[])iary_padr
    Who could imagine such a thing, if it didn't exist already? K&R's "stdc" appendix 6.8.2 iterates some drivel about static initializers, proposing a convenient (sic) workaround (sic) for dynamic memory
    iary[cc] <==> *(iary_padr+cc)
    This situation is plainly absurd. Someone has (very successfully) played a hideous joke on this language, and to the great benefit of their resume. One is left to replace clean array syntax with bug-prone, unreadable pointer arithmetic? what's the compiler for?
    the compiler helps one to avoid bugs by writing simpler expressions than available in a lower level language (asm).
    "As simple as possible, but no simpler." Which in this case means having array syntax, rather than not.
    Originally, "int[]" was syntactically and semantically identical to "int*" in parameter passing. This is C. We need to recognize that the standardizers have persued another language -- a higher level language, and one which would not have have pointers, ultimately, but some handle or object concept.
    How can the C programming language not be able to access the heap using array syntax?
    Sun folks need to JUST SAY NO to this absurdity. it necessarily won't break any code anywhere if CC were to allow array casts. If standardizers break the language, ignore them! No one needs this nonsensical jibberish for anything.
    John

    Hi,
    You may scan using the HP All-In-One Remote app, available for the App Store.
    You may find a step by step instructions below:
    http://support.hp.com/us-en/document/c02486319/
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Flex sdk incremental build will lose swc information

    I have a mxmlc ant task job like this
            <mxmlc 
            file="${trunk_dir}/main/src/main.mxml"
            output="${local_tmp}/app/bin/main.swf"
                      >    
                <load-config filename="${basedir}/flex-config-sea.xml"/>
                <source-path path-element="${FLEX_HOME}/frameworks"/>
            </mxmlc>
    in flex-config-sea.xml I put this in for incremental compile and swc build
          <include-libraries>
             <library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/Mate_08_9.swc</library>
             <library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/xprogress.swc</library>
             <library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/component.swc</library>
          </include-libraries>
          <incremental>true</incremental>
    the first time build is ok, but the second time after I changed one single file, the output is
    [mxmlc] Loading configuration file /opt/cruisecontrol-bin-2.8.4/projects/cc/flex-config-sea.xml
        [mxmlc] Recompile: /opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/src/C.as
        [mxmlc] Reason: The source file or one of the included files has been updated.
        [mxmlc] Files changed: 1 Files affected: 0
        [mxmlc] Required RSLs:
        [mxmlc]     textLayout_2.0.0.232.swz with 1 failover.
        [mxmlc]     framework_4.6.0.23201.swz with 1 failover.
        [mxmlc]     rpc_4.6.0.23201.swz with 1 failover.
        [mxmlc]     mx_4.6.0.23201.swz with 1 failover.
        [mxmlc]     spark_4.6.0.23201.swz with 1 failover.
        [mxmlc]     sparkskins_4.6.0.23201.swz with 1 failover.
        [mxmlc] /tmp/sea_local/app/bin/main.swf (426617 bytes)
    but the output swf is complaining lack of some swc when running, which didn't show up in the first time
    ReferenceError: Error #1065: Variable _shared_maps_GlobalMapWatcherSetupUtil is not defined.
              at global/flash.utils::getDefinitionByName()
              at shared.maps::GlobalMap()
              at main/_main_GlobalMap1_i()
              at main()
              at _main_mx_managers_SystemManager/create()
              at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()
              at mx.managers::SystemManager/initializeTopLevelWindow()
              at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()
              at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()
              at flash.events::EventDispatcher/dispatchEventFunction()
              at flash.events::EventDispatcher/dispatchEvent()
              at mx.preloaders::Preloader/timerHandler()
              at flash.utils::Timer/_timerDispatch()
              at flash.utils::Timer/tick()
    this message normally shows up when there's no Mate_08_9.swc found at runtime. but this shouldn't happen.
    is there anyway to work around this? thanks a lot
    here is the full flex-config-sea.xml:
    <flex-config>
       <!-- benchmark: output performance benchmark-->
       <!-- benchmark usage:
       <benchmark>boolean</benchmark>
       -->
       <compiler>
          <!-- compiler.accessible: generate an accessible SWF-->
          <accessible>true</accessible>
          <!-- compiler.actionscript-file-encoding: specifies actionscript file encoding. If there is no BOM in the AS3 source files, the compiler will use this file encoding.-->
          <!-- compiler.actionscript-file-encoding usage:
          <actionscript-file-encoding>string</actionscript-file-encoding>
          -->
          <!-- compiler.allow-source-path-overlap: checks if a source-path entry is a subdirectory of another source-path entry. It helps make the package names of MXML components unambiguous.-->
          <allow-source-path-overlap>false</allow-source-path-overlap>
          <!-- compiler.as3: use the ActionScript 3 class based object model for greater performance and better error reporting. In the class based object model most built-in functions are implemented as fixed methods of classes.-->
          <as3>true</as3>
          <!-- compiler.compress usage:
          <compress>boolean</compress>
          -->
          <!-- compiler.context-root: path to replace {context.root} tokens for service channel endpoints-->
          <!-- compiler.context-root usage:
          <context-root>context-path</context-root>
          -->
          <!-- compiler.debug: generates a movie that is suitable for debugging-->
          <debug>false</debug>
          <!-- compiler.defaults-css-files usage:
          <defaults-css-files>
             <filename>string</filename>
             <filename>string</filename>
          </defaults-css-files>
          -->
          <!-- compiler.defaults-css-url: defines the location of the default style sheet. Setting this option overrides the implicit use of the defaults.css style sheet in the framework.swc file.-->
          <!-- compiler.defaults-css-url usage:
          <defaults-css-url>string</defaults-css-url>
          -->
          <!-- compiler.define: define a global AS3 conditional compilation definition, e.g. -define=CONFIG::debugging,true or -define+=CONFIG::debugging,true (to append to existing definitions in flex-config.xml) -->
          <!-- compiler.define usage:
          <define>
             <name>string</name>
             <value>string</value>
             <value>string</value>
          </define>
          -->
          <!-- compiler.enable-runtime-design-layers usage:
          <enable-runtime-design-layers>boolean</enable-runtime-design-layers>
          -->
          <!-- compiler.es: use the ECMAScript edition 3 prototype based object model to allow dynamic overriding of prototype properties. In the prototype based object model built-in functions are implemented as dynamic properties of prototype objects.-->
          <es>false</es>
          <extensions>
             <!-- compiler.extensions.extension usage:
             <extension>
                <extension>string</extension>
                <parameters>string</parameters>
             </extension>
             -->
          </extensions>
          <!-- compiler.external-library-path: list of SWC files or directories to compile against but to omit from linking-->
          <external-library-path>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/player/11.1/playerglobal.swc</path-element>
          </external-library-path>
          <fonts>
             <!-- compiler.fonts.advanced-anti-aliasing: enables advanced anti-aliasing for embedded fonts, which provides greater clarity for small fonts.-->
             <advanced-anti-aliasing>true</advanced-anti-aliasing>
             <!-- compiler.fonts.flash-type: enables FlashType for embedded fonts, which provides greater clarity for small fonts.-->
             <!-- compiler.fonts.flash-type usage:
             <flash-type>boolean</flash-type>
             -->
             <languages>
                <!-- compiler.fonts.languages.language-range: a range to restrict the number of font glyphs embedded into the SWF-->
                <!-- compiler.fonts.languages.language-range usage:
                <language-range>
                   <lang>string</lang>
                   <range>string</range>
                   <range>string</range>
                </language-range>
                -->
             </languages>
             <!-- compiler.fonts.local-font-paths usage:
             <local-font-paths>
                <path-element>string</path-element>
                <path-element>string</path-element>
             </local-font-paths>
             -->
             <!-- compiler.fonts.local-fonts-snapshot: File containing system font data produced by flex2.tools.FontSnapshot.-->
             <!-- compiler.fonts.managers: Compiler font manager classes, in policy resolution order-->
             <managers>
                <manager-class>flash.fonts.JREFontManager</manager-class>
                <manager-class>flash.fonts.BatikFontManager</manager-class>
                <manager-class>flash.fonts.AFEFontManager</manager-class>
                <manager-class>flash.fonts.CFFFontManager</manager-class>
             </managers>
             <!-- compiler.fonts.max-cached-fonts: sets the maximum number of fonts to keep in the server cache.  The default value is 20.-->
             <max-cached-fonts>20</max-cached-fonts>
             <!-- compiler.fonts.max-glyphs-per-face: sets the maximum number of character glyph-outlines to keep in the server cache for each font face. The default value is 1000.-->
             <max-glyphs-per-face>1000</max-glyphs-per-face>
          </fonts>
          <!-- compiler.headless-server: a flag to set when Flex is running on a server without a display-->
          <!-- compiler.headless-server usage:
          <headless-server>boolean</headless-server>
          -->
          <!-- compiler.include-libraries: a list of libraries (SWCs) to completely include in the SWF-->
          <!-- compiler.include-libraries usage:
          <include-libraries>
             <library>string</library>
             <library>string</library>
          </include-libraries>
          -->
          <include-libraries>
             <library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/Mate_08_9.swc</library>
             <library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/xprogress.swc</library>
             <library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/component.swc</library>
          </include-libraries>
          <!-- compiler.incremental: enables incremental compilation-->
          <!-- compiler.incremental usage:
          <incremental>boolean</incremental>
          -->
          <incremental>true</incremental>
          <!-- compiler.isolate-styles: enables the compiled application or module to set styles that only affect itself and its children-->
          <!-- compiler.isolate-styles usage:
          <isolate-styles>boolean</isolate-styles>
          -->
          <!-- compiler.keep-all-type-selectors: disables the pruning of unused CSS type selectors-->
          <!-- compiler.keep-all-type-selectors usage:
          <keep-all-type-selectors>boolean</keep-all-type-selectors>
          -->
          <!-- compiler.keep-as3-metadata: keep the specified metadata in the SWF-->
          <!-- compiler.keep-as3-metadata usage:
          <keep-as3-metadata>
             <name>string</name>
             <name>string</name>
          </keep-as3-metadata>
          -->
          <!-- compiler.keep-generated-actionscript: save temporary source files generated during MXML compilation-->
          <keep-generated-actionscript>false</keep-generated-actionscript>
          <!-- compiler.library-path: list of SWC files or directories that contain SWC files-->
          <library-path>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/flash-integration.swc</path-element>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/authoringsupport.swc</path-element>
             <path-element>/opt/flexsdk/4.6.0/frameworks/locale/{locale}</path-element>
          </library-path>
          <!-- compiler.locale: specifies the locale for internationalization-->
          <locale>
             <locale-element>en_US</locale-element>
          </locale>
          <!-- compiler.minimum-supported-version usage:
          <minimum-supported-version>string</minimum-supported-version>
          -->
          <!-- compiler.mobile: specifies the target runtime is a mobile device-->
          <mobile>false</mobile>
          <mxml>
             <!-- compiler.mxml.compatibility-version: specifies a compatibility version. e.g. -compatibility-version=2.0.1-->
             <!-- compiler.mxml.compatibility-version usage:
             <compatibility-version>version</compatibility-version>
             -->
             <!-- compiler.mxml.minimum-supported-version usage:
             <minimum-supported-version>string</minimum-supported-version>
             -->
             <!-- compiler.mxml.qualified-type-selectors usage:
             <qualified-type-selectors>boolean</qualified-type-selectors>
             -->
          </mxml>
          <namespaces>
             <!-- compiler.namespaces.namespace: Specify a URI to associate with a manifest of components for use as MXML elements-->
             <namespace>
                <uri>http://ns.adobe.com/mxml/2009</uri>
                <manifest>/opt/flexsdk/4.6.0/frameworks/mxml-2009-manifest.xml</manifest>
             </namespace>
             <namespace>
                <uri>library://ns.adobe.com/flex/spark</uri>
                <manifest>/opt/flexsdk/4.6.0/frameworks/spark-manifest.xml</manifest>
             </namespace>
             <namespace>
                <uri>library://ns.adobe.com/flex/mx</uri>
                <manifest>/opt/flexsdk/4.6.0/frameworks/mx-manifest.xml</manifest>
             </namespace>
             <namespace>
                <uri>http://www.adobe.com/2006/mxml</uri>
                <manifest>/opt/flexsdk/4.6.0/frameworks/mxml-manifest.xml</manifest>
             </namespace>
          </namespaces>
          <!-- compiler.omit-trace-statements: toggle whether trace statements are omitted-->
          <omit-trace-statements>true</omit-trace-statements>
          <!-- compiler.optimize: Enable post-link SWF optimization-->
          <optimize>true</optimize>
          <!-- compiler.preloader: Specifies the default value for the Application's preloader attribute. If not specified, the default preloader value is mx.preloaders.SparkDownloadProgressBar when -compatibility-version >= 4.0 and mx.preloaders.DownloadProgressBar when -compatibility-version < 4.0.-->
          <!-- compiler.preloader usage:
          <preloader>string</preloader>
          -->
          <!-- compiler.report-invalid-styles-as-warnings: enables reporting of invalid styles as warnings-->
          <!-- compiler.report-invalid-styles-as-warnings usage:
          <report-invalid-styles-as-warnings>boolean</report-invalid-styles-as-warnings>
          -->
          <!-- compiler.report-missing-required-skin-parts-as-warnings: Use this option to generate a warning instead of an error when a missing required skin part is detected.-->
          <!-- compiler.report-missing-required-skin-parts-as-warnings usage:
          <report-missing-required-skin-parts-as-warnings>boolean</report-missing-required-skin-parts-as-warnings>
          -->
          <!-- compiler.services: path to Flex Data Services configuration file-->
          <!-- compiler.services usage:
          <services>filename</services>
          -->
          <!-- compiler.show-actionscript-warnings: runs the AS3 compiler in a mode that detects legal but potentially incorrect code-->
          <show-actionscript-warnings>true</show-actionscript-warnings>
          <!-- compiler.show-binding-warnings: toggle whether warnings generated from data binding code are displayed-->
          <show-binding-warnings>true</show-binding-warnings>
          <!-- compiler.show-invalid-css-property-warnings: toggle whether invalid css property warnings are reported-->
          <!-- compiler.show-invalid-css-property-warnings usage:
          <show-invalid-css-property-warnings>boolean</show-invalid-css-property-warnings>
          -->
          <!-- compiler.show-shadowed-device-font-warnings: toggles whether warnings are displayed when an embedded font name shadows a device font name-->
          <show-shadowed-device-font-warnings>false</show-shadowed-device-font-warnings>
          <!-- compiler.show-unused-type-selector-warnings: toggle whether warnings generated from unused CSS type selectors are displayed-->
          <show-unused-type-selector-warnings>true</show-unused-type-selector-warnings>
          <!-- compiler.source-path: list of path elements that form the roots of ActionScript class hierarchies-->
          <source-path>
          </source-path>
          <!-- compiler.strict: runs the AS3 compiler in strict error checking mode.-->
          <strict>true</strict>
          <!-- compiler.theme: list of CSS or SWC files to apply as a theme-->
          <!-- compiler.use-resource-bundle-metadata: determines whether resources bundles are included in the application.-->
          <use-resource-bundle-metadata>true</use-resource-bundle-metadata>
          <!-- compiler.verbose-stacktraces: save callstack information to the SWF for debugging-->
          <verbose-stacktraces>false</verbose-stacktraces>
          <!-- compiler.warn-array-tostring-changes: Array.toString() format has changed.-->
          <warn-array-tostring-changes>false</warn-array-tostring-changes>
          <!-- compiler.warn-assignment-within-conditional: Assignment within conditional.-->
          <warn-assignment-within-conditional>true</warn-assignment-within-conditional>
          <!-- compiler.warn-bad-array-cast: Possibly invalid Array cast operation.-->
          <warn-bad-array-cast>true</warn-bad-array-cast>
          <!-- compiler.warn-bad-bool-assignment: Non-Boolean value used where a Boolean value was expected.-->
          <warn-bad-bool-assignment>true</warn-bad-bool-assignment>
          <!-- compiler.warn-bad-date-cast: Invalid Date cast operation.-->
          <warn-bad-date-cast>true</warn-bad-date-cast>
          <!-- compiler.warn-bad-es3-type-method: Unknown method.-->
          <warn-bad-es3-type-method>true</warn-bad-es3-type-method>
          <!-- compiler.warn-bad-es3-type-prop: Unknown property.-->
          <warn-bad-es3-type-prop>true</warn-bad-es3-type-prop>
          <!-- compiler.warn-bad-nan-comparison: Illogical comparison with NaN. Any comparison operation involving NaN will evaluate to false because NaN != NaN.-->
          <warn-bad-nan-comparison>true</warn-bad-nan-comparison>
          <!-- compiler.warn-bad-null-assignment: Impossible assignment to null.-->
          <warn-bad-null-assignment>true</warn-bad-null-assignment>
          <!-- compiler.warn-bad-null-comparison: Illogical comparison with null.-->
          <warn-bad-null-comparison>true</warn-bad-null-comparison>
          <!-- compiler.warn-bad-undefined-comparison: Illogical comparison with undefined.  Only untyped variables (or variables of type *) can be undefined.-->
          <warn-bad-undefined-comparison>true</warn-bad-undefined-comparison>
          <!-- compiler.warn-boolean-constructor-with-no-args: Boolean() with no arguments returns false in ActionScript 3.0.  Boolean() returned undefined in ActionScript 2.0.-->
          <warn-boolean-constructor-with-no-args>false</warn-boolean-constructor-with-no-args>
          <!-- compiler.warn-changes-in-resolve: __resolve is no longer supported.-->
          <warn-changes-in-resolve>false</warn-changes-in-resolve>
          <!-- compiler.warn-class-is-sealed: Class is sealed.  It cannot have members added to it dynamically.-->
          <warn-class-is-sealed>true</warn-class-is-sealed>
          <!-- compiler.warn-const-not-initialized: Constant not initialized.-->
          <warn-const-not-initialized>true</warn-const-not-initialized>
          <!-- compiler.warn-constructor-returns-value: Function used in new expression returns a value.  Result will be what the function returns, rather than a new instance of that function.-->
          <warn-constructor-returns-value>false</warn-constructor-returns-value>
          <!-- compiler.warn-deprecated-event-handler-error: EventHandler was not added as a listener.-->
          <warn-deprecated-event-handler-error>false</warn-deprecated-event-handler-error>
          <!-- compiler.warn-deprecated-function-error: Unsupported ActionScript 2.0 function.-->
          <warn-deprecated-function-error>true</warn-deprecated-function-error>
          <!-- compiler.warn-deprecated-property-error: Unsupported ActionScript 2.0 property.-->
          <warn-deprecated-property-error>true</warn-deprecated-property-error>
          <!-- compiler.warn-duplicate-argument-names: More than one argument by the same name.-->
          <warn-duplicate-argument-names>true</warn-duplicate-argument-names>
          <!-- compiler.warn-duplicate-variable-def: Duplicate variable definition -->
          <warn-duplicate-variable-def>true</warn-duplicate-variable-def>
          <!-- compiler.warn-for-var-in-changes: ActionScript 3.0 iterates over an object's properties within a "for x in target" statement in random order.-->
          <warn-for-var-in-changes>false</warn-for-var-in-changes>
          <!-- compiler.warn-import-hides-class: Importing a package by the same name as the current class will hide that class identifier in this scope.-->
          <warn-import-hides-class>true</warn-import-hides-class>
          <!-- compiler.warn-instance-of-changes: Use of the instanceof operator.-->
          <warn-instance-of-changes>true</warn-instance-of-changes>
          <!-- compiler.warn-internal-error: Internal error in compiler.-->
          <warn-internal-error>true</warn-internal-error>
          <!-- compiler.warn-level-not-supported: _level is no longer supported. For more information, see the flash.display package.-->
          <warn-level-not-supported>true</warn-level-not-supported>
          <!-- compiler.warn-missing-namespace-decl: Missing namespace declaration (e.g. variable is not defined to be public, private, etc.).-->
          <warn-missing-namespace-decl>true</warn-missing-namespace-decl>
          <!-- compiler.warn-negative-uint-literal: Negative value will become a large positive value when assigned to a uint data type.-->
          <warn-negative-uint-literal>true</warn-negative-uint-literal>
          <!-- compiler.warn-no-constructor: Missing constructor.-->
          <warn-no-constructor>false</warn-no-constructor>
          <!-- compiler.warn-no-explicit-super-call-in-constructor: The super() statement was not called within the constructor.-->
          <warn-no-explicit-super-call-in-constructor>false</warn-no-explicit-super-call-in-constructor>
          <!-- compiler.warn-no-type-decl: Missing type declaration.-->
          <warn-no-type-decl>true</warn-no-type-decl>
          <!-- compiler.warn-number-from-string-changes: In ActionScript 3.0, white space is ignored and '' returns 0. Number() returns NaN in ActionScript 2.0 when the parameter is '' or contains white space.-->
          <warn-number-from-string-changes>false</warn-number-from-string-changes>
          <!-- compiler.warn-scoping-change-in-this: Change in scoping for the this keyword.  Class methods extracted from an instance of a class will always resolve this back to that instance.  In ActionScript 2.0 this is looked up dynamically based on where the method is invoked from.-->
          <warn-scoping-change-in-this>false</warn-scoping-change-in-this>
          <!-- compiler.warn-slow-text-field-addition: Inefficient use of += on a TextField.-->
          <warn-slow-text-field-addition>true</warn-slow-text-field-addition>
          <!-- compiler.warn-unlikely-function-value: Possible missing parentheses.-->
          <warn-unlikely-function-value>true</warn-unlikely-function-value>
          <!-- compiler.warn-xml-class-has-changed: Possible usage of the ActionScript 2.0 XML class.-->
          <warn-xml-class-has-changed>false</warn-xml-class-has-changed>
       </compiler>
       <!-- debug-password: the password to include in debuggable SWFs-->
       <!-- debug-password usage:
       <debug-password>string</debug-password>
       -->
       <!-- default-background-color: default background color (may be overridden by the application code)-->
       <default-background-color>0xFFFFFF</default-background-color>
       <!-- default-frame-rate: default frame rate to be used in the SWF.-->
       <default-frame-rate>24</default-frame-rate>
       <!-- default-script-limits: default script execution limits (may be overridden by root attributes)-->
       <default-script-limits>
          <max-recursion-depth>1000</max-recursion-depth>
          <max-execution-time>60</max-execution-time>
       </default-script-limits>
       <!-- default-size: default application size (may be overridden by root attributes in the application)-->
       <default-size>
          <width>500</width>
          <height>375</height>
       </default-size>
       <!-- externs: a list of symbols to omit from linking when building a SWF-->
       <!-- externs usage:
       <externs>
          <symbol>string</symbol>
          <symbol>string</symbol>
       </externs>
       -->
       <frames>
          <!-- frames.frame: A SWF frame label with a sequence of classnames that will be linked onto the frame.-->
          <!-- frames.frame usage:
          <frame>
             <label>string</label>
             <classname>string</classname>
          </frame>
          -->
       </frames>
       <framework>halo</framework>
       <!-- include-inheritance-dependencies-only: only include inheritance dependencies of classes specified with include-classes -->
       <!-- include-inheritance-dependencies-only usage:
       <include-inheritance-dependencies-only>boolean</include-inheritance-dependencies-only>
       -->
       <!-- include-resource-bundles: a list of resource bundles to include in the output SWC-->
       <!-- include-resource-bundles usage:
       <include-resource-bundles>
          <bundle>string</bundle>
          <bundle>string</bundle>
       </include-resource-bundles>
       -->
       <!-- includes: a list of symbols to always link in when building a SWF-->
       <!-- includes usage:
       <includes>
          <symbol>string</symbol>
          <symbol>string</symbol>
       </includes>
       -->
       <!-- link-report: Output a XML-formatted report of all definitions linked into the application.-->
       <!-- link-report usage:
       <link-report>filename</link-report>
       -->
       <!-- load-config: load a file containing configuration options-->
       <!-- load-externs: an XML file containing <def>, <pre>, and <ext> symbols to omit from linking when building a SWF-->
       <!-- load-externs usage:
       <load-externs>filename</load-externs>
       -->
       <metadata>
          <!-- metadata.contributor: A contributor's name to store in the SWF metadata-->
          <!-- metadata.contributor usage:
          <contributor>name</contributor>
          -->
          <!-- metadata.creator: A creator's name to store in the SWF metadata-->
          <creator>darkhutgme</creator>
          <!-- metadata.date: The creation date to store in the SWF metadata-->
          <!-- metadata.date usage:
          <date>text</date>
          -->
          <!-- metadata.description: The default description to store in the SWF metadata-->
          <description></description>
          <!-- metadata.language: The language to store in the SWF metadata (i.e. EN, FR)-->
          <language>EN</language>
          <!-- metadata.localized-description: A localized RDF/XMP description to store in the SWF metadata-->
          <!-- metadata.localized-description usage:
          <localized-description>
             <text>string</text>
             <lang>string</lang>
             <lang>string</lang>
          </localized-description>
          -->
          <!-- metadata.localized-title: A localized RDF/XMP title to store in the SWF metadata-->
          <!-- metadata.localized-title usage:
          <localized-title>
             <title>string</title>
             <lang>string</lang>
             <lang>string</lang>
          </localized-title>
          -->
          <!-- metadata.publisher: A publisher's name to store in the SWF metadata-->
          <publisher>darkhutgame</publisher>
          <!-- metadata.title: The default title to store in the SWF metadata-->
          <title>GAME</title>
       </metadata>
       <!-- raw-metadata: XML text to store in the SWF metadata (overrides metadata.* configuration)-->
       <!-- raw-metadata usage:
       <raw-metadata>text</raw-metadata>
       -->
       <!-- remove-unused-rsls: remove RSLs that are not being used by the application-->
       <remove-unused-rsls>true</remove-unused-rsls>
       <!-- resource-bundle-list: prints a list of resource bundles to a file for input to the compc compiler to create a resource bundle SWC file. -->
       <!-- resource-bundle-list usage:
       <resource-bundle-list>filename</resource-bundle-list>
       -->
       <!-- runtime-shared-libraries: a list of runtime shared library URLs to be loaded before the application starts-->
       <!-- runtime-shared-libraries usage:
       <runtime-shared-libraries>
          <url>string</url>
          <url>string</url>
       </runtime-shared-libraries>
       -->
       <!-- runtime-shared-library-path: specifies a SWC to link against, an RSL URL to load, with an optional policy file URL and optional failover URLs -->
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/textLayout.swc</path-element>
          <rsl-url>textLayout_2.0.0.232.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/osmf.swc</path-element>
          <rsl-url>osmf_1.0.0.16316.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/osmf_1.0.0.16316.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/framework.swc</path-element>
          <rsl-url>framework_4.6.0.23201.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/framework_4.6.0.23201.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/charts.swc</path-element>
          <rsl-url>charts_4.6.0.23201.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/charts_4.6.0.23201.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/rpc.swc</path-element>
          <rsl-url>rpc_4.6.0.23201.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/rpc_4.6.0.23201.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/mx/mx.swc</path-element>
          <rsl-url>mx_4.6.0.23201.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/mx_4.6.0.23201.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/advancedgrids.swc</path-element>
          <rsl-url>advancedgrids_4.6.0.23201.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/advancedgrids_4.6.0.23201.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/spark.swc</path-element>
          <rsl-url>spark_4.6.0.23201.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/spark_4.6.0.23201.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/spark_dmv.swc</path-element>
          <rsl-url>spark_dmv_4.6.0.23201.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/spark_dmv_4.6.0.23201.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-path>
          <path-element>/opt/flexsdk/4.6.0/frameworks/libs/sparkskins.swc</path-element>
          <rsl-url>sparkskins_4.6.0.23201.swz</rsl-url>
          <policy-file-url></policy-file-url>
          <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/sparkskins_4.6.0.23201.swz</rsl-url>
          <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
       </runtime-shared-library-path>
       <runtime-shared-library-settings>
          <!-- runtime-shared-library-settings.application-domain: override the application domain an RSL is loaded into. The supported values are 'current', 'default', 'parent', or 'top-level'.-->
          <application-domain>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/textLayout.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/osmf.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/framework.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/charts.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/rpc.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/mx/mx.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/advancedgrids.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/spark.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/spark_dmv.swc</path-element>
             <application-domain-target>default</application-domain-target>
             <path-element>/opt/flexsdk/4.6.0/frameworks/libs/sparkskins.swc</path-element>
             <application-domain-target>default</application-domain-target>
          </application-domain>
          <!-- runtime-shared-library-settings.force-rsls: force an RSL to be loaded, overriding the removal caused by using the remove-unused-rsls option-->
          <!-- runtime-shared-library-settings.force-rsls usage:
          <force-rsls>
             <path-element>string</path-element>
             <path-element>string</path-element>
          </force-rsls>
          -->
       </runtime-shared-library-settings>
       <!-- size-report: Output an XML-formatted report detailing the size of all code and data linked into the application.-->
       <!-- size-report usage:
       <size-report>filename</size-report>
       -->
       <!-- static-link-runtime-shared-libraries: statically link the libraries specified by the -runtime-shared-libraries-path option.-->
       <static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>
       <!-- swf-version: specifies the version of the compiled SWF file.-->
       <swf-version>14</swf-version>
       <!-- target-player: specifies the version of the player the application is targeting. Features requiring a later version will not be compiled into the application. The minimum value supported is "9.0.0".-->
       <target-player>11.1.0</target-player>
       <!-- tools-locale: specifies the locale used by the compiler when reporting errors and warnings.-->
       <!-- tools-locale usage:
       <tools-locale>string</tools-locale>
       -->
       <!-- use-direct-blit: Use hardware acceleration to blit graphics to the screen, where such acceleration is available.-->
       <!-- use-direct-blit usage:
       <use-direct-blit>boolean</use-direct-blit>
       -->
       <!-- use-gpu: Use GPU compositing features when drawing graphics, where such acceleration is available.-->
       <!-- use-gpu usage:
       <use-gpu>boolean</use-gpu>
       -->
       <!-- use-network: toggle whether the SWF is flagged for access to network resources-->
       <use-network>true</use-network>
       <!-- verify-digests: verifies the libraries loaded at runtime are the correct ones.-->
       <verify-digests>true</verify-digests>
       <!-- warnings: toggle the display of warnings-->
       <!-- warnings usage:
       <warnings>boolean</warnings>
       -->
    </flex-config>

    Somewhere in your pom.xml where you are configuring your build dependancies there will be a line <scope>caching</scope> this line is configuring the build to use a flex runtime shared library. This line is generating the error because caching is not a valid dependancy scope in maven 3 however mojos uses it anyway. There was a defect opened against flexmojos; I've linked it below. Froeder's response to the issue was that it was not fixable, that the warning is expected and that we'll have to live with it for now.
    https://issues.sonatype.org/browse/FLEXMOJOS-363?page=com.atlassian.jira.plugin.system.iss uetabpanels%3Achangehistory-tabpanel

  • Run through UI Elements

    Hi
    I want to define change Eventlistener for all elements in a
    mxml component dynamically ( myUI.mxml).
    I tried this inside a class that extends canvas:
    _ui = new myUI()
    this.addChild(_ui);
    for(var i in _ui){
    _ui
    .addEventListener(Event.CHANGE, valueChanged);
    but the "for in" loop doesn`t do anything.
    is there a way to run through all children/properties of a
    mxml component?
    thanks for help!
    muzi

    _ui is a new UI component you created and added. You
    shouldn't be looping through it.
    You can use:
    this.getChildren() ;
    It returns an array of UI components that are children of
    your component. You can then loop through that array, cast each
    element as a 'DisplayObject' and add event listeners to it.
    Also helpful is:
    getChildAt(index:int);
    Returns a DisplayObject object at position 'index'.

  • Bazaar 'specified property not found' error that I cannot get around - LV 6i

    Hiya folks,
    I'm unfortunately stuck with making enhancements to a dinosaur application in LV 6i and am running into a strange issue I can't wrap my head around.
    I have a VI that takes as input a single reference to an array of strict-type clusters.  I would like to access the control references of each control in each element of that array.  Using the standard (or what I believe to be the standard) VI server approach to breaking this down, I am able to get down to a single element of the array, cast it to a strict-type cluster reference, finally exposing an array of control references via a property node (see the attached image).  This is all fine and dandy until I attempt to access that array of control references.  So, referring to the image, the upper thread yields no error in "error out", however the scenario in the lower thread does.
    If I attempt to access ANY other property in that final property node that has nothing to do with references, then everything works great.
    Anybody have any ideas?  Suggestions? Is the fact that these clusters are strict type def that's preventing me from moving forward (the only scenario I have not tested as of yet)?
    Sr Software and Automation Engineer
    Certified LabVIEW Architect
    Kod Integrations, LLC
    http://www.kodintegrations.com
    Attachments:
    vi_server_error.jpg ‏162 KB

    My Nugget on Exploiting Control references should be useful. The attached VIs will too new for you to use but I beilve I posted screen shots of everything. The one limitaion that I can warn you about that will prevent you from duplicating those techniques in LV 6i is how I handled Clusters of arrays, of clusters or arrays.... etc. LV 8 or there-abouts added the ability to do complex recursive calls (A cals B that calls A...) But you shouldbe able to code around that detail or ignore it completely if your data structure will never be that complex. Here is a preview of what you will find in that Nugget.
    Just trying to help,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

Maybe you are looking for

  • Unable to install Windows 7! Black screen?

    Unable to install Windows 7! Black screen? Hey everyone! Some background info: I built my computer ~2 years ago and it worked fine for about half a year, until it crashed. Since then I've been unable to reinstall Windows and I kinda forgot about it..

  • Need Help In Flash/Flex Line Charts...Output should be like stock exchange chart

    Hello Friends, I need a small help from you guys. I want to do a line chart example in flash cs3 or in flex. Actually my requirement is getting the data from external file ie xml and with that i want to display a line chart with some time interval ju

  • Can anyone actually answer this?

    Hi, I'm Mike Federali. For about a year now I have been looking to get iTunes to pick up my music for their online store. I DO NOT want to go through an outside source like CD Baby, etc. Frankly, I just don't trust sites like that. I've been involved

  • Drive Genius 3 LE - how to defrag?

    Hey all, I recently bought Drive Genius 3 LE from the App Store. Using a MBP 15".  It won't let me defrag the HD. There's a big red exclamation point that says "Can not defrag this drive".  I was thinking of booting the computer from my USB HDD which

  • CSA causing WMI issues?

    We are using Cisco Security Agent 5.1.0.79. We have 491 clients, mostly Win XP. We have noticed that within 3 days of CSA installation on a PC, WMI quits working. If you try to connect to a PC using wmimgmt.msc, you get the message: "Failed to connec