Skip to content

Commit b25f999

Browse files
authored
fix: use jdtutils to parse uri (#941)
* fix: use jdtutils to parse uri * fix: fix copilot comments * fix: update * fix: update
1 parent 698593c commit b25f999

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

jdtls.ext/com.microsoft.jdtls.ext.core/src/com/microsoft/jdtls/ext/core/ProjectCommand.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -672,15 +672,13 @@ public static ProjectDependenciesResult getProjectDependencies(List<Object> argu
672672
return new ProjectDependenciesResult(ProjectDependenciesErrorReason.INVALID_URI, fileUri);
673673
}
674674

675-
// Validate URI format
676-
String parsedPath = null;
675+
// Validate URI format using JDTUtils
677676
try {
678-
java.net.URI uri = new java.net.URI(fileUri);
679-
parsedPath = uri.getPath();
680-
if (parsedPath == null) {
681-
return new ProjectDependenciesResult(ProjectDependenciesErrorReason.URI_PARSE_FAILED, parsedPath);
677+
java.net.URI uri = JDTUtils.toURI(fileUri);
678+
if (uri == null) {
679+
return new ProjectDependenciesResult(ProjectDependenciesErrorReason.URI_PARSE_FAILED, fileUri);
682680
}
683-
} catch (java.net.URISyntaxException e) {
681+
} catch (Exception e) {
684682
return new ProjectDependenciesResult(ProjectDependenciesErrorReason.MALFORMED_URI, fileUri);
685683
}
686684

jdtls.ext/com.microsoft.jdtls.ext.core/src/com/microsoft/jdtls/ext/core/parser/ContextResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*******************************************************************************
1+
/*******************************************************************************
22
* Copyright (c) 2018 Microsoft Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0

0 commit comments

Comments
 (0)