[crossfire] Latest CVS version of java editor SERIOUSLY flawed on
my system
tchize
tchize at myrealbox.com
Sun Apr 10 14:50:59 CDT 2005
Just a small java note to Brendan Lally:
Uninitialized objects in java does not exist. The compiler prevent this. So
you will never get 'garbage' in an Object (like a String). Inside methods,
compiler stop on 'variable xy might be used uninitialized' and for class
members, all members are initialized to null, unless there is an explicit
initial value.
If the content of map file contains one or several 'null' (the 4 letters
n.u.l.l.) it just means exactly that, the code attempted to convert a null
object to a String.
Now i don't have time right now to investigate code on where map saving fails,
but getting the name of failed maps, and possibly have a copy if not in cvs,
would help.
Le Dimanche 10 Avril 2005 18:52, Brendan Lally a écrit :
On Sunday 10 Apr 2005 15:44, Andrew Fuchs wrote:
>
The latest version of CFJavaEditor in CVS has destroyed 2 of my maps.
>
When saving maps, it writes the file with null contents.
I have a horrible feeling that might be my fault. I don't know why though. I
changed the writing in and out code to stop the stripping of some of the
headers, when I tested the changes on my system it worked properly.
Can you point to a map that causes this problem (either your own or in CVS)?
The ones I tested were ok...
I can't figure out what could cause the problem you describe. The only thing
I can think of is that the string I am using isn't being initialised
properly, so that some random pointer is being written in, but this
shouldn't give the null files you describe, it should be random garbage
(either that or one of java's ever-present exceptions).
In the unlikely event that I am right, I /think/ the answer would look like
this:
Index: src/cfeditor/MapArchObject.java
===================================================================
RCS file: /cvsroot/crossfire/CFJavaEditor/src/cfeditor/MapArchObject.java,v
retrieving revision 1.8
diff -C5 -r1.8 MapArchObject.java
*** src/cfeditor/MapArchObject.java 7 Apr 2005 23:06:35 -0000 1.8
--- src/cfeditor/MapArchObject.java 10 Apr 2005 16:19:10 -0000
***************
*** 87,97 ****
private boolean ultimate_death; // permanent death with instant
character deletion
private boolean pvp; // PVP combat allowed
private String name; // map name (this is the name that
appears in the game)
private String filename; // name of the map file
! private String region; // the region the map is in
private String[] tile_path = new String[MAX_TILE]; // Used with map
tiling. 0=north, 1=east, 2=south, 3=west
/**
* Constructor, set default values
*
--- 87,97 ----
private boolean ultimate_death; // permanent death with instant
character deletion
private boolean pvp; // PVP combat allowed
private String name; // map name (this is the name that
appears in the game)
private String filename; // name of the map file
! private String region = new String(); // the region the
map is in
private String[] tile_path = new String[MAX_TILE]; // Used with map
tiling. 0=north, 1=east, 2=south, 3=west
/**
* Constructor, set default values
*
AFAICT this runs exactly the same as the current CVS map, but if you (or
anyone else experiencing the same problem) can either patch and test with
this or give/point me to a test case map where the problem you describe
occurs, then I can determine if that is the problem and if this is the
solution.
If anyone knows better what the problem is, then by all means, do tell.
_______________________________________________
crossfire mailing list
crossfire at metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire
--
--
Tchize (David Delbecq)
tchize at myrealbox.com
Public PGP KEY FINGERPRINT:
F4BC EF69 54CC F2B5 4621 8DAF 1C71 8E6B 5436 C17C
Public PGP KEY location:
http://wwwkeys.pgp.net/pgpnet/wwwkeys.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://shadowknight.real-time.com/pipermail/crossfire/attachments/20050410/5a416c28/attachment.pgp
More information about the crossfire
mailing list