[JS] fix NPE for null string and improve Travis config file (#2553)

* fix NPE with null string

* update travis for nodejs

* update js samples
This commit is contained in:
William Cheng 2019-03-31 16:15:09 +08:00 committed by GitHub
parent 977df6e232
commit 18b500218a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 31 deletions

View File

@ -205,7 +205,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
@Override
public String getHelp() {
return "Generates a Javascript client library.";
return "Generates a JavaScript client library.";
}
@Override
@ -340,6 +340,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
supportingFiles.add(new SupportingFile("index.mustache", createPath(sourceFolder, invokerPackage), "index.js"));
supportingFiles.add(new SupportingFile("ApiClient.mustache", createPath(sourceFolder, invokerPackage), "ApiClient.js"));
}
@Override
@ -1124,17 +1125,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
return codegenModel;
}
/*
private static String sanitizePackageName(String packageName) { // FIXME parameter should not be assigned. Also declare it as "final"
packageName = packageName.trim();
packageName = packageName.replaceAll("[^a-zA-Z0-9_\\.]", "_");
if (Strings.isNullOrEmpty(packageName)) {
return "invalidPackageName";
}
return packageName;
}
*/
@Override
public String toEnumName(CodegenProperty property) {
return sanitizeName(camelize(property.name)) + "Enum";
@ -1166,12 +1156,18 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
@Override
public String escapeQuotationMark(String input) {
if (input == null) {
return "";
}
// remove ', " to avoid code injection
return input.replace("\"", "").replace("'", "");
}
@Override
public String escapeUnsafeCharacters(String input) {
if (input == null) {
return "";
}
return input.replace("*/", "*_/").replace("/*", "/_*");
}

View File

@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

View File

@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

View File

@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

View File

@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

View File

@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

View File

@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"