diff --git a/app/build.gradle b/app/build.gradle index 8975a008..8386ccf5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,9 @@ android { buildTypes { debug { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + minifyEnabled false + //minifyEnabled true + //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } release { minifyEnabled true diff --git a/app/src/main/java/at/bitfire/davdroid/Constants.java b/app/src/main/java/at/bitfire/davdroid/Constants.java index 123ca3a5..040d892b 100644 --- a/app/src/main/java/at/bitfire/davdroid/Constants.java +++ b/app/src/main/java/at/bitfire/davdroid/Constants.java @@ -11,8 +11,5 @@ public class Constants { public static final String APP_VERSION = "0.6.9", ACCOUNT_TYPE = "bitfire.at.davdroid", - WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app", - - SETTING_DISABLE_COMPRESSION = "disable_compression", - SETTING_NETWORK_LOGGING = "network_logging"; + WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app"; } diff --git a/app/src/main/java/at/bitfire/davdroid/URIUtils.java b/app/src/main/java/at/bitfire/davdroid/URIUtils.java index a1ab9038..509bb582 100644 --- a/app/src/main/java/at/bitfire/davdroid/URIUtils.java +++ b/app/src/main/java/at/bitfire/davdroid/URIUtils.java @@ -7,11 +7,11 @@ ******************************************************************************/ package at.bitfire.davdroid; +import android.util.Log; + import java.net.URI; import java.net.URISyntaxException; -import android.util.Log; - public class URIUtils { private static final String TAG = "davdroid.URIUtils"; diff --git a/app/src/main/java/at/bitfire/davdroid/resource/CalDavCalendar.java b/app/src/main/java/at/bitfire/davdroid/resource/CalDavCalendar.java index 47a595a9..6012f2ea 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/CalDavCalendar.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/CalDavCalendar.java @@ -7,10 +7,11 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; +import org.apache.http.impl.client.CloseableHttpClient; + import java.net.URISyntaxException; import at.bitfire.davdroid.webdav.DavMultiget; -import org.apache.http.impl.client.CloseableHttpClient; public class CalDavCalendar extends RemoteCollection { //private final static String TAG = "davdroid.CalDavCalendar"; diff --git a/app/src/main/java/at/bitfire/davdroid/resource/CardDavAddressBook.java b/app/src/main/java/at/bitfire/davdroid/resource/CardDavAddressBook.java index 98b9b825..37821ac0 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/CardDavAddressBook.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/CardDavAddressBook.java @@ -7,10 +7,11 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; +import org.apache.http.impl.client.CloseableHttpClient; + import java.net.URISyntaxException; import at.bitfire.davdroid.webdav.DavMultiget; -import org.apache.http.impl.client.CloseableHttpClient; public class CardDavAddressBook extends RemoteCollection { //private final static String TAG = "davdroid.CardDavAddressBook"; diff --git a/app/src/main/java/at/bitfire/davdroid/resource/Contact.java b/app/src/main/java/at/bitfire/davdroid/resource/Contact.java index d301450c..61835668 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/Contact.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/Contact.java @@ -7,6 +7,10 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; +import android.util.Log; + +import org.apache.commons.lang.StringUtils; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -14,13 +18,6 @@ import java.util.LinkedList; import java.util.List; import java.util.UUID; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -import org.apache.commons.lang.StringUtils; - -import android.util.Log; import at.bitfire.davdroid.Constants; import ezvcard.Ezvcard; import ezvcard.VCard; @@ -51,6 +48,9 @@ import ezvcard.property.Telephone; import ezvcard.property.Title; import ezvcard.property.Uid; import ezvcard.property.Url; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; /** diff --git a/app/src/main/java/at/bitfire/davdroid/resource/DavResourceFinder.java b/app/src/main/java/at/bitfire/davdroid/resource/DavResourceFinder.java index 745e9b09..6d16e6f3 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/DavResourceFinder.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/DavResourceFinder.java @@ -7,6 +7,18 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; +import android.content.Context; +import android.util.Log; + +import org.apache.http.HttpException; +import org.apache.http.impl.client.CloseableHttpClient; +import org.xbill.DNS.Lookup; +import org.xbill.DNS.Record; +import org.xbill.DNS.SRVRecord; +import org.xbill.DNS.TXTRecord; +import org.xbill.DNS.TextParseException; +import org.xbill.DNS.Type; + import java.io.Closeable; import java.io.IOException; import java.net.MalformedURLException; @@ -15,15 +27,6 @@ import java.net.URISyntaxException; import java.util.LinkedList; import java.util.List; -import org.xbill.DNS.Lookup; -import org.xbill.DNS.Record; -import org.xbill.DNS.SRVRecord; -import org.xbill.DNS.TXTRecord; -import org.xbill.DNS.TextParseException; -import org.xbill.DNS.Type; - -import android.content.Context; -import android.util.Log; import at.bitfire.davdroid.R; import at.bitfire.davdroid.webdav.DavException; import at.bitfire.davdroid.webdav.DavHttpClient; @@ -31,8 +34,6 @@ import at.bitfire.davdroid.webdav.DavIncapableException; import at.bitfire.davdroid.webdav.HttpPropfind.Mode; import at.bitfire.davdroid.webdav.NotAuthorizedException; import at.bitfire.davdroid.webdav.WebDavResource; -import org.apache.http.HttpException; -import org.apache.http.impl.client.CloseableHttpClient; import ezvcard.VCardVersion; public class DavResourceFinder implements Closeable { @@ -46,7 +47,7 @@ public class DavResourceFinder implements Closeable { this.context = context; // disable compression and enable network logging for debugging purposes - httpClient = DavHttpClient.create(true, true); + httpClient = DavHttpClient.create(); } @Override diff --git a/app/src/main/java/at/bitfire/davdroid/resource/Event.java b/app/src/main/java/at/bitfire/davdroid/resource/Event.java index 91f68012..f99ca2e9 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/Event.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/Event.java @@ -7,19 +7,9 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringReader; -import java.util.Calendar; -import java.util.LinkedList; -import java.util.List; -import java.util.SimpleTimeZone; -import java.util.TimeZone; +import android.text.format.Time; +import android.util.Log; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; import net.fortuna.ical4j.data.CalendarBuilder; import net.fortuna.ical4j.data.CalendarOutputter; import net.fortuna.ical4j.data.ParserException; @@ -58,10 +48,22 @@ import net.fortuna.ical4j.model.property.Uid; import net.fortuna.ical4j.model.property.Version; import net.fortuna.ical4j.util.SimpleHostInfo; import net.fortuna.ical4j.util.UidGenerator; -import android.text.format.Time; -import android.util.Log; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.util.Calendar; +import java.util.LinkedList; +import java.util.List; +import java.util.SimpleTimeZone; +import java.util.TimeZone; + import at.bitfire.davdroid.Constants; import at.bitfire.davdroid.syncadapter.DavSyncAdapter; +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; public class Event extends Resource { diff --git a/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.java b/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.java index b8711cbb..22fbaa0b 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.java @@ -7,23 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; -import java.io.IOException; -import java.io.InputStream; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Set; - -import lombok.Cleanup; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.WordUtils; - import android.accounts.Account; import android.content.ContentProviderClient; import android.content.ContentProviderOperation; @@ -52,6 +35,22 @@ import android.provider.ContactsContract.Data; import android.provider.ContactsContract.Groups; import android.provider.ContactsContract.RawContacts; import android.util.Log; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.WordUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Set; + import at.bitfire.davdroid.syncadapter.AccountSettings; import ezvcard.parameter.AddressType; import ezvcard.parameter.EmailType; @@ -63,6 +62,7 @@ import ezvcard.property.Birthday; import ezvcard.property.DateOrTimeProperty; import ezvcard.property.Impp; import ezvcard.property.Telephone; +import lombok.Cleanup; public class LocalAddressBook extends LocalCollection { diff --git a/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java b/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java index 9fb60064..5fc72794 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java @@ -7,38 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; -import java.net.URI; -import java.net.URISyntaxException; -import java.text.ParseException; -import java.util.LinkedList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import lombok.Cleanup; -import lombok.Getter; -import net.fortuna.ical4j.model.Dur; -import net.fortuna.ical4j.model.Parameter; -import net.fortuna.ical4j.model.ParameterList; -import net.fortuna.ical4j.model.PropertyList; -import net.fortuna.ical4j.model.component.VAlarm; -import net.fortuna.ical4j.model.parameter.Cn; -import net.fortuna.ical4j.model.parameter.CuType; -import net.fortuna.ical4j.model.parameter.PartStat; -import net.fortuna.ical4j.model.parameter.Role; -import net.fortuna.ical4j.model.property.Action; -import net.fortuna.ical4j.model.property.Attendee; -import net.fortuna.ical4j.model.property.Description; -import net.fortuna.ical4j.model.property.Duration; -import net.fortuna.ical4j.model.property.ExDate; -import net.fortuna.ical4j.model.property.ExRule; -import net.fortuna.ical4j.model.property.Organizer; -import net.fortuna.ical4j.model.property.RDate; -import net.fortuna.ical4j.model.property.RRule; -import net.fortuna.ical4j.model.property.Status; - -import org.apache.commons.lang.StringUtils; - import android.accounts.Account; import android.annotation.SuppressLint; import android.annotation.TargetApi; @@ -61,6 +29,39 @@ import android.provider.CalendarContract.Reminders; import android.provider.ContactsContract; import android.util.Log; +import net.fortuna.ical4j.model.Dur; +import net.fortuna.ical4j.model.Parameter; +import net.fortuna.ical4j.model.ParameterList; +import net.fortuna.ical4j.model.PropertyList; +import net.fortuna.ical4j.model.component.VAlarm; +import net.fortuna.ical4j.model.parameter.Cn; +import net.fortuna.ical4j.model.parameter.CuType; +import net.fortuna.ical4j.model.parameter.PartStat; +import net.fortuna.ical4j.model.parameter.Role; +import net.fortuna.ical4j.model.property.Action; +import net.fortuna.ical4j.model.property.Attendee; +import net.fortuna.ical4j.model.property.Description; +import net.fortuna.ical4j.model.property.Duration; +import net.fortuna.ical4j.model.property.ExDate; +import net.fortuna.ical4j.model.property.ExRule; +import net.fortuna.ical4j.model.property.Organizer; +import net.fortuna.ical4j.model.property.RDate; +import net.fortuna.ical4j.model.property.RRule; +import net.fortuna.ical4j.model.property.Status; + +import org.apache.commons.lang.StringUtils; + +import java.net.URI; +import java.net.URISyntaxException; +import java.text.ParseException; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import lombok.Cleanup; +import lombok.Getter; + /** * Represents a locally stored calendar, containing Events. * Communicates with the Android Contacts Provider which uses an SQLite diff --git a/app/src/main/java/at/bitfire/davdroid/resource/LocalCollection.java b/app/src/main/java/at/bitfire/davdroid/resource/LocalCollection.java index 24293421..239b3be9 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/LocalCollection.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/LocalCollection.java @@ -7,9 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; -import java.util.ArrayList; - -import lombok.Cleanup; import android.accounts.Account; import android.content.ContentProviderClient; import android.content.ContentProviderOperation; @@ -23,6 +20,10 @@ import android.os.RemoteException; import android.provider.CalendarContract; import android.util.Log; +import java.util.ArrayList; + +import lombok.Cleanup; + /** * Represents a locally-stored synchronizable collection (for instance, the * address book or a calendar). Manages a CTag that stores the last known diff --git a/app/src/main/java/at/bitfire/davdroid/resource/RemoteCollection.java b/app/src/main/java/at/bitfire/davdroid/resource/RemoteCollection.java index 5d733e15..1a2fb414 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/RemoteCollection.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/RemoteCollection.java @@ -7,6 +7,12 @@ ******************************************************************************/ package at.bitfire.davdroid.resource; +import android.util.Log; + +import net.fortuna.ical4j.model.ValidationException; + +import org.apache.http.impl.client.CloseableHttpClient; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -15,10 +21,6 @@ import java.net.URISyntaxException; import java.util.LinkedList; import java.util.List; -import lombok.Cleanup; -import lombok.Getter; -import net.fortuna.ical4j.model.ValidationException; -import android.util.Log; import at.bitfire.davdroid.URIUtils; import at.bitfire.davdroid.webdav.DavException; import at.bitfire.davdroid.webdav.DavMultiget; @@ -27,8 +29,9 @@ import at.bitfire.davdroid.webdav.HttpException; import at.bitfire.davdroid.webdav.HttpPropfind; import at.bitfire.davdroid.webdav.WebDavResource; import at.bitfire.davdroid.webdav.WebDavResource.PutMode; -import org.apache.http.impl.client.CloseableHttpClient; import ezvcard.io.text.VCardParseException; +import lombok.Cleanup; +import lombok.Getter; /** * Represents a remotely stored synchronizable collection (collection as in diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/AccountDetailsFragment.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/AccountDetailsFragment.java index 37ab4734..7c830dc5 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/AccountDetailsFragment.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/AccountDetailsFragment.java @@ -25,6 +25,7 @@ import android.view.ViewGroup; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; + import at.bitfire.davdroid.Constants; import at.bitfire.davdroid.R; import at.bitfire.davdroid.resource.LocalCalendar; diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/AccountSettings.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/AccountSettings.java index a58fe407..f82c8684 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/AccountSettings.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/AccountSettings.java @@ -7,10 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import java.net.URI; -import java.net.URISyntaxException; - -import lombok.Cleanup; import android.accounts.Account; import android.accounts.AccountManager; import android.content.ContentResolver; @@ -23,8 +19,13 @@ import android.os.Bundle; import android.provider.CalendarContract; import android.provider.CalendarContract.Calendars; import android.util.Log; + +import java.net.URI; +import java.net.URISyntaxException; + import at.bitfire.davdroid.resource.ServerInfo; import ezvcard.VCardVersion; +import lombok.Cleanup; public class AccountSettings { private final static String TAG = "davdroid.AccountSettings"; diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/AddAccountActivity.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/AddAccountActivity.java index f65f42f9..b10c4016 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/AddAccountActivity.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/AddAccountActivity.java @@ -14,6 +14,7 @@ import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; + import at.bitfire.davdroid.Constants; import at.bitfire.davdroid.R; diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/CalendarsSyncAdapterService.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/CalendarsSyncAdapterService.java index 2746163b..ede9927d 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/CalendarsSyncAdapterService.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/CalendarsSyncAdapterService.java @@ -7,10 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.Map; - import android.accounts.Account; import android.app.Service; import android.content.ContentProviderClient; @@ -19,6 +15,11 @@ import android.content.Intent; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; + +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Map; + import at.bitfire.davdroid.resource.CalDavCalendar; import at.bitfire.davdroid.resource.LocalCalendar; import at.bitfire.davdroid.resource.LocalCollection; diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncAdapterService.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncAdapterService.java index 7e8f02a2..1e932955 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncAdapterService.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncAdapterService.java @@ -7,10 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.Map; - import android.accounts.Account; import android.app.Service; import android.content.ContentProviderClient; @@ -18,6 +14,11 @@ import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.util.Log; + +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Map; + import at.bitfire.davdroid.resource.CardDavAddressBook; import at.bitfire.davdroid.resource.LocalAddressBook; import at.bitfire.davdroid.resource.LocalCollection; diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/DavSyncAdapter.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/DavSyncAdapter.java index 00d045af..84821dce 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/DavSyncAdapter.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/DavSyncAdapter.java @@ -7,16 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import java.io.Closeable; -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.Map; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import lombok.Getter; - -import org.apache.http.HttpStatus; - import android.accounts.Account; import android.accounts.AccountManager; import android.content.AbstractThreadedSyncAdapter; @@ -30,14 +20,23 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.Settings; import android.util.Log; -import at.bitfire.davdroid.Constants; + +import org.apache.http.HttpStatus; +import org.apache.http.impl.client.CloseableHttpClient; + +import java.io.Closeable; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.Map; +import java.util.concurrent.locks.ReentrantReadWriteLock; + import at.bitfire.davdroid.resource.LocalCollection; import at.bitfire.davdroid.resource.LocalStorageException; import at.bitfire.davdroid.resource.RemoteCollection; import at.bitfire.davdroid.webdav.DavException; import at.bitfire.davdroid.webdav.DavHttpClient; import at.bitfire.davdroid.webdav.HttpException; -import org.apache.http.impl.client.CloseableHttpClient; +import lombok.Getter; public abstract class DavSyncAdapter extends AbstractThreadedSyncAdapter implements Closeable { private final static String TAG = "davdroid.DavSyncAdapter"; @@ -108,10 +107,7 @@ public abstract class DavSyncAdapter extends AbstractThreadedSyncAdapter impleme if (httpClient == null) { Log.d(TAG, "Creating new DavHttpClient"); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext()); - httpClient = DavHttpClient.create( - settings.getBoolean(Constants.SETTING_DISABLE_COMPRESSION, false), - settings.getBoolean(Constants.SETTING_NETWORK_LOGGING, false) - ); + httpClient = DavHttpClient.create(); } // prevent httpClient shutdown until we're ready by holding a read lock diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginEmailFragment.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginEmailFragment.java index f0879941..523447ed 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginEmailFragment.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginEmailFragment.java @@ -7,9 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import java.net.URI; -import java.net.URISyntaxException; - import android.app.DialogFragment; import android.app.Fragment; import android.app.FragmentTransaction; @@ -23,6 +20,10 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; + +import java.net.URI; +import java.net.URISyntaxException; + import at.bitfire.davdroid.R; public class LoginEmailFragment extends Fragment implements TextWatcher { diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginTypeFragment.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginTypeFragment.java index 8507bcc6..3a6cafdb 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginTypeFragment.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginTypeFragment.java @@ -16,6 +16,7 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.RadioButton; + import at.bitfire.davdroid.R; public class LoginTypeFragment extends Fragment { diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginURLFragment.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginURLFragment.java index 5703fa93..e47efec9 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginURLFragment.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/LoginURLFragment.java @@ -7,11 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import java.net.URI; -import java.net.URISyntaxException; - -import org.apache.commons.lang.StringUtils; - import android.app.DialogFragment; import android.app.Fragment; import android.app.FragmentTransaction; @@ -31,6 +26,12 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; + +import org.apache.commons.lang.StringUtils; + +import java.net.URI; +import java.net.URISyntaxException; + import at.bitfire.davdroid.R; public class LoginURLFragment extends Fragment implements TextWatcher { diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java index 10f64d83..b61d1e7a 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java @@ -7,11 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import lombok.Cleanup; import android.app.DialogFragment; import android.app.LoaderManager.LoaderCallbacks; import android.content.AsyncTaskLoader; @@ -24,11 +19,18 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.Toast; + +import org.apache.http.HttpException; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + import at.bitfire.davdroid.R; import at.bitfire.davdroid.resource.DavResourceFinder; import at.bitfire.davdroid.resource.ServerInfo; import at.bitfire.davdroid.webdav.DavException; -import org.apache.http.HttpException; +import lombok.Cleanup; public class QueryServerDialogFragment extends DialogFragment implements LoaderCallbacks { private static final String TAG = "davdroid.QueryServerDialogFragment"; diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/SelectCollectionsAdapter.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/SelectCollectionsAdapter.java index 95c871ed..8e105757 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/SelectCollectionsAdapter.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/SelectCollectionsAdapter.java @@ -7,7 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import lombok.Getter; import android.annotation.SuppressLint; import android.content.Context; import android.text.Html; @@ -17,9 +16,11 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckedTextView; import android.widget.ListAdapter; + import at.bitfire.davdroid.R; import at.bitfire.davdroid.resource.ServerInfo; import at.bitfire.davdroid.resource.ServerInfo.ResourceInfo.Type; +import lombok.Getter; public class SelectCollectionsAdapter extends BaseAdapter implements ListAdapter { final static int TYPE_ADDRESS_BOOKS_HEADING = 0, diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/SelectCollectionsFragment.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/SelectCollectionsFragment.java index c7a044b2..ce2c7a09 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/SelectCollectionsFragment.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/SelectCollectionsFragment.java @@ -19,6 +19,7 @@ import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListAdapter; import android.widget.ListView; + import at.bitfire.davdroid.R; import at.bitfire.davdroid.resource.ServerInfo; diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/SyncManager.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/SyncManager.java index c1bf2fa2..21bdbfbb 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/SyncManager.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/SyncManager.java @@ -7,14 +7,16 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; +import android.content.SyncResult; +import android.util.Log; + +import net.fortuna.ical4j.model.ValidationException; + import java.io.IOException; import java.net.URISyntaxException; import java.util.HashSet; import java.util.Set; -import net.fortuna.ical4j.model.ValidationException; -import android.content.SyncResult; -import android.util.Log; import at.bitfire.davdroid.ArrayUtils; import at.bitfire.davdroid.resource.LocalCollection; import at.bitfire.davdroid.resource.LocalStorageException; diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/WebDavResourceAdapter.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/WebDavResourceAdapter.java index 9263874d..57b73162 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/WebDavResourceAdapter.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/WebDavResourceAdapter.java @@ -7,14 +7,15 @@ ******************************************************************************/ package at.bitfire.davdroid.syncadapter; -import java.util.List; - import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; + +import java.util.List; + import at.bitfire.davdroid.webdav.WebDavResource; public class WebDavResourceAdapter extends BaseAdapter { diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/DavHttpClient.java b/app/src/main/java/at/bitfire/davdroid/webdav/DavHttpClient.java index 9a20e6f6..55baf356 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/DavHttpClient.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/DavHttpClient.java @@ -8,7 +8,7 @@ package at.bitfire.davdroid.webdav; import android.util.Log; -import at.bitfire.davdroid.Constants; + import org.apache.http.client.config.RequestConfig; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; @@ -17,10 +17,9 @@ import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; -import org.apache.http.impl.conn.ManagedHttpClientConnectionFactory; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import java.lang.reflect.Method; +import at.bitfire.davdroid.Constants; public class DavHttpClient { @@ -44,7 +43,7 @@ public class DavHttpClient { } - public static CloseableHttpClient create(boolean disableCompression, boolean logTraffic) { + public static CloseableHttpClient create() { PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry); // limits per DavHttpClient (= per DavSyncAdapter extends AbstractThreadedSyncAdapter) connectionManager.setMaxTotal(3); // max. 3 connections in total diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/DavHttpRequestRetryHandler.java b/app/src/main/java/at/bitfire/davdroid/webdav/DavHttpRequestRetryHandler.java index fdbcc05c..c26fac93 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/DavHttpRequestRetryHandler.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/DavHttpRequestRetryHandler.java @@ -7,14 +7,13 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; +import org.apache.commons.lang.ArrayUtils; +import org.apache.http.HttpRequest; +import org.apache.http.impl.client.DefaultHttpRequestRetryHandlerHC4; + import java.util.Locale; -import org.apache.commons.lang.ArrayUtils; - -import org.apache.http.HttpRequest; -import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; - -public class DavHttpRequestRetryHandler extends DefaultHttpRequestRetryHandler { +public class DavHttpRequestRetryHandler extends DefaultHttpRequestRetryHandlerHC4 { final static DavHttpRequestRetryHandler INSTANCE = new DavHttpRequestRetryHandler(); // see http://www.iana.org/assignments/http-methods/http-methods.xhtml @@ -27,7 +26,7 @@ public class DavHttpRequestRetryHandler extends DefaultHttpRequestRetryHandler { super(/* retry count */ 3, /* retry already sent requests? */ false); } - //@Override + @Override protected boolean handleAsIdempotent(final HttpRequest request) { final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT); return ArrayUtils.contains(idempotentMethods, method); diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/DavMultiget.java b/app/src/main/java/at/bitfire/davdroid/webdav/DavMultiget.java index 64162b19..d9d3fb31 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/DavMultiget.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/DavMultiget.java @@ -7,13 +7,13 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; -import java.util.ArrayList; -import java.util.List; - import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Order; +import java.util.ArrayList; +import java.util.List; + @Order(elements={"prop","href"}) public class DavMultiget { public enum Type { diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/DavMultistatus.java b/app/src/main/java/at/bitfire/davdroid/webdav/DavMultistatus.java index dce27c2b..e4b8e8eb 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/DavMultistatus.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/DavMultistatus.java @@ -7,12 +7,12 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; -import java.util.List; - import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Namespace; import org.simpleframework.xml.Root; +import java.util.List; + @Namespace(reference="DAV:") @Root(strict=false) public class DavMultistatus { diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/DavProp.java b/app/src/main/java/at/bitfire/davdroid/webdav/DavProp.java index 93f25645..b6b724c0 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/DavProp.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/DavProp.java @@ -7,10 +7,6 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; -import java.util.List; - -import lombok.Getter; - import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; @@ -18,6 +14,10 @@ import org.simpleframework.xml.Namespace; import org.simpleframework.xml.Root; import org.simpleframework.xml.Text; +import java.util.List; + +import lombok.Getter; + @Namespace(prefix="D",reference="DAV:") @Root(strict=false) public class DavProp { diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/DavRedirectStrategy.java b/app/src/main/java/at/bitfire/davdroid/webdav/DavRedirectStrategy.java index 6e4e7d47..9bdda8da 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/DavRedirectStrategy.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/DavRedirectStrategy.java @@ -7,11 +7,8 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; -import java.net.URI; -import java.net.URISyntaxException; - import android.util.Log; -import at.bitfire.davdroid.URIUtils; + import org.apache.http.Header; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; @@ -24,6 +21,11 @@ import org.apache.http.client.methods.RequestBuilder; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.protocol.HttpContext; +import java.net.URI; +import java.net.URISyntaxException; + +import at.bitfire.davdroid.URIUtils; + /** * Custom Redirect Strategy that handles 30x for CalDAV/CardDAV-specific requests correctly */ @@ -89,7 +91,7 @@ public class DavRedirectStrategy implements RedirectStrategy { if (!originalURI.isAbsolute()) { final HttpHost target = HttpClientContext.adapt(context).getTargetHost(); if (target != null) - originalURI = org.apache.http.client.utils.URIUtils.rewriteURI(originalURI, target); + originalURI = org.apache.http.client.utils.URIUtilsHC4.rewriteURI(originalURI, target); else return null; } diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/DavResponse.java b/app/src/main/java/at/bitfire/davdroid/webdav/DavResponse.java index b1ba1fd9..5dc67f38 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/DavResponse.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/DavResponse.java @@ -7,14 +7,14 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; -import java.util.List; - -import lombok.Getter; - import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Root; +import java.util.List; + +import lombok.Getter; + @Root(strict=false) public class DavResponse { @Element diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/HttpPropfind.java b/app/src/main/java/at/bitfire/davdroid/webdav/HttpPropfind.java index 677905ed..c0a39216 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/HttpPropfind.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/HttpPropfind.java @@ -7,18 +7,18 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; +import android.util.Log; + +import org.apache.http.client.methods.HttpEntityEnclosingRequestBaseHC4; +import org.apache.http.entity.StringEntity; +import org.simpleframework.xml.Serializer; +import org.simpleframework.xml.core.Persister; + import java.io.StringWriter; import java.net.URI; import java.util.LinkedList; -import org.simpleframework.xml.Serializer; -import org.simpleframework.xml.core.Persister; - -import android.util.Log; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.entity.StringEntity; - -public class HttpPropfind extends HttpEntityEnclosingRequestBase { +public class HttpPropfind extends HttpEntityEnclosingRequestBaseHC4 { private static final String TAG = "davdroid.HttpPropfind"; public final static String METHOD_NAME = "PROPFIND"; diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/HttpReport.java b/app/src/main/java/at/bitfire/davdroid/webdav/HttpReport.java index d7323818..65d30839 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/HttpReport.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/HttpReport.java @@ -9,13 +9,13 @@ package at.bitfire.davdroid.webdav; import android.util.Log; +import org.apache.http.client.methods.HttpEntityEnclosingRequestBaseHC4; +import org.apache.http.entity.StringEntity; + import java.io.UnsupportedEncodingException; import java.net.URI; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.entity.StringEntity; - -public class HttpReport extends HttpEntityEnclosingRequestBase { +public class HttpReport extends HttpEntityEnclosingRequestBaseHC4 { private static final String TAG = "davdroid.HttpEntityEncloseRequestBase"; public final static String METHOD_NAME = "REPORT"; diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/TlsSniSocketFactory.java b/app/src/main/java/at/bitfire/davdroid/webdav/TlsSniSocketFactory.java index 3cd46f25..e2addbc5 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/TlsSniSocketFactory.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/TlsSniSocketFactory.java @@ -7,6 +7,18 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; +import android.annotation.SuppressLint; +import android.annotation.TargetApi; +import android.net.SSLCertificateSocketFactory; +import android.os.Build; +import android.util.Log; + +import org.apache.commons.lang.StringUtils; +import org.apache.http.HttpHost; +import org.apache.http.conn.socket.LayeredConnectionSocketFactory; +import org.apache.http.conn.ssl.BrowserCompatHostnameVerifierHC4; +import org.apache.http.protocol.HttpContext; + import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; @@ -15,20 +27,11 @@ import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.List; + import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; -import org.apache.commons.lang.StringUtils; -import android.annotation.SuppressLint; -import android.annotation.TargetApi; -import android.net.SSLCertificateSocketFactory; -import android.os.Build; -import android.util.Log; -import org.apache.http.HttpHost; -import org.apache.http.conn.socket.LayeredConnectionSocketFactory; -import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier; -import org.apache.http.protocol.HttpContext; public class TlsSniSocketFactory implements LayeredConnectionSocketFactory { private static final String TAG = "davdroid.SNISocketFactory"; @@ -37,7 +40,7 @@ public class TlsSniSocketFactory implements LayeredConnectionSocketFactory { private final static SSLCertificateSocketFactory sslSocketFactory = (SSLCertificateSocketFactory)SSLCertificateSocketFactory.getDefault(0); - private final static HostnameVerifier hostnameVerifier = new BrowserCompatHostnameVerifier(); + private final static HostnameVerifier hostnameVerifier = new BrowserCompatHostnameVerifierHC4(); /* diff --git a/app/src/main/java/at/bitfire/davdroid/webdav/WebDavResource.java b/app/src/main/java/at/bitfire/davdroid/webdav/WebDavResource.java index 5643f8e4..e4818986 100644 --- a/app/src/main/java/at/bitfire/davdroid/webdav/WebDavResource.java +++ b/app/src/main/java/at/bitfire/davdroid/webdav/WebDavResource.java @@ -7,6 +7,34 @@ ******************************************************************************/ package at.bitfire.davdroid.webdav; +import android.util.Log; + +import org.apache.commons.lang.StringUtils; +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.StatusLine; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.AuthCache; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpDeleteHC4; +import org.apache.http.client.methods.HttpGetHC4; +import org.apache.http.client.methods.HttpOptionsHC4; +import org.apache.http.client.methods.HttpPutHC4; +import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.entity.ByteArrayEntityHC4; +import org.apache.http.impl.auth.BasicSchemeHC4; +import org.apache.http.impl.client.BasicAuthCache; +import org.apache.http.impl.client.BasicCredentialsProviderHC4; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.message.BasicLineParserHC4; +import org.apache.http.util.EntityUtilsHC4; +import org.simpleframework.xml.Serializer; +import org.simpleframework.xml.core.Persister; + import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; @@ -19,42 +47,13 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import lombok.Cleanup; -import lombok.Getter; -import lombok.ToString; - -import org.apache.commons.lang.StringUtils; -import org.simpleframework.xml.Serializer; -import org.simpleframework.xml.core.Persister; - -import android.util.Log; import at.bitfire.davdroid.URIUtils; import at.bitfire.davdroid.resource.Event; import at.bitfire.davdroid.webdav.DavProp.Comp; - -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpHost; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.StatusLine; -import org.apache.http.auth.AuthScope; -import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.http.client.AuthCache; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpOptions; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.protocol.HttpClientContext; -import org.apache.http.entity.ByteArrayEntity; -import org.apache.http.impl.auth.BasicScheme; -import org.apache.http.impl.client.BasicAuthCache; -import org.apache.http.impl.client.BasicCredentialsProvider; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.message.BasicLineParser; -import org.apache.http.util.EntityUtils; import ezvcard.VCardVersion; +import lombok.Cleanup; +import lombok.Getter; +import lombok.ToString; /** @@ -105,21 +104,21 @@ public class WebDavResource { location = baseURI; context = HttpClientContext.create(); - context.setCredentialsProvider(new BasicCredentialsProvider()); + context.setCredentialsProvider(new BasicCredentialsProviderHC4()); } public WebDavResource(CloseableHttpClient httpClient, URI baseURI, String username, String password, boolean preemptive) { this(httpClient, baseURI); - HttpHost host = new HttpHost(baseURI.getHost(), baseURI.getPort(), baseURI.getScheme()); context.getCredentialsProvider().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password)); - + if (preemptive) { + HttpHost host = new HttpHost(baseURI.getHost(), baseURI.getPort(), baseURI.getScheme()); Log.d(TAG, "Using preemptive authentication (not compatible with Digest auth)"); AuthCache authCache = context.getAuthCache(); if (authCache == null) authCache = new BasicAuthCache(); - authCache.put(host, new BasicScheme()); + authCache.put(host, new BasicSchemeHC4()); context.setAuthCache(authCache); } } @@ -150,7 +149,7 @@ public class WebDavResource { /* feature detection */ public void options() throws URISyntaxException, IOException, HttpException { - HttpOptions options = new HttpOptions(location); + HttpOptionsHC4 options = new HttpOptionsHC4(location); CloseableHttpResponse response = httpClient.execute(options, context); try { checkResponse(response); @@ -332,7 +331,7 @@ public class WebDavResource { /* resource operations */ public void get(String acceptedType) throws URISyntaxException, IOException, HttpException, DavException { - HttpGet get = new HttpGet(location); + HttpGetHC4 get = new HttpGetHC4(location); get.addHeader("Accept", acceptedType); CloseableHttpResponse response = httpClient.execute(get, context); @@ -343,7 +342,7 @@ public class WebDavResource { if (entity == null) throw new DavNoContentException(); - content = EntityUtils.toByteArray(entity); + content = EntityUtilsHC4.toByteArray(entity); } finally { response.close(); } @@ -351,8 +350,8 @@ public class WebDavResource { // returns the ETag of the created/updated resource, if available (null otherwise) public String put(byte[] data, PutMode mode) throws URISyntaxException, IOException, HttpException { - HttpPut put = new HttpPut(location); - put.setEntity(new ByteArrayEntity(data)); + HttpPutHC4 put = new HttpPutHC4(location); + put.setEntity(new ByteArrayEntityHC4(data)); switch (mode) { case ADD_DONT_OVERWRITE: @@ -381,7 +380,7 @@ public class WebDavResource { } public void delete() throws URISyntaxException, IOException, HttpException { - HttpDelete delete = new HttpDelete(location); + HttpDeleteHC4 delete = new HttpDeleteHC4(location); if (getETag() != null) delete.addHeader("If-Match", getETag()); @@ -468,7 +467,7 @@ public class WebDavResource { byte[] data = null; for (DavPropstat singlePropstat : singleResponse.getPropstat()) { - StatusLine status = BasicLineParser.parseStatusLine(singlePropstat.status, new BasicLineParser()); + StatusLine status = BasicLineParserHC4.parseStatusLine(singlePropstat.status, new BasicLineParserHC4()); // ignore information about missing properties etc. if (status.getStatusCode()/100 != 1 && status.getStatusCode()/100 != 2)