Browse Source

Fix crash caused by a cast error (creationtime field can be an Integer or a Long, depending on the used dialect).

pull/11/head
Eric Kok 12 years ago
parent
commit
0d70f76a10
  1. 19
      lib/src/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

19
lib/src/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

@ -288,15 +288,24 @@ public class RtorrentAdapter implements IDaemonAdapter { @@ -288,15 +288,24 @@ public class RtorrentAdapter implements IDaemonAdapter {
String error = (String)info[18];
error = error.equals("")? null: error;
// Determine the time added
Date added = null;
Date finished = null;
if(!((String)info[19]).equals(""))
added = new Date(Long.valueOf(((String)info[19]).trim()));
else
added = new Date((Long)info[11]);
// Successfully received the addtime from rTorrent (which is a String like '1337089336\n')
added = new Date(Long.valueOf(((String)info[19]).trim()) * 1000L);
else {
// rTorrent didn't have the addtime (missing plugin?): base it on creationtime instead
if (info[11] instanceof Long)
added = new Date((Long)info[11] * 1000L);
else
added = new Date((Integer)info[11] * 1000L);
}
// Determine the seeding time
Date finished = null;
if(!((String)info[20]).equals(""))
finished = new Date(Long.valueOf(((String)info[20]).trim()));
// Successfully received the seedingtime from rTorrent (which is a String like '1337089336\n')
finished = new Date(Long.valueOf(((String)info[20]).trim()) * 1000L);
String label = null;

Loading…
Cancel
Save