Commit 5d2d0d7d authored by neo's avatar neo

[bugfix] assert for null dbName for specialed period

parent 65f47fb2
...@@ -27,6 +27,10 @@ public class MyAsserts { ...@@ -27,6 +27,10 @@ public class MyAsserts {
if (obj == null || obj.isEmpty()) throw exception; if (obj == null || obj.isEmpty()) throw exception;
} }
public static void assertNotEmpty(String obj, FormulaException exception) {
if (obj == null || obj.isEmpty()) throw exception;
}
public static void assertNotEmpty(Collection obj, ApiException exception) { public static void assertNotEmpty(Collection obj, ApiException exception) {
if (obj == null || obj.isEmpty()) throw exception; if (obj == null || obj.isEmpty()) throw exception;
} }
......
...@@ -5,4 +5,5 @@ public class Exceptions { ...@@ -5,4 +5,5 @@ public class Exceptions {
public static final FormulaException BB_REPORT_NULL = new FormulaException("cell report is null"); public static final FormulaException BB_REPORT_NULL = new FormulaException("cell report is null");
public static final FormulaException BB_CELL_DATA_NULL = new FormulaException("cell data is null"); public static final FormulaException BB_CELL_DATA_NULL = new FormulaException("cell data is null");
public static final FormulaException BB_CELL_DATA_EMPTY = new FormulaException("cell data is empty"); public static final FormulaException BB_CELL_DATA_EMPTY = new FormulaException("cell data is empty");
public static final FormulaException BB_EMPTY = new FormulaException("db name is empty");
} }
...@@ -84,6 +84,7 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -84,6 +84,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
String dbName = agent.getPastProjectDbName(curPeriod.getCurYear(), String dbName = agent.getPastProjectDbName(curPeriod.getCurYear(),
formulaContext.getOrganizationID()); formulaContext.getOrganizationID());
MyAsserts.assertNotEmpty(dbName, Exceptions.BB_EMPTY);
String currentProjectDb = ShardingContextHolder.getDataSourceKey(); String currentProjectDb = ShardingContextHolder.getDataSourceKey();
CellData cellData = null; CellData cellData = null;
if (currentProjectDb.equals(dbName)) { if (currentProjectDb.equals(dbName)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment