Skip to content

Commit e1a5e42

Browse files
authored
Fix null pointer when parsing path, prep for v0.5.2 release (#27)
- Fix a null pointer exception triggered when trying to parse and censor URL path elements - Prep for 0.5.2 release
1 parent 4bfec58 commit e1a5e42

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## v0.5.2 (2023-01-13)
4+
5+
- Fix a null pointer exception triggered when trying to parse and censor URL path elements.
6+
37
## v0.5.1 (2023-01-13)
48

59
- Removes dead and unused code

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Add this to your project's POM:
1818
<dependency>
1919
<groupId>com.easypost</groupId>
2020
<artifactId>easyvcr</artifactId>
21-
<version>0.5.1</version>
21+
<version>0.5.2</version>
2222
</dependency>
2323
```
2424

@@ -27,7 +27,7 @@ Add this to your project's POM:
2727
Add this to your project's build file:
2828

2929
```groovy
30-
implementation "com.easypost:easyvcr:0.5.1"
30+
implementation "com.easypost:easyvcr:0.5.2"
3131
```
3232

3333
## Supported HTTP Clients

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.1
1+
0.5.2

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>com.easypost</groupId>
77
<artifactId>easyvcr</artifactId>
88

9-
<version>0.5.1</version>
9+
<version>0.5.2</version>
1010
<packaging>jar</packaging>
1111

1212
<name>com.easypost:easyvcr</name>

src/main/java/com/easypost/easyvcr/internal/Utilities.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,14 @@ public static String extractPathFromUri(URI uri) {
237237
String uriString = uri.toString();
238238

239239
// strip the query parameters
240-
uriString = uriString.replace(uri.getQuery(), "");
240+
// wrapping in a try-catch because getQuery might return null
241+
try {
242+
String query = uri.getQuery();
243+
if (query != null) {
244+
uriString = uriString.replace(query, "");
245+
}
246+
} catch (NullPointerException ignored) {
247+
}
241248

242249
if (uriString.endsWith("?")) {
243250
uriString = uriString.substring(0, uriString.length() - 1);

0 commit comments

Comments
 (0)