sillsdev / silkin

Kinship Analysis software for field workers in Anthropology and Bible translation
http://www.sil.org/resources/software_fonts/silkin
4 stars 1 forks source link

File reading NullPointerException #21

Closed stevetasticsteve closed 4 years ago

stevetasticsteve commented 4 years ago

Hi there

A friend of mine who has put a lot of work into charting the family tree of our landowner here in PNG. Unfortunately, my friend isn't too tech-minded and has no backups so we can't revert to an older save. I don't know what steps caused the error but now the file won't load either on his or my machine. I've attached the saved file as a .txt (GitHub wouldn't allow me to upload .silk), and I've recorded the error message below.

I'm hoping there's a simple error in the save file that can be corrected and the work he's put in isn't lost.

I speak python myself, but Java is meaningless to me - any help would be appreciated!

Thanks Steve

Jowapo Family tree.txt

While reading Jowapo Family tree.silk java.lang.NullPointerException Tokenizer.please(Tokenizer.java:117) Tokenizer.readToken(Tokenizer.java:100) ParserSilkFile.parseUDPs(ParserSilkFile.java:833) ParserSilkFile.parseUDPList(ParserSILKFile.java:780) ParserSilkFile.parseIndividual(ParserSilkFile.java:1606)

garymorris2245 commented 4 years ago

Thanks for this very thorough bug report. The error message and the text version of the file both agree; the SILK file has been truncated. This sometimes happens if SILKin crashes while writing the file. Or it can be caused by a file reading error, i.e. the pointer to the next file segment is garbled, so the PC stops reading at the end of the last segment found.

According to the text file, there were 98 people and 42 families recorded. The file error occurred at the end of the record for person #91, “Kenedy."

The solution is to load the prior version of this file. If your friend is a Mac user, he can do this using Time Machine. If he is a Linux user, he can use the standard Unix versioning utilities. If he is a Windows user, I don’t know the routine — I have no experience with Windows.

If there are no prior versions and no backups, I’m afraid data loss has occurred.

On Oct 14, 2019, at 1:48 AM, Steve notifications@github.com wrote:

Hi there

A friend of mine who has put a lot of work into charting the family tree of our landowner here in PNG. Unfortunately, my friend isn't too tech-minded and has no backups so we can't revert to an older save. I don't know what steps caused the error but now the file won't load either on his or my machine. I've attached the saved file as a .txt (GitHub wouldn't allow me to upload .silk), and I've recorded the error message below.

I'm hoping there's a simple error in the save file that can be corrected and the work he's put in isn't lost.

I speak python myself, but Java is meaningless to me - any help would be appreciated!

Thanks Steve

Jowapo Family tree.txt https://github.com/sillsdev/silkin/files/3723071/Jowapo.Family.tree.txt While reading Jowapo Family tree.silk java.lang.NullPointerException Tokenizer.please(Tokenizer.java:117) Tokenizer.readToken(Tokenizer.java:100) ParserSilkFile.parseUDPs(ParserSilkFile.java:833) ParserSilkFile.parseUDPList(ParserSILKFile.java:780) ParserSilkFile.parseIndividual(ParserSilkFile.java:1606)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sillsdev/silkin/issues/21?email_source=notifications&email_token=AEIBMMITELVYCFLE2YTF35TQOQB3BA5CNFSM4JAK2OJKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HRP6KEA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIBMMJZ7FCUUFZQVSFK5V3QOQB3BANCNFSM4JAK2OJA.

stevetasticsteve commented 4 years ago

Thanks for the quick reply. Unfortunately my friend has no back up.

Is any of the information salvageable if I manually edit the .silk file?

I had a quick go at changing the individual and family number tags to 92 and 0 respectively and then changing birth family for each individual to 0, but I keep running into array errors. I'm not familiar enough with the file format to hack a solution. It looks like that's not going to work. Just thought I'd ask if you see any possibility of salvage before I let him know he has to start over, even if it's just the names and XY coordinates on the chart.

Thanks Steve

garymorris2245 commented 4 years ago

Steve,

