Skip to content

Commit 94468dc

Browse files
committed
fixed out of bound exception for pattern string.
1 parent 45066f0 commit 94468dc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlaskConnexionCodegen.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,10 @@ public void postProcessPattern(String pattern, Map<String, Object> vendorExtensi
688688
if(pattern != null) {
689689
int i = pattern.lastIndexOf('/');
690690

691+
//Must follow Perl /pattern/modifiers convention
691692
if(pattern.charAt(0) != '/' || i < 2) {
692-
pattern = String.format("/%s/", pattern);
693+
pattern = String.format("/%s/", pattern);;
694+
i = pattern.lastIndexOf('/');
693695
}
694696

695697
String regex = pattern.substring(1, i).replace("'", "\\'");

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@ public void postProcessPattern(String pattern, Map<String, Object> vendorExtensi
265265
if(pattern != null) {
266266
int i = pattern.lastIndexOf('/');
267267

268+
//Must follow Perl /pattern/modifiers convention
268269
if(pattern.charAt(0) != '/' || i < 2) {
269270
pattern = String.format("/%s/", pattern);
271+
i = pattern.lastIndexOf('/');
270272
}
271273

272274
String regex = pattern.substring(1, i).replace("'", "\\'");

0 commit comments

Comments
 (0)