Skip to content

Commit 016db73

Browse files
committed
* Add better regular expression detection from PR
[spring-projects#9730] in MVC endpoint * Bump to version 1.4.10.BUILD-COVEO [AUTH-610]
1 parent 6b1d06c commit 016db73

File tree

83 files changed

+370
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+370
-186
lines changed

pom.xml

Lines changed: 71 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45
<groupId>org.springframework.boot</groupId>
56
<artifactId>spring-boot-build</artifactId>
6-
<version>1.4.8.BUILD-SNAPSHOT</version>
7+
<version>1.4.10.BUILD-COVEO</version>
78
<packaging>pom</packaging>
89
<name>Spring Boot Build</name>
910
<description>Spring Boot Build</description>
@@ -153,15 +154,20 @@
153154
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
154155
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" />
155156
<var name="version-type" value="${project.version}" />
156-
<propertyregex property="version-type" override="true" input="${version-type}" regexp=".*\.(.*)" replace="\1" />
157-
<propertyregex property="version-type" override="true" input="${version-type}" regexp="(M)\d+" replace="MILESTONE" />
158-
<propertyregex property="version-type" override="true" input="${version-type}" regexp="(RC)\d+" replace="MILESTONE" />
159-
<propertyregex property="version-type" override="true" input="${version-type}" regexp="BUILD-(.*)" replace="SNAPSHOT" />
157+
<propertyregex property="version-type" override="true"
158+
input="${version-type}" regexp=".*\.(.*)" replace="\1" />
159+
<propertyregex property="version-type" override="true"
160+
input="${version-type}" regexp="(M)\d+" replace="MILESTONE" />
161+
<propertyregex property="version-type" override="true"
162+
input="${version-type}" regexp="(RC)\d+" replace="MILESTONE" />
163+
<propertyregex property="version-type" override="true"
164+
input="${version-type}" regexp="BUILD-(.*)" replace="SNAPSHOT" />
160165
<stringutil string="${version-type}" property="profile">
161166
<lowercase />
162167
</stringutil>
163168
<echo message="Writing settings for ${profile} profile" />
164-
<copy file=".settings-template.xml" tofile="settings.xml" overwrite="true">
169+
<copy file=".settings-template.xml" tofile="settings.xml"
170+
overwrite="true">
165171
<filterset>
166172
<filter token="profile" value="${profile}" />
167173
</filterset>
@@ -216,7 +222,8 @@
216222
<inherited>false</inherited>
217223
<configuration>
218224
<target>
219-
<property name="sourceFile" value="spring-boot-starters/spring-boot-starter-parent/pom.xml" />
225+
<property name="sourceFile"
226+
value="spring-boot-starters/spring-boot-starter-parent/pom.xml" />
220227
<xslt in="${sourceFile}" out="${sourceFile}.new" force="true">
221228
<style>
222229
<string><![CDATA[
@@ -254,7 +261,8 @@
254261
<inherited>false</inherited>
255262
<configuration>
256263
<target>
257-
<property name="sourceFile" value="spring-boot-samples/spring-boot-sample-ant/pom.xml" />
264+
<property name="sourceFile"
265+
value="spring-boot-samples/spring-boot-sample-ant/pom.xml" />
258266
<xslt in="${sourceFile}" out="${sourceFile}.new" force="true">
259267
<style>
260268
<string><![CDATA[
@@ -359,4 +367,58 @@
359367
</build>
360368
</profile>
361369
</profiles>
370+
<repositories>
371+
<repository>
372+
<snapshots>
373+
<enabled>false</enabled>
374+
</snapshots>
375+
<id>central</id>
376+
<name>libs-release</name>
377+
<url>https://maven.cloud.coveo.com/artifactory/libs-release</url>
378+
</repository>
379+
<repository>
380+
<releases>
381+
<enabled>false</enabled>
382+
</releases>
383+
<id>snapshots</id>
384+
<name>libs-snapshot</name>
385+
<url>https://maven.cloud.coveo.com/artifactory/libs-snapshot</url>
386+
</repository>
387+
</repositories>
388+
<pluginRepositories>
389+
<pluginRepository>
390+
<snapshots>
391+
<enabled>false</enabled>
392+
</snapshots>
393+
<id>central</id>
394+
<name>plugins-release</name>
395+
<url>https://maven.cloud.coveo.com/artifactory/plugins-release</url>
396+
</pluginRepository>
397+
<pluginRepository>
398+
<releases>
399+
<enabled>false</enabled>
400+
</releases>
401+
<id>snapshots</id>
402+
<name>plugins-snapshot</name>
403+
<url>https://maven.cloud.coveo.com/artifactory/plugins-snapshot</url>
404+
</pluginRepository>
405+
</pluginRepositories>
406+
407+
<distributionManagement>
408+
<repository>
409+
<id>CoveoCloud</id>
410+
<name>CoveoCloud-releases</name>
411+
<url>https://maven.cloud.coveo.com/artifactory/libs-release-local</url>
412+
</repository>
413+
<snapshotRepository>
414+
<id>CoveoCloud</id>
415+
<name>CoveoCloud-snapshots</name>
416+
<url>https://maven.cloud.coveo.com/artifactory/libs-snapshot-local</url>
417+
</snapshotRepository>
418+
<site>
419+
<id>${project.artifactId}</id>
420+
<name>${project.artifactId}</name>
421+
<url>${project.artifactId}/</url>
422+
</site>
423+
</distributionManagement>
362424
</project>

spring-boot-actuator-docs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.springframework.boot</groupId>
66
<artifactId>spring-boot-parent</artifactId>
7-
<version>1.4.8.BUILD-SNAPSHOT</version>
7+
<version>1.4.10.BUILD-COVEO</version>
88
<relativePath>../spring-boot-parent</relativePath>
99
</parent>
1010
<artifactId>spring-boot-actuator-docs</artifactId>

spring-boot-actuator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.springframework.boot</groupId>
66
<artifactId>spring-boot-parent</artifactId>
7-
<version>1.4.8.BUILD-SNAPSHOT</version>
7+
<version>1.4.10.BUILD-COVEO</version>
88
<relativePath>../spring-boot-parent</relativePath>
99
</parent>
1010
<artifactId>spring-boot-actuator</artifactId>

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2015 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import java.util.LinkedHashMap;
2121
import java.util.Map;
2222
import java.util.regex.Pattern;
23+
import java.util.regex.PatternSyntaxException;
2324

2425
/**
2526
* Utility class that can be used to filter source data using a name regular expression.
@@ -31,7 +32,7 @@
3132
* @author Phillip Webb
3233
* @author Sergei Egorov
3334
* @author Andy Wilkinson
34-
* @since 1.3.0
35+
* @author Dylian Bego
3536
*/
3637
abstract class NamePatternFilter<T> {
3738

@@ -44,27 +45,32 @@ abstract class NamePatternFilter<T> {
4445
}
4546

4647
public Map<String, Object> getResults(String name) {
47-
if (!isRegex(name)) {
48+
Pattern pattern = compilePatternIfNecessary(name);
49+
if (pattern == null) {
4850
Object value = getValue(this.source, name);
4951
Map<String, Object> result = new HashMap<String, Object>();
5052
result.put(name, value);
5153
return result;
5254
}
53-
Pattern pattern = Pattern.compile(name);
5455
ResultCollectingNameCallback resultCollector = new ResultCollectingNameCallback(
5556
pattern);
5657
getNames(this.source, resultCollector);
5758
return resultCollector.getResults();
5859

5960
}
6061

61-
private boolean isRegex(String name) {
62+
private Pattern compilePatternIfNecessary(String name) {
6263
for (String part : REGEX_PARTS) {
6364
if (name.contains(part)) {
64-
return true;
65+
try {
66+
return Pattern.compile(name);
67+
}
68+
catch (PatternSyntaxException ex) {
69+
return null;
70+
}
6571
}
6672
}
67-
return false;
73+
return null;
6874
}
6975

7076
protected abstract void getNames(T source, NameCallback callback);
@@ -76,7 +82,7 @@ private boolean isRegex(String name) {
7682
/**
7783
* Callback used to add a name.
7884
*/
79-
protected interface NameCallback {
85+
interface NameCallback {
8086

8187
void addName(String name);
8288

spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilterTests.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
2727
*
2828
* @author Phillip Webb
2929
* @author Andy Wilkinson
30+
* @author Dylian Bego
3031
*/
3132
public class NamePatternFilterTests {
3233

@@ -38,6 +39,13 @@ public void nonRegex() throws Exception {
3839
assertThat(filter.isGetNamesCalled()).isFalse();
3940
}
4041

42+
@Test
43+
public void nonRegexThatContainsRegexPart() throws Exception {
44+
MockNamePatternFilter filter = new MockNamePatternFilter();
45+
assertThat(filter.getResults("*")).containsEntry("*", "*");
46+
assertThat(filter.isGetNamesCalled()).isFalse();
47+
}
48+
4149
@Test
4250
public void regexRepetitionZeroOrMore() {
4351
MockNamePatternFilter filter = new MockNamePatternFilter();

spring-boot-autoconfigure/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.springframework.boot</groupId>
66
<artifactId>spring-boot-parent</artifactId>
7-
<version>1.4.8.BUILD-SNAPSHOT</version>
7+
<version>1.4.10.BUILD-COVEO</version>
88
<relativePath>../spring-boot-parent</relativePath>
99
</parent>
1010
<artifactId>spring-boot-autoconfigure</artifactId>

spring-boot-cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.springframework.boot</groupId>
66
<artifactId>spring-boot-parent</artifactId>
7-
<version>1.4.8.BUILD-SNAPSHOT</version>
7+
<version>1.4.10.BUILD-COVEO</version>
88
<relativePath>../spring-boot-parent</relativePath>
99
</parent>
1010
<artifactId>spring-boot-cli</artifactId>

0 commit comments

Comments
 (0)