It may be possible to salvage the individual data on persons 0 through 91, I think (we’ve never tried this before). All the family records are gone, but you can reconstruct them manually by inference from the Individual data (but it’s a lot of work). If there was any data on kinship terms, that is also gone and cannot be salvaged by any means.

If you want to try a salvage operation, here is how you might do it. Open the attached .silk file in a plain text editor. You will find that I have added the proper ending for the block, added a fake block with one hypothetical family 0, and added three other empty blocks: , , and . Grab a pen and paper (or spreadsheet if that is more comfortable) and go through the records for individuals 0 through 91. Note the sex, marriages and birth family of each individual and use them to reconstruct the family census. For example: Person #0 is male, has a birth family = #33 and a marriage = #0. So you can create family #0 with a husband = 0. You can also create a family #33 with a child = 0. Use the dummy family I provided (lines 2864 through 2878) as a template for the families you create. (The families must be recorded in numerical order in the block.) As you create families in the block, please be careful to maintain “proper block structure.” A .silk file is an XML-type file. All XML files have blocks within blocks within blocks. Usually** a block begins with the block name in angle brackets (called the start tag) and ends with angle brackets around a slash “/“ and the block name (called the end tag). The beginning of the block may also contain some data. If there are 2 blocks, A & B, it is OK for block A to wholly contain block B, or vice versa. It is also legal for one block to precede the other. But what is not legal is for the beginning of block A to be outside block B but the end of block A to be inside block B. Such “overlapping” blocks are illegal and will cause a fatal error. It is also illegal to forget the end tag. After you have carefully created all the families you must then fill in the homeChart and location data. It looks like there is only one chart, A, so that was easy. The location will be a pain in the neck. In SILKin the user places people and families on the chart wherever she wants them. The convention, which she probably followed, is to place the family symbol between the husband and wife. To implement that convention, we must look up the location of the husband and wife and make the location of the family symbol halfway between. FOR EXAMPLE: Person 0 is the husband in marriage 0 and Person 1 is the wife. Person 0 has a location of x=880, y=420. (That means his horizontal location is 880 pixels from the left edge of Chart A, and his vertical position is 420 pixels below the top.) His wife is at x=960, y=420. So they are both at the same height, and she is 80 pixels to the right of her husband. So marriage 0 must be at x=920, y=420 — right in the middle of them. When all that work is completed, you should read through the block to make sure the families are in ascending order, all the blocks are in proper format, and the last block is followed by the end tag. Make sure that the and blocks (lines 12 & 14) have the correct counts: 92 for people and however many families you created (i.e. one more than the highest family serial number, because we start with zero).

Then hold your breath and try to load the file into SILKin. It probably won’t work the first time — unless you were really careful — but if you send me the file and the text of the error message you get, I’ll try to clean it up. After I get it to load successfully on my copy of SILKin, I’ll send it back to you.

PLEASE NOTE that the above procedure, laborious as it is, still won’t reconstruct any kinship terms your friend recorded. That data was completely missing.

** There are also “one-piece tags” like the homeChart and location blocks. The “/>” at the end means the block is ended.

On Oct 15, 2019, at 12:30 AM, Steve notifications@github.com wrote:

Thanks for the quick reply. Unfortunately my friend has no back up.

Is any of the information salvageable if I manually edit the .silk file?

I had a quick go at changing the individual and family number tags to 92 and 0 respectively and then changing birth family for each individual to 0, but I keep running into array errors. I'm not familiar enough with the file format to hack a solution. It looks like that's not going to work. Just thought I'd ask if you see any possibility of salvage before I let him know he has to start over, even if it's just the names and XY coordinates on the chart.

Thanks Steve

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sillsdev/silkin/issues/21?email_source=notifications&email_token=AEIBMMOP7METMPNKLMKQ5ALQOVBMVA5CNFSM4JAK2OJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBHL2RI#issuecomment-542031173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIBMMKOMV7H4DFXBAV6ML3QOVBMVANCNFSM4JAK2OJA.

stevetasticsteve commented 4 years ago

Thanks a bunch

I've laid out the options to my friend and he concludes that starting over will be the route to go Part of me wants to give it a go, there's a gun scripting challenge there, but we're in the middle of house building in the bush and there's no time!

Thanks so much for your very helpful response.