This repository was archived by the owner on Jan 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/java/main/com/topcoder/direct/services/view/action/contest/launch Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1003,6 +1003,31 @@ public boolean evaluate(Object object) {
10031003 ProjectPropertyType .DR_POINTS_PROJECT_PROPERTY_KEY , "0"
10041004 );
10051005 }
1006+
1007+ // guard check if the admin fee is set to a positive double value
1008+ if (softwareCompetition .getProjectHeader ().getProperties ().containsKey (ProjectPropertyType .ADMIN_FEE_PROJECT_PROPERTY_KEY )) {
1009+ String adminFeeStrValue = softwareCompetition .getProjectHeader ().getProperties ().get (ProjectPropertyType .ADMIN_FEE_PROJECT_PROPERTY_KEY );
1010+ if (adminFeeStrValue != null && adminFeeStrValue .trim ().length () > 0 ) {
1011+ // try parsing the string value to double value
1012+ try {
1013+ double adminFeeDoubleValue = Double .parseDouble (adminFeeStrValue );
1014+
1015+ if (adminFeeDoubleValue < 0 ) {
1016+ throw new IllegalArgumentException (
1017+ String .format ("The admin fee value [%s] should be positive" , adminFeeDoubleValue ));
1018+ }
1019+
1020+ if (Double .isNaN (adminFeeDoubleValue )) {
1021+ throw new IllegalArgumentException (
1022+ String .format ("The admin fee value [%s] should not be NaN" , adminFeeDoubleValue ));
1023+ }
1024+
1025+ } catch (NumberFormatException nfe ) {
1026+ throw new IllegalArgumentException (
1027+ String .format ("The admin fee value [%s] is not a valid number" , adminFeeStrValue ));
1028+ }
1029+ }
1030+ }
10061031 }
10071032
10081033 /**
You can’t perform that action at this time.
0 commit comments