diff --git a/distribution/shell/src/assemble/LICENSE.bin.txt b/distribution/shell/src/assemble/LICENSE.bin.txt
index 2b2f1c26be112..e735bd454eed2 100644
--- a/distribution/shell/src/assemble/LICENSE.bin.txt
+++ b/distribution/shell/src/assemble/LICENSE.bin.txt
@@ -309,7 +309,6 @@ pulsar-client-cpp/lib/checksum/crc32c_sw.cc
This projects includes binary packages with the following licenses:
The Apache Software License, Version 2.0
- * JCommander -- jcommander-1.82.jar
* Picocli
- picocli-4.7.5.jar
- picocli-shell-jline3-4.7.5.jar
diff --git a/pom.xml b/pom.xml
index caa2fc49b2781..da7f2c7642102 100644
--- a/pom.xml
+++ b/pom.xml
@@ -213,7 +213,6 @@ flexible messaging model and an intuitive client API.
6.2.8
0.20
2.12.1
- 1.82
3.11
1.10
2.8.0
@@ -693,12 +692,6 @@ flexible messaging model and an intuitive client API.
linux-aarch_64
-
- com.beust
- jcommander
- ${jcommander.version}
-
-
info.picocli
picocli
diff --git a/pulsar-cli-utils/pom.xml b/pulsar-cli-utils/pom.xml
index ac442b4004e8b..1638029f4c8ba 100644
--- a/pulsar-cli-utils/pom.xml
+++ b/pulsar-cli-utils/pom.xml
@@ -35,11 +35,6 @@
Isolated CLI utility module
-
- com.beust
- jcommander
- compile
-
info.picocli
picocli
diff --git a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/converters/TimeUnitToSecondsConverter.java b/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/converters/TimeUnitToSecondsConverter.java
deleted file mode 100644
index 3aca2e95d2526..0000000000000
--- a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/converters/TimeUnitToSecondsConverter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.cli.converters;
-
-import static org.apache.pulsar.cli.ValueValidationUtil.emptyCheck;
-import com.beust.jcommander.ParameterException;
-import com.beust.jcommander.converters.BaseConverter;
-import java.util.concurrent.TimeUnit;
-
-public class TimeUnitToSecondsConverter extends BaseConverter {
-
- public TimeUnitToSecondsConverter(String optionName) {
- super(optionName);
- }
-
- @Override
- public Long convert(String str) {
- emptyCheck(getOptionName(), str);
- try {
- return TimeUnit.SECONDS.toSeconds(
- RelativeTimeUtil.parseRelativeTimeInSeconds(str.trim()));
- } catch (IllegalArgumentException exception) {
- throw new ParameterException("For input " + getOptionName() + ": " + exception.getMessage());
- }
- }
-}
diff --git a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/IntegerMaxValueLongValidator.java b/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/IntegerMaxValueLongValidator.java
deleted file mode 100644
index 63115b1418793..0000000000000
--- a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/IntegerMaxValueLongValidator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.cli.validators;
-
-import com.beust.jcommander.IValueValidator;
-import com.beust.jcommander.ParameterException;
-import org.apache.pulsar.cli.ValueValidationUtil;
-
-public class IntegerMaxValueLongValidator implements IValueValidator {
- @Override
- public void validate(String name, Long value) throws ParameterException {
- ValueValidationUtil.maxValueCheck(name, value, Integer.MAX_VALUE);
- }
-}
diff --git a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/MinNegativeOneValidator.java b/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/MinNegativeOneValidator.java
deleted file mode 100644
index 320e36812bfc2..0000000000000
--- a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/MinNegativeOneValidator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.cli.validators;
-
-import com.beust.jcommander.IValueValidator;
-import com.beust.jcommander.ParameterException;
-import org.apache.pulsar.cli.ValueValidationUtil;
-
-public class MinNegativeOneValidator implements IValueValidator {
- @Override
- public void validate(String name, Long value) throws ParameterException {
- ValueValidationUtil.minValueCheck(name, value, -1L);
- }
-}
diff --git a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/NonNegativeValueValidator.java b/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/NonNegativeValueValidator.java
deleted file mode 100644
index 473961be06d83..0000000000000
--- a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/NonNegativeValueValidator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.cli.validators;
-
-import com.beust.jcommander.IValueValidator;
-import com.beust.jcommander.ParameterException;
-import org.apache.pulsar.cli.ValueValidationUtil;
-
-public class NonNegativeValueValidator implements IValueValidator {
- @Override
- public void validate(String name, Long value) throws ParameterException {
- ValueValidationUtil.minValueCheck(name, value, 0L);
- }
-}
diff --git a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/PositiveIntegerValueValidator.java b/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/PositiveIntegerValueValidator.java
deleted file mode 100644
index c6b4cc43d6825..0000000000000
--- a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/PositiveIntegerValueValidator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.cli.validators;
-
-import com.beust.jcommander.IValueValidator;
-import com.beust.jcommander.ParameterException;
-import org.apache.pulsar.cli.ValueValidationUtil;
-
-public class PositiveIntegerValueValidator implements IValueValidator {
-
- @Override
- public void validate(String name, Integer value) throws ParameterException {
- ValueValidationUtil.positiveCheck(name, value);
- }
-}
diff --git a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/PositiveLongValueValidator.java b/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/PositiveLongValueValidator.java
deleted file mode 100644
index 849a55241c665..0000000000000
--- a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/PositiveLongValueValidator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.cli.validators;
-
-import com.beust.jcommander.IValueValidator;
-import com.beust.jcommander.ParameterException;
-import org.apache.pulsar.cli.ValueValidationUtil;
-
-public class PositiveLongValueValidator implements IValueValidator {
-
- @Override
- public void validate(String name, Long value) throws ParameterException {
- ValueValidationUtil.positiveCheck(name, value);
- }
-}
diff --git a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/package-info.java b/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/package-info.java
deleted file mode 100644
index 4d132b984c244..0000000000000
--- a/pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/validators/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.cli.validators;
diff --git a/pulsar-cli-utils/src/test/java/org/apache/pulsar/cli/converters/TimeConversionTest.java b/pulsar-cli-utils/src/test/java/org/apache/pulsar/cli/converters/TimeConversionTest.java
index cc50eed4d03e4..451a215bce313 100644
--- a/pulsar-cli-utils/src/test/java/org/apache/pulsar/cli/converters/TimeConversionTest.java
+++ b/pulsar-cli-utils/src/test/java/org/apache/pulsar/cli/converters/TimeConversionTest.java
@@ -22,6 +22,7 @@
import static org.testng.Assert.assertThrows;
import java.util.concurrent.TimeUnit;
import org.apache.pulsar.cli.converters.picocli.TimeUnitToMillisConverter;
+import org.apache.pulsar.cli.converters.picocli.TimeUnitToSecondsConverter;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -57,8 +58,8 @@ public void testSuccessfulRelativeTimeUtilParsing(String input, long expected) {
}
@Test(dataProvider = "successfulRelativeTimeUtilTestCases")
- public void testSuccessfulTimeUnitToSecondsConverter(String input, long expected) {
- TimeUnitToSecondsConverter secondsConverter = new TimeUnitToSecondsConverter("optionName");
+ public void testSuccessfulTimeUnitToSecondsConverter(String input, long expected) throws Exception {
+ TimeUnitToSecondsConverter secondsConverter = new TimeUnitToSecondsConverter();
assertEquals(secondsConverter.convert(input), Long.valueOf(expected));
}
diff --git a/pulsar-cli-utils/src/test/java/org/apache/pulsar/cli/validators/CliUtilValidatorsTest.java b/pulsar-cli-utils/src/test/java/org/apache/pulsar/cli/validators/CliUtilValidatorsTest.java
deleted file mode 100644
index ba7de23373892..0000000000000
--- a/pulsar-cli-utils/src/test/java/org/apache/pulsar/cli/validators/CliUtilValidatorsTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.cli.validators;
-
-import static org.testng.Assert.assertThrows;
-import org.testng.annotations.Test;
-
-public class CliUtilValidatorsTest {
-
- @Test
- public void testPositiveLongValueValidator() {
- PositiveLongValueValidator validator = new PositiveLongValueValidator();
- assertThrows(IllegalArgumentException.class, () -> validator.validate("param", -1L));
- assertThrows(IllegalArgumentException.class, () -> validator.validate("param", 0L));
- validator.validate("param", 1L);
- }
-
- @Test
- public void testPositiveIntegerValueValidator() {
- PositiveIntegerValueValidator validator = new PositiveIntegerValueValidator();
- assertThrows(IllegalArgumentException.class, () -> validator.validate("param", -1));
- assertThrows(IllegalArgumentException.class, () -> validator.validate("param", 0));
- validator.validate("param", 1);
- }
-
- @Test
- public void testNonNegativeValueValidator() {
- NonNegativeValueValidator validator = new NonNegativeValueValidator();
- assertThrows(IllegalArgumentException.class, () -> validator.validate("param", -1L));
- validator.validate("param", 0L);
- validator.validate("param", 1L);
- }
-
- @Test
- public void testMinNegativeOneValidator() {
- MinNegativeOneValidator validator = new MinNegativeOneValidator();
- assertThrows(IllegalArgumentException.class, () -> validator.validate("param", -2L));
- validator.validate("param", -1L);
- validator.validate("param", 0L);
- }
-
- @Test
- public void testIntegerMaxValueLongValidator() {
- IntegerMaxValueLongValidator validator = new IntegerMaxValueLongValidator();
- assertThrows(IllegalArgumentException.class, () -> validator.validate("param", Integer.MAX_VALUE + 1L));
- validator.validate("param", (long) Integer.MAX_VALUE);
- }
-}
diff --git a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/utils/NameValueParameterSplitterTest.java b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/utils/NameValueParameterSplitterTest.java
deleted file mode 100644
index 1bf4f3fedeca4..0000000000000
--- a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/utils/NameValueParameterSplitterTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.admin.cli.utils;
-
-import java.util.Map;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class NameValueParameterSplitterTest {
- @Test(description = "Basic Test")
- public void test1() {
- NameValueParameterSplitter splitter = new NameValueParameterSplitter();
- Map result = splitter.convert("Name=Sunnyvale");
- Assert.assertEquals(result.get("Name"), "Sunnyvale");
- }
-
- @Test(description = "Check trimming of values")
- public void test2() {
- NameValueParameterSplitter splitter = new NameValueParameterSplitter();
- Map result = splitter.convert(" Name = Sunnyvale CA");
- Assert.assertEquals(result.get("Name"), "Sunnyvale CA");
- }
-
- @Test(description = "Check error on invalid input")
- public void test3() {
- try {
- NameValueParameterSplitter splitter = new NameValueParameterSplitter();
- splitter.convert(" Name Sunnyvale CA");
- // Expecting exception
- Assert.fail("' Name Sunnyvale CA' is not a valid name value pair");
- } catch (Exception e) {
- // TODO: handle exception
- }
- }
-}
diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java
index a4db39f9cc92b..bfbd78601c4c1 100644
--- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java
+++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java
@@ -18,7 +18,6 @@
*/
package org.apache.pulsar.admin.cli.utils;
-import com.beust.jcommander.ParameterException;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
import java.io.File;
@@ -40,7 +39,7 @@ public static T loadConfig(String file, Class clazz) throws IOException {
unrecognizedPropertyException.getLocation().getLineNr(),
unrecognizedPropertyException.getLocation().getColumnNr(),
unrecognizedPropertyException.getKnownPropertyIds());
- throw new ParameterException(exceptionMessage);
+ throw new IllegalArgumentException(exceptionMessage);
} else if (ex instanceof InvalidFormatException) {
InvalidFormatException invalidFormatException = (InvalidFormatException) ex;
@@ -50,23 +49,23 @@ public static T loadConfig(String file, Class clazz) throws IOException {
invalidFormatException.getLocation().getLineNr(),
invalidFormatException.getLocation().getColumnNr());
- throw new ParameterException(exceptionMessage);
+ throw new IllegalArgumentException(exceptionMessage);
} else {
- throw new ParameterException(ex.getMessage());
+ throw new IllegalArgumentException(ex.getMessage());
}
}
}
public static boolean positiveCheck(String paramName, long value) {
if (value <= 0) {
- throw new ParameterException(paramName + " cannot be less than or equal to 0!");
+ throw new IllegalArgumentException(paramName + " cannot be less than or equal to 0!");
}
return true;
}
public static boolean maxValueCheck(String paramName, long value, long maxValue) {
if (value > maxValue) {
- throw new ParameterException(paramName + " cannot be greater than " + maxValue + "!");
+ throw new IllegalArgumentException(paramName + " cannot be greater than " + maxValue + "!");
}
return true;
}
diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/NameValueParameterSplitter.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/NameValueParameterSplitter.java
deleted file mode 100644
index 011f93e18f1f0..0000000000000
--- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/NameValueParameterSplitter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pulsar.admin.cli.utils;
-
-import com.beust.jcommander.IStringConverter;
-import com.beust.jcommander.ParameterException;
-import java.util.HashMap;
-import java.util.Map;
-
-public class NameValueParameterSplitter implements IStringConverter