Skip to content

Commit

Permalink
Fix some InvalidLwM2mException/InvalidRequestException error message
Browse files Browse the repository at this point in the history
sbernard31 committed Nov 14, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 481f17b commit e78b2ec
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ public LwM2mPath(String path) throws InvalidLwM2mPathException {
}
String[] p = path.split("/");
if (0 > p.length || p.length > 4) {
throw new InvalidLwM2mPathException("Invalid length for path: ", path);
throw new InvalidLwM2mPathException("Invalid length for path %s", path);
}
try {
this.objectId = (p.length >= 1 && !p[0].isEmpty()) ? Integer.valueOf(p[0]) : null;
@@ -124,7 +124,7 @@ public LwM2mPath(String path) throws InvalidLwM2mPathException {
this.resourceInstanceId = (p.length == 4) ? Integer.valueOf(p[3]) : null;
validate();
} catch (NumberFormatException e) {
throw new InvalidLwM2mPathException(e, "Invalid elements in path: ", path);
throw new InvalidLwM2mPathException(e, "Invalid elements in path %s", path);
}
}

Original file line number Diff line number Diff line change
@@ -75,23 +75,23 @@ protected static LwM2mPath newPath(Integer objectId) {
try {
return new LwM2mPath(objectId);
} catch (InvalidLwM2mPathException e) {
throw new InvalidRequestException();
throw new InvalidRequestException(e);
}
}

protected static LwM2mPath newPath(Integer objectId, Integer objectInstanceId) {
try {
return new LwM2mPath(objectId, objectInstanceId);
} catch (InvalidLwM2mPathException e) {
throw new InvalidRequestException();
throw new InvalidRequestException(e);
}
}

protected static LwM2mPath newPath(Integer objectId, Integer objectInstanceId, Integer resourceId) {
try {
return new LwM2mPath(objectId, objectInstanceId, resourceId);
} catch (InvalidLwM2mPathException e) {
throw new InvalidRequestException();
throw new InvalidRequestException(e);
}
}

@@ -100,15 +100,15 @@ protected static LwM2mPath newPath(Integer objectId, Integer objectInstanceId, I
try {
return new LwM2mPath(objectId, objectInstanceId, resourceId, resourceInstancId);
} catch (InvalidLwM2mPathException e) {
throw new InvalidRequestException();
throw new InvalidRequestException(e);
}
}

protected static LwM2mPath newPath(String path) {
try {
return new LwM2mPath(path);
} catch (InvalidLwM2mPathException e) {
throw new InvalidRequestException();
throw new InvalidRequestException(e);
}
}

0 comments on commit e78b2ec

Please sign in to comment.