It is currently 07 Sep 2025, 18:20
   
Text Size

SVN

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: SVN

Postby silly freak » 27 Oct 2009, 19:44

doh! sorry, I found my error... look in forge.QuestData_State, the constructor is empty...

thanks, your response was critical. i probably wouldn't have figured that out.

i'll commit it as soon as google allows it again ;)
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: SVN

Postby zerker2000 » 28 Oct 2009, 05:01

The changes I just committed should let snow mana work, represented by "S".
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby DennisBergkamp » 28 Oct 2009, 17:11

Very nice!
Due to an unfortunate incident, I had to reinstall my entire windows... I'm just redownloading Eclipse right now :(
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby silly freak » 28 Oct 2009, 20:40

don't make that mistake! switch to linux right now^^

i hope you're up again soon
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: SVN

Postby DennisBergkamp » 28 Oct 2009, 22:53

I'm not exactly a Linux guru :lol:
Anyway, I did get things up and running... I checked out the latest version, and made a few small updates myself.

Compiling and running in Eclipse is no problem... However, when I export stuff as a JAR, running this JAR gives me the following error:

Code: Select all
An error has occured. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
   http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
   mtgrares@yahoo.com

forge.Deck

Detailed error trace:
java.lang.ArrayStoreException: forge.Deck
   at java.io.ObjectInputStream.readArray(Unknown Source)
   at java.io.ObjectInputStream.readObject0(Unknown Source)
   at java.io.ObjectInputStream.readObject(Unknown Source)
   at java.util.HashMap.readObject(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
   at java.io.ObjectInputStream.readSerialData(Unknown Source)
   at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
   at java.io.ObjectInputStream.readObject0(Unknown Source)
   at java.io.ObjectInputStream.readObject(Unknown Source)
   at forge.DeckIO.readFile(DeckIO.java:174)
   at forge.DeckIO.<init>(DeckIO.java:55)
   at forge.Gui_NewGame.<init>(Gui_NewGame.java:50)
   at forge.Gui_NewGame.main(Gui_NewGame.java:118)
and right after, when I click "Close":

Code: Select all
An error has occured. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
   http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
   mtgrares@yahoo.com

DeckIO : read() error, java.lang.ArrayStoreException: forge.Deck

Detailed error trace:
java.lang.RuntimeException: DeckIO : read() error, java.lang.ArrayStoreException: forge.Deck
   at forge.DeckIO.readFile(DeckIO.java:179)
   at forge.DeckIO.<init>(DeckIO.java:55)
   at forge.Gui_NewGame.<init>(Gui_NewGame.java:50)
   at forge.Gui_NewGame.main(Gui_NewGame.java:118)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby silly freak » 29 Oct 2009, 00:23

that's shitty... this happend because an array is read from the stream, and that keeps its type, but the decks in the array are converted to the new type, meaning it can't be stored.

I hope i can sort this out, we'll see...
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: SVN

Postby zerker2000 » 29 Oct 2009, 07:29

Maybe make a "old deck to new deck" converter? I'm quite sure people would want to keep their old decks, so could you just read an ArrayList<Object> and check for "instanceof Deck_Old"? Why isn't the deck file in plain text in the first place?!
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby silly freak » 29 Oct 2009, 11:00

i think i'll clarify part of the problem that's going on here... it's not strictly necessary, but if you're interested in "behind the scenes", read on.

in a nutshell, it comes down to that generics are not there at all at runtime. Generics are just for the compiler to check, so that we can conveniently skip our cast when working with collections. arrays, on the other hand, are checked at runtime, too

this means that some code can't instantiate an array of a generic type, like in
Code: Select all
class Test<T> {
    private T[] t; //possible
    public Test() {
        t = new T[5]; //impossible
    }
   
    public Test(T[] t) {
        this.t = t; //possible
    }
}
for that reason, an ArrayList, or other collection, internally stores Object[]s, not Arrays of the declared types

when an ArrayList<Deck> is serialized, its content (Deck elements in an Object[]) are stored, but the generic information is gone. When it is deserialized as ArrayList<forge.Deck>, the content (forge.Deck, because of readResolve, in an Object[]) is restored. no problem

however, when storing a Deck[] directly, the array runtime class is stored when serializing. readResolve doesn't apply to it, because it only works for instances of Deck, not Deck[]. now we have a Deck[] array and forge.Deck elements, which doesn't work.

i posted this at the sun forums, that's what I got back:
You have a thoroughly predictable disaster on your hands. Find the original developers and their management and make them fix it. Or have them taken out and shot. There is very little you can do about this problem without a massive amount of work. You are going to have to deserialize all the old data using the old non-packaged classes and re-serialize it using the new packaged classes. While you're at it, make sure all the new serializable classes declare a serialVersionUID member so you will reduce the next most predictable problem to manageability.
as shooting you isn't an option^^, i think we'll really need some sort of a "migration tool". not the most beautiful option, but... i'll try to do that, and before we run it, we'll decide for a final location for our to-be-serialized classes
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: SVN

Postby DennisBergkamp » 29 Oct 2009, 14:58

Yikes! Ok, that doesn't sound good :shock:

However, what does he mean exactly by "deserialize all the old data using the old non-packaged classes and re-serialize it using the new packaged classes"?
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby DennisBergkamp » 29 Oct 2009, 15:12

Silly Freak,

I just tried R50 you released (dedicated to me, very nice :) ), and when I compile + run it works, but again when I export the JAR I get the same error :

