google-sites-liberation
google-sites-liberation copied to clipboard
export of pages with unknown author fails
What steps will reproduce the problem?
probably:
1. user X creates a page
2. delete user X's Google Account
3. after some time, attempting to export the site/page with
google-sites-liberation won't work as the user does not exist anymore and
google-sites-liberation tries to query the user's email from the Google
Sites API. This leads to a NullPointerException (see below for stack trace)
What is the expected output? What do you see instead?
Expected output: everything should work fine and the page should be
exported. Instead, there is an exception:
Exception in thread "Thread-2" java.lang.NullPointerException: text
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:203)
at
com.google.sites.liberation.renderers.RendererUtils.getHyperLink(RendererUtils.j
ava:140)
at
com.google.sites.liberation.renderers.RendererUtils.getAuthorElement(RendererUti
ls.java:71)
at
com.google.sites.liberation.renderers.ContentRendererImpl.renderContent(ContentR
endererImpl.java:39)
at
com.google.sites.liberation.export.PageExporterImpl.exportPage(PageExporterImpl.
java:123)
at
com.google.sites.liberation.export.SiteExporterImpl.exportPage(SiteExporterImpl.
java:158)
at
com.google.sites.liberation.export.SiteExporterImpl.exportSite(SiteExporterImpl.
java:131)
at
com.google.sites.liberation.util.GuiMain$ImportExportRunnable.run(GuiMain.java:2
79)
at java.lang.Thread.run(Thread.java:637)
What version of the product are you using? On what operating system?
google-sites-liberation 1.0.1 on Mac OS X Snow Leopard
Please provide any additional information below.
In our company, we have an old (approx. 2yrs) multi-user webspace within
Google Sites. It seems that google-sites-liberation fails to export pages
where the author's email is NULL in the page entry as retrieved from the
Google Sites API because the user has been deleted a long time ago.
(looking at the revision history says "unknown user" in the author column)
Original issue reported on code.google.com by [email protected]
on 16 Nov 2009 at 8:24
i'll take a look at this one.
Original comment by [email protected]
on 20 Nov 2009 at 3:49
- Changed state: Accepted
Can anyone edit the code in
com.google.sites.liberation.renderers.RendererUtils.getAuthorElement(RendererUti
ls.java:72)
and protect the line...
/**
* Creates a new hCard element for the given entry.
*/
static XmlElement getAuthorElement(BaseContentEntry<?> entry) {
checkNotNull(entry);
XmlElement element = new XmlElement("span");
element.setAttribute("class", "author");
XmlElement vcard = new XmlElement("span");
vcard.setAttribute("class", "vcard");
Person author = entry.getAuthors().get(0);
String name = author.getName();
String email = author.getEmail();
if (name == null) {
if (email == null) { // THIS LINE IS NEW
XmlElement link = getHyperLink("mailto: "unknown author"); // THIS LINE IS NEW
} else { // THIS LINE IS NEW
XmlElement link = getHyperLink("mailto: + email, email);
} // THIS LINE IS NEW
link.setAttribute("class", "email");
vcard.addElement(link);
} else {
XmlElement link = getHyperLink("mailto: + email, name);
link.setAttribute("class", "fn");
vcard.addElement(link);
}
return element.addElement(vcard);
}
Original comment by [email protected]
on 29 Apr 2010 at 9:48
Just ran into this. Same error message. "Unknown user" is listed in the
revision history as the author of the offending page.
Original comment by [email protected]
on 14 Feb 2011 at 7:07
same here -- need to export an old intranet (with posts by several deleted
users) to our new intranet site. Old site exported fine with Revisions
unchecked, but hangs on export when Revisions is checked.
Original comment by [email protected]
on 19 Jul 2012 at 9:45
I have the same issue please fix the bug
Original comment by [email protected]
on 23 May 2013 at 2:22