diff --git a/patches/8036-draft.diff b/patches/8036-draft.diff index 7e6ff673..1ba0dee6 100644 --- a/patches/8036-draft.diff +++ b/patches/8036-draft.diff @@ -1,5 +1,5 @@ diff --git a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java -index 76bb6080c73c..a708698bd008 100644 +index 76bb6080c73c..5ac38f940612 100644 --- a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java +++ b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java @@ -26,6 +26,7 @@ @@ -20,26 +20,24 @@ index 76bb6080c73c..a708698bd008 100644 /** * NetBeans implementation of a PAC script evaluator. This implementation -@@ -196,6 +200,8 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator { +@@ -196,6 +200,7 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator { private static final String PAC_SOCKS5_FFEXT = "SOCKS5"; // Mozilla Firefox extension. Not part of original Netscape spec. private static final String PAC_HTTP_FFEXT = "HTTP"; // Mozilla Firefox extension. Not part of original Netscape spec. private static final String PAC_HTTPS_FFEXT = "HTTPS"; // Mozilla Firefox extension. Not part of original Netscape spec. -+ private static class RPSingleton { private static final RequestProcessor instance = new RequestProcessor(NbPacScriptEvaluator.class.getName(), Runtime.getRuntime().availableProcessors(), true, false); } -+ private static RequestProcessor getRequestProcessor() { return RPSingleton.instance; } ++ private static final RequestProcessor RP = new RequestProcessor(NbPacScriptEvaluator.class.getName(), Runtime.getRuntime().availableProcessors(), true, false); private final String pacScriptSource; -@@ -213,7 +219,8 @@ public NbPacScriptEvaluator(String pacSourceCocde) throws PacParsingException { +@@ -213,7 +218,7 @@ public NbPacScriptEvaluator(String pacSourceCocde) throws PacParsingException { @Override public List findProxyForURL(URI uri) throws PacValidationException { - List jsResultAnalyzed; -+ AtomicReference> resultHolder = new AtomicReference<>(null); + List jsResultAnalyzed = null; // First try the cache if (resultCache != null) { -@@ -222,38 +229,36 @@ public List findProxyForURL(URI uri) throws PacValidationException { +@@ -222,38 +227,37 @@ public List findProxyForURL(URI uri) throws PacValidationException { return jsResultAnalyzed; } } @@ -73,7 +71,8 @@ index 76bb6080c73c..a708698bd008 100644 + if (timeout <= 0){ + jsResultAnalyzed = executeProxyScript(uri); + } else { -+ Task task = getRequestProcessor().post(() -> { ++ AtomicReference> resultHolder = new AtomicReference<>(null); ++ Task task = RP.post(() -> { + resultHolder.set(executeProxyScript(uri)); + }); + @@ -93,10 +92,10 @@ index 76bb6080c73c..a708698bd008 100644 - LOGGER.log(Level.WARNING, "Error when executing PAC script function " + scriptEngine.getJsMainFunction().getJsFunctionName() + " : ", ex); - return Collections.singletonList(Proxy.NO_PROXY); + jsResultAnalyzed = resultHolder.get(); -+ } + } + if (canUseURLCaching && (resultCache != null) && (jsResultAnalyzed != null)) { + resultCache.put(uri, jsResultAnalyzed); // save the result in the cache - } ++ } + return jsResultAnalyzed != null ? jsResultAnalyzed : Collections.singletonList(Proxy.NO_PROXY); } - @@ -104,7 +103,7 @@ index 76bb6080c73c..a708698bd008 100644 @Override public boolean usesCaching() { return (canUseURLCaching && (resultCache != null)); -@@ -275,6 +280,32 @@ public String getPacScriptSource() { +@@ -275,6 +279,32 @@ public String getPacScriptSource() { return this.pacScriptSource; } @@ -210,7 +209,7 @@ index 178c9b162feb..90812bfa4612 100644 testPacFile2("pac-test4.js", factory); } diff --git a/platform/o.n.core/src/org/netbeans/core/ProxySettings.java b/platform/o.n.core/src/org/netbeans/core/ProxySettings.java -index 2d29427cd3c2..19e48d9bad82 100644 +index 2d29427cd3c2..bb0bc42ae19f 100644 --- a/platform/o.n.core/src/org/netbeans/core/ProxySettings.java +++ b/platform/o.n.core/src/org/netbeans/core/ProxySettings.java @@ -49,6 +49,8 @@ public class ProxySettings { @@ -218,7 +217,7 @@ index 2d29427cd3c2..19e48d9bad82 100644 public static final String DIRECT = "DIRECT"; // NOI18N public static final String PAC = "PAC"; // NOI18N + public static final String PAC_SCRIPT_TIMEOUT = "pacScriptTimeout"; // NOI18N -+ public static final int DEFAULT_TIMEOUT = 60000; ++ public static final int DEFAULT_TIMEOUT = 10000; public static final String SYSTEM_PROXY_HTTP_HOST = "systemProxyHttpHost"; // NOI18N public static final String SYSTEM_PROXY_HTTP_PORT = "systemProxyHttpPort"; // NOI18N @@ -227,7 +226,7 @@ index 2d29427cd3c2..19e48d9bad82 100644 } + public static int getPacScriptTimeout() { -+ return NbPreferences.forModule(ProxySettings.class) ++ return getPreferences () + .getInt(PAC_SCRIPT_TIMEOUT, DEFAULT_TIMEOUT); + } diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index 0b94b7d8..3127724d 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -23,6 +23,15 @@ --> +## Version 23.1.0 +### What's Changed + +#### Other Changes +* Minor README updates and fixes [#334](https://github.com/oracle/javavscode/pull/334) and [#339](https://github.com/oracle/javavscode/pull/339) +* Suppressed JNI warning during language server startup [#338](https://github.com/oracle/javavscode/pull/338) +* Dependency upgrades [#337](https://github.com/oracle/javavscode/pull/337) +* Extension maintainance changes [#348](https://github.com/oracle/javavscode/pull/348) and [#349](https://github.com/oracle/javavscode/pull/349) + ## Version 23.0.1 ### What's Changed diff --git a/vscode/src/test/integration/suite/general/explorer.test.ts b/vscode/src/test/integration/suite/general/explorer.test.ts index 8669c9b9..b9dd750b 100644 --- a/vscode/src/test/integration/suite/general/explorer.test.ts +++ b/vscode/src/test/integration/suite/general/explorer.test.ts @@ -35,5 +35,5 @@ suite('Explorer Test Suite', () => { const lvp = await myExplorer.createViewProvider(await awaitClient(), 'foundProjects'); const firstLevelChildren = await (lvp.getChildren() as Thenable); assert.strictEqual(firstLevelChildren.length, 0, "No child under the root"); - }).timeout(10000); + }).timeout(60000); }); diff --git a/vscode/src/test/integration/suite/general/extension.test.ts b/vscode/src/test/integration/suite/general/extension.test.ts index e8ee2daa..a4f38774 100644 --- a/vscode/src/test/integration/suite/general/extension.test.ts +++ b/vscode/src/test/integration/suite/general/extension.test.ts @@ -40,7 +40,7 @@ suite('Extension Test Suite', function () { // Create project which used be used for testing this.beforeAll(async () => { await prepareProject(filePaths); - }).timeout(10000); + }).timeout(60000); // This test must be run first, in order to activate the extension and wait for the activation to complete test("Extension loaded and activated", async () => { @@ -59,7 +59,7 @@ suite('Extension Test Suite', function () { } assert.ok(cannotReassignVersion, "Cannot reassign value of version"); - }).timeout(10000); + }).timeout(60000); // Test if clusters are loaded or not test('Find clusters', async () => { @@ -93,7 +93,7 @@ suite('Extension Test Suite', function () { for (let c of found) { assert.ok(c.startsWith(nbcode.extensionPath), `All extensions are below ${nbcode.extensionPath}, but: ${c}`); } - }).timeout(10000); + }).timeout(60000); // Check if Jdk commands have been loaded test("Jdk commands loaded", async () => { @@ -107,7 +107,7 @@ suite('Extension Test Suite', function () { } assert.ok(containsJdkCommands, "No Jdk command has been loaded"); - }).timeout(10000); + }).timeout(60000); // Check if format document command is executed successfully test("Format document", async () => { @@ -118,7 +118,7 @@ suite('Extension Test Suite', function () { const unformattedCode = SAMPLE_CODE_FORMAT_DOCUMENT.split('\n').length; const isDocumentFormatted = formattedCode > unformattedCode; assert.ok(isDocumentFormatted, "document is not formatted"); - }).timeout(10000); + }).timeout(60000); // Check if imports are getting sorted on saving document test("Sort imports", async () => { @@ -133,7 +133,7 @@ suite('Extension Test Suite', function () { savedCode.indexOf('import java.util.ArrayList;'); assert.ok(isImportsSorted, "Imports are not sorted"); - }).timeout(10000); + }).timeout(60000); // Check if unused imports are getting removed on saving document test("Remove unused imports", async () => { @@ -148,7 +148,7 @@ suite('Extension Test Suite', function () { savedCode.indexOf('import java.lang.Integer;') === -1; assert.ok(areUnusedImportsRemoved, "Unused imports are not removed"); - }).timeout(10000); + }).timeout(60000); // Check if refactor actions are getting showing on UI and if they are working test("Refactor actions executing", async () => { @@ -176,7 +176,7 @@ suite('Extension Test Suite', function () { } } } - }).timeout(10000); + }).timeout(60000); // Tests explorer is loading properly test("Test Explorer tests", async () => { @@ -203,7 +203,7 @@ suite('Extension Test Suite', function () { dumpJava(); throw error; } - }).timeout(10000); + }).timeout(60000); // Check if compile workspace command is excuted succesfully test("Compile workspace", async () => { @@ -221,7 +221,7 @@ suite('Extension Test Suite', function () { const item = await (lvp.getTreeItem(firstLevelChildren[0]) as Thenable); assert.strictEqual(item?.label, "basicapp", "Element is named as the Maven project"); }); - }).timeout(10000); + }).timeout(60000); // Get Project info test("Get project sources, classpath, and packages", async () => { @@ -286,7 +286,7 @@ suite('Extension Test Suite', function () { dumpJava(); throw error; } - }).timeout(10000); + }).timeout(60000); // Check if clean workspace command is excuted succesfully test("Clean workspace", async () => { @@ -296,7 +296,7 @@ suite('Extension Test Suite', function () { const mainClass = path.join(folder, 'target'); assert.ok(!fs.existsSync(mainClass), "Class created by compilation: " + mainClass); - }).timeout(10000); + }).timeout(60000); // Check if xml document formatting is executed successfully test("XML Format document", async () => { @@ -305,6 +305,6 @@ suite('Extension Test Suite', function () { const formattedContents = editor.document.getText().trim(); assert.ok(formattedContents == FORMATTED_POM_XML.trim(), "pom.xml is not formatted"); - }).timeout(10000); + }).timeout(60000); }); \ No newline at end of file diff --git a/vscode/src/test/integration/suite/gradle/extension.test.ts b/vscode/src/test/integration/suite/gradle/extension.test.ts index f7fa1a93..d3e437f4 100644 --- a/vscode/src/test/integration/suite/gradle/extension.test.ts +++ b/vscode/src/test/integration/suite/gradle/extension.test.ts @@ -58,7 +58,7 @@ suite("Extension gradle tests", function () { dumpJava(); throw error; } - }).timeout(50000); + }).timeout(120*1000); // Check if clean workspace command is excuted succesfully test("Clean workspace - Gradle", async () => { @@ -71,5 +71,5 @@ suite("Extension gradle tests", function () { !fs.existsSync(mainClass), "Class created by compilation: " + mainClass ); - }).timeout(10000); + }).timeout(60000); }); diff --git a/vscode/src/test/integration/suite/localisation/extension.test.ts b/vscode/src/test/integration/suite/localisation/extension.test.ts index 93a7fe0d..0e409c74 100644 --- a/vscode/src/test/integration/suite/localisation/extension.test.ts +++ b/vscode/src/test/integration/suite/localisation/extension.test.ts @@ -45,7 +45,7 @@ suite("Extension localisation tests", function () { assert.ok(matchKeys(enBundlePath, langBundlePath), `Keys of ${DEFAULT_BUNDLE_FILE_NAME} and bundle.l10n.${lang}.json don't match`); assert.ok(matchValuesTemplate(enBundlePath, langBundlePath), `Value templates don't match for of the keys of ${DEFAULT_BUNDLE_FILE_NAME} and bundle.l10n.${lang}.json `); } - }).timeout(10000); + }).timeout(60000); test("Consistency of keys across package.nls.lang.json files for supported languages", async () => { const extension = extensions.getExtension(EXTENSION_NAME); @@ -57,7 +57,7 @@ suite("Extension localisation tests", function () { assert.ok(fs.existsSync(langPackagePath), `package.nls.${lang}.json doesn't exists`); assert.ok(matchKeys(enPackagePath, langPackagePath), `Keys of ${DEFAULT_PACKAGE_FILE_NAME} and package.nls.${lang}.json don't match`); } - }).timeout(10000); + }).timeout(60000); // Check localisable fields being appropriately localised for the contributes defined in package.json test("Localisable fields in package.json localised properly ", async () => { @@ -74,7 +74,7 @@ suite("Extension localisation tests", function () { assert.ok(checkViewsLocalisation(contributes.views, validKeys), "Error some views is not localized"); assert.ok(checkDebuggersLocalisation(contributes.debuggers, validKeys), "Error some debugger labels not localized"); assert.ok(checkConfigurationLocalisation(contributes.configuration, validKeys), "Error some configuration labels not localized"); - }).timeout(10000); + }).timeout(60000); // Check if l10n.value is called with a valid key and the placeholder map has all the keys as required in the string template @@ -86,6 +86,6 @@ suite("Extension localisation tests", function () { assert(enBundlePath, `${DEFAULT_BUNDLE_FILE_NAME} not found`); const validKeyValues = JSON.parse(fs.readFileSync(enBundlePath, 'utf8')); assert(checkL10nUsageInFiles(path.join(extension.extensionPath, "out"), ignoredDirEntriesNames, validKeyValues) === 0, "Some files have invalid localisation keys used. Check the logs or error messages"); - }).timeout(10000); + }).timeout(60000); });