superman123456789 / google-sites-liberation

Automatically exported from code.google.com/p/google-sites-liberation
0 stars 0 forks source link

Bug: Random Exception When Downloading Attachments #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the jar from windows or ubuntu console
2. Export a google sites with a lot of pages and attachments (~500 items)
3. Exceptions occurred for different page at different time. (Sort of random.)
4. GUI Freezes and doesn't progress any further
5. Note: I never managed to download my website.

What is the expected output? What do you see instead?
Expected: Website downloaded
Instead: An exception is throwed out at console. The GUI freezes and
doesn't progress any further.

What version of the product are you using? On what operating system?
1.0.1, Ubuntu 9.10 and Windows XP

Please provide any additional information below.
user@ubuntu:~/Downloads$ java -jar google-sites-liberation-1.0.1.jar 
Exception in thread "Thread-3" java.lang.ClassCastException:
com.google.gdata.data.sites.AttachmentEntry cannot be cast to
com.google.gdata.data.sites.BasePageEntry
    at
com.google.sites.liberation.export.InMemoryEntryStore.getParent(InMemoryEntrySto
re.java:101)
    at
com.google.sites.liberation.export.SiteExporterImpl.downloadAttachment(SiteExpor
terImpl.java:174)
    at
com.google.sites.liberation.export.SiteExporterImpl.exportSite(SiteExporterImpl.
java:142)
    at
com.google.sites.liberation.util.GuiMain$ImportExportRunnable.run(GuiMain.java:2
79)
    at java.lang.Thread.run(Thread.java:619)

Original issue reported on code.google.com by agent...@gmail.com on 8 Dec 2009 at 7:43

GoogleCodeExporter commented 9 years ago

Original comment by gk5...@kickstyle.net on 6 Jan 2010 at 4:40

GoogleCodeExporter commented 9 years ago
Also reproduced on Windows XP (java full version "1.6.0_11-b03"), export failed 
at 
the first JPG attachment 

java -cp google-sites-liberation-1.0.1.jar 
com.google.sites.liberation.export.Main -
w mysite -u myname -p ******** -f e:\temp\1 -r > liberation.log 2>&1
...
Current progress: 77%.
Downloading attachment: DSC_1498.JPG.
Exception in thread "main" java.lang.ClassCastException: 
com.google.gdata.data.sites.AttachmentEntry cannot be cast to 
com.google.gdata.data.sites.BasePageEntry
    at com.google.sites.liberation.export.InMemoryEntryStore.getParent
(InMemoryEntryStore.java:101)
    at com.google.sites.liberation.export.SiteExporterImpl.downloadAttachment
(SiteExporterImpl.java:174)
    at com.google.sites.liberation.export.SiteExporterImpl.exportSite
(SiteExporterImpl.java:142)
    at com.google.sites.liberation.export.Main.doMain(Main.java:81)
    at com.google.sites.liberation.export.Main.main(Main.java:97)

Original comment by smishc...@gmail.com on 7 Jan 2010 at 9:52

GoogleCodeExporter commented 9 years ago
It sounds strange, but parent of AttachmentEntry is not necessarily PageEntry. 
Sometimes great URLs occur, like this:
http://sites.google.com/site/mysite/notes/note200/DSC_1496.JPG/DSC_1498.JPG 
(one 
attachment and then another). Their origination is obscure for me, but it 
seems, 
they have to do with versioned attachments. I suppose, it may be some 
architectural 
flaw in Google Sites, sometimes browsing through such pages leads to 404 error.

I suggest for now: simply catch an exception at 
com.google.sites.liberation.export.SiteExporterImpl.java (at least, in this 
case 
export completes, and it seems, all attachments are here, I am not quite shure 
about 
latest versions)

for (AttachmentEntry attachment : attachments) {
        progressListener.setStatus("Downloading attachment: " 
            + attachment.getTitle().getPlainText() + '.');

        try {           
            downloadAttachment(attachment, rootDirectory, entryStore, 
sitesService);
        } catch (Exception ex) {
            progressListener.setStatus("Error downloading attachment " 
                + attachment.getTitle().getPlainText() + " : " + 
ex.toString() + '.');
        }

        progressListener.setProgress(((double) ++currentEntries) / totalEntries);
      }

Original comment by smishc...@gmail.com on 24 Jan 2010 at 1:18

Attachments: