eservent / google-sites-liberation

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

export of pages with unknown author fails #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 robert.m...@gmail.com on 16 Nov 2009 at 8:24

GoogleCodeExporter commented 9 years ago
i'll take a look at this one.

Original comment by gk5...@kickstyle.net on 20 Nov 2009 at 3:49

GoogleCodeExporter commented 9 years ago
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 joseluis...@gmail.com on 29 Apr 2010 at 9:48

GoogleCodeExporter commented 9 years ago
Search for the page problem 

Original comment by greestreet@gmail.com on 12 May 2010 at 9:17

GoogleCodeExporter commented 9 years ago
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 j...@metrumrg.com on 14 Feb 2011 at 7:07

GoogleCodeExporter commented 9 years ago
Concur here

Original comment by k...@campbellmusclelab.org on 17 Mar 2012 at 8:45

GoogleCodeExporter commented 9 years ago
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 hvonmark...@gmail.com on 19 Jul 2012 at 9:45

GoogleCodeExporter commented 9 years ago
I have the same issue please fix the bug

Original comment by marc.lec...@enensys.com on 23 May 2013 at 2:22