Skip to content

Commit 492311c

Browse files
Merge pull request #1226 from folio-org/RMB-1047
RMB-1047: Fix polynomial runtime regex in PgUtil
2 parents 04d7a2c + b6c71a3 commit 492311c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • domain-models-runtime/src/main/java/org/folio/rest/persist

domain-models-runtime/src/main/java/org/folio/rest/persist/PgUtil.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public final class PgUtil {
9090
* 2 = <code>=(</code>
9191
*/
9292
private static final Pattern KEY_ALREADY_EXISTS_PATTERN = Pattern.compile(
93-
"^Key \\(([^=]+)\\)=\\((.*)\\) already exists.$");
93+
"^Key \\(([^)]+)\\)=\\((.*)\\) already exists.$");
9494
/**
9595
* Assume this String:
9696
* <p>
@@ -105,7 +105,7 @@ public final class PgUtil {
105105
* 3 = <code>users</code>
106106
*/
107107
private static final Pattern KEY_NOT_PRESENT_PATTERN = Pattern.compile(
108-
"^Key [(]([^=]+)[)]=[(](.*)[)] is not present in table \"(.*)\".$");
108+
"^Key [(]([^)]+)[)]=(?>[(](.*)[)]) is not present in table \"([^\"]+)\".$");
109109
/**
110110
* Assume this String:
111111
* <p>
@@ -120,7 +120,8 @@ public final class PgUtil {
120120
* 3 = <code>referencing</code>
121121
*/
122122
private static final Pattern KEY_STILL_REFERENCED_PATTERN = Pattern.compile(
123-
"^Key [(]([^=]+)[)]=[(](.*)[)] is still referenced from table \"(.*)\".$");
123+
"^Key [(]([^)]+)[)]=(?>[(](.*)[)]) is still referenced from table \"([^\"]+)\".$");
124+
124125
/** Number of records to read from the sort index in getWithOptimizedSql and generateOptimizedSql method */
125126
private static int optimizedSqlSize = 10000;
126127

0 commit comments

Comments
 (0)