From d1a43d5417c7fe45b6d49f046603d54bf9cddd27 Mon Sep 17 00:00:00 2001 From: Martin Weber <11367029+15knots@users.noreply.github.com> Date: Tue, 6 Sep 2022 21:24:26 +0200 Subject: [PATCH] avoid StringIndexOutOfBoundsException on close. Fixes #66 Signed-off-by: Martin Weber <11367029+15knots@users.noreply.github.com> Change-Id: I816b8ee5852e6b25011a611c07c54d0a814a74d8 --- .../org/eclipse/cdt/cmake/core/internal/CMakeErrorParser.java | 4 ++++ .../cdt/cmake/core/internal/ICMakeExecutionMarkerFactory.java | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeErrorParser.java b/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeErrorParser.java index b4f8e935220..e15cd609dc5 100644 --- a/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeErrorParser.java +++ b/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeErrorParser.java @@ -205,6 +205,10 @@ import org.eclipse.core.runtime.Status; */ public void processMessage(ICMakeExecutionMarkerFactory markerFactory, String fullMessage) throws CoreException { + int length = getMessageStart().length(); + if (fullMessage.length() <= length) { + return; + } String content = fullMessage.substring(getMessageStart().length()); // mandatory attributes for the marker Map attributes = new HashMap<>(3); diff --git a/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/ICMakeExecutionMarkerFactory.java b/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/ICMakeExecutionMarkerFactory.java index b6283f2c517..1380cf44714 100644 --- a/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/ICMakeExecutionMarkerFactory.java +++ b/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/ICMakeExecutionMarkerFactory.java @@ -50,7 +50,6 @@ interface ICMakeExecutionMarkerFactory { * * @throws CoreException */ - // TODO pass in the extra attributes here then return void void createMarker(String message, int severity, String filePath, Map mandatoryAttributes) throws CoreException; } \ No newline at end of file