Answer the question
In order to leave comments, you need to log in
Why doesn't it go further through the body of the loop?
There is a check function in which many checks are performed
static void checkAll()
{
while (true)
{
StudentOrder sO = readStudentOrder();
if (sO == null)
{
break;
}
AnswerCityRegister cityAnswer = checkCityRegister(sO);
if (!cityAnswer.answer) // if answer is then keep going
{
continue; // if it's empty than go to the beginning of cycle
}
AnswerWedding weddingAnswer = checkWedding(sO);
AnswerChildren childAnswer = checkChildren(sO);
AnswerStudent studentAnswer = checkStudent(sO);
sendMail(sO);
}
}
static AnswerCityRegister checkCityRegister (StudentOrder sO)
{
CityRegisterValidator cityRegisterValidator = new CityRegisterValidator();
cityRegisterValidator.hostName = "Host1";
cityRegisterValidator.password = "Password1";
AnswerCityRegister answer = cityRegisterValidator.checkCityRegister(sO);
return answer;
}
public class AnswerCityRegister
{
public boolean answer;
}
public class CityRegisterValidator
{
public String hostName;
public int port;
private String login;
public String password;
public AnswerCityRegister checkCityRegister (StudentOrder sO)
{
System.out.println("CityRegister is running : " + hostName + ", " + login + ", " + password + '.');
AnswerCityRegister ans = new AnswerCityRegister();
ans.answer = false;
return ans;
}
}
Answer the question
In order to leave comments, you need to log in
ans.answer = false;
return ans;
so answer is always false. The if(!answer) check is always true.
continue; // if it's empty than go to the beginning of cycle
says it all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question