Add input validation
This commit is contained in:
parent
f90affb5a3
commit
bd2cd01658
Binary file not shown.
@ -21,6 +21,7 @@ import java.util.Scanner;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
@ -360,18 +361,40 @@ public class App
|
|||||||
|
|
||||||
System.out.println(Arrays.toString(t20scores));
|
System.out.println(Arrays.toString(t20scores));
|
||||||
System.out.println(Arrays.toString(lowerTierScores));
|
System.out.println(Arrays.toString(lowerTierScores));
|
||||||
|
boolean error1=false;
|
||||||
for (int i=0;i<20;i++) {
|
for (int i=0;i<20;i++) {
|
||||||
new Thread(
|
if (!StringUtils.isNumeric(t20scores[i])) {
|
||||||
new SubmitThread(t20names[i],t20desc[i],t20scores[i],EVENT,i+1))
|
error1=true;
|
||||||
.start();
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean error2=false;
|
||||||
|
for (int i=0;i<10;i++) {
|
||||||
|
if (!StringUtils.isNumeric(lowerTierScores[i])) {
|
||||||
|
error2=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!error1) {
|
||||||
|
for (int i=0;i<20;i++) {
|
||||||
|
new Thread(
|
||||||
|
new SubmitThread(t20names[i],t20desc[i],t20scores[i],EVENT,i+1))
|
||||||
|
.start();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("Cannot submit t20 scores. Invalid array params.");
|
||||||
}
|
}
|
||||||
int[] ranks = new int[] {50,100,500,1000,2000,5000,10000,20000,30000,50000};
|
int[] ranks = new int[] {50,100,500,1000,2000,5000,10000,20000,30000,50000};
|
||||||
for (int j=0;j<10;j++) {
|
if (!error2) {
|
||||||
new Thread(
|
for (int j=0;j<10;j++) {
|
||||||
new SubmitThread(lowerTierNames[j],lowerTierDesc[j],lowerTierScores[j],EVENT,ranks[j]))
|
new Thread(
|
||||||
.start();
|
new SubmitThread(lowerTierNames[j],lowerTierDesc[j],lowerTierScores[j],EVENT,ranks[j]))
|
||||||
}
|
.start();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("Cannot submit lower tier scores. Invalid array params.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user