IndexOutOfBounds Exception at List.append

Hi, I'm writing akind of tree view control for MIDP2 using a class derived from lcdui.List.
I am using JRE 1.5.0.11 and WTK 2.5.2. But the program crashes with an exception.
I have a custom class derived from List. Lets say i have 10items in the list. If the user chooses select from the custom menu, the fontface of the item at getSelectedIndex will changed to bold, italics to display the slecetion. After a new tree node is expanded, all items will be deleted and new list items will be added to the list, lets say 20items.
Then at the call of this.append, index 10 an IndexOutOfBOunds exception occurs, wich is exactlz one more than the last index of the list before. If I comment out only the line where the Font face is changed and getSelectionIndex is called, everything's running fine.
As a work around Ive tried to unselect all items before deleting, but it doesnt work.
So, it seems as if the List class still "thinks" that the number of items in the LIst is 10 but when I append a 11th item, the exception will be thrown.
I hope anyone can help!
Thanks, Jan

I reported this bug on 13 Nov 2007 following these discussions:
{color:0000ff}http://forum.java.sun.com/thread.jspa?threadID=5235145{color}
I am yet to receive the 7-digit bug ID from Sun.
db

Similar Messages

  • Java.lang.indexoutofbound Exception

    HI all
    i am trying to convert multiple jpg images to single tiff image..i am getting an exception that is
    "java.lang.indexoutofbound Exception"..can anyone help me
    import com.sun.media.imageio.plugins.tiff.TIFFImageWriteParam;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.Locale;
    import javax.imageio.IIOImage;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.ImageWriteParam;
    import javax.imageio.ImageWriter;
    import javax.imageio.metadata.IIOMetadata;
    import javax.imageio.stream.ImageInputStream;
    import javax.imageio.stream.ImageOutputStream;
    public class mergeImages
    public void execute(ArrayList<File> imageFiles , File newTIFF)
    throws IOException
    Iterator iterator = imageFiles.iterator();
    Iterator writers = ImageIO.getImageWritersByFormatName("tif");
    ImageWriter writer = (ImageWriter)writers.next();
    ImageOutputStream ios = ImageIO.createImageOutputStream(newTIFF);
    writer.setOutput(ios);
    TIFFImageWriteParam tiffWriteParam = new TIFFImageWriteParam(Locale.US);
    tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    tiffWriteParam.setCompressionType("JPEG");
    boolean firstImage = true;
    while (iterator.hasNext())
    File imageFile = (File) iterator.next();
    ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
    Iterator readers = ImageIO.getImageReaders(iis);
    ImageReader reader = (ImageReader)readers.next();
    reader.setInput(iis);
    try
    for(int i = 0;i<imageFiles.size();i++)
    IIOMetadata iioImageMetadata = reader.getImageMetadata(i);
    int imageHeight = reader.getHeight(i);
    int imageWidth = reader.getWidth(i);
    tiffWriteParam.setTilingMode(ImageWriteParam.MODE_EXPLICIT);
    tiffWriteParam.setTiling(imageWidth, imageHeight, 0, 0);
    BufferedImage bi = reader.read(i, null);
    IIOImage image = new IIOImage(bi, null, iioImageMetadata);
    if(firstImage==false)
    writer.writeInsert(-1,image, tiffWriteParam);
    else {
    writer.write(null, image, tiffWriteParam);
    firstImage = false;
    catch (Exception e)
    System.out.println("Exxxxxxxxx"+e);
    reader.dispose();
    writer.dispose();
    public static void main(String[] args)throws IOException
    ArrayList filesList=new ArrayList();
    File destFile = new File("c:\\TEST.tif");
    //your logic to get the list of files.
    // set the file list to 'filesList'
    File in1 = new File("c:\\a.jpg");
    File in2 = new File("c:\\b.jpg");
    filesList.add(0,in1);
    filesList.add(1,in2);
    mergeImages mI=new mergeImages();
    mI.execute(filesList,destFile);
    }

    To expand on that a little, so that you get better information next time:
    This line tells you what, ultimately, failed.
    java.lang.IndexOutOfBoundsExceptionYou then get the stack trace from most recent method called to least recent method called. The most recent method will contain the line of code that actually failed, but as here may be in an external library:
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:448)The last external package after your own code will be the method call that failed. Here you were calling the getImageMetadata() method of the com.sun.imageio.plugins.jpeg.JPEGImageReader class. Documentation on this class is available from the [Sun API documentation|http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/ImageReader.html] .
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.getImageMetadata(JPEGImageReader.java:851)The next entry indicates which line of your own code failed. Here it was line 45 which is within a method called execute (mediocre name - it should describe what it's doing, execute is too abstract) of your own class called mergeImagesHCL (also a poor name - classes should always start with a capital letter):
    at mergeImagesHCL.execute(mergeImagesHCL.java:45)The rest of the stack trace tells you how you got there - here by calling mergeImagesHCL at line 84 of the main method of the same class:
    at mergeImagesHCL.main(mergeImagesHCL.java:84)Stack traces tell you exactly what line of code your error is on, what you were calling when it failed, and why it failed. Use them.

  • Hundreds of blocked cookies that used to be in my "exceptions" privacy list are now gone/erased. Where did they go? Where on my computer is the list?

    Hundreds of blocked cookies and "allow for session only" cookies that used to be in my "exceptions" privacy list are now gone/erased. Where did they go? Where on my computer is the list? This list tooks years to accumulate and I tried to find the file that contained the list so I could save it or copy it but I never could. Is this list somewhere on my computer so I can restore it?

    I found that after Firefox v29, a LOT of my settings and<BR>
    add-ons were changed / reset. Try this;
    '''''[https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode Start Firefox in Safe Mode]'''''
    <BR>While you are in safe mode;<BR>
    '''''Firefox Options > Advanced > General'''''.<BR>
    Look for and turn off '''Use Hardware Acceleration'''.<BR>
    Then check ALL of your settings. Browser and add-ons. Then restart.

  • Font Size Change works on all except menu & Lists

    Hi folks.  I've searched the forum and gone through about 100 pages of issues with Font size and font changes but have not found an answer that fixes the issue i'm having.
    Issue:  I change the font size in Menu, options, screen/keyboard.  This changes the font on everything in the system EXCEPT the email listing, SMS listings, BBerry Messenger Listings, Menu Lists (like the options menu, etc...
    i have seen answers to similar questiions that says that these items might be theme controlled.  Is there a way for me to fix without deleting my theme?
    i've seen many people telling developers how to allow users to change the font but nothing that addresses this issue.
    finally, i've seen some answers that say a person should upgrade to the latest software OS.  i ahve the latest OS 5.0.0.654 on a sprint curve 8530...
    so to sum up... when i actually see the lsit of emails in my inbox, that font stays constant.  when i open a specific email that font is what i chose within Screen/Keyboard option in settings/options menu... Same with SMS, same with almost everything...
    Any help would be appreciated.  Thanks tons.
    dave

    If it is a theme issue, the only way to fix it would be to contact the developer and see if they can develop a fix (or adjust it for you).  The catch is that when I played around with themes, it seemed that most of these sorts of settings were set within the theme itself and it wasn't easy to be able to adjust it.  It's not to say it wouldn't be possible - just that I couldn't figure out how during my efforts.
    I'm glad you were able to figure out the source of the problem.  I just wish there was something more that you could do to directly fix it yourself.
    If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
    If your issue is resolved, don't forget to click the Solution button on the resolution!

  • Null pointer exception with Lists

    Hi,
    I have got a problem with java.util.List. It is giving Null pointer exception whenever I try to add after extracting from my XML file.I have written the code like this:
    List year; //Global variable
    List loaddatas; //Global variable
    Element e1; //Global
    loaddatas=root.getChild("Load").getChildren("LoadData");
    int k=loaddatas.size();
    for(int i=0;i<loaddatas.size();i++)
    e1=(Element)loaddatas.get(i);
    year.add(i,Integer.valueOf(e1.getChildText("Year"))); // I am getting exception here.....
    root is root element in XML file.
    I am able to display "Integer.valueOf(e1.getChildText("Year"))" correctly.
    Anybody please tell me how to solve this.
    Thanks,
    Sai Ram

    Looks like somebody forgot to learn to program before starting to write code....
    List list = new ArrayList();

  • Clear cookies on exit Except for listed Exceptions

    Firefox used to allow clearing history including cookies on exit while retaining those cookies marked as exceptions in the privacy panel. It appears that the clear on close now deletes all history, regardless of exceptions settings. It would be highly useful to be able to specify which sites can set "permanent" cookies while also allowing other sites to set session cookies only *and* allowing users to clear all history, cookies, etc. for site not specifically excepted from such history clearing settings. Does anyone know what was changed such that this mo longer works as it used to in earlier versions? Are exceptions functioning as intended now, or are exceptions meant to be global, including clear on exit settings?

    I'm encountering this problem in Firefox 3.6.12 and it's been occurring for a while -- so I'm not sure exactly what update changed the behavior but wish they'd put it back so any marked "Allow" in the Exceptions would be retained like they used to be.
    Meanwhile, I've come up with a partial workaround using the free third-party Windows utility named CCleaner from [http://www.piriform.com/ccleaner], which has the ability to selectively delete cookies when it's run.
    How the utility operates on cookies is controlled in its Options > Cookies settings where there are two lists, one for cookies to delete and another for those to keep. By default, all cookies are in the Cookies to Delete column. To prevent that, I moved the cookies I wanted to retain to the second list and then scheduled CCleaner to run automatically at set intervals using Window's Task Scheduler and the following command-line <b><pre>"C:\Program Files\CCleaner\CCleaner.exe" /AUTO</pre></b>. See the CCleaner Online Help for scheduling it to run automatically.
    Once that is in place you can tell Firefox to keep cookies until the expire and let CCleaner handle getting rid of all of them all except for the ones you've indicated you want retained. This isn't as good as having Firefox do it every time you start and exit the program, but is better than nothing...
    Hope this helps.
    '''Update'''
    I just found this Mozilla extension called "CookieCuller" that might help it's at [http://example.com https://addons.mozilla.org/en-US/firefox/addon/82] and has a "Cookie Keep List".

  • SharePoint 2010 List - Append Changes to Existing Text - multiline text fields being duplicated

    Hello!
    SharePoint 2010 - I have this same problem for all Lists that use the combination of 1) Multi-line text column; 2) Column is set to "Append Changes to existing text"; 3) Text choice = Plain Text or Rich Text or Enhanced Rich Text. 4) List item is modified
    in datasheet view
    Each time a list item is modified in datasheet view, if the multi-line text column is left blank it will have it's previous value duplicated. For example - If I'm updating a list item in Datasheet View and updating a column other than this column
    I described above, each time I make an update to the list item the previous value/comment left by someone else in that column will be duplicated with my name attached along with the date.
    Why is SharePoint duplicating the contents of this field??
    Example:
    Comments (multiline text column): Comment 1
    Miguel Patey 10/3/2011 2:12 PM
    Comments (multiline text column): Comment 1
    Miguel Patey 10/3/2011 2:10 PM
    Comments (multiline text column): Comment 1
    George Pully 10/1/2011 8:45 AM
    In my testing I noticed that a list item that is modified in standard view (not datasheet view) will not duplicate the value of the Comments field if left empty. Once the item has been modified in standard view I can make changes to that list item in datasheet
    view and the Comments field won't be duplicated...
    Any ideas?
    Michael Reinhardt

    I think I have identified exactly when/how this happens. It was happening to us, I found this post, and then I did further testing based on your note that it only happens when using datasheet. Thanks so much for that lead!
    In my example below, "status note" is the column where we use MLT w/ append comments. Here's what I found in my testing:
    If I used datasheet to edit an item, and the LAST edit made to that item did not include a status note, then no duplicate status note was created when I made my edit.
    IF, however, the last edit made to the item DID include a status note, my edit (no matter WHAT I was changing, no matter if the view included the status note column or not) created a duplicate of the previous status note.
    Try it out and see if that works the same for you. You can even tell easily if you show the column in the datasheet view. If, when you go to make your edit you see content in that column, you know your edit will include a duplicate of that MLT content. If
    you see it is blank (meaning that last time someone made an edit they did not change that MLT column), your edit should be fine and create no duplicate.
    PS- editing in the editform creates no problem whatsoever. The problem definitely seems specific to the way Datasheet handles edits.

  • Oracle JDBC Driver 10.1.0.4.0 and IndexOutOfBounds-Exception

    Hello all,
    we´ve experienced a weird problem using the Oracle JDBC driver version 10.1.0.4.0. While executing SELECT statement we get an ArrayIndexOutOfBounds exception from the JDBC driver. Here´s the stacktrace:
    java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at oracle.jdbc.driver.T4CDateAccessor.saveDataFromOldDefineBuffers(T4CDateAccessor.java:212)
    at oracle.jdbc.driver.T4CPreparedStatement.saveDefineBuffersIfRequired(T4CPreparedStatement.java:405)
    at oracle.jdbc.driver.OracleStatement.prepareAccessors(OracleStatement.java:859)
    at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:949)
    at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:532)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1037)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2905)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2946)
    at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:124)
    We couldn´t find anything on the web on this error. We´re using Weblogic 8.1 SP4 with JDBC version. Does anyone have a hint or an idea what could be the problem here?
    Thanks for any help in advance!
    Cheers,
    Joerg

    I may have a related bug, I get a similiar exception when running JIRA...
    java.lang.ArrayIndexOutOfBoundsException: -1
    at oracle.jdbc.driver.DateTimeCommonAccessor.computeJulianDay(DateTimeCommonAccessor.java:341)
    at oracle.jdbc.driver.DateTimeCommonAccessor.getMillis(DateTimeCommonAccessor.java:386)
    at oracle.jdbc.driver.DateAccessor.getTimestamp(DateAccessor.java:142)
    at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(OracleResultSetImpl.java:1018)...I tried the 10.1.0.2 and 10.1.0.4 drivers, both throw the same exception. I would try the 10.2 drivers, but they just hang! Gotta love Oracle QA!

  • IndexOutOfBounds Exception using ArrayList running in a Thread

    Hi, I am a beginner in Java. While I am studying I became interested in Game Developing. So I tried to create a game like Space Shooting. Although the design and the ship lives are not yet finished it should run. Here is my whole code.
    import java.applet.Applet;
    import java.applet.AudioClip;
    import java.awt.*;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.io.File;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.ArrayList;
    import java.util.Random;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    class Ship
        int x,y,lives;
        long score,lastExplodeDisplay;
        public Ship()
            x = 307;
            y = 444;
            lives = 3;
            score = lastExplodeDisplay = 0;
        public void move(int xDir)
            x = x + xDir;
    class Asteroid
        int x,y,speed;
        Random asteroidGenerator;
        int explodeMode;
        long lastExplodeDisplay;
        public Asteroid()
            asteroidGenerator = new Random();
            x = asteroidGenerator.nextInt(600) + 10;
            y = asteroidGenerator.nextInt(1250) + 100;
            y = y * -1;
            speed =  1;
            explodeMode = 0;
            lastExplodeDisplay = 0;
    class Star
        int x,y,speed,radius,colorChooser;
        Color color;
        Random starGenerator;
        public Star()
            starGenerator = new Random();
            x = (starGenerator.nextInt(620) + 10);
            y = (starGenerator.nextInt(460) + 10);
            speed = starGenerator.nextInt(2) + 1;
            radius = (starGenerator.nextInt(3));
            colorChooser = starGenerator.nextInt(200);
            if(colorChooser % 3 == 0)
                color = Color.YELLOW;
            else if(colorChooser % 4 == 0)
                color = Color.BLUE;
            else if(colorChooser % 5 == 0)
                color = Color.RED;
            else
                color = Color.WHITE;
    class Shot
        int x,y,speed;
        public Shot(int position)
            x = position + 3;
            y = 440;
            speed = 7;
    public class Main extends JFrame implements Runnable{
        private Image dbImage, ship,shot,asteroid,explode,shield;
        private Graphics dbg;
        private ImageIcon i;
        private Font stageFont;
        long lastShot, start;
        AudioClip shoot;
        String scoreShow;
        int lastAsteroidPosition;
        Ship ship1 = new Ship();
        Star[] stars = new Star[200];
        ArrayList<Shot> shots = new ArrayList<Shot>();
        ArrayList<Asteroid> asteroids = new ArrayList<Asteroid>();
        ArrayList<Asteroid> exploded = new ArrayList<Asteroid>();
        boolean[] keys = new boolean[3];
        private boolean shipDestroyed,continued,shielded;
        private int ex;
        public class ActionList extends KeyAdapter{
            public void keyPressed(KeyEvent e)
                int keyCode = e.getKeyCode();
                if(keyCode == e.VK_A)
                    keys[0] = true;
                if(keyCode == e.VK_D)
                    keys[1] = true;
                if(keyCode == e.VK_Y)
                    keys[2] = true;
                if(keyCode == e.VK_F2 && !continued)
                    continued = true;
                    shipDestroyed = false;
                    ex = 0;
                    shielded = true;
                    start = System.currentTimeMillis();
                /*if(keyCode == e.VK_A)
                    if(ship1.x <= 15)
                        ship1.x = 15;
                    else
                        ship1.x -= 5;
                if(keyCode == e.VK_D)
                    if(ship1.x >= 589)
                        ship1.x = 589;
                    else
                        ship1.x += 5;
                if(keyCode == e.VK_Y)
                    Shot newShot = new Shot(ship1.x);
                    shots.add(newShot);
            public void keyReleased(KeyEvent e)
                int keyCode = e.getKeyCode();
                if(keyCode == e.VK_A)
                    keys[0] = false;
                if(keyCode == e.VK_D)
                    keys[1] = false;
                if(keyCode == e.VK_Y)
                    keys[2] = false;
        public Main()
            createStars();
            addKeyListener(new ActionList());
            setSize(640,480);
            setTitle("Shoot by Takeshi®");
            setResizable(false);
            setVisible(true);
            setBackground(Color.BLACK);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            i = new ImageIcon("C:/Documents and Settings/dioNisio.OWLCITY/My Documents/NetBeansProjects/GamePractice/src/ship1.png");
            ship = i.getImage();
            i = new ImageIcon("C:/Documents and Settings/dioNisio.OWLCITY/My Documents/NetBeansProjects/GamePractice/src/shot.png");
            shot = i.getImage();
            i = new ImageIcon("C:/Documents and Settings/dioNisio.OWLCITY/My Documents/NetBeansProjects/GamePractice/src/asteroid.png");
            asteroid = i.getImage();
            i = new ImageIcon("C:/Documents and Settings/dioNisio.OWLCITY/My Documents/NetBeansProjects/GamePractice/src/shield.png");
            shield = i.getImage();
            stageFont = new Font("Courier New",Font.BOLD,20);
            lastAsteroidPosition = 0;
            scoreShow = "0000000000";
            shielded = true;
            try
                URL sound = new URL("file:///C:/Documents%20and%20Settings/dioNisio.OWLCITY/My%20Documents/NetBeansProjects/GamePractice/src/laserfast.au");
                shoot = Applet.newAudioClip(sound);
            catch(MalformedURLException e)
                System.out.print(""+e.getMessage());
            continued = true;
            createAsteroids();
        @Override
        public void run()
                start = System.currentTimeMillis();
                while(true)
                    if((System.currentTimeMillis() - start) >= 5000)
                        shielded = false;
                    animateStars();
                    animateAsteroids();
                    animateExplosion();
                    animateShots();
                    if(continued)
                        animateShip();
                        createShot();
                try {
                    Thread.sleep(5);
                } catch (InterruptedException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        public static void main(String[] args)
            Main newMain = new Main();
            Thread t1 = new Thread(newMain);
            t1.start();
        @Override
        public void paint(Graphics g)
            dbImage = createImage(getWidth(), getHeight());
            dbg = dbImage.getGraphics();
            paintComponent(dbg);
            g.drawImage(dbImage, 0, 0, this);
            repaint();
        public void paintComponent(Graphics g)
            g.setColor(Color.WHITE);
            for(int c = 0; c < 200; c++)
                g.setColor(stars[c].color);
                g.fillOval(stars[c].x, stars[c].y, (stars[c].radius * 2), (stars[c].radius * 2));
            for(int c = 0; c < asteroids.size(); c++)
                g.drawImage(asteroid,asteroids.get(c).x, asteroids.get(c).y, this);
            for(int c = 0; c < exploded.size(); c++)
                i = new ImageIcon("C:/Documents and Settings/dioNisio.OWLCITY/My Documents/NetBeansProjects/GamePractice/src/e"+(exploded.get(c).explodeMode+1)+".png");
                explode = i.getImage();
                g.drawImage(explode,exploded.get(c).x, exploded.get(c).y, this);
                if(exploded.get(c).explodeMode < 14)
                    g.setColor(Color.white);
                    g.drawString("50",exploded.get(c).x, exploded.get(c).y);
            for(int c = 0; c < shots.size(); c++)
                g.drawImage(shot,shots.get(c).x, shots.get(c).y, this);
            if(!shipDestroyed)
                g.drawImage(ship, ship1.x, ship1.y, this);
                if(shielded)
                    g.drawImage(shield, ship1.x - 15, ship1.y - 15 , this);
            else
                if(ex<14)
                        i = new ImageIcon("C:/Documents and Settings/dioNisio.OWLCITY/My Documents/NetBeansProjects/GamePractice/src/e"+(ex+1)+".png");
                        explode = i.getImage();
                        g.drawImage(explode,ship1.x, ship1.y, this);
                        if((System.currentTimeMillis() - ship1.lastExplodeDisplay) >= 250)
                            ex++;
                            ship1.lastExplodeDisplay = System.currentTimeMillis();
                if(!continued)
                    g.setColor(Color.WHITE);   
                    g.drawString("PRESS F2 TO CONTINUE",470,50);
            g.setColor(Color.WHITE);
            g.setFont(stageFont);
            g.drawString("STAGE 1",20,50);
            g.setColor(Color.RED);
            for(int c = 0; c < ship1.lives; c++)
                g.drawString("♥",120+(c*10),50);
            g.setColor(Color.WHITE);
            g.drawString(""+ship1.score, 20, 70);
        public void animateStars()
            for(int c = 0; c < 200; c++)
                if(stars[c].y >= 460)
                    stars[c].y = 0;
                else
                    stars[c].y += stars[c].speed;
        public void animateShots() {
            boolean xTargeted = false, yTargeted = false, destroyed = false;
            for(int c = 0; c < shots.size() ; c++)
                for(int j = 0; j < asteroids.size(); j++)
                        if(((shots.get(c).x >= asteroids.get(j).x) && (shots.get(c).x < (asteroids.get(j).x + 30))) || (((shots.get(c).x + 30) >= asteroids.get(j).x) && ((shots.get(c).x + 30) < (asteroids.get(j).x + 30))))
                            xTargeted = true;
                        if((asteroids.get(j).y + 30 - shots.get(c).y) > 0)
                            yTargeted = true;
                        if(xTargeted && yTargeted)
                            exploded.add(asteroids.get(j));
                            asteroids.remove(j);
                            ship1.score += 50;
                            destroyed = true;
                        xTargeted = false;
                        yTargeted = false;
                if(destroyed)
                    shots.remove(c);
                    destroyed = false;
                else if(shots.get(c).y <=0)
                    shots.remove(c);
                else
                    shots.get(c).y -= shots.get(c).speed;
        public void animateAsteroids() {
            boolean xTargeted = false;
            boolean yTargeted = false;
            boolean sxTargeted = false;
            boolean syTargeted = false;
            for(int c = 0; c < asteroids.size() ; c++)
                if(shielded)
                    if(((ship1.x - 15 >= asteroids.get(c).x) && (ship1.x - 15 < (asteroids.get(c).x + 30))) || ((((ship1.x - 15) + 64) >= asteroids.get(c).x) && (((ship1.x - 15) + 64) < (asteroids.get(c).x + 30))))
                        sxTargeted = true;
                    if((asteroids.get(c).y + 30 - ship1.y) > 0)
                        syTargeted = true;
                    if(sxTargeted && syTargeted)
                        exploded.add(asteroids.get(c));
                        asteroids.remove(c);
                    sxTargeted = false;
                    syTargeted = false;
                else
                    if(((ship1.x >= asteroids.get(c).x) && (ship1.x < (asteroids.get(c).x + 30))) || (((ship1.x + 30) >= asteroids.get(c).x) && ((ship1.x + 30) < (asteroids.get(c).x + 30))))
                        xTargeted = true;
                    if((asteroids.get(c).y + 30 - ship1.y) > 0)
                        yTargeted = true;
                    if(xTargeted && yTargeted)
                        asteroids.remove(c);
                        shipDestroyed = true;
                        continued = false;
                        ship1.lives --;
                    xTargeted = false;
                    yTargeted = false;
                if(asteroids.get(c).y >=480)
                    asteroids.remove(c);
                else
                    asteroids.get(c).y += asteroids.get(c).speed;
        public void animateShip()
            if(keys[0] && !keys[1])
                if(ship1.x <= 15)
                    ship1.x = 15;
                else
                    ship1.x -= 5;
            else if(!keys[0] && keys[1])
                if(ship1.x >= 589)
                    ship1.x = 589;
                else
                    ship1.x += 5;
        public final void createStars()
            for(int c = 0; c < 200; c++)
                stars[c] = new Star();
        public void createShot()
            if(keys[2] && System.currentTimeMillis() - lastShot >= 150)
                Shot newShot = new Shot(ship1.x);
                shots.add(newShot);
                lastShot = System.currentTimeMillis();
                shoot.play();
        public final void createAsteroids()
            boolean verifiedGeneration = false;
            Asteroid newAsteroid = null;
            for(int c = 0; c < 100; c++)
                newAsteroid = new Asteroid();
                if((newAsteroid.y - lastAsteroidPosition) < 500)
                    newAsteroid.y -= (500 - (lastAsteroidPosition - newAsteroid.y));
                asteroids.add(newAsteroid);
                lastAsteroidPosition = newAsteroid.y;
        public void animateExplosion()
            for(int c = 0; c< exploded.size(); c++)
                if(exploded.get(c).y >= 480)
                    exploded.remove(c);
                else
                    exploded.get(c).y += exploded.get(c).speed;
                    if((System.currentTimeMillis() - exploded.get(c).lastExplodeDisplay) >= 150)
                        exploded.get(c).explodeMode++;
                        exploded.get(c).lastExplodeDisplay = System.currentTimeMillis();
    }So when I freshly run the program it works fine, but after a few shots and collisions with asteroids, the program throws an IndexOutOfBoundsException and I don't know where to trace it. I am beginning to think that the problem lies in my ArrayList. Here is a link to the program screenshot.
    Any help would be greatly appreciated.
    Thanks!
    Edited by: 893284 on Oct 26, 2011 4:59 AM

    First of all, put your program code between tags. Nobody's going to read unformatted code.
    Secondly, IOOBE is a very simple to understand exception. You're accessing a collection beyond its limits.
    Thirdly, the stacktrace will tell you where this happens. If you have multiple threads involved, you might need appropriate synchronization in there.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • IndexOutOfBounds exception in populateAttribute

    Hi,
    Since I moved to jdev 10.1.2, I randomly fall upon IndexOutOfBoundsException while executing Queries.
    I have absolutely no clue where they come from, any one from JDev Team can tell me what could be going on?
    Seems It usually occurs on dynamically created viewObject (built with createViewObjectFromQueryStmt)
    Regards
    Rémi
    here is the stack trace I get:
    java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
    at com.sun.java.util.collections.ArrayList.RangeCheck(ArrayList.java:492)
    at com.sun.java.util.collections.ArrayList.set(ArrayList.java:322)
    at oracle.jbo.server.ViewRowStorage.setDynamicAttribute(ViewRowStorage.java:1848)
    at oracle.jbo.server.ViewRowStorage.populateAttribute(ViewRowStorage.java:1761)
    at oracle.jbo.server.ViewRowImpl.populateAttribute(ViewRowImpl.java:2255)
    at oracle.jbo.server.ViewRowImpl.populate(ViewRowImpl.java:2206)
    at oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(ViewDefImpl.java:1031)
    at oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(ViewObjectImpl.java:2746)
    at oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(ViewObjectImpl.java:2649)
    at oracle.jbo.server.QueryCollection.populateRow(QueryCollection.java:1871)
    at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:1772)
    at oracle.jbo.server.QueryCollection.get(QueryCollection.java:1240)
    at oracle.jbo.server.ViewRowSetImpl.getRow(ViewRowSetImpl.java:3202)
    at oracle.jbo.server.ViewRowSetIteratorImpl.doFetch(ViewRowSetIteratorImpl.java:2754)
    at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2610)
    at oracle.jbo.server.ViewRowSetIteratorImpl.refresh(ViewRowSetIteratorImpl.java:2850)
    at oracle.jbo.server.ViewRowSetImpl.notifyRefresh(ViewRowSetImpl.java:1941)
    at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:689)
    at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:769)
    at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:706)
    at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3363)

    Little chances to be related, but did you see ths thread: ViewRowImpl getAttributeNames 10.1.2.0.0 ?
    HTH,
    Adrian

  • Search Results Query Text - Get all data, Exclude all list data except one

    Hi Experts,
    I have a situation wherein in the global search of our internal site, we have to display all results & restrict any list item except one list. Earlier we had restricted /Lists/ & People to be displayed in the results.
    But in the new search results I have to display results from only one list along with other results (documents, sites, pages etc).
    Below is the original query text entered in the Search Results Query Text editor
    {searchboxquery} -contentclass:STS_List_Links  
    -filename:allitems.aspx  -Path:/articles/Pages/default.aspx
    -filename:DispForm.aspx  -Path:/Lists/ -Path:person.aspx
    I have tried various different queries with AND, OR operator. I have researched other blogs, sites over google. But unsuccessful. I am sure this is not a rare requirement. Need your expert help.
    I have tried this query also...
    {searchboxquery} (-filename:allitems.aspx -Path:/articles/Pages/ -Path:/Lists/ -Path:/PublishingImages/) OR
    (+(+Path: /Lists/ArticleContent/ AND +filename:*.aspx) AND
    -(-Path: */Lists/* OR -filename:*.aspx))
    Vighnesh Bendre
    MCTS
    http://markviky.blogspot.com

    Vighnesh,
    You should have success using the following:
    {searchboxquery} -contentclass:STS_List_Links -filename:allitems.aspx  -Path:/articles/Pages/default.aspx -Path:person.aspx ((-filename:DispForm.aspx  -Path:/Lists/) OR Path:/Lists/ArticleContent/)
    Two things from your original query were excluding list items from your results, your exclusion of file
    DispForm.aspx and path Lists.  By using "OR" in the above query, we're creating an exception to also allow items under
    Lists/ArticleContent to be included in the results.

  • Why does Web Start App ignore Proxy bypass/exception list in Proxy settings

    Hi All,
    I've been pulling my hair out on this one for a while now and finally decided to see if someone can help me out.
    In my office I have a intranet of numerous devices and pcs connected. There is also a proxy server on the network to allow connection through the the internet. I have my proxy settings setup to bypass the proxy for any addresses on my intranet. This is set in the normal way by adding ( http://192.168.1. to proxy settings exception list in IE. This proxy bypass list works fine for all other situation except the following:
    On my Intranet I have an embedded web server device I have been developing that has a java application deployed using web start. This application is a monitoring tool that allows the user to check the various settings and status of the embedded device. The problem is that when the app is launched for some reason web start tries to get the require jar file from the proxy instead of directly from the device, even when the IP address of the device it is trying to get it from is in the bypass list?? I don't think Web start is checking the exception/bypass list in the proxy settings to see if it should be using the proxy or not?? I can see this by using wireshark and inspecting the GET HTTP requests sent from my pc to the proxy server instead of directly to the ip address of the embedded device.
    If I change my proxy settings to use a direct connection/no proxy (untick the "use proxy server for your lan" box in IE settings) then everything works fine. However this is not a workable option for my customers as they don't want to have to continually change these settings when connecting to this device and then to the internet (which is the whole reason of having the exception / bypass list).
    I've tried many things including using the proxy settings in the Java console instead of getting them from the browser but the same thing occurs.
    Any help would much appreciated, as I not sure if it is something I am doing wrong, or a possible bug, or just the way it is meant to work??
    I'm using the following...
    Java version: 1.6 1.6.0_17
    Operating system: ( I've tried XP and Vista)

    I have the same problem, please anyone can help?

  • If I choose never save password for a website and want to reverse that how can I? There are no exception listed.

    If I choose never save password for a website and want to reverse that how can I, no exceptions are listed.

    You can remove that site from the exceptions: Tools > Options > Security: Passwords: Exceptions
    See [[Remembering passwords]]

  • Sending mail to distribution list

    HI guys,
    Please look at the coding below..
    l_wa_recieve-receiver = '[email protected]'. " this is the distribution list id "with number of mail ids inside it
        l_wa_recieve-rec_type = 'C'.  "shared dis list
        APPEND l_wa_recieve TO l_it_recieve.
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
          EXPORTING
            document_data              = "ERROR'
            document_type              = 'DLI'
            put_in_outbox              = c_x
            commit_work                = c_x
          TABLES
            object_content             = l_it_content "this table contains the body of email
            receivers                  = l_it_recieve " this is above
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.
    Can you just tell me whether it works fine.. And if it is correct how much time will it take to get email in my respective email address..
    I have run this FM by just giving my mail id (not distribution list just giving doctype = 'RAW instead of DLI)
    The FM ran sucessfully without any errors , But I didnot receive any mail in my mail Inbox..
    Can you please help me how to sort it out getting mail in less time..
    Points will be rewarded
    regards,
    nazeer

    HI prabhu,
    there is no numbmer in the waitinh list but number 5 is in the error column in SCOT..
    Can you please tell me what could be the reason..
    regards,
    nazeer

  • Improvement of Steve Muench's sample #62. Cascading Lists in JSF

    If you go to
    http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#dynamiccascadingpoplist
    you will find sample application demonstrating use of Cascading ListBoxes in JSF using selectOneChoice and ADF Master/detail relation.
    But it has one problem - if you delete required field "City" you can not longer use cascading list because of validation error. I came to one solution of this problem and I like share it with others.
    1. add immediate="true" to selectOneChoice tag. This will prevent client-side validation (in conjunction with autoSubmit="true")
    2. add
    FacesContext.getCurrentInstance().renderResponse();in the end of onRegionListChanged() in backing.java to prevent server-side validation
    There is no validation errors anymore, but now link between lists is broken
    3. add following code to onRegionListChanged in backing.java
    int position = (Integer)valueChangeEvent.getNewValue();
    DCIteratorBinding regionDCIter = bindings.findIteratorBinding("RegionsIterator");
    regionDCIter.setCurrentRowIndexInRange(position);Tip: easy way to get bindings in backing bean is to double click on some button in JSF design mode
    4. Almost there. Cascading works but we have one small bug. Set some location to Europe/United Kingdom and commit. Now, try to change region to anything else. Doesn't works. If yours logs there is IndexOutOfBounds exception.
    To solve this add following code to onRegionListChanged in backing.java:
    bindings.findIteratorBinding("LocationsViewIterator").getCurrentRow()
         .setAttribute("CountryId", null);
    getCountryIdSOC().setSubmittedValue(null);Tip: to create getCountryIdSOC() method you should edit binding attribute of the Country selectOneChoice
    In the end your method will look something like this:
    public void onRegionListChanged (ValueChangeEvent valueChangeEvent) {
         FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("RegionChanged", "x");
         bindings.findIteratorBinding("LocationsViewIterator").getCurrentRow()
              .setAttribute("CountryId", null);
         getCountryIdSOC().setSubmittedValue(null);
         int position = (Integer)valueChangeEvent.getNewValue();
         DCIteratorBinding regionDCIter = bindings.findIteratorBinding("RegionsIterator");
         regionDCIter.setCurrentRowIndexInRange(position);
         FacesContext.getCurrentInstance().renderResponse();
    }Note: I casted bindings to DCBindingContainer.
    I hope you will find this helpful.

    To solve this add following code to
    onRegionListChanged in backing.java:
    bindings.findIteratorBinding("LocationsViewIterator").
    getCurrentRow()
         .setAttribute("CountryId", null);
    getCountryIdSOC().setSubmittedValue(null);Tip: to create getCountryIdSOC() method you should
    edit binding attribute of the Country
    selectOneChoice
    What does that do? and what do you mean by editing the binding attribute of the selectonechoice?
    Other than that I get what you're doing.

Maybe you are looking for