Dkru838 / google-sites-liberation

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

Import fails with if-match or if-none-match header required error #41

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Site is pathfinderogc, free sites not google apps.

1. I have one local directory created from running an export of the site
using latest/current sites liberation jar. I deleted every file in the
directory but the one file I wanted to import back into the site for
testing. I edited that file.

2. Run C:\>java -Xms128m -Xmx256m -cp google-sites-liberation-1.0.1.jar
com.google.sites.liberation.imprt.Main -w "pathfinderogc" -u <myusername>
-p <mypassword> -f "c:\d20pfsrd"

3. Receive following error:

WARNING: Unable to update entry:{WebPageEntry {BasePageEntry
{BaseContentEntry com.google.gdata.data.sites.WebPageEntry@1fd5e2}}}
com.google.gdata.util.ServiceForbiddenException: Forbidden
If-Match or If-None-Match header required

What is the expected output? What do you see instead?
Expect one page to be imported showing changes. See error above.

What version of the product are you using? On what operating system?
Windows XP Professional. Java build 1.6.0_16-b01

Please provide any additional information below.

Full error:

C:\>java -Xms128m -Xmx256m -cp google-sites-liberation-1.0.1.jar
com.google.sites.liberation.imprt.Main -w "pathfinderogc" -u <myusername>
-p <mypassword> -f "c:\d20pfsrd"
Scanning directory.
Importing page: classes
Jan 6, 2010 2:08:21 PM com.google.sites.liberation.imprt.EntryUpdaterImpl
updateEntry
WARNING: Unable to update entry:{WebPageEntry {BasePageEntry
{BaseContentEntry com.google.gdata.data.sites.WebPageEntry@1fd5e2}}}
com.google.gdata.util.ServiceForbiddenException: Forbidden
If-Match or If-None-Match header required

        at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataReque
st.java:561)
        at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataR
equest.java:543)
        at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.jav
a:536)
        at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:515)
        at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:
515)
        at com.google.gdata.client.Service.update(Service.java:1482)
        at com.google.gdata.client.Service.update(Service.java:1448)
        at com.google.gdata.client.GoogleService.update(GoogleService.java:583)
        at
com.google.sites.liberation.imprt.EntryUpdaterImpl.updateEntry(EntryUpdaterImpl.
java:47)
        at
com.google.sites.liberation.imprt.EntryUploaderImpl.uploadEntry(EntryUploaderImp
l.java:113)
        at
com.google.sites.liberation.imprt.PageImporterImpl.importPage(PageImporterImpl.j
ava:104)
        at
com.google.sites.liberation.imprt.SiteImporterImpl.importPage(SiteImporterImpl.j
ava:61)
        at
com.google.sites.liberation.imprt.SiteImporterImpl.importSite(SiteImporterImpl.j
ava:47)
        at com.google.sites.liberation.imprt.Main.doMain(Main.java:85)
        at com.google.sites.liberation.imprt.Main.main(Main.java:101)
Exception in thread "main" java.lang.NullPointerException
        at
com.google.sites.liberation.util.EntryUtils.setParent(EntryUtils.java:80)
        at
com.google.sites.liberation.imprt.PageImporterImpl.importPage(PageImporterImpl.j
ava:126)
        at
com.google.sites.liberation.imprt.SiteImporterImpl.importPage(SiteImporterImpl.j
ava:61)
        at
com.google.sites.liberation.imprt.SiteImporterImpl.importSite(SiteImporterImpl.j
ava:47)
        at com.google.sites.liberation.imprt.Main.doMain(Main.java:85)
        at com.google.sites.liberation.imprt.Main.main(Main.java:101)

Original issue reported on code.google.com by jre...@gmail.com on 6 Jan 2010 at 7:26

GoogleCodeExporter commented 8 years ago
Not even a comment in 8 days. Everyone must be reassigned to answering support 
calls
for the Nexus One. This sucks.

Original comment by jre...@gmail.com on 15 Jan 2010 at 3:11

GoogleCodeExporter commented 8 years ago
13 days, no comment. Disheartening. It appears Google has abandoned this 
project.

Original comment by jre...@gmail.com on 19 Jan 2010 at 8:54

GoogleCodeExporter commented 8 years ago
It's an open-source project.  Contributions welcome.

Original comment by luke.bla...@gmail.com on 19 Jan 2010 at 9:05

GoogleCodeExporter commented 8 years ago
I have asked three separate independent developers to look into the matter. 
None have
gotten anywhere. Another developer (not a java developer mind you) will begin 
looking
into the source code in the very near future. I hope he will make some level of
progress. I was under the impression, perhaps incorrectly, that even though 
this was
an open source project that there were Google Developers actively working on the
project. That does not appear to be the case even though Google claims to 
really want
to support/promote data liberation. Oh well, I just have to recalibrate my
expectations is all.

Original comment by jre...@gmail.com on 19 Jan 2010 at 9:09

GoogleCodeExporter commented 8 years ago
Looks like this particular error maybe coming from a call in the GData Java 
Client Library caused by a redirect on 
a delete (which seems to make sense given that the import is probably deleting 
existing content and then 
replacing with the imported page).  The workaround for this error is described 
at: 
http://code.google.com/p/gdata-java-client/issues/detail?id=92

I have downloaded the source and am attempting to locate the specific call to 
see if it is a potential quick fix (and 
to verify this is the actual problem).  Hope this helps in tracking down and 
fixing the bug.

Original comment by childs.m...@gmail.com on 20 Jan 2010 at 8:34

GoogleCodeExporter commented 8 years ago
This error is getting thrown on this call:

return sitesService.update(new URL(oldEntry.getId()), newEntry);

The documentation for the API states that .update takes three arguments the 
entry URL, the entry and an etag 
(which it says must match the existing tag).  If the etag is null then no 
precondition is set, and if it is a * then 
the update happens unconditionally.  This call can (and appears to) throw the 
ServiceException error - which 
denotes some type of system error.  My Java is just rusty enough that I can't 
remember if leaving the argument 
out implies a null value or not (I thought it had to be an explicit 
declaration).  Something about this particular 
call is unhappy.  I'm going to try to do some testing to see if I can further 
narrow it down. 

Original comment by childs.m...@gmail.com on 20 Jan 2010 at 9:06

GoogleCodeExporter commented 8 years ago
Thanks Matt for getting involved! Hopefully you'll either have this fixed or 
will
have at least identified enough information to help Google make a fix sooner.

Original comment by jre...@gmail.com on 21 Jan 2010 at 7:19

GoogleCodeExporter commented 8 years ago
I have found the fix for this:

Line 47 of EntryUpdaterImpl.java reads:
return sitesService.update(new URL(oldEntry.getId()), newEntry);

This returns the Service Forbidden If-Match If-No-Match Header Required Error

According to the docs for this call there is a third parameter that can be 
included -
the etag of the page or the * for an unconditional overwrite.  Since this is a 
bulk
import/export tool - I added the *.  The line now reads:

return sitesService.update(new URL(oldEntry.getId()), newEntry, "*");
and when I run the code in the IDE (I'm using NetBeans 6.8) it works like a 
champ.  

I've made my own clone of the repository and will check this code back in when 
I get
the chance.  I am curious - when I perform the build locally my JAR file is
considerably smaller than yours and does not run.  I'd like to understand why 
(and am
fully ready to hear that there is some NetBeans thing that I have missed).

Original comment by childs.m...@gmail.com on 27 Jan 2010 at 10:37

GoogleCodeExporter commented 8 years ago

Original comment by gk5...@kickstyle.net on 8 Mar 2010 at 5:03