austgl / android-shuffle

Automatically exported from code.google.com/p/android-shuffle
0 stars 0 forks source link

Tracks 2.0 sync fails to illegal "state" field in a Context #268

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reproducing the problem:
1. Configure Shuffle to sync to a Tracks 2.0 host
2. Create new Context in shuffle
3. Try to sync the Context to the Tracks server

The expected outcome would be the Context synchronized to Tracks, but instead 
Tracks fails to add the Context and it will only stay in Shuffle. This also 
prevents synchronizing any tasks which are marked for that Context.

The problem appears with Tracks 2.0 & any current shuffle version (also HG HEAD 
2011-09-10).

The error message from Tracks log clearly shows that it fails because Shuffle 
tries to send a "state" field for Contexts:

====== tracks log ===========================

Processing ContextsController#create to xml (for 192.168.1.103 at 2011-09-10 
16:26:23) [POST]
  Parameters: {"context"=>{"position"=>12, "name"=>"Patching test 1", "created_at"=>Sat Sep 10 14:26:22 UTC 2011, "hide"=>false, "updated_at"=>Sat Sep 10 14:26:22 UTC 2011, "state"=>"active"}}

ActiveRecord::UnknownAttributeError (unknown attribute: state):
  app/controllers/contexts_controller.rb:69:in `create'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering /srv/bsag-tracks-22a0c94/public/500.html (500 Internal Server Error)

====== tracks log ===========================

Original issue reported on code.google.com by jaakko.s...@gmail.com on 10 Sep 2011 at 1:35

GoogleCodeExporter commented 9 years ago
Here's a hg diff against today's hg head to fix this problem:

diff -r 4e6b60d830ff 
client/src/org/dodgybits/shuffle/android/synchronisation/tracks/ContextSynchroni
zer.java
--- 
a/client/src/org/dodgybits/shuffle/android/synchronisation/tracks/ContextSynchro
nizer.java  Sun Aug 14 19:27:57 2011 +0100
+++ 
b/client/src/org/dodgybits/shuffle/android/synchronisation/tracks/ContextSynchro
nizer.java  Sat Sep 10 16:38:47 2011 +0300
@@ -95,7 +95,8 @@
             serializer.startTag("", "hide").attribute("", "type", "boolean").text(String.valueOf(!localContext.isActive())).endTag("", "hide");
             serializer.startTag("", "name").text(localContext.getName()).endTag("", "name");
             serializer.startTag("", "position").attribute("", "type", "integer").text("12").endTag("", "position");
-            serializer.startTag("", "state").text(localContext.isDeleted() ? 
"hidden" : "active").endTag("", "state");
+            // NB: Tracks 2.0 Rest API doesn't accept state field for contexts
+            //serializer.startTag("", "state").text(localContext.isDeleted() ? 
"hidden" : "active").endTag("", "state");
             serializer.startTag("", "updated-at").attribute("", "type", "datetime").text(now).endTag("", "updated-at");
             serializer.endTag("", "context");
             // serializer.endDocument();

Original comment by jaakko.s...@gmail.com on 10 Sep 2011 at 1:41

GoogleCodeExporter commented 9 years ago
I had independently found this issue and I can verify that it fixes the 
reported bug.

Original comment by ptsampou...@gmail.com on 27 Sep 2011 at 5:03

GoogleCodeExporter commented 9 years ago
i have exactly the same problem, but I'm a bit of a newbie and I've got a 
little stuck wit this diff file. I copied the text of the diff file in to a 
text doc and added the .diff to the file name. (is that correct?) I then 
followed the link on the home page 
http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion/ 
The problem is I can't find where shuffle actually is. When I do a search for 
Shuffle in "es file browser" I can only find my backups. So I'm not sure where 
to put it. 
Thanks

Original comment by johnlumg...@gmail.com on 29 Sep 2011 at 7:36

GoogleCodeExporter commented 9 years ago
If you're interested to test this and a couple of other Tracks patches, you can 
use a temporary installation package I've built. The issues it fixes are #268, 
#238, #269 & #270. It's built from my cloned android-shuffle source tree 
http://code.google.com/r/jaakkosipari-shuffle-tracks-sync-patches/.

Be aware, however, that:
- I take no responsibility of lost data or any other problems this installation 
package or modified Shuffle application might cause you.
- Removing your current Shuffle installation will remove all your Shuffle data, 
unless you have managed to synchronize it to Tracks or have backed up the data 
some other way.
- You must remove your current Shuffle installation before installing this 
package (otherwise Android will just say that installation failed). This is 
probably because it has a different signature than the official package from 
Android Market.
- You must enable "Allow installation from unknown sources" to allow Android to 
install this package. See Settings / Applications.
- You must remove this installation package before returning to an official 
Market-version of Shuffle.
- This is really only meant to be a temporary solution before these patches are 
applied to the official source tree and released as a new Shuffle release via 
Android Market.

Keeping all of the above in mind, you can download my package from: 
http://ukuti.net/MyShuffleSigned.apk

Original comment by jaakko.s...@gmail.com on 5 Oct 2011 at 8:58

GoogleCodeExporter commented 9 years ago
It seems like this file isn't available anymore. Can someone else help me out?

Original comment by joemburg...@gmail.com on 17 Oct 2011 at 12:54

GoogleCodeExporter commented 9 years ago

Original comment by andybry...@gmail.com on 6 Nov 2011 at 7:44

GoogleCodeExporter commented 9 years ago
Issue 127 has been merged into this issue.

Original comment by andybry...@gmail.com on 27 Mar 2012 at 6:48

GoogleCodeExporter commented 9 years ago
Issue 129 has been merged into this issue.

Original comment by andybry...@gmail.com on 27 Mar 2012 at 6:49

GoogleCodeExporter commented 9 years ago
Patch added to v2.0.0

Original comment by andybry...@gmail.com on 27 Mar 2012 at 7:00