mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8264208: Console charset API
Reviewed-by: joehw, rriggs, alanb
This commit is contained in:
parent
5aab1609b9
commit
bebfae48e3
10 changed files with 202 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -29,7 +29,6 @@ import java.io.*;
|
|||
import java.nio.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.Arrays;
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
|
||||
/**
|
||||
* A utility class for reading passwords
|
||||
|
@ -140,7 +139,7 @@ public class Password {
|
|||
private static byte[] convertToBytes(char[] pass) {
|
||||
if (enc == null) {
|
||||
synchronized (Password.class) {
|
||||
enc = SharedSecrets.getJavaIOAccess()
|
||||
enc = System.console()
|
||||
.charset()
|
||||
.newEncoder()
|
||||
.onMalformedInput(CodingErrorAction.REPLACE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue