Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 045ba16

Browse files
author
Martin Leon
committed
Merge branch 'master' into 2.4.x
2 parents a6b348a + 55b921a commit 045ba16

File tree

22 files changed

+1675
-317
lines changed

22 files changed

+1675
-317
lines changed

connectors/jetty-connector/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<dependency>
7575
<groupId>org.glassfish.jersey.media</groupId>
7676
<artifactId>jersey-media-json-jackson</artifactId>
77-
<version>${jersey.version}</version>
77+
<version>${project.version}</version>
7878
<scope>test</scope>
7979
</dependency>
8080
<dependency>

core-common/src/main/java/org/glassfish/jersey/SslConfigurator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public SslConfigurator keyStorePassword(String password) {
436436
* @return updated SSL configurator instance.
437437
*/
438438
public SslConfigurator keyStorePassword(char[] password) {
439-
this.keyStorePass = password;
439+
this.keyStorePass = password.clone();
440440
return this;
441441
}
442442

@@ -458,7 +458,7 @@ public SslConfigurator keyPassword(String password) {
458458
* @return updated SSL configurator instance.
459459
*/
460460
public SslConfigurator keyPassword(char[] password) {
461-
this.keyPass = password;
461+
this.keyPass = password.clone();
462462
return this;
463463
}
464464

@@ -490,7 +490,7 @@ public SslConfigurator trustStoreFile(String fileName) {
490490
* @return updated SSL configurator instance.
491491
*/
492492
public SslConfigurator trustStoreBytes(byte[] payload) {
493-
this.trustStoreBytes = payload;
493+
this.trustStoreBytes = payload.clone();
494494
this.trustStoreFile = null;
495495
this.trustStore = null;
496496
return this;
@@ -524,7 +524,7 @@ public SslConfigurator keyStoreFile(String fileName) {
524524
* @return updated SSL configurator instance.
525525
*/
526526
public SslConfigurator keyStoreBytes(byte[] payload) {
527-
this.keyStoreBytes = payload;
527+
this.keyStoreBytes = payload.clone();
528528
this.keyStoreFile = null;
529529
this.keyStore = null;
530530
return this;

core-common/src/main/java/org/glassfish/jersey/internal/l10n/LocalizableMessage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -64,7 +64,7 @@ public String getKey() {
6464

6565
@Override
6666
public Object[] getArguments() {
67-
return _args;
67+
return _args.clone();
6868
}
6969

7070
@Override

core-common/src/main/java/org/glassfish/jersey/message/internal/OutboundMessageContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ public void setEntityType(Type type) {
739739
* @return entity annotations.
740740
*/
741741
public Annotation[] getEntityAnnotations() {
742-
return entityAnnotations;
742+
return entityAnnotations.clone();
743743
}
744744

745745
/**

core-common/src/main/java/org/glassfish/jersey/uri/PathPattern.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -47,7 +47,7 @@
4747
* <p>
4848
* The path pattern is normalized by removing a terminating "/" if present.
4949
* <p>
50-
* The path pattern is postfixed with a right hand pattern that consists of either
50+
* The path pattern is post-fixed with a right hand pattern that consists of either
5151
* a matching group that matches zero or more path segments,
5252
* see {@link RightHandPath#capturingZeroOrMoreSegments}, or zero path
5353
* segments, see {@link RightHandPath#capturingZeroSegments}.

core-common/src/main/java/org/glassfish/jersey/uri/PatternWithGroups.java

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -50,7 +50,7 @@
5050
* A pattern for matching a string against a regular expression
5151
* and returning capturing group values for any capturing groups present in
5252
* the expression.
53-
*
53+
* <p/>
5454
* #renamed com.sun.jersey.api.uri.UriPattern
5555
*
5656
* @author Paul Sandoz
@@ -76,7 +76,7 @@ public class PatternWithGroups {
7676
private final int[] groupIndexes;
7777

7878
/**
79-
* Construct an empty pattern.
79+
* Construct an empty pattern.
8080
*/
8181
protected PatternWithGroups() {
8282
this.regex = "";
@@ -87,11 +87,9 @@ protected PatternWithGroups() {
8787
/**
8888
* Construct a new pattern.
8989
*
90-
* @param regex the regular expression. If the expression is null or an
91-
* empty string then the pattern will only match a null or empty
92-
* string.
93-
* @throws java.util.regex.PatternSyntaxException if the
94-
* regular expression could not be compiled
90+
* @param regex the regular expression. If the expression is {@code null} or an empty string then the pattern will only match
91+
* a {@code null} or empty string.
92+
* @throws java.util.regex.PatternSyntaxException if the regular expression could not be compiled.
9593
*/
9694
public PatternWithGroups(final String regex) throws PatternSyntaxException {
9795
this(regex, EMPTY_INT_ARRAY);
@@ -100,12 +98,10 @@ public PatternWithGroups(final String regex) throws PatternSyntaxException {
10098
/**
10199
* Construct a new pattern.
102100
*
103-
* @param regex the regular expression. If the expression is null or an
104-
* empty string then the pattern will only match a null or empty
105-
* string.
101+
* @param regex the regular expression. If the expression is {@code null} or an empty string then the pattern will only match
102+
* a {@code null} or empty string.
106103
* @param groupIndexes the array of group indexes to capturing groups.
107-
* @throws java.util.regex.PatternSyntaxException if the
108-
* regular expression could not be compiled
104+
* @throws java.util.regex.PatternSyntaxException if the regular expression could not be compiled.
109105
*/
110106
public PatternWithGroups(final String regex, final int[] groupIndexes) throws PatternSyntaxException {
111107
this(compile(regex), groupIndexes);
@@ -118,8 +114,8 @@ private static Pattern compile(final String regex) throws PatternSyntaxException
118114
/**
119115
* Construct a new pattern.
120116
*
121-
* @param regexPattern the regular expression pattern
122-
* @throws IllegalArgumentException if the regexPattern is null.
117+
* @param regexPattern the regular expression pattern.
118+
* @throws IllegalArgumentException if the regexPattern is {@code null}.
123119
*/
124120
public PatternWithGroups(final Pattern regexPattern) throws IllegalArgumentException {
125121
this(regexPattern, EMPTY_INT_ARRAY);
@@ -128,9 +124,9 @@ public PatternWithGroups(final Pattern regexPattern) throws IllegalArgumentExcep
128124
/**
129125
* Construct a new pattern.
130126
*
131-
* @param regexPattern the regular expression pattern
127+
* @param regexPattern the regular expression pattern.
132128
* @param groupIndexes the array of group indexes to capturing groups.
133-
* @throws IllegalArgumentException if the regexPattern is null.
129+
* @throws IllegalArgumentException if the regexPattern is {@code null}.
134130
*/
135131
public PatternWithGroups(final Pattern regexPattern, final int[] groupIndexes) throws IllegalArgumentException {
136132
if (regexPattern == null) {
@@ -139,7 +135,7 @@ public PatternWithGroups(final Pattern regexPattern, final int[] groupIndexes) t
139135

140136
this.regex = regexPattern.toString();
141137
this.regexPattern = regexPattern;
142-
this.groupIndexes = groupIndexes;
138+
this.groupIndexes = groupIndexes.clone();
143139
}
144140

145141
/**
@@ -157,7 +153,7 @@ public final String getRegex() {
157153
* @return the group indexes.
158154
*/
159155
public final int[] getGroupIndexes() {
160-
return groupIndexes;
156+
return groupIndexes.clone();
161157
}
162158

163159
private static final class EmptyStringMatchResult implements MatchResult {
@@ -206,6 +202,7 @@ public int groupCount() {
206202
return 0;
207203
}
208204
}
205+
209206
private static final EmptyStringMatchResult EMPTY_STRING_MATCH_RESULT = new EmptyStringMatchResult();
210207

211208
private final class GroupIndexMatchResult implements MatchResult {
@@ -293,17 +290,14 @@ public final MatchResult match(final CharSequence cs) {
293290

294291
/**
295292
* Match against the pattern.
296-
* <p>
297-
* If a matched then the capturing group values
298-
* (if any) will be added to a list passed in as parameter.
293+
* <p/>
294+
* If a matched then the capturing group values (if any) will be added to a list passed in as parameter.
299295
*
300296
* @param cs the char sequence to match against the template.
301-
* @param groupValues the list to add the values of a pattern's
302-
* capturing groups if matching is successful. The values are added
303-
* in the same order as the pattern's capturing groups. The list
304-
* is cleared before values are added.
305-
* @return true if the char sequence matches the pattern, otherwise false.
306-
* @throws IllegalArgumentException if the group values is null.
297+
* @param groupValues the list to add the values of a pattern's capturing groups if matching is successful. The values are
298+
* added in the same order as the pattern's capturing groups. The list is cleared before values are added.
299+
* @return {@code true} if the char sequence matches the pattern, otherwise {@code false}.
300+
* @throws IllegalArgumentException if the group values is {@code null}.
307301
*/
308302
public final boolean match(final CharSequence cs, final List<String> groupValues) throws IllegalArgumentException {
309303
if (groupValues == null) {
@@ -312,7 +306,7 @@ public final boolean match(final CharSequence cs, final List<String> groupValues
312306

313307
// Check for match against the empty pattern
314308
if (cs == null || cs.length() == 0) {
315-
return (regexPattern == null) ? true : false;
309+
return regexPattern == null;
316310
} else if (regexPattern == null) {
317311
return false;
318312
}
@@ -342,33 +336,26 @@ public final boolean match(final CharSequence cs, final List<String> groupValues
342336

343337
/**
344338
* Match against the pattern.
345-
* <p>
346-
* If a matched then the capturing group values
347-
* (if any) will be added to a list passed in as parameter.
339+
* <p/>
340+
* If a matched then the capturing group values (if any) will be added to a list passed in as parameter.
348341
*
349342
* @param cs the char sequence to match against the template.
350-
* @param groupNames the list names associated with a pattern's
351-
* capturing groups. The names MUST be in the same order as the
352-
* pattern's capturing groups and the size MUST be equal to or
353-
* less than the number of capturing groups.
354-
* @param groupValues the map to add the values of a pattern's
355-
* capturing groups if matching is successful. A values is put
356-
* into the map using the group name associated with the
357-
* capturing group. The map is cleared before values are added.
358-
* @return true if the matches the pattern, otherwise false.
359-
* @throws IllegalArgumentException if group values is null.
343+
* @param groupNames the list names associated with a pattern's capturing groups. The names MUST be in the same order as the
344+
* pattern's capturing groups and the size MUST be equal to or less than the number of capturing groups.
345+
* @param groupValues the map to add the values of a pattern's capturing groups if matching is successful. A values is put
346+
* into the map using the group name associated with the capturing group. The map is cleared before values are added.
347+
* @return {@code true} if the matches the pattern, otherwise {@code false}.
348+
* @throws IllegalArgumentException if group values is {@code null}.
360349
*/
361-
public final boolean match(
362-
final CharSequence cs,
363-
final List<String> groupNames,
364-
final Map<String, String> groupValues) throws IllegalArgumentException {
350+
public final boolean match(final CharSequence cs, final List<String> groupNames, final Map<String,
351+
String> groupValues) throws IllegalArgumentException {
365352
if (groupValues == null) {
366353
throw new IllegalArgumentException();
367354
}
368355

369356
// Check for match against the empty pattern
370357
if (cs == null || cs.length() == 0) {
371-
return (regexPattern == null) ? true : false;
358+
return regexPattern == null;
372359
} else if (regexPattern == null) {
373360
return false;
374361
}
@@ -385,7 +372,7 @@ public final boolean match(
385372
String name = groupNames.get(i);
386373
String currentValue = m.group((groupIndexes.length > 0) ? groupIndexes[i] : i + 1);
387374

388-
// Group names can have the same name occuring more than once,
375+
// Group names can have the same name occurring more than once,
389376
// check that groups values are same.
390377
String previousValue = groupValues.get(name);
391378
if (previousValue != null && !previousValue.equals(currentValue)) {

core-server/src/main/java/org/glassfish/jersey/server/internal/monitoring/EmptyRequestEventBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@
5454
* @author Miroslav Fuksa (miroslav.fuksa at oracle.com)
5555
*/
5656
public class EmptyRequestEventBuilder implements RequestEventBuilder {
57+
5758
/**
5859
* Instance of empty request event builder.
5960
*/
60-
public static EmptyRequestEventBuilder EMPTY_EVENT_BUILDER = new EmptyRequestEventBuilder();
61+
public static final EmptyRequestEventBuilder EMPTY_EVENT_BUILDER = new EmptyRequestEventBuilder();
6162

6263
@Override
6364
public RequestEventBuilder setExceptionMapper(ExceptionMapper<?> exceptionMapper) {

core-server/src/main/java/org/glassfish/jersey/server/internal/monitoring/jmx/ApplicationMXBeanImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@
5252
import com.google.common.collect.Sets;
5353

5454
/**
55-
* MXBean implementing {@link org.glassfish.jersey.server.monitoring.ApplicationMXBean} MXbean interface.
55+
* MXBean implementing {@link org.glassfish.jersey.server.monitoring.ApplicationMXBean} MXBean interface.
56+
*
5657
* @author Miroslav Fuksa (miroslav.fuksa at oracle.com)
5758
*/
5859
public class ApplicationMXBeanImpl implements ApplicationMXBean {
60+
5961
private final String applicationName;
6062
private final String applicationClass;
6163
private final Map<String, String> configurationProperties;
@@ -66,12 +68,12 @@ public class ApplicationMXBeanImpl implements ApplicationMXBean {
6668

6769
/**
6870
* Create a new application MXBean and register it to the mbean server using {@code mBeanExposer}.
71+
*
6972
* @param applicationStatistics Application statistics which should be exposed.
7073
* @param mBeanExposer MBean exposer.
7174
* @param parentName {@link javax.management.ObjectName Object name} prefix of parent mbeans.
7275
*/
73-
public ApplicationMXBeanImpl(ApplicationStatistics applicationStatistics,
74-
MBeanExposer mBeanExposer, String parentName) {
76+
public ApplicationMXBeanImpl(ApplicationStatistics applicationStatistics, MBeanExposer mBeanExposer, String parentName) {
7577
this.providers = Sets.newHashSet();
7678
this.registeredClasses = Sets.newHashSet();
7779
this.registeredInstances = Sets.newHashSet();
@@ -95,7 +97,7 @@ public ApplicationMXBeanImpl(ApplicationStatistics applicationStatistics,
9597
for (Map.Entry<String, Object> entry : resourceConfig.getProperties().entrySet()) {
9698
configurationProperties.put(entry.getKey(), entry.getValue().toString());
9799
}
98-
this.startTime = applicationStatistics.getStartTime();
100+
this.startTime = new Date(applicationStatistics.getStartTime().getTime());
99101

100102
mBeanExposer.registerMBean(this, parentName + ",global=Configuration");
101103
}

core-server/src/main/java/org/glassfish/jersey/server/internal/scanning/PackageNamesScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public PackageNamesScanner(final String[] packages, final boolean recursive) {
125125
*/
126126
public PackageNamesScanner(final ClassLoader classLoader, final String[] packages, final boolean recursive) {
127127
this.recursive = recursive;
128-
this.packages = packages;
128+
this.packages = packages.clone();
129129
this.classloader = classLoader;
130130

131131
this.finderFactories = new HashMap<String, UriSchemeResourceFinderFactory>();

0 commit comments

Comments
 (0)