Campaign save Corrupted! In dire need of help!

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
YuriPRIME
Kobold
Posts: 19
Joined: Fri Nov 09, 2012 5:45 pm

Campaign save Corrupted! In dire need of help!

Post by YuriPRIME »

Hey! I'm working on Only War campaign for last week, I've put hours into it, designing maps, encounters, token library for encounters and what now. The campaign grew large and it all got ready for a game we're having soon... But today I've been working on a map and got some java error while drawing ground layers. I tried to close the pop-up window, but it just kept repeating and popping up again. Tried to save the campaign in between those pop-ups, but Maptool got into a loop and I had to shut it down.

I've opened the maptool again, and loaded the autosave backup, but the map I was working on haven't been saved, so I closed it and tried to load the old campaign from the main folder... But the file got corrupt! I mean it's still there, whole 90 MB of the campaign file with all the assets, just the moment I try to open it it says
Error while reading campaign file.
java.lang.NullPointerException
and then a warning "Cannot determine campaign format; not loaded."

What do I do?! I worked so hard on this, and since I closed MT already, the backup file's gone! I wanted to load it back since it worked, but it's all gone! The campaign is there in my folder, just can't open it. Is there a way to salvage the situation? Or do I have to start all over? Also, is there a feature for the bakcup files to stay after crash? It's infuriating to see them disappear. I'm using 1.4 version btw.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Campaign save Corrupted! In dire need of help!

Post by aliasmask »

You should upload your campaign file to a file repository and share the link so someone can look at it. Also, the .cmpgn file is just a .zip file. Try changing the extension to .zip and see if you can browse the folders. If not, then the zip portion is corrupted. There are some free online apps that can fix that. If it does open with the .zip extension then data in the content.xml is bad and needs to be edited out.

YuriPRIME
Kobold
Posts: 19
Joined: Fri Nov 09, 2012 5:45 pm

Re: Campaign save Corrupted! In dire need of help!

Post by YuriPRIME »

I can browse the campaign file in winrar with no problems, so the .zip's okay.
I don't know how to host repository online (never used this feature), so I just packed the entire file on a file hosting site.
http://www.filedropper.com/kampaniaonlywar

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Campaign save Corrupted! In dire need of help!

Post by Full Bleed »

YuriPRIME wrote:I can browse the campaign file in winrar with no problems, so the .zip's okay.
I don't know how to host repository online (never used this feature), so I just packed the entire file on a file hosting site.
http://www.filedropper.com/kampaniaonlywar
First, have you checked the backup folder in your maptool data directory?

Second, this campaign takes a long time to try to open... so it must be very memory intensive. Chances are that this got corrupted because your memory profile is insufficient to handle the memory spike when saving (if you're within 20% of your max mem when attempting to save you're in the danger zone for a failed save that can corrupt a campaign). What memory profile are you using?

Third, as for repairing this campaign file... you're correct, the zip file is not damaged. That means an asset probably is. The problem is trying to figure out which asset is the problem and removing it... then zipping it back up for use. I have not had much success in re-zipping a file and then having MT use it without error and I've tried like 4 different zip extraction tools... someone else might have better luck. Were you working on a particularly large/complex new asset after your last proper load?

Fourth, if you have any file recovery software on your computer, you can see if you can recover a file called "AutoSave.cmpgn". If you have autosave on in MT it save the campaign under that file name at whatever intervale you have set... then deletes it after you properly close MT. However, you might be able to recover the deleted file. Problem is, if you've had MT open for the length of time it takes to make a new autosave on a different campaign (even just the empty grasslands) recovery might be a problem.

Fifth, not that it helps you now... but you should be saving the campaign with a different name any time you seriously work on it or play a new game session.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

YuriPRIME
Kobold
Posts: 19
Joined: Fri Nov 09, 2012 5:45 pm

Re: Campaign save Corrupted! In dire need of help!

Post by YuriPRIME »

