Browse Source

consolidate invalidName check

tags/2.0.1
Jonathan Cobb 4 years ago
parent
commit
6079ec3a13
1 changed files with 1 additions and 2 deletions
  1. +1
    -2
      wizard-server/src/main/java/org/cobbzilla/wizard/server/listener/SystemInitializerListener.java

+ 1
- 2
wizard-server/src/main/java/org/cobbzilla/wizard/server/listener/SystemInitializerListener.java View File

@@ -107,7 +107,6 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {
public boolean checkTable(PgRestServerConfiguration config) { public boolean checkTable(PgRestServerConfiguration config) {
if (checkTable) { if (checkTable) {
final String tableName = getCheckTableName(config); final String tableName = getCheckTableName(config);
if (!checkSafeShellArg(tableName)) invalidName("invalid table name", tableName);
try { try {
return runTableCheck(config, tableName); return runTableCheck(config, tableName);
} catch (Exception e) { } catch (Exception e) {
@@ -119,6 +118,7 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {
} }


public boolean runTableCheck(PgRestServerConfiguration config, String tableName) { public boolean runTableCheck(PgRestServerConfiguration config, String tableName) {
if (!checkSafeShellArg(tableName)) invalidName("invalid table name", tableName);
final ResultSetBean rs = config.execSql("select * from " + tableName + " limit 1"); final ResultSetBean rs = config.execSql("select * from " + tableName + " limit 1");
return rs != null && rs.rowCount() <= 1; return rs != null && rs.rowCount() <= 1;
} }
@@ -127,7 +127,6 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {
if (checkTable) { if (checkTable) {
final PgRestServerConfiguration config = (PgRestServerConfiguration) server.getConfiguration(); final PgRestServerConfiguration config = (PgRestServerConfiguration) server.getConfiguration();
final String tableName = getCheckTableName(config); final String tableName = getCheckTableName(config);
if (!checkSafeShellArg(tableName)) invalidName("invalid table name", tableName);
try { try {
runTableCheck(config, tableName); runTableCheck(config, tableName);
} catch (Exception e) { } catch (Exception e) {


Loading…
Cancel
Save