ClassCastException with JDK7U5 while using Iterator.

Hi All,
While i am trying to iterate through a raw Collection (without generics) which contains my business objects using Iterator. It is throwing ClassCastException when i am casting the Iterator's next value with expected object.
but when i replace Iterator with for(int i=0; i<collection.size();i++) loop its working fine and i am able to iterate the collection without any exception and i am able to cast my object with expected class type.
I am not sure why this is happening with JDK1.7u5 while the same code(with iterator) works fine in JDK1.6u31.
Please suggest me the solution or workaround for the same.
Thanks .

show your code.

Similar Messages

  • Compilation problem with templates while using option -m64

    Hi,
    I have compilation problem with template while using option -m64.
    No problem while using option -m32.
    @ uname -a
    SunOS snt5010 5.10 Generic_127111-11 sun4v sparc SUNW,SPARC-Enterprise-T5220
    $ CC -V
    CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25
    Here is some C++ program
    ############# foo5.cpp #############
    template <typename T, T N, unsigned long S = sizeof(T) * 8>
    struct static_number_of_ones
    static const T m_value = static_number_of_ones<T, N, S - 1>::m_value >> 1;
    static const unsigned long m_count = static_number_of_ones<T, N, S - 1>::m_count + (static_number_of_ones<T, N, S - 1>::m_value & 0x1);
    template <typename T, T N>
    struct static_number_of_ones<T, N, 0>
    static const T m_value = N;
    static const unsigned long m_count = 0;
    template <typename T, T N>
    struct static_is_power_of_2
    static const bool m_result = (static_number_of_ones<T,N>::m_count == 1);
    template <unsigned long N>
    struct static_number_is_power_of_2
    static const bool m_result = (static_number_of_ones<unsigned long, N>::m_count == 1);
    int main(int argc)
    int ret = 0;
    if (argc > 1)
    ret += static_is_power_of_2<unsigned short, 16>::m_result;
    ret += static_is_power_of_2<unsigned int, 16>::m_result;
    ret += static_is_power_of_2<unsigned long, 16>::m_result;
    ret += static_number_is_power_of_2<16>::m_result;
    else
    ret += static_is_power_of_2<unsigned short, 17>::m_result;
    ret += static_is_power_of_2<unsigned int, 17>::m_result;
    ret += static_is_power_of_2<unsigned long, 17>::m_result;
    ret += static_number_is_power_of_2<17>::m_result;
    return ret;
    Compiation:
    @ CC -m32 foo5.cpp
    // No problem
    @ CC -m64 foo5.cpp
    "foo5.cpp", line 20: Error: An integer constant expression is required here.
    "foo5.cpp", line 36: Where: While specializing "static_is_power_of_2<unsigned long, 16>".
    "foo5.cpp", line 36: Where: Specialized in non-template code.
    "foo5.cpp", line 26: Error: An integer constant expression is required here.
    "foo5.cpp", line 37: Where: While specializing "static_number_is_power_of_2<16>".
    "foo5.cpp", line 37: Where: Specialized in non-template code.
    "foo5.cpp", line 20: Error: An integer constant expression is required here.
    "foo5.cpp", line 43: Where: While specializing "static_is_power_of_2<unsigned long, 17>".
    "foo5.cpp", line 43: Where: Specialized in non-template code.
    "foo5.cpp", line 26: Error: An integer constant expression is required here.
    "foo5.cpp", line 44: Where: While specializing "static_number_is_power_of_2<17>".
    "foo5.cpp", line 44: Where: Specialized in non-template code.
    4 Error(s) detected.
    Predefined macro:
    @ CC -m32 -xdumpmacros=defs foo5.cpp | & tee log32
    @ CC -m64 -xdumpmacros=defs foo5.cpp | & tee log64
    @ diff log32 log64
    7c7
    < #define __TIME__ "09:24:58"
    #define __TIME__ "09:25:38"20c20
    < #define __sparcv8plus 1
    #define __sparcv9 1[snipped]
    =========================
    What is wrong?
    Thanks,
    Alex Vinokur

    Bug 6749491 has been filed for this problem. It will be visible at [http://bugs.sun.com] in a day or two.
    If you have a service contract with Sun, you can ask to have this bug's priority raised, and get a pre-release version of a compiler patch that fixes the problem.
    Otherwise, you can check for new patches from time to time at
    [http://developers.sun.com/sunstudio/downloads/patches/]
    and see whether this bug is listed as fixed.

  • I am facing lots of problems with security while using Mozilla. How can I send you a detailed report for this?

    I am getting redirected to unknown sites whenever I open any site while using mozilla. Initially I thought that there is a problem with my device, but then I realized that this happens only when using mozilla, not with other browsers like chrome, IE, or opera.
    These sites are mainly having the message 'Ad by ShopDrop'..
    I am pasting below links to few sites to which I get redirected to
    http://offers.bycontext<i></i>.com/scjs/tb/ctxjs/index<i></i>.php?kw2=www.espncricinfo<i></i>.com&affid=1151&subaff_id=725_724&intformat=roll&nextpage=http%3A%2F%2Fwww.espncricinfo<i></i>.com%2F&ch=421&sbrand=ShopDrop&folder=v4.19&typrd=ctx&cu=32929&country=IN&original_country=IN
    http://add0n<i></i>.com/fastest-gmail.html?v=0.1.6&p=0.1.5&type=upgrade

    hello, you have various malicious addons present. please perform all these steps:
    # [[Reset Firefox – easily fix most problems|reset firefox]] (this will keep your bookmarks and passwords)
    # afterwards go to the firefox menu ≡ > addons > extensions and in case there are still extensions listed there, disable them.
    # finally run a full scan of your system with different security tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] and [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] to make sure that adware isn't present in other places of your system as well.
    [[Troubleshoot Firefox issues caused by malware]]

  • I am having sound issues with Pottermore while using Safari 6.1. I once muted the sound and now can't unmute it even though the icon tells me it's unmated. I can hear samples of audio books in the store section.  Any ideas?

    I am having sound issues with the website Pottermore while using Safari 6.1. I once muted the sound and now can't unmute it even though the icon tells me it's unmuted. I can hear samples of audio books in the store section.  Any ideas? I have reset Safari.  Website works fine on Firefox.

    I am having sound issues with the website Pottermore while using Safari 6.1. I once muted the sound and now can't unmute it even though the icon tells me it's unmuted. I can hear samples of audio books in the store section.  Any ideas? I have reset Safari.  Website works fine on Firefox.

  • Java.lang.ClassCastException in Servle while using EJB

    I m trying to get a ejb instant in a servlet.I am using Blazix EJB server as a EJB contianer and Blazix Web server as servlet container.I get a java.lang.ClassCastException.
    I m using Demo bean with DemoHome as home interface and DemoBean as EJB name.
    The servlet code contains....
    Context initial = getInitialContext();
    Object objref = initial.lookup("DemoBean");
    DemoHome dhome =(DemoHome)PortableRemoteObject.narrow(objref,DemoHome.class);
                   demo = dhome.create();
    The printStackTrace is as follows
    java.lang.ClassCastException
    at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    at BeanServlet.init(BeanServlet.java:30)
    at desisoft.server.servlets.Servlet.init(Servlet.java:52)
    at desisoft.server.servlets.Context.getServletInstance(Context.java:1783
    at desisoft.server.servlets.Context.getContextInternalDispatcher(Context.java:2583)
    at desisoft.server.servlets.Context.getContextDispatcher(Context.java:2402)
    at desisoft.server.servlets.Context.getDispatcher(Context.java:2212)
    at desisoft.server.common.HttpStream.processRequest(HttpStream.java:617)
    at desisoft.server.conn.ServerThread.run(ServerThread.java:335)
    So please help me
    Regards
    Pravin

    I am having a similar issue with stratightforward client code ...
    I set properties values
    java.naming.provider.url=iiop://officepc:3700
    java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
    java.naming.factory.url.pkgs=com.sun.enterprise.naming
    in a properties file.
    When "Object objref = jndiContext.lookup( resourceId ) "
    returns,objref is resolved as a "com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1"
    instance. The "resourceId" is a String jndi-name for a Session Bean reference.
    When the "javax.rmi.PortableRemoteObject.narrow((java.lang.Object) objref, CartHome.class )"
    is called, the stack dumps:
    java.lang.ClassCastException
    at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    Any thoughts? I have tried everything, I think.
    HW

  • Insert with Select while Using Merge

    Actual Query
    MERGE INTO schema1.employees D
       USING (SELECT employee_id, salary, department_id FROM schema2.employees
       WHERE department_id = 80) S
       ON (D.employee_id = S.employee_id)
       WHEN MATCHED THEN
       UPDATE
       SET D.bonus = D.bonus + S.salary*.01
       WHERE (S.salary > 8000)
       WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
       VALUES (S.employee_id, S.salary*.01)
       WHERE (S.salary <= 8000) Is there a possible way to write a select Query in Insert Statement while using Merge.
      WHEN NOT MATCHED THEN
       INSERT
       SELECT * FROM schema2.employees
       WHERE S.salary <= 8000;

    it works:
    MERGE INTO fifapps.tes2
    using dual
    on (1=2)
    when not matched then insert values(59,'yes');
    commit;or
    MERGE INTO fifapps.tes2
    using dual
    on (1=2)
    when not matched then insert values ((select 99 from dual),(select'weii' from dual));
    commit;Edited by: ʃʃp on Jun 13, 2012 2:03 AM
    Edited by: ʃʃp on Jun 13, 2012 2:03 AM

  • OIM 11Unknown entity type Account with ID while using linkEventToUser() API

    I would like to link an recon event (which is in status "No User Match Found" ) to an user.The recon event is generated through target recon using reconciliation API
    I am using the API linkEventToUser() but getting the following error.
    <Error> <oracle.iam.reconciliation.impl> <IAM-5010000> <Generic Error/Information: {0}
    oracle.iam.reconciliation.exception.InvalidEventException: Unknown entity type Account with ID 2180,060
    From OIM web console if i check the Link button / option iin event management for this event is greyed out.
    There are already threads on this in the forum but they are old and no replies so i thought to post a fresh thread.
    I am also getting the same error while generating a new recon event.
    The strangest part is that this was working a few weeks back.
    Any help or idea how to proceed is highly appreciated.
    Thanks and Regards,
    Kungo.
    Edited by: Kungo on Oct 25, 2012 3:06 AM

    Any one saw this thread :)
    Is there a way to get attention on this thread from all the Gurus on this forum ?
    Please do let me know.
    Thanks and Regards,
    Kungo

  • Extended Notifications with Links while using Citrix to Access Hosted SAP

    Hello,
    I am working on a system which is hosted remotely where Citrix and Single signon are used to access the SAP instance.  I need to be able to send email to their Outlook server with executable links back to the workitems.  I had planned to use Extended Notifications to get this done.  I am fine with everything except for the Citrix link.  I am not sure whether the link in the email will be able to find its way through Citrix to the SAP instance.  I also need to know the SSO is going to work - it seems at a minimum they would need to sign on to Citrix.  Has anyone out there done this, or at least know whether it would/should/won't work?
    Thanks in advance for any help you can offer,
    Jeff Gray

    As far my knowledge, on Citrix it won't work. As far portal is concerned, it will work.
    Regards, IA

  • Can't register Shared Services with workspace while using db2 9.1

    Hi,
    When I used Hyperion EPM to register workspace shared services with db2 9.1 pack 3,it's failed and workspace database configuration failed too.
    When I used db2 9.5, it's failed too.But workspace database configuration is success. When I excute the sentence as follow
    ===================================================================================
    db2 CREATE DATABASE HPSUX USING CODESET GBK TERRITORY CN COLLATE USING SYSTEM
    db2 connect to HPSUX
    db2 create bufferpool HPSUX_BP immediate size 256 pagesize 8k
    db2 create bufferpool HPSUX_BP_TEMP immediate size 512 pagesize 8k
    db2 terminate
    db2 force application all
    db2stop
    db2start
    db2 connect to HPSUX
    db2 "create regular tablespace HPS_TS pagesize 8k managed by system using ('hps_ts') extentsize 16k overhead 10.5 prefetchsize 16k transferrate 0.33 bufferpool HPSUX_BP dropped table recovery on"
    db2 "create system temporary tablespace HPS_TS_TEMP pagesize 8k managed by system using ('hps_ts_temp') extentsize 16k overhead 10.5 prefetchsize 16k transferrate 0.33 bufferpool HPSUX_BP_TEMP"
    db2 grant connect on database to user hypadmin
    db2 grant createtab on database to user hypadmin
    db2 grant bindadd,implicit_schema on database to user hypadmin
    db2 grant use of tablespace HPS_TS to user hypadmin with grant option
    db2 "update dbm cfg using DRDA_HEAP_SZ 2048"
    db2 drop tablespace USERSPACE1
    db2 force application all
    db2stop
    db2start
    =================================
    It's all work with db2 9.5 but still failed with db2 9.1.
    Can someone give me the suggestion?
    Thanks
    Edited by: [email protected] on 2009-7-23 上午12:25

    Start in Shared Services
    What have you Provisioned your user with?
    Are there Projects Registered with Shared Services? Have you Assigned Users to those Projects?
    I would suggest you refer to the Hyperion Security Guide as a starting point
    http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/hyp_security_guide.pdf
    Wayne Van Sluys
    TopDown Consulting

  • [SOLVED] Tap Networking with QEMU, while Using WICD for Network

    I would like to set up tap networking with my QEMU system. I note that according to
    http://wiki.archlinux.org/index.php/QEM … _with_QEMU
    I am supposed to set up the network bridge to include my real adapter inside it. However, because I am using WICD, the actual adapter switches between eth0 and wlan0 depending on whether I am on ethernet or wifi. Does anyone know what my "bridge_br0=..." line in my /etc/rc.conf should look like to use either eth0 or wlan0? Thanks in advance for any help!
    Last edited by tony5429 (2009-07-24 19:43:36)

    Okay...I've made some progress on this problem but I'm still missing something... I've taken the following steps so far...
    1. I installed uml_utilities, iproute2, and parprouted
    2. I added tun to the modules array of /etc/rc.conf and rebooted
    3. Before running Qemu, I run the following commands as root
        sysctl net.ipv4.ip_forward=1
        tunctl -b -u (my user name)
        ifconfig tap0 up
        ip addr add 192.168.1.108/24 dev tap0
        parprouted wlan0 tap0
    4. I start Qemu with qemu-kvm -boot c -m 512 -hda /home/tony/win_xp.img -net nic,macaddr=36:7B:36:F7:F0:6F -net tap,ifname=tap0,script=no,downscript=no -localtime -k en-us -soundhw ac97 -vga std -full-screen (that mac address is the mac address for tap0)
    5. In Qemu, running 64-bit Windows XP, I changed the TCP/IP properties to use the static IP 192.168.1.108, subnet mask 255.255.255.0, default gateway 192.168.1.1, preferred DNS server 216.104.64.5, and alternate DNS server 216.104.72.5.
    6. After running Qemu, I shut down the interface running the following as root
        ifconfig tap0 down
        tunctl -d tap0 > /dev/null
        sysctl net.ipv4.ip_forward=0
        pkill parprouted
    However, I am still unable to see the outside network from the virtual system. Does anyone have any ideas on how to solve this problem? Any help is greatly appreciated...

  • Merging calendar with iCloud while using gmail account

    I have a me.com account that I never use - just bought it years ago when I got mobileme and my calendar has always synced easily from my mac to my iphone. I never read the info about the switch to icloud which is probably why I'm confused now. But all the sudden my iphone calendar isn't syncing with my mac calendar. The key is, I don't want to have to change my email to my "me.com" address to use the calendars. Also, would like to use notes but not sure I can without switching to me.com. Any suggestions?

    An iCloud email account is required to sync notes with iCloud.  You don't have to use the email account but it must be present on your phone.  Just create the account, then go to Settings>Mail,Contacts,Calendars>Default Account (in the Mail section) and make sure this is set to your Gmail account.  Then just ignore the iCloud email account.

  • Problem with locks while using iBATIS with MS Access through JDBC-ODBC brid

    Hello,
    I am attempting to use iBATIS to access MS Access file via JDBC-ODBC bridge.
    (I am using Spring's "SqlMapClientDaoSupport," but that is probably irrelevant)
    All this runs on Tomcat... First time DB gets accessed the LDB lock file is created. From there on the only way I can remove the lock file is to kill the JVM...
    Any help is greatly appreciated...

    And why is that a problem?

  • Monitor my Sound while using Voice Over?

    Hi all -- I have a problem using Final Cut Express 3.5 HD: Can I monitor my voice with headphones while using the voice over tool. So far I can hear the soundtracks of the material i am voicing over but not my own voice - and this is disturbing. Thanks in advance! Autogrill

    The ideal way is to do it on a tape recorder etc.
    (well away from the computer) and then import it, cut
    it and position it exactly where you want on the
    audio timeline.
    I use Audacity (excellent and free) to record my voiceovers while the project is running in View > Video out > Digital Cinema Display. This ensures that the voice is in sync and with the mike several feet away from the computer there is no noise. Save the voice from audacity as an AIFF file and drop it into the Timeline and adjust the position to sync it.
    Or, if I can't think fast enough and without ums and ahs, I record in blocks.

  • Static while using earphones?

    Hey guys,
    Just bought a 3GS off craigslist that is still under warranty til late August. Before I take it back to the genius, have you guys ever had a problem with static while using earbuds? I've tried 2 pairs and get the same static. I looked for the sticker in the jack to see if it was red, but didn't notice anything unusual. Maybe some excess lint.
    What does it sound like?
    Thanks

    I'd say genius bar, but you can also use a bluetooth headset to override the plugin. It's possible the plug hole was damaged by the previous user.

  • The demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.

    the demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.
    your recommended second option that i could add true/false case.
    this true/false case must be inside the for loop or outside the for loop?if this case is inside the for
    loop, how can i send stop command from outer while
    loop?
    more over do you have any example for this please?
    thanks"

    You can execute a fixed number of iterations using a while loop by comparing the iteration count to the number of iterations you want and wiring the output of that comparison (e.g. Less Than or Equal To) to the continue (or stop) terminal of your while loop. Which comparison you use depends on personal preference, where you wire the desired count and the interation count, and whether you're using the while loop as Continue if True or Stop if True.
    Ben gave you step-by-step instructions in response to your previous question. Look here for Ben's response.
    Ben's response looks pretty good and detailed to me. It certa
    inly deserved better than a 1-star rating.

Maybe you are looking for