1) Yes, that's the first thing I checked, but as I've read later on the forums, the moment you close off MT successfully the files get purged from the folder as they are just temporary
2) Yes, it's quite big, as I was building maps using a lot of assets, and since it's Only War where encounters take place in large zones with a lot of cover to go around and maneuver and weapon ranges up to 300 meters, the maps got quite heavy and filled with content... I did such maps before however and it was all good, just this time I got this strange java error. As for memory, I always give MT generous 2GB RAM to use (Since I can both afford that with my current rig, and Wolph's 40k RPG macros recommend at least 1GB. I'm running java 64 bit, so no problem here that ever poked it's head.
3) That's the problem, I don't know what to do... Well, I've been working on the maps in alternate campaign file, pretty much starting from scratch, but the biggest bummer are the character data stored on token :/ My group had their characters and they are what I care the most. I can recreate the maps... it'll take a while, but it's just more time in the end - character's I can't recreate.
As for the load of the assets, when the problem occurred I believe I was 'painting' a map with different layers of textures. Changing opacity to make them blend nicely and flesh out the scene. Suddenly there's a big popup about the "java.lang.NullPointerException" but I didn't managed to copy the text, hoping it's just temporary. I tried to close it, but there goes the infamous loop of Maptool where no matter how often you press close, the popup window keeps comming up forever and you can't really press any other button. I believe MT tried to autosave in that very same moment. I had to Shut the process off from the Task Manager.
4) I'm affraid it's far too late for that, since I worked on alternative fast, to have something prepared for the group if I can't salvage this file.
5) Yeah, now I save at three different files, all presenting different stages... sadly it's post factum :/

taustinoc
Dragon
Posts: 516
Joined: Mon Aug 03, 2015 6:30 pm

Re: Campaign save Corrupted! In dire need of help!

Post by taustinoc »

Full Bleed wrote:I have not had much success in re-zipping a file and then having MT use it without error and I've tried like 4 different zip extraction tools... someone else might have better luck.
Have you tried 7Zip? I haven't had any problem with updating token files with it (through Visual Basic). If you register .rptok (or .cmpgn, I just checked) file with Windows to open in 7Zip[1], you get the graphic interface, and you can extract individual files to check out, and update with drag-n-drop from Windows Explorer. No need to rename the file extension.

I did find, however, that one must understand the guts of the content.xml file, and the various xml files for each asset, or . . . bad things happen. (Always work with copies of files, not the only one you have.)

I took a quick look at the .cmpgn file. There are about a thousand images in the assets folder. I extracted that folder, deleted all the xml files (which have no file extension), and scrolled through thumbnails of the images. Didn't see anything broken.

The content.xml file, though, it nearly 80 meg(!). And I think there's something broken in it. I can't get it to open in Notepad, which isn't surprising, and my web browser won't scroll when it's open. When I try to open it in Word, I get an error message about an invalid Unicode character on line 852671, column 515. If I tell Word it's an XML file, I get a different error about parts mission or invalid.



[1]Double click on the file, and when Windows doesn't know what to do with it, navigate to 7zFM.exe in the Program Files tree, then you can double click on the .rptok or .cmpgn file to open it directly in 7Zip.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Campaign save Corrupted! In dire need of help!

Post by Full Bleed »

