Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jdk17u
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
openjdk
jdk17u
Commits
60c9b382
Commit
60c9b382
authored
Jul 11, 2022
by
Aleksei Voitylov
Committed by
Christoph Langer
Oct 4, 2022
Browse files
Options
Downloads
Patches
Plain Diff
8285662: Better permission resolution
Reviewed-by: mbalao Backport-of: 431802c54df9caaa00ba79f3713861005d06ee62
parent
009488ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/java.base/share/classes/java/security/UnresolvedPermission.java
+50
-42
50 additions, 42 deletions
...ase/share/classes/java/security/UnresolvedPermission.java
with
50 additions
and
42 deletions
src/java.base/share/classes/java/security/UnresolvedPermission.java
+
50
−
42
View file @
60c9b382
/*
* Copyright (c) 1997, 202
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 202
2
, 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
...
...
@@ -153,7 +153,7 @@ implements java.io.Serializable
* Each chain is ordered bottom-to-top (i.e., with the signer certificate
* first and the (root) certificate authority last). The signer
* certificates are copied from the array. Subsequent changes to
* the array will not affect this UnsolvedPermission.
* the array will not affect this Un
re
solvedPermission.
*/
public
UnresolvedPermission
(
String
type
,
String
name
,
...
...
@@ -165,21 +165,27 @@ implements java.io.Serializable
if
(
type
==
null
)
throw
new
NullPointerException
(
"type can't be null"
);
// Perform a defensive copy and reassign certs if we have a non-null
// reference
if
(
certs
!=
null
)
{
certs
=
certs
.
clone
();
}
this
.
type
=
type
;
this
.
name
=
name
;
this
.
actions
=
actions
;
if
(
certs
!=
null
)
{
// Extract the signer certs from the list of certificates.
for
(
int
i
=
0
;
i
<
certs
.
length
;
i
++)
{
if
(!(
certs
[
i
]
instanceof
X509Certificate
))
{
// there is no concept of signer certs, so we store the
// entire cert array
this
.
certs
=
certs
.
clone
()
;
b
re
ak
;
// entire cert array
. No further processing is necessary.
this
.
certs
=
certs
;
re
turn
;
}
}
if
(
this
.
certs
==
null
)
{
// Go through the list of certs and see if all the certs are
// signer certs.
int
i
=
0
;
...
...
@@ -195,11 +201,11 @@ implements java.io.Serializable
}
if
(
count
==
certs
.
length
)
{
// All the certs are signer certs, so we store the entire
// array
this
.
certs
=
certs
.
clone
();
// array. No further processing is needed.
this
.
certs
=
certs
;
return
;
}
if
(
this
.
certs
==
null
)
{
// extract the signer certs
ArrayList
<
java
.
security
.
cert
.
Certificate
>
signerCerts
=
new
ArrayList
<>();
...
...
@@ -218,8 +224,6 @@ implements java.io.Serializable
signerCerts
.
toArray
(
this
.
certs
);
}
}
}
}
private
static
final
Class
<?>[]
PARAMS0
=
{
};
...
...
@@ -310,6 +314,7 @@ implements java.io.Serializable
*
* @return false.
*/
@Override
public
boolean
implies
(
Permission
p
)
{
return
false
;
}
...
...
@@ -330,6 +335,7 @@ implements java.io.Serializable
* type (class) name, permission name, actions, and
* certificates as this object.
*/
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
==
this
)
return
true
;
...
...
@@ -402,7 +408,7 @@ implements java.io.Serializable
*
* @return a hash code value for this object.
*/
@Override
public
int
hashCode
()
{
int
hash
=
type
.
hashCode
();
if
(
name
!=
null
)
...
...
@@ -422,6 +428,7 @@ implements java.io.Serializable
*
* @return the empty string "".
*/
@Override
public
String
getActions
()
{
return
""
;
...
...
@@ -489,6 +496,7 @@ implements java.io.Serializable
*
* @return information about this UnresolvedPermission.
*/
@Override
public
String
toString
()
{
return
"(unresolved "
+
type
+
" "
+
name
+
" "
+
actions
+
")"
;
}
...
...
@@ -500,7 +508,7 @@ implements java.io.Serializable
* @return a new PermissionCollection object suitable for
* storing UnresolvedPermissions.
*/
@Override
public
PermissionCollection
newPermissionCollection
()
{
return
new
UnresolvedPermissionCollection
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment