8344330: Remove AccessController.doPrivileged() from jdk.charsets module

Reviewed-by: lancea, bpb, rriggs, jlu
This commit is contained in:
Naoto Sato 2024-11-18 18:22:18 +00:00
parent c4e7dc7ff2
commit c59adf68d9

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,10 +31,6 @@ import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult; import java.nio.charset.CoderResult;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import sun.nio.cs.CharsetMapping;
import sun.nio.cs.*; import sun.nio.cs.*;
/* /*
@ -77,13 +73,8 @@ public class SJIS_0213 extends Charset {
} }
private static class Holder { private static class Holder {
@SuppressWarnings("removal") static final CharsetMapping mapping =
static final CharsetMapping mapping = AccessController.doPrivileged( CharsetMapping.get(SJIS_0213.class.getResourceAsStream("sjis0213.dat"));
new PrivilegedAction<CharsetMapping>() {
public CharsetMapping run() {
return CharsetMapping.get(SJIS_0213.class.getResourceAsStream("sjis0213.dat"));
}
});
} }
protected static class Decoder extends CharsetDecoder { protected static class Decoder extends CharsetDecoder {