YuriPRIME wrote:1) Yes, that's the first thing I checked, but as I've read later on the forums, the moment you close off MT successfully the files get purged from the folder as they are just temporary
You're thinking of the AutoSave folder. There is also a Backup folder. The backup folder does not purge the files on closing the app... but it only keep a certain number of copies (I think 10).
2) Yes, it's quite big, as I was building maps using a lot of assets, and since it's Only War where encounters take place in large zones with a lot of cover to go around and maneuver and weapon ranges up to 300 meters, the maps got quite heavy and filled with content... I did such maps before however and it was all good, just this time I got this strange java error. As for memory, I always give MT generous 2GB RAM to use (Since I can both afford that with my current rig, and Wolph's 40k RPG macros recommend at least 1GB. I'm running java 64 bit, so no problem here that ever poked it's head.
I suggest you up your max mem to 3 or 4 gigs if you ran into a problem at 2g (and have at least 8 gigs in your system).
As for the load of the assets, when the problem occurred I believe I was 'painting' a map with different layers of textures. Changing opacity to make them blend nicely and flesh out the scene. Suddenly there's a big popup about the "java.lang.NullPointerException" but I didn't managed to copy the text, hoping it's just temporary. I tried to close it, but there goes the infamous loop of Maptool where no matter how often you press close, the popup window keeps comming up forever and you can't really press any other button. I believe MT tried to autosave in that very same moment. I had to Shut the process off from the Task Manager.
That might help someone out who knows what to look for... I'd strip out the drawings on the map you were working on and try opening it after that.
Last edited by Full Bleed on Sun Mar 27, 2016 11:26 pm, edited 1 time in total.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Campaign save Corrupted! In dire need of help!

Post by Full Bleed »

taustinoc wrote:Have you tried 7Zip? I haven't had any problem with updating token files with it (through Visual Basic). If you register .rptok (or .cmpgn, I just checked) file with Windows to open in 7Zip[1], you get the graphic interface, and you can extract individual files to check out, and update with drag-n-drop from Windows Explorer. No need to rename the file extension.
I did try 7-zip, but I did it by unzipping the files and then re-zipping it. It throws an IO error even if I change absolutely nothing. Did not do a single file extraction and update though.

The content.xml file, though, it nearly 80 meg(!). And I think there's something broken in it.
My money would be on a drawable.
I can't get it to open in Notepad, which isn't surprising, and my web browser won't scroll when it's open. When I try to open it in Word, I get an error message about an invalid Unicode character on line 852671, column 515. If I tell Word it's an XML file, I get a different error about parts mission or invalid.
I can open it in Notepad++. But it's a massive file.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

taustinoc
Dragon
Posts: 516
Joined: Mon Aug 03, 2015 6:30 pm

Re: Campaign save Corrupted! In dire need of help!

Post by taustinoc »

Full Bleed wrote: I did try 7-zip, but I did it by unzipping the files and then re-zipping it. It throws an IO error even if I change absolutely nothing. Did not do a single file extraction and update though.
Try it by extracting a single file, by drag-n-drop, update the file, then drag-n-drop it back into 7Zip. That way, 7Zip is working with the original file, not creating a new one. It sounds like it's the "creating a new zip" file that's doing something different than the original file. There are a lot of different options for zip files.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Campaign save Corrupted! In dire need of help!

Post by aliasmask »

Here's the actual error when loading:

Code: Select all

2016-03-27 23:06:05,415 [client.AppState:158] DEBUG - AppState.isSaving is false
2016-03-27 23:06:05,594 [io.PackedFile:590] DEBUG - FileUtil.getContentType() returned application/xml
2016-03-27 23:06:05,598 [io.PackedFile:590] DEBUG - FileUtil.getContentType() returned application/xml
2016-03-27 23:06:53,707 [client.MapTool:266] ERROR - PersistenceUtil.error.campaignRead
java.lang.NullPointerException
	at sun.dc.DuctusRenderingEngine.createStrokedShape(Unknown Source)
	at java.awt.BasicStroke.createStrokedShape(Unknown Source)
	at net.rptools.maptool.model.drawing.LineSegment.createLineArea(LineSegment.java:66)
	at net.rptools.maptool.model.drawing.LineSegment.getArea(LineSegment.java:50)
	at net.rptools.maptool.model.Zone.collapseDrawableLayer(Zone.java:1413)
	at net.rptools.maptool.model.Zone.collapseDrawables(Zone.java:1399)
	at net.rptools.maptool.model.Zone.optimize(Zone.java:1387)
	at net.rptools.maptool.util.PersistenceUtil.loadCampaign(PersistenceUtil.java:431)
	at net.rptools.maptool.client.AppActions$55.run(AppActions.java:2095)
2016-03-27 23:06:56,877 [util.PersistenceUtil:448] WARN - Could not load campaign in the current format...  trying the legacy format.
2016-03-27 23:06:56,877 [client.MapTool:298] WARN - PersistenceUtil.warn.campaignNotLoaded
So, it's definitely one of the drawables. As mentioned above, the file is huge and thus is difficult to work with. I tried editing the content.xml but something is wrong with zip when repacking. I don't recall having this problem in earlier versions of MT. It may also be a windows 10 thing because I just recently upgraded. I'll have to try some new things later.

But for any MT developers, they could probably use the low level debugging tools to see which drawable is causing the issue. Since file corruption due to a drawable is not new, there may be a certain combo with a certain tool that is the core issue and is probably worth investigating.

YuriPRIME
Kobold
Posts: 19
Joined: Fri Nov 09, 2012 5:45 pm

Re: Campaign save Corrupted! In dire need of help!

Post by YuriPRIME »

Full Bleed wrote:
YuriPRIME wrote:1) Yes, that's the first thing I checked, but as I've read later on the forums, the moment you close off MT successfully the files get purged from the folder as they are just temporary
You're thinking of the AutoSave folder. There is also a Backup folder. The backup folder does not purge the files on closing the app... but it only keep a certain number of copies (I think 10).
No, I actually spoke about Backup, I know it's in the .maptool folder, the thing is the original campaign file I tried to open later AFTER autosave has exactly same name, meaning when I tried to open it to check if things saved (prior to discovering the issue with the loading) it purged the backup file.

