With this code:
protected void second_ButtonAction(Component c, ActionEvent event) {
ConnectionRequest cn = new ConnectionRequest();
cn.setUrl(theURLaddress);
cn.setPost(false);
cn.addArgument("name", "this");
NetworkManager.getInstance().addToQueueAndWait(cn);
cn.getResponseData();
}
I keep getting the following:
EDT violation detected!
com.codename1.impl.javase.JavaSEPort$EDTViolation: EDT Violation Stack!
at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:344)
EDT violation detected!
EDT violation detected!
EDT violation detected!
at com.codename1.impl.javase.JavaSEPort.isNativeInputSupported(JavaSEPort.java:2459)
at com.codename1.ui.Display.isNativeInputSupported(Display.java:2306)
at com.codename1.ui.TextArea.setText(TextArea.java:406)
at com.codename1.ui.TextArea.<init>(TextArea.java:328)
at com.codename1.ui.TextArea.<init>(TextArea.java:257)
at com.codename1.ui.Dialog.show(Dialog.java:771)
at com.codename1.ui.Dialog.show(Dialog.java:727)
at com.codename1.ui.Dialog.show(Dialog.java:692)
at com.codename1.ui.Dialog.show(Dialog.java:536)
at com.codename1.ui.Dialog.show(Dialog.java:788)
at com.codename1.io.ConnectionRequest.handleErrorResponseCode(ConnectionRequest.java:680)
at com.codename1.io.ConnectionRequest.performOperation(ConnectionRequest.java:379)
at com.codename1.io.NetworkManager$NetworkThread.run(NetworkManager.java:261)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
com.codename1.impl.javase.JavaSEPort$EDTViolation: EDT Violation Stack!
at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:344)
at com.codename1.impl.javase.JavaSEPort.getImageWidth(JavaSEPort.java:3087)
at com.codename1.ui.Image.getWidth(Image.java:667)
at com.codename1.ui.EncodedImage.getWidth(EncodedImage.java:413)
at com.codename1.ui.plaf.Border.getMinimumWidth(Border.java:200)
at com.codename1.ui.Container.calcPreferredSize(Container.java:1431)
at com.codename1.ui.Component.calcScrollSize(Component.java:579)
at com.codename1.ui.Component.getScrollDimension(Component.java:566)
at com.codename1.ui.Container.isScrollableY(Container.java:1495)
at com.codename1.ui.Component.isScrollable(Component.java:1413)
at com.codename1.ui.Container.setLayout(Container.java:246)
at com.codename1.ui.Dialog.<init>(Dialog.java:205)
at com.codename1.ui.Dialog.<init>(Dialog.java:189)
at com.codename1.ui.Dialog.<init>(Dialog.java:180)
at com.codename1.ui.Dialog.show(Dialog.java:952)
EDT violation detected!
...
What am I missing!!?
Except for the lack of progress indication the code above looks fine.
It seems you are invoking setText off the EDT elsewhere but you cut the stack trace that pointed at that.
Edited:
From the revised stack trace it seems that this line is the important one:
at com.codename1.io.ConnectionRequest.handleErrorResponseCode(ConnectionRequest.java:680)
You are getting a call to the handleErrorResponseCode which means the URL returned an error code. So we are showing you an error dialog. Yes it does violate the EDT (these exceptions are in the simulator to warn of potential bugs). You need to decide what to do on error response code and handle them appropriately either by deriving the connection request and overriding this method or by binding an error handler to the network manager or by invoking setFailSilently(true) on the connection request.
Related
I have an app that works well on the simulator. I did an Android build and installed on a device. Now , several functionalities don't work. The debug log I receive contain several errors of this sort
[EDT] 0:23:31,275 - Exception in Ziemozi version 1.0
[EDT] 0:23:31,275 - OS and
[EDT] 0:23:31,275 - Error java.lang.NullPointerException: Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
[EDT] 0:23:31,276 - Current Form null
[EDT] 0:23:31,276 - Exception: java.lang.NullPointerException - Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
at com.codename1.g.j.a(InfiniteScrollAdapter.java:156)
at com.codename1.g.j.a(InfiniteScrollAdapter.java:143)
at com.codename1.ab.aa.t(InfiniteContainer.java:177)
at com.codename1.ab.aa$5.run(InfiniteContainer.java:193)
at com.codename1.ab.r.n(Display.java:1298)
at com.codename1.ab.r.l(Display.java:1242)
at com.codename1.ab.r.k(Display.java:1130)
at com.codename1.ab.ao.run(RunnableWrapper.java:120)
at com.codename1.impl.b$1.run(CodenameOneThread.java:60)
How do I debug this or how does it arise so I can fix it?
This happens when one of the components returned from InfiniteContainer is null. E.g. you did something like:
public Component[] fetchComponents(int index, int amount);
// ...
return cmps;
}
cmps is a valid array that's bigger than 0 but one of its elements is null.
Following is the error log from App in the production. what is the easy way to understand the bad second byte issue here. Provide me any guidance here.
This error getting thrown on different bytes..sometimes at 2 and sometimes at 19 etc. I'm not able to reproduce this issue on simulator. This happens rare but I'm not sure what is causing this issue.
[EDT] 0:23:57,929 - Exception: java.lang.RuntimeException - bad second byte at 19
java.lang.RuntimeException
at java_io_DataInputStream.decode:207
at java_io_DataInputStream.decodeUTF:187
at java_io_DataInputStream.decodeUTF:181
at java_io_DataInputStream.readUTF:177
at com_codename1_io_Util.readUTF:1081
at com__server_Activity.internalize:571
at com_codename1_io_Util.readObject:714
at com_codename1_io_Util.readObject:689
at com_codename1_io_Storage.readObject:264
at com_server_ServerImpl.getActivitiesOfflineMode:1898
at com__forms_AppointmentForm.lambda$onShowCompleted$14:636
at com__forms_AppointmentForm__Lambda_9.run:276
at com_codename1_ui_Display.processSerialCalls:1298
at com_codename1_ui_Display.edtLoopImpl:1242
at com_codename1_ui_Display.mainEDTLoop:1130
at com_codename1_ui_RunnableWrapper.run:120
at com_codename1_impl_CodenameOneThread.run:176
at java_lang_Thread.runImpl:153
It looks like Activity internalize and externalize aren't symmetric and you're writing different data than you're reading leading to corruption. You're doing that before the readUTF line. By the time you reach the readUTF call the data is corrupt hence this error.
I have decided to learn ReactiveUI after seeing what can be done with it, but my enthusiasm has been broken at the first attempt to run a simple project. I have recreated the example from this article, using reactiveui-winforms.Net40 version 6.5.0 from NuGet. Everything compiles ok, but i get an exception during runtime at the following line
var OKCmdObs = this.WhenAny(vm => vm.EnteredText,
s => !string.IsNullOrWhiteSpace(s.Value));
System.InvalidOperationException occurred
HResult=-2146233079
Message=The current thread has no Dispatcher associated with it.
Source=System.Reactive.Windows.Threading
StackTrace:
at System.Reactive.Concurrency.DispatcherScheduler.get_Current()
at ReactiveUI.PlatformRegistrations.<>c.<Register>b__0_7() in C:\workspace\git-perso\ReactiveUI\ReactiveUI\Platform\Registrations.cs:line 75
InnerException:
Does anyone have any idea of what's happening ?
The mentioned article does not have the compiled project available for download, and i didn't find any complete "Hello-World" project for reactiveui-winforms.
My test project can be downloaded here.
In Visual Studio, if i Continue(F5), another exception occures :
System.NullReferenceException occurred
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=ReactiveUI
StackTrace:
at ReactiveUI.IROObservableForProperty.<>c__DisplayClass1_0.<GetNotificationForProperty>b__6(IReactivePropertyChangedEventArgs`1 x) in C:\workspace\git-perso\ReactiveUI\ReactiveUI\IROObservableForProperty.cs:line 44
InnerException:
If i continue to hit F5 i get :
System.Exception was unhandled by user code
HResult=-2146233088
Message=An OnError occurred on an object (usually ObservableAsPropertyHelper) that would break a binding or command. To prevent this, Subscribe to the ThrownExceptions property of your objects
Source=ReactiveUI
This exception is caused because RxUI always tries to initialize for WPF, even though (because you're also using the winforms package) it'll override this setting with a Winforms-based scheduler right after.
It should be harmless though, as it's catched and ignored. You're probably hitting it within VS ?
Please find below the code i ran (Using: eclipse-java-kepler-SR2-win32-x86_64 + IE 11)
public class SampleTest {
public static void main(String[] args) {
System.setProperty("webdriver.ie.driver", "C:\\Program Files\\IEDriverServer\\IEDriverServer.exe");
WebDriver d1 = new InternetExplorerDriver();
d1.get("http://www.google.com/");
WebElement element = d1.findElement(By.name("q"));
element.sendKeys("selenium");
System.out.println("Test Selenium");
}
}
While running I got below logs
Started InternetExplorerDriver server (64-bit)
2.40.0.0
Listening on port 22795
Mar 26, 2014 7:04:27 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: I/O exception (java.net.SocketException) caught when processing request: Software caused connection abort: recv failed
Mar 26, 2014 7:04:27 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: Retrying request
Why am i getting this warning messages all the time only in IE
While writing "Send Keys" string in "Search" text box its taking more than 5 secs for each character
Would appreciate any helpful note on these... :)
From a blog post that discusses this issue in great detail:
There are two answers to this question, a short one and a long one.
The short one is, "Read the log message. It's clearly tagged as
'INFO', as in an informational message, and not indicative of any
problem with the code?" I find that this question often comes from
users of Eclipse, and that the Eclipse console has colored the message
red, and people are so conditioned to see "red == bad" that they react
to the format of the message rather than the content. The content of
the message is flagged at a level that means, "Hey, nothing is wrong,
we're just telling you about it."
For the longer, more detailed explanation, see the blog post, but it boils down to a race condition in bringing up an HTTP server, and using an HTTP client to poll for when that server is available to receive commands.
I have a multi-threaded application using solrj 4. There are a maximum of 25 threads. Each thread creates a connection using HttpSolrServer, and runs one query. Most of the time this works just fine. But occasionally I get the following exception:
Jan 10, 2013 9:29:07 AM org.apache.http.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.NoRouteToHostException) caught when connecting to the target host: Cannot assign requested address
Jan 10, 2013 9:29:07 AM org.apache.http.impl.client.DefaultRequestDirector tryConnect
INFO: Retrying connect
Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
I wrote some code to retry the query, if it fails:
while(!querySuccess && queryAttempts<m_MaxQueryAttempts ){
try{
queryAttempts++;
rsp = m_Server.query( query );
querySuccess = true;
}catch(SolrServerException e){
querySuccess = false;
}
}
After one or more retries the query usually works. But sometimes it fails even after 100 retries. Either way, I'd like to understand what the cause of the problem is. Why does it work some of the time? Is it an issue with concurrent access to solr? Apart from this process, I only have one other process that it continually writing to the index using a single connection. The default server settings are below - so I don't think it's because of too many simultaneous connections.
INFO: Creating new http client, config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false
Any suggestions on how to diagnose this would be much appreciated.