You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/05/11 18:23:11 UTC
(commons-net) branch master updated: [SpotBugs] Make explicit use of the default encoding
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git
The following commit(s) were added to refs/heads/master by this push:
new 32cac324 [SpotBugs] Make explicit use of the default encoding
32cac324 is described below
commit 32cac32401e0134af4c96b35287e6ffb3445ab7e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat May 11 14:23:07 2024 -0400
[SpotBugs] Make explicit use of the default encoding
---
.../java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java b/src/main/java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java
index 98724e83..ec39da0d 100644
--- a/src/main/java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java
+++ b/src/main/java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java
@@ -16,9 +16,11 @@
*/
package org.apache.commons.net.examples.cidr;
+import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Scanner;
+import org.apache.commons.net.util.Charsets;
import org.apache.commons.net.util.SubnetUtils;
import org.apache.commons.net.util.SubnetUtils.SubnetInfo;
@@ -50,7 +52,7 @@ public class SubnetUtilsExample {
final String prompt = "Enter an IP address (e.g. 192.168.0.10):";
System.out.println(prompt);
- try (final Scanner scanner = new Scanner(System.in)) {
+ try (final Scanner scanner = new Scanner(System.in, Charset.defaultCharset().name())) {
while (scanner.hasNextLine()) {
final String address = scanner.nextLine();
System.out.println("The IP address [" + address + "] is " + (info.isInRange(address) ? "" : "not ") + "within the subnet [" + subnet + "]");