Skip to content

Commit 9f87152

Browse files
Support specifying the exception types you want to break on (#1333)
* Support specifying the exception types you want to break on
1 parent 29de797 commit 9f87152

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @testforstephen @jdneo @Eskibear @CsCherrYY
1+
* @testforstephen @jdneo

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
135135
- `internalConsole` - VS Code debug console (input stream not supported).
136136
- `integratedTerminal` - VS Code integrated terminal.
137137
- `externalTerminal` - External terminal that can be configured in user settings.
138+
- `java.debug.settings.exceptionBreakpoint.exceptionTypes`: Specifies a set of exception types you want to break on, e.g. `java.lang.NullPointerException`. A specific exception type and its subclasses can be selected for caught exceptions, uncaught exceptions, or both can be selected.
139+
- `java.debug.settings.exceptionBreakpoint.allowClasses`: Specifies the allowed locations where the exception breakpoint can break on. Wildcard is supported, e.g. `java.*`, `*.Foo`.
138140
- `java.debug.settings.exceptionBreakpoint.skipClasses`: Skip the specified classes when breaking on exception.
139141
- `$JDK` - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
140142
- `$Libraries` - Skip the classes from application libraries, such as Maven, Gradle dependencies.

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,22 @@
861861
"description": "%java.debugger.configuration.console%",
862862
"default": "integratedTerminal"
863863
},
864+
"java.debug.settings.exceptionBreakpoint.exceptionTypes": {
865+
"type": "array",
866+
"description": "%java.debugger.configuration.exceptionBreakpoint.exceptionTypes%",
867+
"items": {
868+
"type": "string"
869+
},
870+
"default": []
871+
},
872+
"java.debug.settings.exceptionBreakpoint.allowClasses": {
873+
"type": "array",
874+
"description": "%java.debugger.configuration.exceptionBreakpoint.allowClasses%",
875+
"items": {
876+
"type": "string"
877+
},
878+
"default": []
879+
},
864880
"java.debug.settings.exceptionBreakpoint.skipClasses": {
865881
"type": "array",
866882
"description": "%java.debugger.configuration.exceptionBreakpoint.skipClasses%",

package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
"java.debugger.configuration.forceBuildBeforeLaunch": "Force building the workspace before launching java program. If 'java.autobuild.enabled' is disabled, this setting will be ignored and still force a build job before launching.",
6666
"java.debugger.configuration.onBuildFailureProceed": "Force to proceed when build fails",
6767
"java.debugger.configuration.console": "The specified console to launch Java program. If you want to customize the console for a specific debug session, please modify the 'console' config in launch.json.",
68+
"java.debugger.configuration.exceptionBreakpoint.exceptionTypes": "Specifies a set of exception types you want to break on, e.g. java.lang.NullPointerException. A specific exception type and its subclasses can be selected for caught exceptions, uncaught exceptions, or both can be selected.",
69+
"java.debugger.configuration.exceptionBreakpoint.allowClasses": "Specifies the allowed locations where the exception breakpoint can break on. Wildcard is supported, e.g. java.*, *.Foo",
6870
"java.debugger.configuration.exceptionBreakpoint.skipClasses": "Skip the specified classes when breaking on exception. You could use the built-in variables such as '$JDK' and '$Libraries' to skip a group of classes, or add a specific class name expression, e.g. java.*, *.Foo",
6971
"java.debugger.configuration.jdwp.limitOfVariablesPerJdwpRequest.description": "The maximum number of variables or fields that can be requested in one JDWP request. The higher the value, the less frequently debuggee will be requested when expanding the variable view. Also a large number can cause JDWP request timeout.",
7072
"java.debugger.configuration.jdwp.requestTimeout.description": "The timeout (ms) of JDWP request when the debugger communicates with the target JVM.",

package.nls.zh-cn.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
"java.debugger.configuration.enableRunDebugCodeLens.description": "在main方法上启用CodeLens标记。",
6363
"java.debugger.configuration.forceBuildBeforeLaunch": "在启动java程序之前强制编译整个工作空间。如果“java.autobuild.enabled”被禁掉,则会忽略该设置,在运行之前强制执行一次编译。",
6464
"java.debugger.configuration.console": "指定的控制台用于启动Java程序。如果要为特定的调试会话自定义控制台,请修改launch.json中的“console”配置。",
65+
"java.debugger.configuration.exceptionBreakpoint.exceptionTypes": "指定要中断的一组异常类型,例如 java.lang.NullPointerException。可以为捕获的异常、未捕获的异常或两者都选择一个特定的异常类型及其子类。",
66+
"java.debugger.configuration.exceptionBreakpoint.allowClasses": "指定允许异常断点中断的位置。支持通配符,例如 java.,.Foo",
6567
"java.debugger.configuration.exceptionBreakpoint.skipClasses": "当发生异常时,跳过指定的类。你可以使用内置变量,如'$JDK'和'$Libraries'来跳过一组类,或者添加一个特定的类名表达式,如java.*,*.Foo。",
6668
"java.debugger.configuration.jdwp.limitOfVariablesPerJdwpRequest.description": "一次JDWP请求中可以请求的变量或字段的最大数量。该值越高,在展开变量视图时,请求debuggee的频率就越低。同时数量过大也会导致JDWP请求超时。",
6769
"java.debugger.configuration.jdwp.requestTimeout.description": "调试器与目标JVM通信时JDWP请求的超时时间(ms)。",

src/configurationProvider.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,8 @@ async function updateDebugSettings(event?: vscode.ConfigurationChangeEvent) {
779779
skipConstructors: debugSettingsRoot.settings.stepping.skipConstructors,
780780
};
781781
const exceptionFilters = {
782+
exceptionTypes: debugSettingsRoot.settings.exceptionBreakpoint.exceptionTypes,
783+
allowClasses: debugSettingsRoot.settings.exceptionBreakpoint.allowClasses,
782784
skipClasses: await substituteFilterVariables(debugSettingsRoot.settings.exceptionBreakpoint.skipClasses),
783785
};
784786

@@ -793,7 +795,10 @@ async function updateDebugSettings(event?: vscode.ConfigurationChangeEvent) {
793795
javaHome,
794796
stepFilters,
795797
exceptionFilters,
796-
exceptionFiltersUpdated: event && event.affectsConfiguration("java.debug.settings.exceptionBreakpoint.skipClasses"),
798+
exceptionFiltersUpdated: event &&
799+
(event.affectsConfiguration("java.debug.settings.exceptionBreakpoint.skipClasses")
800+
|| event.affectsConfiguration("java.debug.settings.exceptionBreakpoint.allowClasses")
801+
|| event.affectsConfiguration("java.debug.settings.exceptionBreakpoint.exceptionTypes")),
797802
limitOfVariablesPerJdwpRequest: Math.max(debugSettingsRoot.settings.jdwp.limitOfVariablesPerJdwpRequest, 1),
798803
jdwpRequestTimeout: Math.max(debugSettingsRoot.settings.jdwp.requestTimeout, 100),
799804
asyncJDWP,

0 commit comments

Comments
 (0)