mirror of
https://github.com/etesync/android
synced 2024-11-23 00:18:19 +00:00
ical4j update, clean up XML requests
* ical4j update to 2.0-beta1 (fixes #509, fixes #606) * only run sync adapters in :sync process, set thread context class loaders appropriately * remove "class" attribute from XML requests (fixes #615)
This commit is contained in:
parent
d7fff8a760
commit
31f5be01b4
@ -48,9 +48,9 @@ dependencies {
|
|||||||
compile 'org.apache.commons:commons-lang3:3.4'
|
compile 'org.apache.commons:commons-lang3:3.4'
|
||||||
compile 'commons-io:commons-io:2.4'
|
compile 'commons-io:commons-io:2.4'
|
||||||
// Lombok for useful @helpers
|
// Lombok for useful @helpers
|
||||||
provided 'org.projectlombok:lombok:1.16.4'
|
provided 'org.projectlombok:lombok:1.16.6'
|
||||||
// ical4j for parsing/generating iCalendars
|
// ical4j for parsing/generating iCalendars
|
||||||
compile('org.mnode.ical4j:ical4j:2.0-alpha1') {
|
compile('org.mnode.ical4j:ical4j:2.0-beta1') {
|
||||||
// we don't need content builders, see https://github.com/ical4j/ical4j/wiki/Groovy
|
// we don't need content builders, see https://github.com/ical4j/ical4j/wiki/Groovy
|
||||||
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
|
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ package at.bitfire.davdroid.resource;
|
|||||||
|
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.test.InstrumentationTestCase;
|
import android.test.InstrumentationTestCase;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.CharEncoding;
|
import org.apache.commons.lang3.CharEncoding;
|
||||||
@ -19,10 +18,8 @@ import java.io.InputStream;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import at.bitfire.davdroid.ArrayUtils;
|
|
||||||
import at.bitfire.davdroid.webdav.DavException;
|
import at.bitfire.davdroid.webdav.DavException;
|
||||||
import at.bitfire.davdroid.webdav.HttpException;
|
import at.bitfire.davdroid.webdav.HttpException;
|
||||||
import ezvcard.VCardVersion;
|
import ezvcard.VCardVersion;
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme">
|
||||||
android:process=":sync">
|
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".syncadapter.AccountAuthenticatorService"
|
android:name=".syncadapter.AccountAuthenticatorService"
|
||||||
@ -49,7 +48,8 @@
|
|||||||
</service>
|
</service>
|
||||||
<service
|
<service
|
||||||
android:name=".syncadapter.ContactsSyncAdapterService"
|
android:name=".syncadapter.ContactsSyncAdapterService"
|
||||||
android:exported="true" >
|
android:exported="true"
|
||||||
|
android:process=":sync">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.content.SyncAdapter" />
|
<action android:name="android.content.SyncAdapter" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
@ -62,7 +62,8 @@
|
|||||||
</service>
|
</service>
|
||||||
<service
|
<service
|
||||||
android:name=".syncadapter.CalendarsSyncAdapterService"
|
android:name=".syncadapter.CalendarsSyncAdapterService"
|
||||||
android:exported="true" >
|
android:exported="true"
|
||||||
|
android:process=":sync">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.content.SyncAdapter" />
|
<action android:name="android.content.SyncAdapter" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
@ -72,7 +73,8 @@
|
|||||||
</service>
|
</service>
|
||||||
<service
|
<service
|
||||||
android:name=".syncadapter.TasksSyncAdapterService"
|
android:name=".syncadapter.TasksSyncAdapterService"
|
||||||
android:exported="true" >
|
android:exported="true"
|
||||||
|
android:process=":sync">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.content.SyncAdapter" />
|
<action android:name="android.content.SyncAdapter" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -31,7 +31,7 @@ import java.util.SimpleTimeZone;
|
|||||||
public class DateUtils {
|
public class DateUtils {
|
||||||
private final static String TAG = "davdroid.DateUtils";
|
private final static String TAG = "davdroid.DateUtils";
|
||||||
|
|
||||||
public final static TimeZoneRegistry tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry();
|
public static final TimeZoneRegistry tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// disable automatic time-zone updates (causes unwanted network traffic)
|
// disable automatic time-zone updates (causes unwanted network traffic)
|
||||||
|
@ -154,9 +154,14 @@ public abstract class iCalendar extends Resource {
|
|||||||
|
|
||||||
public static class Factory implements ParameterFactory {
|
public static class Factory implements ParameterFactory {
|
||||||
@Override
|
@Override
|
||||||
public Parameter createParameter(String name, String value) throws URISyntaxException {
|
public Parameter createParameter(String value) throws URISyntaxException {
|
||||||
return new Email(value);
|
return new Email(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supports(String name) {
|
||||||
|
return PARAMETER_NAME.equalsIgnoreCase(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,8 @@ public abstract class DavSyncAdapter extends AbstractThreadedSyncAdapter impleme
|
|||||||
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
|
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
|
||||||
Log.i(TAG, "Performing sync for authority " + authority);
|
Log.i(TAG, "Performing sync for authority " + authority);
|
||||||
|
|
||||||
// set class loader for iCal4j ResourceLoader
|
/* Set class loader for iCal4j ResourceLoader – this is required because the various
|
||||||
|
* sync adapters (contacts, events, tasks) share the same :sync process (see AndroidManifest */
|
||||||
Thread.currentThread().setContextClassLoader(getContext().getClassLoader());
|
Thread.currentThread().setContextClassLoader(getContext().getClassLoader());
|
||||||
|
|
||||||
// create httpClient, if necessary
|
// create httpClient, if necessary
|
||||||
|
@ -12,7 +12,6 @@ import org.simpleframework.xml.ElementList;
|
|||||||
import org.simpleframework.xml.Order;
|
import org.simpleframework.xml.Order;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Order(elements={"prop","href"})
|
@Order(elements={"prop","href"})
|
||||||
public class DavMultiget {
|
public class DavMultiget {
|
||||||
@ -26,7 +25,7 @@ public class DavMultiget {
|
|||||||
DavProp prop;
|
DavProp prop;
|
||||||
|
|
||||||
@ElementList(inline=true)
|
@ElementList(inline=true)
|
||||||
List<DavHref> hrefs;
|
ArrayList<DavHref> hrefs;
|
||||||
|
|
||||||
|
|
||||||
public static DavMultiget newRequest(Type type, String names[]) {
|
public static DavMultiget newRequest(Type type, String names[]) {
|
||||||
|
@ -11,11 +11,12 @@ import org.simpleframework.xml.ElementList;
|
|||||||
import org.simpleframework.xml.Namespace;
|
import org.simpleframework.xml.Namespace;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Namespace(reference="DAV:")
|
@Namespace(reference="DAV:")
|
||||||
@Root(strict=false)
|
@Root(strict=false)
|
||||||
public class DavMultistatus {
|
public class DavMultistatus {
|
||||||
@ElementList(inline=true,entry="response",required=false)
|
@ElementList(inline=true,entry="response",required=false)
|
||||||
List<DavResponse> response;
|
ArrayList<DavResponse> response;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import org.simpleframework.xml.Namespace;
|
|||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
import org.simpleframework.xml.Text;
|
import org.simpleframework.xml.Text;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -85,7 +85,7 @@ public class DavProp {
|
|||||||
/* RFC 3744 WebDAV Access Control Protocol */
|
/* RFC 3744 WebDAV Access Control Protocol */
|
||||||
|
|
||||||
@ElementList(required=false,name="current-user-privilege-set",entry="privilege")
|
@ElementList(required=false,name="current-user-privilege-set",entry="privilege")
|
||||||
List<Privilege> currentUserPrivilegeSet;
|
ArrayList<Privilege> currentUserPrivilegeSet;
|
||||||
|
|
||||||
public static class Privilege {
|
public static class Privilege {
|
||||||
@Element(required=false)
|
@Element(required=false)
|
||||||
@ -125,7 +125,7 @@ public class DavProp {
|
|||||||
|
|
||||||
@Namespace(prefix="CD",reference="urn:ietf:params:xml:ns:carddav")
|
@Namespace(prefix="CD",reference="urn:ietf:params:xml:ns:carddav")
|
||||||
@ElementList(required=false,name="supported-address-data",entry="address-data-type")
|
@ElementList(required=false,name="supported-address-data",entry="address-data-type")
|
||||||
List<AddressDataType> supportedAddressData;
|
ArrayList<AddressDataType> supportedAddressData;
|
||||||
|
|
||||||
@Element(required=false,name="calendar-description")
|
@Element(required=false,name="calendar-description")
|
||||||
CalendarDescription calendarDescription;
|
CalendarDescription calendarDescription;
|
||||||
@ -138,7 +138,7 @@ public class DavProp {
|
|||||||
|
|
||||||
@Namespace(prefix="C",reference="urn:ietf:params:xml:ns:caldav")
|
@Namespace(prefix="C",reference="urn:ietf:params:xml:ns:caldav")
|
||||||
@ElementList(required=false,name="supported-calendar-component-set",entry="comp")
|
@ElementList(required=false,name="supported-calendar-component-set",entry="comp")
|
||||||
List<Comp> supportedCalendarComponentSet;
|
ArrayList<Comp> supportedCalendarComponentSet;
|
||||||
|
|
||||||
@Element(name="address-data",required=false)
|
@Element(name="address-data",required=false)
|
||||||
AddressData addressData;
|
AddressData addressData;
|
||||||
|
@ -11,7 +11,7 @@ import org.simpleframework.xml.Element;
|
|||||||
import org.simpleframework.xml.ElementList;
|
import org.simpleframework.xml.ElementList;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@Root(strict=false)
|
@Root(strict=false)
|
||||||
public class DavResponse {
|
public class DavResponse {
|
||||||
@ -22,5 +22,5 @@ public class DavResponse {
|
|||||||
String status;
|
String status;
|
||||||
|
|
||||||
@ElementList(inline=true,required=false)
|
@ElementList(inline=true,required=false)
|
||||||
List<DavPropstat> propstat;
|
ArrayList<DavPropstat> propstat;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import org.simpleframework.xml.core.Persister;
|
|||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.LinkedList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class HttpPropfind extends HttpEntityEnclosingRequestBaseHC4 {
|
public class HttpPropfind extends HttpEntityEnclosingRequestBaseHC4 {
|
||||||
private static final String TAG = "davdroid.HttpPropfind";
|
private static final String TAG = "davdroid.HttpPropfind";
|
||||||
@ -56,25 +56,25 @@ public class HttpPropfind extends HttpEntityEnclosingRequestBaseHC4 {
|
|||||||
depth = 1;
|
depth = 1;
|
||||||
propfind.prop.displayname = new DavProp.DisplayName();
|
propfind.prop.displayname = new DavProp.DisplayName();
|
||||||
propfind.prop.resourcetype = new DavProp.ResourceType();
|
propfind.prop.resourcetype = new DavProp.ResourceType();
|
||||||
propfind.prop.currentUserPrivilegeSet = new LinkedList<>();
|
propfind.prop.currentUserPrivilegeSet = new ArrayList<>();
|
||||||
propfind.prop.addressbookDescription = new DavProp.AddressbookDescription();
|
propfind.prop.addressbookDescription = new DavProp.AddressbookDescription();
|
||||||
break;
|
break;
|
||||||
case CALDAV_COLLECTIONS:
|
case CALDAV_COLLECTIONS:
|
||||||
depth = 1;
|
depth = 1;
|
||||||
propfind.prop.displayname = new DavProp.DisplayName();
|
propfind.prop.displayname = new DavProp.DisplayName();
|
||||||
propfind.prop.resourcetype = new DavProp.ResourceType();
|
propfind.prop.resourcetype = new DavProp.ResourceType();
|
||||||
propfind.prop.currentUserPrivilegeSet = new LinkedList<>();
|
propfind.prop.currentUserPrivilegeSet = new ArrayList<>();
|
||||||
propfind.prop.calendarDescription = new DavProp.CalendarDescription();
|
propfind.prop.calendarDescription = new DavProp.CalendarDescription();
|
||||||
propfind.prop.calendarColor = new DavProp.CalendarColor();
|
propfind.prop.calendarColor = new DavProp.CalendarColor();
|
||||||
propfind.prop.calendarTimezone = new DavProp.CalendarTimezone();
|
propfind.prop.calendarTimezone = new DavProp.CalendarTimezone();
|
||||||
propfind.prop.supportedCalendarComponentSet = new LinkedList<>();
|
propfind.prop.supportedCalendarComponentSet = new ArrayList<>();
|
||||||
break;
|
break;
|
||||||
case COLLECTION_PROPERTIES:
|
case COLLECTION_PROPERTIES:
|
||||||
propfind.prop.getctag = new DavProp.GetCTag();
|
propfind.prop.getctag = new DavProp.GetCTag();
|
||||||
propfind.prop.resourcetype = new DavProp.ResourceType();
|
propfind.prop.resourcetype = new DavProp.ResourceType();
|
||||||
propfind.prop.displayname = new DavProp.DisplayName();
|
propfind.prop.displayname = new DavProp.DisplayName();
|
||||||
propfind.prop.calendarColor = new DavProp.CalendarColor();
|
propfind.prop.calendarColor = new DavProp.CalendarColor();
|
||||||
propfind.prop.supportedAddressData = new LinkedList<>();
|
propfind.prop.supportedAddressData = new ArrayList<>();
|
||||||
break;
|
break;
|
||||||
case MEMBERS_ETAG:
|
case MEMBERS_ETAG:
|
||||||
depth = 1;
|
depth = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user