IntelliJ IDEA won't stop on assertions in debug mode - java

Why won't IntelliJ IDEA stop in debug mode when an assertion is triggered? I get a java.lang.AssertionError to console, but the running code doesn't pause at it as it is supposed to. Here are my exception breakpoints settings:

I found out that somehow debugger doesn't stop on assertions when running tests, but it does stop when running other code. The code I was trying to make stop on a failed assertion in debug mode was a test. That seems to be the issue, but I don't understand why would IDE behave that way.

Open source code of AssertionError and put a breakpoint on the constructor it will stop.

Related

App runs in Release build, but receive FATAL UNHANDLED EXCEPTION in Debug

I am getting some unhandeled exceptions that I don't understand.
It is a Xamarin Android App. The app runs perfectly fine using the Release build, however, when run in Debug the UI hangs and I get this error:
[mono] at System.Runtime.CompilerServices.TaskAwaiter`1[SpotifyWebAPI.Models.PrivateProfile].GetResult () [0x00000] in :0
[mono] at IntervalAndroid.MainActivity+c__async0.MoveNext () [0x0006d] in /Users/f/Projects/FourByFourInterval/IntervalAndroid/MainActivity.cs:390
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
[mono-rt] at SpotifyWebAPI.SpotifyWebAPIClass+c__async1A.MoveNext () [0x00000] in :0
[mono-rt] --- End of stack trace from previous location where exception was thrown ---
etc. The full error can be viewed on pastebin
EDIT 2: In Debug mode choosing to "Run without debugging" works perfectly fine.
EDIT: Setting Debug information in Project options to None solves the issue, but Symbols only and Full persists.
I have read that not having the correct android.permission.*, but since it works in Release (and not the otherway around where android.permission.INTERNET might be an issue) I don't think so.
But honestly, I have no idea.
Thank you for helping out
- Fred

Debugging Java in eclipse error

I am trying to debug my simple program in Eclipse. When I run it, the program runs as expected. But when I try to debug it, the program output is as expected but there is an error
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [util.c:838]
I would like to use the advantage of debugging mode. I want to know how to tweak this error.
Use
System.exit(0);
at the end of main() method
That is a bug when you have some breakpoints marked. Simply the easiest way is to clear all breakpoints in your code. That worked for me.
To find all breakpoints switch to DEBUG mode.

Hadoop test BenchmarkThroughput crashes with NullPointerException due to mapred.temp.dir

I just configured Eclipse with the development environment for Hadoop(v 1.0.1). When I run one of the tests /src/test/org/apache/hadoop/hdfs/BenchmarkThroughput.java it crashes with a NullPointerException.
The problem seems to be in BenchmarkThroughput.run(), line 196 where it does System.setProperty("test.build.data", localDir). The localDir shows up as null because mapred.temp.dir is not set.
How should I correct this problem? Should I set the value of mapred.temp.dir in core-site.xml or is there a problem in the way I configured Eclipse?
Make sure that you are able to start the namenode. Run start-all and check the log. most probably it is not running.

AGENT_ERROR_INVALID_EVENT_TYPE when testing an eclipse plugin

I'm developing an eclipse plugin. When testing it, I sometimes encounter the following error:
JDWP exit error AGENT_ERROR_INVALID_EVENT_TYPE(204): ExceptionOccurred [../../../src/share/back/eventHelper.c:808]
FATAL ERROR in native method: JDWP ExceptionOccurred, jvmtiError=AGENT_ERROR_INVALID_EVENT_TYPE(204)
Which immediately kills the running eclipse instance (not the eclipse host).
Does anyone know what can lead to this error? I suspect some multithreading shenanigans, but it's not easy pinpointing it.
Turns out this was the result of a wayward Thread.stop() method invoked when running eclipse in debug mode. This didn't happen in run mode, only in debug mode, and it no longer appeared after removing the stop() method.
I guess it is deprecated for a good reason!
You are passing wrong arguments to the jvm. You can try first by removing all the options and then adding one by one to find out which one causes the error

Selenium running as junit in ant prematurely closes browser but not in IDE

I've got a bunch of selenium test cases set up in a JUnit class as four methods. The first runs fine - but the remaining three close the Firefox browser before the final step of the method is complete - giving a
ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: this.page().currentDocument is undefined
com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: this.page().currentDocument is undefined
Setup is following:
Ant based execution
Java 1.5
Eclipse 3.5
Selenium Server 1.0.1
Selenium Client Driver 1.0.1
IDE
Java 1.5
Eclipse 3.5
Selenium Server 1.0.1
Selenium Client Driver 1.0.1
I'm hoping to track down the root cause
It is crashing on the following line:
This is the modification to the user-extensions.js file:
Selenium.prototype.getElementBody = function(elementId) {
return this.outerHTML(this.page().currentDocument.getElementById(elementId));
};
This is what is being called:
commandProcessor.getString("getElementBody", "idOfElement");
I have never seen a command called getString part of the Selenium API so think that is why your tests are failing.
The other thing is have you told Selenium RC to use the user-extensions.js file that you have modified with the following -userExtensions user-extensions.js argument? I have never found it beneficial to use user-extensions in Se:RC and instead use .getEval() commands.
what you want would be selenium.getEval("this.browserbot.getUserWindow().getElementByID(id).outerHTML");
I have cleaned up your JavaScript for you. The this.browserbot.getUserWindow() gives you access to the Selenium JavaScript object which has the page in it.
I hope that helps
Can you show us your JUnit test class ?
I know from personnal experience that once in a while Selenium tests can crash for no apparent reason, but your problem seems to be happening each time so it might have something to do with your code/script.
Afraid I can't help you without some more details.

Categories

Resources