Yes, No, NO NO NO NO
by in CodeSOD on 2024-07-31Mike was doing work for a mobile services provider. He found this in their code:
private static YesNoType toYesNo(String isYes)
{
if (isYes != null)
{
if (isYes.equalsIgnoreCase("Y"))
{
return YesNoType.fromString("Yes");
}
else
{
return YesNoType.fromString("No");
}
}
else
{
return YesNoType.fromString("No");
}
}
/**
* @param isYes
* @return
*/
private static YesNoType toYesNo(boolean isYes)
{
if (isYes)
{
return YesNoType.fromString("Yes");
}
else
{
return YesNoType.fromString("No");
}
}
/**
* @param isYes
* @return
*/
private static String fromYesNo(YesNoType isYes)
{
if (isYes != null)
{
String resultStr = isYes.toString();
if (resultStr.equalsIgnoreCase("Yes"))
{
return ("Yes");
}
else
{
return ("No");
}
}
else
{
return ("No");
}
}
/**
* @param isYes
* @return
*/
private static boolean isYesNo(YesNoType isYes)
{
boolean isBroadbandUser = false;
if (isYes != null && isYes.toString().equalsIgnoreCase("Yes"))
{
isBroadbandUser = true;
}
return isBroadbandUser;
}
It was a little past 4AM when Massimo's support pager went off, jarring him awake. Without even looking at the pager or logging into his laptop, he flipped on the television to Channel 242: the Video on Demand channel for the Italian TV broadcaster that he worked for.
The year was 1993, and that meant one thing: Old Iron was finally ready for 