Code: Select all
An error has occured. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
   http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
   mtgrares@yahoo.com

forge.Deck

Detailed error trace:
java.lang.ArrayStoreException: forge.Deck
   at java.io.ObjectInputStream.readArray(Unknown Source)
   at java.io.ObjectInputStream.readObject0(Unknown Source)
   at java.io.ObjectInputStream.readObject(Unknown Source)
   at java.util.HashMap.readObject(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
   at java.io.ObjectInputStream.readSerialData(Unknown Source)
   at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
   at java.io.ObjectInputStream.readObject0(Unknown Source)
   at java.io.ObjectInputStream.readObject(Unknown Source)
   at forge.DeckIO.readFile(DeckIO.java:172)
   at forge.DeckIO.<init>(DeckIO.java:53)
   at forge.Gui_NewGame.<init>(Gui_NewGame.java:50)
   at forge.Gui_NewGame.main(Gui_NewGame.java:118)
Code: Select all
An error has occured. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
   http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
   mtgrares@yahoo.com

DeckIO : read() error, java.lang.ArrayStoreException: forge.Deck

Detailed error trace:
java.lang.RuntimeException: DeckIO : read() error, java.lang.ArrayStoreException: forge.Deck
   at forge.DeckIO.readFile(DeckIO.java:177)
   at forge.DeckIO.<init>(DeckIO.java:53)
   at forge.Gui_NewGame.<init>(Gui_NewGame.java:50)
   at forge.Gui_NewGame.main(Gui_NewGame.java:118)
:(
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby DennisBergkamp » 29 Oct 2009, 15:16

One thing that's interesting though is when I delete the all-decks2 file (big one that is included with all the releases), it runs fine (which is to be expected I suppose) if I then create a deck and save it I expect it to crash again, but it actually works! Maybe it's just this all-decks2 file that's corrupted or incompatible with the new version ?
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby silly freak » 29 Oct 2009, 15:37

incompatible of course, because of the new changes. i suspect that you tested the jar with an all-decks2 file that contains booster drafts. those are stored in arrays, that's why the error occurs. if you test the jar with the files from SVN, do you still get the error? bty, can you post your all-decks2 so i can test it myself?
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: SVN

Postby DennisBergkamp » 29 Oct 2009, 20:30

Sure. No this is an older all-decks2 file (I don't think it contains booster draft decks though), I think it's identical to the one included with the previous beta release, but here it is again :)

So anyway, it looks like it's merely an incompatible all-decks2 file... but this probably also means that every older all-decks2 file (on other people's computers) wouldn't work either?
Attachments
all-decks2.rar
(24.86 KiB) Downloaded 487 times
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby zerker2000 » 29 Oct 2009, 23:38

I repeat, why can't we store decks in text format? And use an old version to make a converter for the old deck2 files...
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: SVN

Postby silly freak » 30 Oct 2009, 00:59

should be possible. i'm currently doing the migration tool, basically a read-reformat-store batch, so it shouldn't be too hard to make plain text out of it. i'll try to find a reasonable format.
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 69 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 69 users online :: 0 registered, 0 hidden and 69 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 69 guests

Login Form