Skip to content

Commit 82149ad

Browse files
authored
Merge pull request #359 from oracle/main
Merge 'main' into 'telemetry'
2 parents c86ce81 + 8361d71 commit 82149ad

File tree

6 files changed

+42
-34
lines changed

6 files changed

+42
-34
lines changed

patches/8036-draft.diff

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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
2-
index 76bb6080c73c..a708698bd008 100644
2+
index 76bb6080c73c..5ac38f940612 100644
33
--- a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
44
+++ b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
55
@@ -26,6 +26,7 @@
@@ -20,26 +20,24 @@ index 76bb6080c73c..a708698bd008 100644
2020

2121
/**
2222
* NetBeans implementation of a PAC script evaluator. This implementation
23-
@@ -196,6 +200,8 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
23+
@@ -196,6 +200,7 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
2424
private static final String PAC_SOCKS5_FFEXT = "SOCKS5"; // Mozilla Firefox extension. Not part of original Netscape spec.
2525
private static final String PAC_HTTP_FFEXT = "HTTP"; // Mozilla Firefox extension. Not part of original Netscape spec.
2626
private static final String PAC_HTTPS_FFEXT = "HTTPS"; // Mozilla Firefox extension. Not part of original Netscape spec.
27-
+ private static class RPSingleton { private static final RequestProcessor instance = new RequestProcessor(NbPacScriptEvaluator.class.getName(), Runtime.getRuntime().availableProcessors(), true, false); }
28-
+ private static RequestProcessor getRequestProcessor() { return RPSingleton.instance; }
27+
+ private static final RequestProcessor RP = new RequestProcessor(NbPacScriptEvaluator.class.getName(), Runtime.getRuntime().availableProcessors(), true, false);
2928
private final String pacScriptSource;
3029

3130

32-
@@ -213,7 +219,8 @@ public NbPacScriptEvaluator(String pacSourceCocde) throws PacParsingException {
31+
@@ -213,7 +218,7 @@ public NbPacScriptEvaluator(String pacSourceCocde) throws PacParsingException {
3332
@Override
3433
public List<Proxy> findProxyForURL(URI uri) throws PacValidationException {
3534

3635
- List<Proxy> jsResultAnalyzed;
37-
+ AtomicReference<List<Proxy>> resultHolder = new AtomicReference<>(null);
3836
+ List<Proxy> jsResultAnalyzed = null;
3937

4038
// First try the cache
4139
if (resultCache != null) {
42-
@@ -222,38 +229,36 @@ public List<Proxy> findProxyForURL(URI uri) throws PacValidationException {
40+
@@ -222,38 +227,37 @@ public List<Proxy> findProxyForURL(URI uri) throws PacValidationException {
4341
return jsResultAnalyzed;
4442
}
4543
}
@@ -73,7 +71,8 @@ index 76bb6080c73c..a708698bd008 100644
7371
+ if (timeout <= 0){
7472
+ jsResultAnalyzed = executeProxyScript(uri);
7573
+ } else {
76-
+ Task task = getRequestProcessor().post(() -> {
74+
+ AtomicReference<List<Proxy>> resultHolder = new AtomicReference<>(null);
75+
+ Task task = RP.post(() -> {
7776
+ resultHolder.set(executeProxyScript(uri));
7877
+ });
7978
+
@@ -93,18 +92,18 @@ index 76bb6080c73c..a708698bd008 100644
9392
- LOGGER.log(Level.WARNING, "Error when executing PAC script function " + scriptEngine.getJsMainFunction().getJsFunctionName() + " : ", ex);
9493
- return Collections.singletonList(Proxy.NO_PROXY);
9594
+ jsResultAnalyzed = resultHolder.get();
96-
+ }
95+
}
9796
+ if (canUseURLCaching && (resultCache != null) && (jsResultAnalyzed != null)) {
9897
+ resultCache.put(uri, jsResultAnalyzed); // save the result in the cache
99-
}
98+
+ }
10099
+ return jsResultAnalyzed != null ? jsResultAnalyzed : Collections.singletonList(Proxy.NO_PROXY);
101100
}
102101
-
103102
+
104103
@Override
105104
public boolean usesCaching() {
106105
return (canUseURLCaching && (resultCache != null));
107-
@@ -275,6 +280,32 @@ public String getPacScriptSource() {
106+
@@ -275,6 +279,32 @@ public String getPacScriptSource() {
108107
return this.pacScriptSource;
109108
}
110109

@@ -210,15 +209,15 @@ index 178c9b162feb..90812bfa4612 100644
210209
testPacFile2("pac-test4.js", factory);
211210
}
212211
diff --git a/platform/o.n.core/src/org/netbeans/core/ProxySettings.java b/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
213-
index 2d29427cd3c2..19e48d9bad82 100644
212+
index 2d29427cd3c2..bb0bc42ae19f 100644
214213
--- a/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
215214
+++ b/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
216215
@@ -49,6 +49,8 @@ public class ProxySettings {
217216
public static final String USE_PROXY_ALL_PROTOCOLS = "useProxyAllProtocols"; // NOI18N
218217
public static final String DIRECT = "DIRECT"; // NOI18N
219218
public static final String PAC = "PAC"; // NOI18N
220219
+ public static final String PAC_SCRIPT_TIMEOUT = "pacScriptTimeout"; // NOI18N
221-
+ public static final int DEFAULT_TIMEOUT = 60000;
220+
+ public static final int DEFAULT_TIMEOUT = 10000;
222221

223222
public static final String SYSTEM_PROXY_HTTP_HOST = "systemProxyHttpHost"; // NOI18N
224223
public static final String SYSTEM_PROXY_HTTP_PORT = "systemProxyHttpPort"; // NOI18N
@@ -227,7 +226,7 @@ index 2d29427cd3c2..19e48d9bad82 100644
227226
}
228227

229228
+ public static int getPacScriptTimeout() {
230-
+ return NbPreferences.forModule(ProxySettings.class)
229+
+ return getPreferences ()
231230
+ .getInt(PAC_SCRIPT_TIMEOUT, DEFAULT_TIMEOUT);
232231
+ }
233232

vscode/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
2424
-->
2525

26+
## Version 23.1.0
27+
### What's Changed
28+
29+
#### Other Changes
30+
* Minor README updates and fixes [#334](https://github.com/oracle/javavscode/pull/334) and [#339](https://github.com/oracle/javavscode/pull/339)
31+
* Suppressed JNI warning during language server startup [#338](https://github.com/oracle/javavscode/pull/338)
32+
* Dependency upgrades [#337](https://github.com/oracle/javavscode/pull/337)
33+
* Extension maintainance changes [#348](https://github.com/oracle/javavscode/pull/348) and [#349](https://github.com/oracle/javavscode/pull/349)
34+
2635
## Version 23.0.1
2736
### What's Changed
2837

vscode/src/test/integration/suite/general/explorer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ suite('Explorer Test Suite', () => {
3535
const lvp = await myExplorer.createViewProvider(await awaitClient(), 'foundProjects');
3636
const firstLevelChildren = await (lvp.getChildren() as Thenable<any[]>);
3737
assert.strictEqual(firstLevelChildren.length, 0, "No child under the root");
38-
}).timeout(10000);
38+
}).timeout(60000);
3939
});

vscode/src/test/integration/suite/general/extension.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ suite('Extension Test Suite', function () {
4040
// Create project which used be used for testing
4141
this.beforeAll(async () => {
4242
await prepareProject(filePaths);
43-
}).timeout(10000);
43+
}).timeout(60000);
4444

4545
// This test must be run first, in order to activate the extension and wait for the activation to complete
4646
test("Extension loaded and activated", async () => {
@@ -59,7 +59,7 @@ suite('Extension Test Suite', function () {
5959
}
6060
assert.ok(cannotReassignVersion, "Cannot reassign value of version");
6161

62-
}).timeout(10000);
62+
}).timeout(60000);
6363

6464
// Test if clusters are loaded or not
6565
test('Find clusters', async () => {
@@ -93,7 +93,7 @@ suite('Extension Test Suite', function () {
9393
for (let c of found) {
9494
assert.ok(c.startsWith(nbcode.extensionPath), `All extensions are below ${nbcode.extensionPath}, but: ${c}`);
9595
}
96-
}).timeout(10000);
96+
}).timeout(60000);
9797

9898
// Check if Jdk commands have been loaded
9999
test("Jdk commands loaded", async () => {
@@ -107,7 +107,7 @@ suite('Extension Test Suite', function () {
107107
}
108108

109109
assert.ok(containsJdkCommands, "No Jdk command has been loaded");
110-
}).timeout(10000);
110+
}).timeout(60000);
111111

112112
// Check if format document command is executed successfully
113113
test("Format document", async () => {
@@ -118,7 +118,7 @@ suite('Extension Test Suite', function () {
118118
const unformattedCode = SAMPLE_CODE_FORMAT_DOCUMENT.split('\n').length;
119119
const isDocumentFormatted = formattedCode > unformattedCode;
120120
assert.ok(isDocumentFormatted, "document is not formatted");
121-
}).timeout(10000);
121+
}).timeout(60000);
122122

123123
// Check if imports are getting sorted on saving document
124124
test("Sort imports", async () => {
@@ -133,7 +133,7 @@ suite('Extension Test Suite', function () {
133133
savedCode.indexOf('import java.util.ArrayList;');
134134
assert.ok(isImportsSorted, "Imports are not sorted");
135135

136-
}).timeout(10000);
136+
}).timeout(60000);
137137

138138
// Check if unused imports are getting removed on saving document
139139
test("Remove unused imports", async () => {
@@ -148,7 +148,7 @@ suite('Extension Test Suite', function () {
148148
savedCode.indexOf('import java.lang.Integer;') === -1;
149149
assert.ok(areUnusedImportsRemoved, "Unused imports are not removed");
150150

151-
}).timeout(10000);
151+
}).timeout(60000);
152152

153153
// Check if refactor actions are getting showing on UI and if they are working
154154
test("Refactor actions executing", async () => {
@@ -176,7 +176,7 @@ suite('Extension Test Suite', function () {
176176
}
177177
}
178178
}
179-
}).timeout(10000);
179+
}).timeout(60000);
180180

181181
// Tests explorer is loading properly
182182
test("Test Explorer tests", async () => {
@@ -203,7 +203,7 @@ suite('Extension Test Suite', function () {
203203
dumpJava();
204204
throw error;
205205
}
206-
}).timeout(10000);
206+
}).timeout(60000);
207207

208208
// Check if compile workspace command is excuted succesfully
209209
test("Compile workspace", async () => {
@@ -221,7 +221,7 @@ suite('Extension Test Suite', function () {
221221
const item = await (lvp.getTreeItem(firstLevelChildren[0]) as Thenable<TreeItem>);
222222
assert.strictEqual(item?.label, "basicapp", "Element is named as the Maven project");
223223
});
224-
}).timeout(10000);
224+
}).timeout(60000);
225225

226226
// Get Project info
227227
test("Get project sources, classpath, and packages", async () => {
@@ -286,7 +286,7 @@ suite('Extension Test Suite', function () {
286286
dumpJava();
287287
throw error;
288288
}
289-
}).timeout(10000);
289+
}).timeout(60000);
290290

291291
// Check if clean workspace command is excuted succesfully
292292
test("Clean workspace", async () => {
@@ -296,7 +296,7 @@ suite('Extension Test Suite', function () {
296296

297297
const mainClass = path.join(folder, 'target');
298298
assert.ok(!fs.existsSync(mainClass), "Class created by compilation: " + mainClass);
299-
}).timeout(10000);
299+
}).timeout(60000);
300300

301301
// Check if xml document formatting is executed successfully
302302
test("XML Format document", async () => {
@@ -305,6 +305,6 @@ suite('Extension Test Suite', function () {
305305

306306
const formattedContents = editor.document.getText().trim();
307307
assert.ok(formattedContents == FORMATTED_POM_XML.trim(), "pom.xml is not formatted");
308-
}).timeout(10000);
308+
}).timeout(60000);
309309

310310
});

vscode/src/test/integration/suite/gradle/extension.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ suite("Extension gradle tests", function () {
5858
dumpJava();
5959
throw error;
6060
}
61-
}).timeout(50000);
61+
}).timeout(120*1000);
6262

6363
// Check if clean workspace command is excuted succesfully
6464
test("Clean workspace - Gradle", async () => {
@@ -71,5 +71,5 @@ suite("Extension gradle tests", function () {
7171
!fs.existsSync(mainClass),
7272
"Class created by compilation: " + mainClass
7373
);
74-
}).timeout(10000);
74+
}).timeout(60000);
7575
});

vscode/src/test/integration/suite/localisation/extension.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ suite("Extension localisation tests", function () {
4545
assert.ok(matchKeys(enBundlePath, langBundlePath), `Keys of ${DEFAULT_BUNDLE_FILE_NAME} and bundle.l10n.${lang}.json don't match`);
4646
assert.ok(matchValuesTemplate(enBundlePath, langBundlePath), `Value templates don't match for of the keys of ${DEFAULT_BUNDLE_FILE_NAME} and bundle.l10n.${lang}.json `);
4747
}
48-
}).timeout(10000);
48+
}).timeout(60000);
4949

5050
test("Consistency of keys across package.nls.lang.json files for supported languages", async () => {
5151
const extension = extensions.getExtension(EXTENSION_NAME);
@@ -57,7 +57,7 @@ suite("Extension localisation tests", function () {
5757
assert.ok(fs.existsSync(langPackagePath), `package.nls.${lang}.json doesn't exists`);
5858
assert.ok(matchKeys(enPackagePath, langPackagePath), `Keys of ${DEFAULT_PACKAGE_FILE_NAME} and package.nls.${lang}.json don't match`);
5959
}
60-
}).timeout(10000);
60+
}).timeout(60000);
6161

6262
// Check localisable fields being appropriately localised for the contributes defined in package.json
6363
test("Localisable fields in package.json localised properly ", async () => {
@@ -74,7 +74,7 @@ suite("Extension localisation tests", function () {
7474
assert.ok(checkViewsLocalisation(contributes.views, validKeys), "Error some views is not localized");
7575
assert.ok(checkDebuggersLocalisation(contributes.debuggers, validKeys), "Error some debugger labels not localized");
7676
assert.ok(checkConfigurationLocalisation(contributes.configuration, validKeys), "Error some configuration labels not localized");
77-
}).timeout(10000);
77+
}).timeout(60000);
7878

7979

8080
// 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 () {
8686
assert(enBundlePath, `${DEFAULT_BUNDLE_FILE_NAME} not found`);
8787
const validKeyValues = JSON.parse(fs.readFileSync(enBundlePath, 'utf8'));
8888
assert(checkL10nUsageInFiles(path.join(extension.extensionPath, "out"), ignoredDirEntriesNames, validKeyValues) === 0, "Some files have invalid localisation keys used. Check the logs or error messages");
89-
}).timeout(10000);
89+
}).timeout(60000);
9090

9191
});

0 commit comments

Comments
 (0)