Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
chore: Sonar fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zepfred committed Jul 3, 2024
1 parent 6015a19 commit d42ef22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public PythonLikeObject toPythonObject(ConstraintRef javaObject) {
@Override
public ConstraintRef toJavaObject(PythonLikeObject pythonObject) {
try {
var packageName = ((PythonString) packageNameField.get(pythonObject)).value.toString();
var constraintName = ((PythonString) constraintNameField.get(pythonObject)).value.toString();
var packageName = ((PythonString) packageNameField.get(pythonObject)).value;
var constraintName = ((PythonString) constraintNameField.get(pythonObject)).value;
return ConstraintRef.of(packageName, constraintName);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ def constraint_id(self) -> str:
@staticmethod
def parse_id(constraint_id: str):
slash_index = constraint_id.rfind('/')
if slash_index == -1: raise RuntimeError(
f'The constraint_id {constraint_id} is invalid as it does not contain a package separator \'/\'.')
if slash_index == -1:
raise IndexError(
f'The constraint_id {constraint_id} is invalid as it does not contain a package separator \'/\'.')
package_name = constraint_id[:slash_index]
constraint_name = constraint_id[slash_index + 1:]
return ConstraintRef(package_name, constraint_name)
Expand Down

0 comments on commit d42ef22

Please sign in to comment.