Skip to content

Commit

Permalink
(fix) lib: getPatternSizeInfo()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-pelykh committed Jun 28, 2024
1 parent d6dc167 commit b294bfc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/src/main/java/org/pcre4j/Pcre2Code.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,27 @@ private int getPatternIntInfo(int info) {
* @return the size information as long
*/
private long getPatternSizeInfo(int info) {
final var infoSize = api.patternInfo(handle, IPcre2.INFO_FRAMESIZE);
final var infoSize = api.patternInfo(handle, info);

Check warning on line 189 in lib/src/main/java/org/pcre4j/Pcre2Code.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/org/pcre4j/Pcre2Code.java#L189

Added line #L189 was not covered by tests

if (infoSize == 4) {
final var where = new int[1];
final var error = api.patternInfo(handle, IPcre2.INFO_FRAMESIZE, where);
final var error = api.patternInfo(handle, info, where);

Check warning on line 193 in lib/src/main/java/org/pcre4j/Pcre2Code.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/org/pcre4j/Pcre2Code.java#L193

Added line #L193 was not covered by tests
if (error != 0) {
throw new IllegalStateException(Pcre4jUtils.getErrorMessage(api, error));
}

return where[0];
} else if (infoSize == 8) {
final var where = new long[1];
final var error = api.patternInfo(handle, IPcre2.INFO_FRAMESIZE, where);
final var error = api.patternInfo(handle, info, where);

Check warning on line 201 in lib/src/main/java/org/pcre4j/Pcre2Code.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/org/pcre4j/Pcre2Code.java#L201

Added line #L201 was not covered by tests
if (error != 0) {
throw new IllegalStateException(Pcre4jUtils.getErrorMessage(api, error));
}

return where[0];
}

throw new Pcre2PatternInfoSizeError(Pcre2PatternInfo.valueOf(IPcre2.INFO_FRAMESIZE).orElseThrow(), infoSize);
throw new Pcre2PatternInfoSizeError(Pcre2PatternInfo.valueOf(info).orElseThrow(), infoSize);

Check warning on line 209 in lib/src/main/java/org/pcre4j/Pcre2Code.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/org/pcre4j/Pcre2Code.java#L209

Added line #L209 was not covered by tests
}

/**
Expand Down

0 comments on commit b294bfc

Please sign in to comment.