|
@@ -2,6 +2,7 @@ package com.mooctest.crowd.site.command;
|
|
|
|
|
|
import com.mooctest.crowd.domain.domainobject.CrowdTestTask;
|
|
|
import com.mooctest.crowd.domain.domainobject.EndPoint;
|
|
|
+import com.mooctest.crowd.domain.exception.CrowdTestEndPointException;
|
|
|
import lombok.Data;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
@@ -75,19 +76,23 @@ public class CrowdTestTaskCommand {
|
|
|
|
|
|
if(endPoint.getServerCode() != null && endPoint.getServerCode() != ""){
|
|
|
String serverCode = endPoint.getServerCode();
|
|
|
- byte[] decodedBytes = Base64.getDecoder().decode(serverCode);
|
|
|
- String url = new String(decodedBytes);
|
|
|
-
|
|
|
- if(url.contains("examId_")){
|
|
|
- endPoint.setExamId(url.split("examId_")[1].split("/")[0]);
|
|
|
- url = url.replaceFirst("examId_","");
|
|
|
- }
|
|
|
- if(url.contains("caseId_")){
|
|
|
- endPoint.setCaseId(url.split("caseId_")[1].split("/")[0]);
|
|
|
- url = url.replaceFirst("caseId_","");
|
|
|
+ try {
|
|
|
+ byte[] decodedBytes = Base64.getDecoder().decode(serverCode);
|
|
|
+ String url = new String(decodedBytes);
|
|
|
+
|
|
|
+ if(url.contains("examId_")){
|
|
|
+ endPoint.setExamId(url.split("examId_")[1].split("/")[0]);
|
|
|
+ url = url.replaceFirst("examId_","");
|
|
|
+ }
|
|
|
+ if(url.contains("caseId_")){
|
|
|
+ endPoint.setCaseId(url.split("caseId_")[1].split("/")[0]);
|
|
|
+ url = url.replaceFirst("caseId_","");
|
|
|
+ }
|
|
|
+ endPoint.setUrl(url);
|
|
|
+ crowdTestTask.setEndPoint(endPoint);
|
|
|
+ }catch (IllegalArgumentException e){
|
|
|
+ throw new CrowdTestEndPointException();
|
|
|
}
|
|
|
- endPoint.setUrl(url);
|
|
|
- crowdTestTask.setEndPoint(endPoint);
|
|
|
}
|
|
|
return crowdTestTask;
|
|
|
}
|