Skip to content

Conversation

@jbescos
Copy link
Member

@jbescos jbescos commented Nov 28, 2019

This pull request is related to this issue:
#4323

The properties are not loaded by reflection, they are explicitly set in a list. The reason I didn't use reflection is we only want to load jersey properties, so we already know them.

In case we create a new property class and we forget to add it in the list, there is a new test that should fail.

Signed-off-by: Jorge Bescos Gascon <[email protected]>
Signed-off-by: Jorge Bescos Gascon <[email protected]>
@jansupol jansupol changed the title Jbescos/4323 Allow to use additional properties with security manager/4323 Dec 9, 2019
@senivam senivam added this to the 2.30 milestone Dec 9, 2019
@jansupol jansupol requested a review from senivam December 12, 2019 15:56
assertTrue(properties.containsKey(MultiPartProperties.BUFFER_THRESHOLD));
assertTrue(properties.containsKey(OAuth1ServerProperties.ACCESS_TOKEN_URI));
} finally {
System.setSecurityManager(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just remove that line? because you are setting securityManager 3 lines below...

* It doesn't work for higher JDKs because it is using different classloader
* (jdk.internal.loader.ClassLoaders$AppClassLoader) that current Guava version doesn't support.
*/
String version = System.getProperty("java.version");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is JdkVersion class in Jersey which helps to work with versions. Could it be useful here?


grant {
permission java.util.PropertyPermission "jersey.config.allowSystemPropertiesProvider", "read";
permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment?

return Void.class;
}
});
for (Predicate<Class<?>> predicate : predicates) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you are already using streams I suppose it would be appropriate to rewrite this FOR cycle with :

.filter(Arrays.stream(predicates).reduce(x->true, Predicate::and))

and then you can just return

.collect(Collectors.toList())

Signed-off-by: Jorge Bescos Gascon <[email protected]>
Copy link
Contributor

@senivam senivam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Jorge Bescos Gascon <[email protected]>
Signed-off-by: Jorge Bescos Gascon <[email protected]>
Signed-off-by: Jorge Bescos Gascon <[email protected]>
Copy link
Contributor

@jansupol jansupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it looks pretty neat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants