Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

ArrayStoreException on empty line

$
0
0
Okay, so this gets even weirder (at least for me, maybe I'm being an idiot). Not only is the line empty and consistently the error occurs on the same line (no matter what I do), but I still get the error when I don't use arrays. I'm using arrays to store data that is later being written to txt files using another class that I built. Also, I checked multiple times to see if I could be missing something and wrongly assigning a value to the incorrect array, but I'm not. Okay, so here is the problem code.

    private int[] gridTrans = new int[32768];
    private Float arrayPosFloat;
    private int arrayPos;
    private int defaultVal = 0;
    
    
    /**
     * This is used for building the basic grid and save structure, it then calls other methods that fill it out and
     * add detail. The other methods also modify the standard array values when the grid changes (so it saves properly).
     * @throws ArrayStoreException
     */
    public void makeGrid() throws ArrayStoreException {
        
        for(int u = 0; u<32769; u++) {
            gridTrans[u] = 1;
        }
        
        Arrays.fill( gridTrans, defaultVal);



Note, I didn't include "throws ArrayStoreException" until recently, along with using the for loop for filling the array. Those were more just acts of desperation that I left in the code to keep track of what I've tried.

Here is the exact error,
java.lang.ArrayStoreException: java.lang.Integer
at java.util.Arrays.fill(Arrays.java:2170)
at mygame.ChunkInitializer.makeGrid(ChunkInitializer.java:78)
at mygame.MenuAppState.makeWorld(MenuAppState.java:93)
at mygame.MenuAppState.access$000(MenuAppState.java:26)
at mygame.MenuAppState$1.onAction(MenuAppState.java:78)
at com.jme3.input.InputManager.invokeActions(InputManager.java:169)
at com.jme3.input.InputManager.onKeyEventQueued(InputManager.java:455)
at com.jme3.input.InputManager.processQueue(InputManager.java:833)
at com.jme3.input.InputManager.update(InputManager.java:885)
at com.jme3.app.Application.update(Application.java:606)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:230)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)

I am using the JMonkey Engine right now, but its just made up of a bunch of java libraries (so I thought I might be able to get some help here). I asked a question on their forum recently that people kinda ignored, so I don't really wanna bother them and I think someone here could help. I hope it isn't a problem :/

P.S.
A friend of mine (who is smart but doesn't know any java) thinks I messed up my compiler somehow. Could this be true? I searched for a while but came up with nothing on google. Thanks in advance, I'm totally stumped on this one.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>