Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
* @since 1.0.0
*/
public class MalformedPackageURLException extends Exception {

private static final long serialVersionUID = 1095476478991047663L;
private static final long serialVersionUID = -3428748639194901696L;

/**
* Constructs a {@code MalformedPackageURLException} with no detail message.
Expand All @@ -47,4 +46,24 @@ public MalformedPackageURLException(String msg) {
super(msg);
}

/**
* Constructs a new {@code MalformedPackageURLException} with the specified detail message and
* cause.
*
* @param message the detail message
* @param cause the cause
*/
public MalformedPackageURLException(String message, Throwable cause) {
super(message, cause);
}

/**
* Constructs a new {@code MalformedPackageURLException} with the specified cause and a detail
* message of {@code (cause==null ? null : cause.toString())}.
*
* @param cause the cause
*/
public MalformedPackageURLException(Throwable cause) {
super(cause);
}
}
10 changes: 5 additions & 5 deletions src/main/java/com/github/packageurl/PackageURL.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ private String validatePath(final String[] segments, final boolean isSubpath) th
}
return segment;
}).collect(Collectors.joining("/"));
} catch (ValidationException ex) {
throw new MalformedPackageURLException(ex.getMessage());
} catch (ValidationException e) {
throw new MalformedPackageURLException(e);
}
}

Expand Down Expand Up @@ -590,7 +590,7 @@ private void parse(final String purl) throws MalformedPackageURLException {
}
verifyTypeConstraints(this.type, this.namespace, this.name);
} catch (URISyntaxException e) {
throw new MalformedPackageURLException("Invalid purl: " + e.getMessage());
throw new MalformedPackageURLException("Invalid purl: " + e.getMessage(), e);
}
}

Expand Down Expand Up @@ -624,8 +624,8 @@ private Map<String, String> parseQualifiers(final String encodedString) throws M
},
TreeMap<String, String>::putAll);
return validateQualifiers(results);
} catch (ValidationException ex) {
throw new MalformedPackageURLException(ex.getMessage());
} catch (ValidationException e) {
throw new MalformedPackageURLException(e);
}
}

Expand Down