I'm trying to preview my card composeable function which takes a custom parametrs.
My card composeable preview function is not rendered in the preview tab and when trying to deploy the preview into a device the app crashes and by inspecting the log I found that the parameter passed into my card composeable preview is returning null even though it's annotaited with #PreviewParameter and passed in a parameter provider class implementing the PreviewParameterProvider<*> interface.
I've noticed one line in the log that got my attention:
D/PreviewActivity: Previewing PokemonCardPreview without a parameter provider.
for some reason my parameter provider class is not being detected by PreviewActivity.
PokemonCardPreview
#Preview("Pokemon Card")
#Composable
fun PokemonCardPreview(
#PreviewParameter(PokedexEntryListParameterProvider::class) fakePokedex: PokedexListEntry,
navController: NavHostController = rememberNavController()
){
PokedexEntry(entry = fakePokedex, navController)
}
PokedexEntryListParameterProvider
class PokedexEntryListParameterProvider : PreviewParameterProvider<PokedexListEntry> {
override val values = sequenceOf(
PokedexListEntry(pokemonName = "ditto",
imageUrl = "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png",
pokemonNumber = 132)
)
}
Log Error
D/PreviewActivity: Previewing 'PokemonCardPreview' without a parameter provider.
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.blacketron.jetpackcomposepokedex, PID: 4987
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassNotFoundException: Composable Method 'io.blacketron.jetpackcomposepokedex.util.preview.PreviewsKt.PokemonCardPreview' not found
at androidx.compose.ui.tooling.preview.PreviewUtilsKt.invokeComposableViaReflection(PreviewUtils.kt:188)
at androidx.compose.ui.tooling.preview.PreviewActivity$setComposableContent$2.invoke(PreviewActivity.kt:74)
at androidx.compose.ui.tooling.preview.PreviewActivity$setComposableContent$2.invoke(PreviewActivity.kt:73)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:346)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:202)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:201)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:193)
at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:148)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:114)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:113)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:193)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:106)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:162)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:161)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:193)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:161)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:144)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.ComposerKt.invokeComposable(Composer.kt:3433)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:2615)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:348)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:702)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:304)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:144)
E/AndroidRuntime: at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:135)
at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:655)
at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:135)
at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:187)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:142)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:135)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:719)
at android.view.View.dispatchAttachedToWindow(View.java:20479)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3489)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2417)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1952)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8171)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:731)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
... 3 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.compose.ui.tooling.preview.PreviewUtilsKt.invokeComposableMethod(PreviewUtils.kt:141)
at androidx.compose.ui.tooling.preview.PreviewUtilsKt.invokeComposableViaReflection(PreviewUtils.kt:180)
... 61 more
Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter fakePokedex
at io.blacketron.jetpackcomposepokedex.util.preview.PreviewsKt.PokemonCardPreview(Unknown Source:2)
... 64 more
We are developing an Android Application using Xamarin. The application sends working data to a backend service (WCF secured with certificate) via HttpWebRequest Post on HTTPS. Everything works fine until the message sent exceed a limit size. In this case, at each synchronization we got one of the following errors :
System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.NullReferenceException: Object reference not set to an instance of an object.
System.Net.WebException: Error getting response stream (ReadDone1): ReceiveFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Unable to write data to the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer
A “big” message that cause the error is 44KB (22KB in utf8) !
What we already try:
One thing we notice is that if we make a HttpWebRequest Post with a small message just before sending big messages, it works fine.
Tested with Restsharp and the behavior is the same. Restsharp also uses System.net.dll
We have also tested with Postman with messages that cause issue on the mobile app and message are sent successfully. So this seems to be linked to System.Net.
We found that other people seems to have this issue and the solution would be to use ModernHttp but not applicable for us because it doesn’t support client certificate:
HttpClient Error getting response stream (ReadDone1): ReceiveFailure
Below Xamarin versions we are using:
Visual Studio 2015 Update 3
Xamarin 4.2.1.64
Xamarin.Android 7.0.2.37 – Tested on Samsung Device S4 and S5 with Android 5.0.1 and Android 6
Any idea?
First error stack trace:
System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.NullReferenceException: Object reference not set to an instance of an object.
at Mono.Security.Protocol.Tls.SslStreamBase.InternalBeginWrite (Mono.Security.Protocol.Tls.SslStreamBase+InternalAsyncResult asyncResult) [0x00031] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:782 ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
at System.Net.Sockets.NetworkStream.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.AsyncCallback callback, System.Object state) [0x00014] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/System/net/System/Net/Sockets/NetworkStream.cs:907
at Mono.Security.Protocol.Tls.RecordProtocol.BeginSendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData, System.AsyncCallback callback, System.Object state) [0x00026] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:765
at Mono.Security.Protocol.Tls.RecordProtocol.SendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData) [0x00000] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:786
at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (Mono.Security.Protocol.Tls.Alert alert) [0x00027] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:633
at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (System.Exception& ex) [0x00021] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:598
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.InternalBeginWrite (Mono.Security.Protocol.Tls.SslStreamBase+InternalAsyncResult asyncResult) [0x00077] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:791
at Mono.Security.Protocol.Tls.SslStreamBase.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 count, System.AsyncCallback callback, System.Object state) [0x000a3] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:858
at Mono.Net.Security.Private.LegacySslStream.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 count, System.AsyncCallback asyncCallback, System.Object asyncState) [0x00006] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/Mono.Net.Security/LegacySslStream.cs:435
at System.Net.WebConnection.BeginWrite (System.Net.HttpWebRequest request, System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.AsyncCallback cb, System.Object state) [0x0005f] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/System.Net/WebConnection.cs:1000
Second error stack trace:
System.Net.WebException: Error getting response stream (ReadDone1): ReceiveFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer
at System.Net.Sockets.Socket.EndReceive (System.IAsyncResult result) [0x0002d] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/System.Net.Sockets/Socket.cs:2031
at System.Net.Sockets.NetworkStream.EndRead (System.IAsyncResult asyncResult) [0x0005f] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/System/net/System/Net/Sockets/NetworkStream.cs:858
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.RecordProtocol.EndReceiveRecord (System.IAsyncResult asyncResult) [0x0003a] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:430
at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (System.IAsyncResult ar, System.Boolean ignoreEmpty) [0x00000] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:256
at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (System.IAsyncResult result) [0x00071] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:418
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (System.IAsyncResult result) [0x00035] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:396
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (System.IAsyncResult asyncResult) [0x0000c] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:101 ---> System.IO.IOException: Unable to write data to the transport connection: The socket is not connected. ---> System.Net.Sockets.SocketException: The socket is not connected
at System.Net.Sockets.Socket.BeginSend (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socket_flags, System.AsyncCallback callback, System.Object state) [0x00021] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/System.Net.Sockets/Socket.cs:2566
at System.Net.Sockets.NetworkStream.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.AsyncCallback callback, System.Object state) [0x000b4] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/System/net/System/Net/Sockets/NetworkStream.cs:934
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.AsyncCallback callback, System.Object state) [0x000f2] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/System/net/System/Net/Sockets/NetworkStream.cs:954
at Mono.Security.Protocol.Tls.RecordProtocol.BeginSendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData, System.AsyncCallback callback, System.Object state) [0x00026] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:765
at Mono.Security.Protocol.Tls.RecordProtocol.SendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData) [0x00000] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:786
at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (Mono.Security.Protocol.Tls.Alert alert) [0x00027] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:633
at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (System.Exception& ex) [0x00021] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:598
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.EndRead (System.IAsyncResult asyncResult) [0x00051] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:883
at Mono.Net.Security.Private.LegacySslStream.EndRead (System.IAsyncResult asyncResult) [0x00006] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/Mono.Net.Security/LegacySslStream.cs:494
at System.Net.WebConnection.ReadDone (System.IAsyncResult result) [0x0002a] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/System.Net/WebConnection.cs:468
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x0005e] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1023
at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1037
at MyOrg.Logistic.Mobile.Droid.CommunicationUtilities.RestPost[T] (MyOrg.Logistic.Droid.Mobile.ServiceTypes type, Communication.CommServerSettings commServerSettings, System.String requestPath, System.Object parameters, System.Boolean retry, System.Boolean closeHttpConnection) [0x000cf] in C:\Dev\Mobile\Application\main\Application\Mobile.App.Droid\CommunicationUtilities.cs:309
at MyOrg.Logistic.Droid.Mobile.Droid.Service.SendStoreSecondLayerEvent (MyOrg.Logistic.Droid.Messages.StoreSecondLayerEventMessage msg) [0x00001] in C:\Dev\Mobile\Application\main\Application\Mobile.App.Droid\Services\Service.cs:96
at MyOrg.Logistic.Droid.Mobile.SynchronizationExecutionViewModel+<Synchronize>d__38.MoveNext () [0x00173] in C:\Dev\Mobile\Application\main\Application\Mobile.App\ViewModels\SynchronizationExecutionViewModel.cs:172
HttpWebRequest code:
public static T RestPost<T>(ServiceTypes type, CommServerSettings commServerSettings, string requestPath,
object parameters = null, bool retry = false, bool closeHttpConnection = true) where T : new()
{
//https://192.168.1.12:6206/Transmission/StoreSecondLayerEvent
var url = BuildServiceUrl(type,
commServerSettings,
requestPath);
HttpWebRequest.DefaultMaximumResponseHeadersLength = 128 * 1024; // 128kb
//specify to use TLS 1.2 as default connection
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
/* HttpWebRequest Variant */
string output = string.Empty;
if (parameters != null)
{
output = JsonConvert.SerializeObject(parameters);
}
byte[] postDataByteArray = Encoding.UTF8.GetBytes(output);
var rq = new HttpWebRequest(new Uri(url));
if (Certificate != null)
{
rq.ClientCertificates = new X509Certificate2Collection(Certificate);
}
rq.KeepAlive = !closeHttpConnection;
//rq.PreAuthenticate = true;
//rq.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequested;
rq.Method = "POST";
rq.ContentType = "application/json";
rq.ContentLength = postDataByteArray.Length;
// write the data on the connection stream
using (var dataStream = rq.GetRequestStream())
{
dataStream.Write(postDataByteArray, 0, postDataByteArray.Length);
dataStream.Close();
}
string responseString;
using (HttpWebResponse rs = (HttpWebResponse) rq.GetResponse())
{
using (Stream responseStream = rs.GetResponseStream())
{
using (StreamReader responseReader = new StreamReader(responseStream))
{
responseString = responseReader.ReadToEnd();
}
}
}
Console.WriteLine("Received: " + responseString);
var keyResponse = JsonConvert.DeserializeObject<T>(responseString);
return keyResponse;
}
static CommunicationUtilities()
{
try
{
// # Sets the validation of the certificate to be always valid
// # Check: https://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.servercertificatevalidationcallback(v=vs.110).aspx
ServicePointManager.ServerCertificateValidationCallback += (sender,
certificate,
chain,
errors) => true;
}
catch (Exception ex)
{
throw new Exception("Error initializing CommunicationUtilities class!", ex);
}
}
The error itself looks like a form of TLS authentication issues. The current alpha build of Xamarin has some updates to our TLS implementations. If you look at the release notes for Xamarin.iOS you will see some information about us migrating the TLS implementations:
https://developer.xamarin.com/releases/ios/xamarin.ios_10/xamarin.ios_10.4/
At the time of this writing Android/Platform has not updated their documentation to mention similar but it applies for Android as well.
The official documentation hub would be here:
https://developer.xamarin.com/guides/cross-platform/transport-layer-security/
I am using omnifaces validate order component in JSF application to validate start date and end date similar to one show cased. But, when end date is null in my application this throws null pointer exception below. How to handle this.
<app:calendar label="#{msg['gang.effectiveDate']}" property="effectiveDate" required="true"/>
<app:calendar label="#{msg['gang.expiryDate']}" property="expiryDate"/>
<o:validateOrder id="order" type="lte" components="effectiveDate expiryDate"
message="#{msg['startdate.lte.enddate']}" showMessageFor="effectiveDate" />
Exception thrown
java.lang.NullPointerException
at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:290)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:157)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:146)
at java.util.Arrays.sort(Arrays.java:472)
at java.util.Collections.sort(Collections.java:155)
at org.omnifaces.component.validator.ValidateOrder$Type$2.invoke(ValidateOrder.java:75)
at org.omnifaces.component.validator.ValidateOrder$Type$2.invoke(ValidateOrder.java:71)
at org.omnifaces.component.validator.ValidateOrder$Type.validateOrder(ValidateOrder.java:105)
at org.omnifaces.component.validator.ValidateOrder.validateValues(ValidateOrder.java:141)
at org.omnifaces.component.validator.ValidateMultipleFields.validateComponents(ValidateMultipleFields.java:187)
at org.omnifaces.component.validator.ValidatorFamily.processValidators(ValidatorFamily.java:63)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at org.primefaces.component.panel.Panel.processValidators(Panel.java:287)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at org.primefaces.component.dialog.Dialog.processValidators(Dialog.java:385)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at
You can either check for expiryDate value before submit to prevent nullPointerException or add this code to your <o:validateOrder> to disable it when expiryDate is null :
<o:validateOrder ... disabled="#{empty param['yourForm:yourNullableField']}" />
See : OmniFaces validateOrder disabling
I'm trying to JUnit a DAO which accesses iBatis. The problem is iBatis cannot read SqlMapClient although I specified it in applicationContext.xml. So I tried to set full path for it but I still get errors.
applicationContext.xml
<!-- Sql Map Client -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="file:C:/workspace/MyProject/WebContent/WEB-INF/sqlMapConfig.xml" />
<property name="dataSource" ref="dataSource"/>
</bean>
JUnit Code
#RunWith(SpringJUnit4ClassRunner.class)
#ContextConfiguration(
locations={
"file:C:/workspace/MyProject/WebContent/WEB-INF/sqlMapConfig.xml",
"file:C:/workspace/MyProject/WebContent/WEB-INF/applicationContext.xml",
"file:C:/workspace/MyProject/WebContent/WEB-INF/dataSource.xml",
}
)
// This doesn't work
//locations={
//"classpath:/WEB-INF/sqlMapConfig.xml",
//"classpath:/WEB-INF/applicationContext.xml",
//"classpath:/WEB-INF/dataSource.xml",
//}
public class ProductDaoTest {
/**
* Run the List<Product> getProductList(Product) method test.
*
* #throws Exception
*
* #generatedBy CodePro at 7/1/13 10:55 AM
*/
#Test
public void testGetProductList()
throws Exception {
ProductDao fixture = new ProductDao();
Product product = new Product();
List<Product> result = fixture.getProductList(product);
assertNotNull(result);
}
}
I get this error
java.lang.IllegalArgumentException: No SqlMapClient specified
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:166)
at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:249)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:296)
at net.rcba.dao.BrandDao.getBrandRankingSumViewList(BrandDao.java:19)
at net.rcba.dao.BrandDaoTest.testGetBrandRankingSumViewList_1(BrandDaoTest.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
I guess the error maybe in
ProductDao fixture = new ProductDao();
try to change it to
WebApplicationContext wac = WebApplicationContextUtils.
getRequiredWebApplicationContext( config.getServletContext());
ProductDao fixture = (ProductDao) wac.getBean("ProductDao" );
I'm using an item renderer, but keep getting this actionscript error:
Error: Unknown Property: 'skillName'. at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:870]
at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:338]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Watcher/wrapUpdate()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:192]
at mx.binding::PropertyWatcher/updateParent()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:239]
at mx.binding::Watcher/updateChildren()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:138]
at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:347]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Watcher/wrapUpdate()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:192]
at mx.binding::PropertyWatcher/eventHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:375]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at spark.components::DataRenderer/set data()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataRenderer.as:123]
at spark.components::SkinnableDataContainer/updateRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableDataContainer.as:606]
at spark.components.supportClasses::ListBase/updateRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\ListBase.as:1106]
at spark.components::DataGroup/setUpItemRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:1157]
at spark.components::DataGroup/initializeTypicalItem()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:327]
at spark.components::DataGroup/ensureTypicalLayoutElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:384]
at spark.components::DataGroup/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:1467]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506]
at mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8430]
at mx.managers::LayoutManager/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:665]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:816]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
The weird thing is that it worked fine, until at a certain point I kept getting this error, out of the blue. I've been searching for it on Google and Stackoverflow and struck upon a few websites, but none of the answers could help me get any further. It seems this error is also mostly thrown in mobile AIR projects, but mine is a Flash Player project...
This is how the itemrenderer looks:
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:components="components.*"
width="100%" height="100%" autoDrawBackground="true"
creationComplete="creationCompleteHandler(event)"
height.login_edit_state="80"
color.login_edit_state="#000000"
height.login_preview_state="80">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ArrayUtil;
public var loggedin:Boolean = true;
[Bindable]private var ac_projects:ArrayCollection;
protected function creationCompleteHandler(event:FlexEvent):void
{
currentState = "login_preview_state";
img_foldout_preview.addEventListener(MouseEvent.CLICK, changeState);
img_edit_preview.addEventListener(MouseEvent.CLICK, changeState);
http_projects.addEventListener(ResultEvent.RESULT, http_projects_resultEvent);
http_projects.addEventListener(FaultEvent.FAULT, http_projects_faultEvent);
http_projects.url = "http://localhost/sourcefoliocom.adobe.flexbuilder.project.flexbuilder/bindebug/php/getAllProjectsByUserSkill.php?id=" + data.userId + "&skill=" + data.skillId ;
trace("http://localhost/sourcefoliocom.adobe.flexbuilder.project.flexbuilder/bindebug/php/getAllProjectsByUserSkill.php?id="+ data.userId + "&skill=" + data.skillId);
http_projects.send();
}
protected function http_projects_resultEvent(event:ResultEvent):void
{
ac_projects = new ArrayCollection(ArrayUtil.toArray(event.result.projects.project));
rpt_projects.dataProvider = ac_projects;
}
protected function http_projects_faultEvent(event:FaultEvent):void
{
trace("Kon projecten niet laden");
}
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="http_projects"
method="GET" />
</fx:Declarations>
<s:states>
<s:State name="login_preview_state"/>
<s:State name="login_opened_state"/>
<s:State name="login_edit_state"/>
</s:states>
<s:layout.login_opened_state>
<s:VerticalLayout horizontalAlign="right"/>
</s:layout.login_opened_state>
<!-- login_opened_state -->
<s:SkinnableContainer includeIn="login_opened_state" width="100%" height="80">
<s:layout>
<s:HorizontalLayout gap="20" paddingBottom="20" paddingLeft="20" paddingRight="20" paddingTop="20" verticalAlign="middle"/>
</s:layout>
<s:Label fontSize="20" fontWeight="bold" text="{data.skillName}"/>
<s:Label fontSize="20" text="junior"/>
<s:Spacer width="100%" height="10"/>
<s:Image id="img_edit_open" width="20" height="20" source="images/edit.png" buttonMode="true" useHandCursor="true"/>
<s:Image id="img_foldin_open" width="20" height="20" buttonMode="true" source="images/foldin.png" useHandCursor="true"/>
</s:SkinnableContainer>
<s:VGroup id="vg_opened"
visible="false"
width="900" height="1000" gap="0"
horizontalAlign="right">
<mx:VBox>
<mx:Repeater id="rpt_projects" width="100%">
<components:Project currentItem= {rpt_projects.currentItem}" loggedin="true"/>
</mx:Repeater>
<components:AddProject />
</mx:VBox>
<s:Image x="824" width="76" height="51" source="images/edit_flag.png" useHandCursor="true"/>
</s:VGroup>
</s:ItemRenderer>
The error is thrown at this line:
<s:Label fontSize="20" fontWeight="bold" text="{data.skillName}"/>
The ArrayCollection filling up this renderer is an xml file my own webservice returns. I've tested the file and the use of skillName should be correct in this case.
Do you need to see more code or some more info? Let me know!
I found out I'm dealing with a two dimensional ArrayCollection. I'm not correctly referring to the items in this ArrayCollection, so that's why the properties are not recognized.