This is an automated email from the ASF dual-hosted git repository.
mbien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 946c688a44 hide maven transfer progress via flag instead of regexp
filtering.
new 8270e7c70c Merge pull request #4954 from
mbien/fix-maven-transfer-progress-filtering
946c688a44 is described below
commit 946c688a44f8986dcfdffbec33a9d348dd677b87
Author: Michael Bien <[email protected]>
AuthorDate: Thu Nov 10 00:28:41 2022 +0100
hide maven transfer progress via flag instead of regexp filtering.
- sets --no-transfer-progress as default global maven option
- removes console regexp filter which fixes #4017
- regexp filter didn't work with current maven anyway
---
.../maven/execute/CommandLineOutputHandler.java | 36 ++++++++--------------
.../modules/maven/options/Bundle.properties | 1 +
.../modules/maven/options/MavenSettings.java | 4 +--
.../modules/maven/options/SettingsPanel.java | 6 ++--
.../execute/CommandLineOutputHandlerTest.java | 18 -----------
5 files changed, 20 insertions(+), 45 deletions(-)
diff --git
a/java/maven/src/org/netbeans/modules/maven/execute/CommandLineOutputHandler.java
b/java/maven/src/org/netbeans/modules/maven/execute/CommandLineOutputHandler.java
index 8ad34b0a29..6baab0d816 100644
---
a/java/maven/src/org/netbeans/modules/maven/execute/CommandLineOutputHandler.java
+++
b/java/maven/src/org/netbeans/modules/maven/execute/CommandLineOutputHandler.java
@@ -78,7 +78,6 @@ public class CommandLineOutputHandler extends
AbstractOutputHandler {
private static final RequestProcessor PROCESSOR = new
RequestProcessor("Maven ComandLine Output Redirection",
Integer.getInteger("maven.concurrent.builds", 16) * 2); //NOI18N
private static final Logger LOG =
Logger.getLogger(CommandLineOutputHandler.class.getName());
private InputOutput inputOutput;
- /*test*/ static final Pattern DOWNLOAD = Pattern.compile("^(\\d+(/\\d*)?
?(M|K|b|KB|B|\\?)\\s*)+$"); //NOI18N
private static final Pattern linePattern =
Pattern.compile("\\[(DEBUG|INFO|WARNING|ERROR|FATAL)\\] (.*)"); // NOI18N
public static final Pattern startPatternM2 = Pattern.compile("\\[INFO\\]
\\[([\\w]*):([\\w]*)[ ]?.*\\]"); // NOI18N
public static final Pattern startPatternM3 = Pattern.compile("\\[INFO\\]
--- (\\S+):\\S+:(\\S+)(?: [(]\\S+[)])? @ \\S+ ---"); //
ExecutionEventLogger.mojoStarted NOI18N
@@ -314,31 +313,22 @@ public class CommandLineOutputHandler extends
AbstractOutputHandler {
checkSleepiness();
}
- boolean isDownloadProgress = false;
if(line.length() > 0 && line.charAt(line.length() - 1) ==
'\r') {
- // issue #252514
- if (DOWNLOAD.matcher(line).matches()) {
- isDownloadProgress = true;
- } else {
- line = line.substring(0, line.length() - 1);
- }
+ line = line.substring(0, line.length() - 1);
}
- if(!isDownloadProgress) {
- Matcher match = linePattern.matcher(line);
- if (match.matches()) {
- String levelS = match.group(1);
- Level level = Level.valueOf(levelS);
- String text = match.group(2);
- updateFoldForException(text);
-
processLine(MavenSettings.getDefault().isShowLoggingLevel() ? line : text,
stdOut, level);
- if (level == Level.INFO && contextImpl == null) {
//only perform for maven 2.x now
- checkProgress(text);
- }
- } else {
- // oh well..
- updateFoldForException(line);
- processLine(line, stdOut, Level.INFO);
+ Matcher lineMatcher = linePattern.matcher(line);
+ if (lineMatcher.matches()) {
+ Level level = Level.valueOf(lineMatcher.group(1));
+ String text = lineMatcher.group(2);
+ updateFoldForException(text);
+
processLine(MavenSettings.getDefault().isShowLoggingLevel() ? line : text,
stdOut, level);
+ if (level == Level.INFO && contextImpl == null) {
//only perform for maven 2.x now
+ checkProgress(text);
}
+ } else {
+ // oh well..
+ updateFoldForException(line);
+ processLine(line, stdOut, Level.INFO);
}
if (contextImpl == null && firstFailure == null) {
Matcher match = reactorFailure.matcher(line);
diff --git
a/java/maven/src/org/netbeans/modules/maven/options/Bundle.properties
b/java/maven/src/org/netbeans/modules/maven/options/Bundle.properties
index d4e33275c6..5a430ebe69 100644
--- a/java/maven/src/org/netbeans/modules/maven/options/Bundle.properties
+++ b/java/maven/src/org/netbeans/modules/maven/options/Bundle.properties
@@ -56,6 +56,7 @@ FORCE_UPTODATE_CHECK=Force upToDate check for any relevant
registered plugins.\n
SUPPRESS_UPTODATE_CHECK=Suppress upToDate check for any relevant registered
plugins.\n\nExclusive with --check-plugin-updates.
FORCES_A_CHECK=Forces a check for updated releases and snapshots on remote
repositories.
DON'T_USE_PLUGIN-REGISTRY=Don't use ~/.m2/plugin-registry.xml for plugin
versions
+NO_TRANSFER_PROGRESS=Don't print the download progress.
TIT_Add_Globals=Add Global Option(s)
SettingsPanel.jLabel1.text=Dependency Download Strategy :
TIT_NEVER=Never
diff --git
a/java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java
b/java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java
index 53ab2966ad..6fe2a7f1f7 100644
--- a/java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java
+++ b/java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java
@@ -159,7 +159,7 @@ public final class MavenSettings {
//import from older versions
String defOpts = getPreferences().get(PROP_DEFAULT_OPTIONS, null);
if (defOpts == null) {
- defOpts = "";
+ defOpts = getDefaultOptions();
//only when not already set by user or by previous import
String debug = getPreferences().get(PROP_DEBUG, null);
if (debug != null) {
@@ -223,7 +223,7 @@ public final class MavenSettings {
}
public String getDefaultOptions() {
- return getPreferences().get(PROP_DEFAULT_OPTIONS, ""); //NOI18N
+ return getPreferences().get(PROP_DEFAULT_OPTIONS,
"--no-transfer-progress"); //NOI18N
}
public void setDefaultOptions(String options) {
diff --git
a/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java
b/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java
index 3df8aff34c..fe3a3ecad7 100644
--- a/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java
+++ b/java/maven/src/org/netbeans/modules/maven/options/SettingsPanel.java
@@ -245,7 +245,8 @@ public class SettingsPanel extends javax.swing.JPanel {
"--check-plugin-updates", //NOI18N
"--no-plugin-updates", //NOI18N
"--update-snapshots", //NOI18N
- "--no-plugin-registry" //NOI18N
+ "--no-plugin-registry", //NOI18N
+ "--no-transfer-progress" //NOI18N
};
@@ -263,7 +264,8 @@ public class SettingsPanel extends javax.swing.JPanel {
org.openide.util.NbBundle.getMessage(SettingsPanel.class,
"FORCE_UPTODATE_CHECK"),
org.openide.util.NbBundle.getMessage(SettingsPanel.class,
"SUPPRESS_UPTODATE_CHECK"),
org.openide.util.NbBundle.getMessage(SettingsPanel.class,
"FORCES_A_CHECK"),
- org.openide.util.NbBundle.getMessage(SettingsPanel.class,
"DON'T_USE_PLUGIN-REGISTRY")
+ org.openide.util.NbBundle.getMessage(SettingsPanel.class,
"DON'T_USE_PLUGIN-REGISTRY"),
+ org.openide.util.NbBundle.getMessage(SettingsPanel.class,
"NO_TRANSFER_PROGRESS")
};
}
diff --git
a/java/maven/test/unit/src/org/netbeans/modules/maven/execute/CommandLineOutputHandlerTest.java
b/java/maven/test/unit/src/org/netbeans/modules/maven/execute/CommandLineOutputHandlerTest.java
index 33148d5552..dd38324b4b 100644
---
a/java/maven/test/unit/src/org/netbeans/modules/maven/execute/CommandLineOutputHandlerTest.java
+++
b/java/maven/test/unit/src/org/netbeans/modules/maven/execute/CommandLineOutputHandlerTest.java
@@ -20,7 +20,6 @@
package org.netbeans.modules.maven.execute;
import java.util.regex.Matcher;
-import static junit.framework.TestCase.fail;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -42,23 +41,6 @@ public class CommandLineOutputHandlerTest {
@AfterClass
public static void tearDownClass() throws Exception {
}
-
- @Test
- public void testDownloadPattern() {
- String[] lines = {
- "51521/?", "11/12K", "11/12M", "51521/120000b",
- "51521/? 12/25K", "34/263M 464/500b",
- "51521/? 13/25K 4034/4640M",
- // #189465: M3 ConsoleMavenTransferListener.doProgress
- "59/101 KB ", "1/3 B ", "55 KB", "300 B ",
- "10/101 KB 48/309 KB ", // sometimes seems to jam
- };
- for (String line : lines) {
- if (!CommandLineOutputHandler.DOWNLOAD.matcher(line).matches()) {
- fail("Line " + line + " not skipped");
- }
- }
- }
@Test
public void testRegExp() throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists