Skip to content

Commit 14a4017

Browse files
sperkazoewangg
authored andcommitted
Add support for plus (+) character in profile names
1 parent 9df1462 commit 14a4017

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "feature",
3+
"category": "AWS SDK for Java v2",
4+
"description": "Add support for plus (+) character in profile names"
5+
}

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8777,4 +8777,3 @@
87778777
## __AWS SDK for Java v2__
87788778
- ### Features
87798779
- Initial release of the AWS SDK for Java v2. See our [blog post](https://aws.amazon.com/blogs/developer/aws-sdk-for-java-2-0-developer-preview) for information about this new major veresion. This release is considered a developer preview and is not intended for production use cases.
8780-

core/profiles/src/main/java/software/amazon/awssdk/profiles/internal/ProfileFileReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public final class ProfileFileReader {
4242

4343
private static final Pattern EMPTY_LINE = Pattern.compile("^[\t ]*$");
4444

45-
private static final Pattern VALID_IDENTIFIER = Pattern.compile("^[A-Za-z0-9_\\-/.%@:]*$");
45+
private static final Pattern VALID_IDENTIFIER = Pattern.compile("^[A-Za-z0-9_\\-/.%@:\\+]*$");
4646

4747
private ProfileFileReader() {
4848
}
@@ -214,7 +214,7 @@ private static Optional<String> parseProfileDefinition(ParserState state, String
214214
// If the profile name includes invalid characters, it should be ignored.
215215
if (!isValidIdentifier(profileName)) {
216216
log.warn(() -> "Ignoring profile '" + standardizedProfileName + "' on line " + state.currentLineNumber + " because " +
217-
"it was not alphanumeric with only these special characters: - / . % @ _ :");
217+
"it was not alphanumeric with only these special characters: - / . % @ _ : +");
218218
return Optional.empty();
219219
}
220220

@@ -257,7 +257,7 @@ private static Optional<Pair<String, String>> parsePropertyDefinition(ParserStat
257257
// If the profile name includes invalid characters, it should be ignored.
258258
if (!isValidIdentifier(propertyKey)) {
259259
log.warn(() -> "Ignoring property '" + propertyKey + "' on line " + state.currentLineNumber + " because " +
260-
"its name was not alphanumeric with only these special characters: - / . % @ _ :");
260+
"its name was not alphanumeric with only these special characters: - / . % @ _ : +");
261261
return Optional.empty();
262262
}
263263

core/profiles/src/test/java/software/amazon/awssdk/profiles/ProfileFileTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,14 @@ public void invalidPropertyNamesAreIgnored() {
326326

327327
@Test
328328
public void allValidProfileNameCharactersAreSupported() {
329-
assertThat(configFileProfiles("[profile ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@:]"))
330-
.isEqualTo(profiles(profile("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@:")));
329+
assertThat(configFileProfiles("[profile ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@:+]"))
330+
.isEqualTo(profiles(profile("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@:+")));
331331
}
332332

333333
@Test
334334
public void allValidPropertyNameCharactersAreSupported() {
335-
assertThat(configFileProfiles("[profile foo]\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@: = value"))
336-
.isEqualTo(profiles(profile("foo", property("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@:",
335+
assertThat(configFileProfiles("[profile foo]\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@:+ = value"))
336+
.isEqualTo(profiles(profile("foo", property("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@:+",
337337
"value"))));
338338
}
339339

0 commit comments

Comments
 (0)