1.1 --- a/src/org/gege/caldavsyncadapter/android/entities/AndroidEvent.java Sat Feb 14 00:28:10 2015 +0100 1.2 +++ b/src/org/gege/caldavsyncadapter/android/entities/AndroidEvent.java Sat Feb 14 00:30:34 2015 +0100 1.3 @@ -72,6 +72,8 @@ 1.4 import java.net.URISyntaxException; 1.5 import java.text.ParseException; 1.6 1.7 +import static org.junit.Assert.*; 1.8 + 1.9 import com.europalab.caldavsyn.Appctxpro; 1.10 1.11 //import android.accounts.Account; 1.12 @@ -319,9 +321,12 @@ 1.13 public boolean createIcs(String strUid) { 1.14 boolean Result = false; 1.15 TimeZone timeZone = null; 1.16 - //Thread.currentThread().setContextClassLoader(Context.getApplicationContext().getClassLoader()); 1.17 - Thread.currentThread().setContextClassLoader(Appctxpro.getContext().getClassLoader()); 1.18 - TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); 1.19 + // Hack to bootstrap a multithreaded class loader context 1.20 + if (Thread.currentThread().getContextClassLoader() == null) 1.21 + Thread.currentThread().setContextClassLoader(Appctxpro.getContext().getClassLoader()); 1.22 + TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance(); 1.23 + assertNotNull(registry); 1.24 + registry.createRegistry(); 1.25 //TODO: do not simply create the ics-file new. take into account the RAWDATA if available 1.26 /* 1.27 * dtstart=1365598800000