On the other note the MT memory use was nowhere near the maximum, it used about half the RAM assigned.

As for the campaign itself. I managed to recreate most, spend some time on it... sadly most assets were wasted, that said however: is there a way to extract the token data from the xml files? Just so I can recreate characters?

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Campaign save Corrupted! In dire need of help!

Post by Full Bleed »

YuriPRIME wrote:No, I actually spoke about Backup, I know it's in the .maptool folder, the thing is the original campaign file I tried to open later AFTER autosave has exactly same name, meaning when I tried to open it to check if things saved (prior to discovering the issue with the loading) it purged the backup file.
Then it's a conflict of terms. I see the AutoSave.cmpgn file as being "purged" on exit as you described it. The backup file is just eventually over written by another backup file (and I don't know the conditions/specifics of this... though I wish we could set them ourselves... at one point I know it saved up to ten backups... but I think there was a movement to reduce that at some point.)
On the other note the MT memory use was nowhere near the maximum, it used about half the RAM assigned.
Watch the memory usage when you save a large file... it spikes *at least* 20%. Sometimes much higher. What the file is using when you load it fresh is not static and it will be very different than what it is using after you've been developing for hours.

At any rate, your problem looks to be a corrupted drawable. Whether that happens due to memory use or not, I have no idea. As I mentioned above, just knowing the map you were working on might allow someone to edit out all drawbles on that map... if they can put the archive back together successfully.
As for the campaign itself. I managed to recreate most, spend some time on it... sadly most assets were wasted, that said however: is there a way to extract the token data from the xml files? Just so I can recreate characters?
If you have the names of the tokens... I bet there is a way to copy/paste from your old content.xml file to save a lot of that information.

But, again, as I and Alias have mentioned, rebuilding the zip file is problematic... though it may be possible to use taustinoc's method above by extracting only a single file with 7-zip and then inserting it back into the archive without fully rebuilding the archive and causing MT to throw an IO error.
aliasmask wrote:I tried editing the content.xml but something is wrong with zip when repacking. I don't recall having this problem in earlier versions of MT. It may also be a windows 10 thing because I just recently upgraded. I'll have to try some new things later.
I know this was an issue at least as far back as Windows 8... maybe further. And it's not likely the zip programs themselves because I have tried at least 4 different ones (Winzip, WinRar, 7zip, and the built in Extraction tools). All throw an IO error when trying to open the re-packed file.
But for any MT developers, they could probably use the low level debugging tools to see which drawable is causing the issue. Since file corruption due to a drawable is not new, there may be a certain combo with a certain tool that is the core issue and is probably worth investigating.
A tool to "Clear All Drawings" without having to fully load a campaign file would probably to the trick.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

taustinoc
Dragon
Posts: 516
Joined: Mon Aug 03, 2015 6:30 pm

Re: Campaign save Corrupted! In dire need of help!

Post by taustinoc »

Full Bleed wrote:I know this was an issue at least as far back as Windows 8... maybe further. And it's not likely the zip programs themselves because I have tried at least 4 different ones (Winzip, WinRar, 7zip, and the built in Extraction tools). All throw an IO error when trying to open the re-packed file.
It's tempting to think that a zip file is a zip file is a zip file, but that's not the case. There are many different options when creating a zip file, with various compression methods, dictionary sizes, word sizes, etc. I suspect that Java is limited in what options it can handle, and that all the compression programs default to an option that Java (or perhaps just MapTool) can't recognize. That's why opening the .cmpgn file directly in 7Zip might work - it will work with the options chosen at creation, rather than its own defaults.

If somebody can make edited the content.xml file available, I can test it. (I definitely get the error trying to open the original .cmpgn file in Maptool.)

Post Reply

Return to “MapTool”