Merge remote-tracking branch 'origin/master' into 2.3.0

This commit is contained in:
wing328
2017-07-02 22:43:08 +08:00
61 changed files with 586 additions and 417 deletions

View File

@@ -607,7 +607,7 @@ public class DefaultCodegen {
* @return properly-escaped pattern
*/
public String toRegularExpression(String pattern) {
return escapeText(addRegularExpressionDelimiter(pattern));
return addRegularExpressionDelimiter(escapeText(pattern));
}
/**
@@ -3572,9 +3572,14 @@ public class DefaultCodegen {
* @return the pattern with delimiter
*/
public String addRegularExpressionDelimiter(String pattern) {
if (pattern != null && !pattern.matches("^/.*")) {
return "/" + pattern + "/";
if (StringUtils.isEmpty(pattern)) {
return pattern;
}
if (!pattern.matches("^/.*")) {
return "/" + pattern.replaceAll("/", "\\\\/") + "/";
}
return pattern;
}

View File

@@ -312,10 +312,10 @@ public class CppRestClientCodegen extends DefaultCodegen implements CodegenConfi
return "0.0";
} else if (p instanceof FloatProperty) {
return "0.0f";
} else if (p instanceof IntegerProperty || p instanceof BaseIntegerProperty) {
return "0";
} else if (p instanceof LongProperty) {
return "0L";
} else if (p instanceof IntegerProperty || p instanceof BaseIntegerProperty) {
return "0";
} else if (p instanceof DecimalProperty) {
return "0.0";
} else if (p instanceof MapProperty) {

View File

@@ -286,10 +286,10 @@ public class PistacheServerCodegen extends DefaultCodegen implements CodegenConf
return "0.0";
} else if (p instanceof FloatProperty) {
return "0.0f";
} else if (p instanceof IntegerProperty || p instanceof BaseIntegerProperty) {
return "0";
} else if (p instanceof LongProperty) {
return "0L";
} else if (p instanceof IntegerProperty || p instanceof BaseIntegerProperty) {
return "0";
} else if (p instanceof DecimalProperty) {
return "0.0";
} else if (p instanceof MapProperty) {

View File

@@ -318,10 +318,10 @@ public class RestbedCodegen extends DefaultCodegen implements CodegenConfig {
return "0.0";
} else if (p instanceof FloatProperty) {
return "0.0f";
} else if (p instanceof IntegerProperty || p instanceof BaseIntegerProperty) {
return "0";
} else if (p instanceof LongProperty) {
return "0L";
} else if (p instanceof IntegerProperty || p instanceof BaseIntegerProperty) {
return "0";
} else if (p instanceof DecimalProperty) {
return "0.0";
} else if (p instanceof MapProperty) {