Program: 14195
Project: 14195
Buggy source:
@Override public void create(int stepNum) throws Exception {
switch (stepNum) {
case 0:
    ServiceConfiguration configuration=Topology.lookup(Compute.class);
  AttachVolumeType attachVolumeType=new AttachVolumeType();
attachVolumeType.setEffectiveUserId(info.getEffectiveUserId());
DescribeInstancesType describeInstancesType=new DescribeInstancesType();
describeInstancesType.setInstancesSet(Lists.newArrayList(properties.getInstanceId()));
describeInstancesType.setEffectiveUserId(info.getEffectiveUserId());
DescribeInstancesResponseType describeInstancesResponseType=AsyncRequests.<DescribeInstancesType,DescribeInstancesResponseType>sendSync(configuration,describeInstancesType);
if (describeInstancesResponseType.getReservationSet() == null || describeInstancesResponseType.getReservationSet().isEmpty()) {
throw new ValidationErrorException("String_Node_Str" + properties.getInstanceId());
}
attachVolumeType.setInstanceId(properties.getInstanceId());
DescribeVolumesType describeVolumesType=new DescribeVolumesType();
describeVolumesType.setVolumeSet(Lists.newArrayList(properties.getVolumeId()));
describeVolumesType.setEffectiveUserId(info.getEffectiveUserId());
DescribeVolumesResponseType describeVolumesResponseType=AsyncRequests.<DescribeVolumesType,DescribeVolumesResponseType>sendSync(configuration,describeVolumesType);
if (describeVolumesResponseType.getVolumeSet().size() == 0) throw new ValidationErrorException("String_Node_Str" + properties.getVolumeId());
if (!"String_Node_Str".equals(describeVolumesResponseType.getVolumeSet().get(0).getStatus())) {
throw new ValidationErrorException("String_Node_Str" + properties.getVolumeId() + "String_Node_Str");
}
attachVolumeType.setVolumeId(properties.getVolumeId());
attachVolumeType.setDevice(properties.getDevice());
AsyncRequests.<AttachVolumeType,AttachVolumeResponseType>sendSync(configuration,attachVolumeType);
boolean attached=false;
for (int i=0; i < 60; i++) {
Thread.sleep(5000L);
DescribeVolumesType describeVolumesType2=new DescribeVolumesType();
describeVolumesType2.setVolumeSet(Lists.newArrayList(properties.getVolumeId()));
describeVolumesType2.setEffectiveUserId(info.getEffectiveUserId());
DescribeVolumesResponseType describeVolumesResponseType2=AsyncRequests.<DescribeVolumesType,DescribeVolumesResponseType>sendSync(configuration,describeVolumesType2);
if (describeVolumesResponseType2.getVolumeSet().size() == 0) continue;
if (describeVolumesResponseType2.getVolumeSet().get(0).getAttachmentSet() == null || describeVolumesResponseType2.getVolumeSet().get(0).getAttachmentSet().isEmpty()) continue;
for (AttachedVolume attachedVolume : describeVolumesResponseType2.getVolumeSet().get(0).getAttachmentSet()) {
if (attachedVolume.getInstanceId().equals(properties.getInstanceId()) && attachedVolume.getDevice().equals(properties.getDevice()) && attachedVolume.getStatus().equals("String_Node_Str")) {
attached=true;
break;
}
}
if (attached == true) break;
}
if (!attached) throw new Exception("String_Node_Str");
String physicalResourceId=getStackEntity().getStackName() + "String_Node_Str" + info.getLogicalResourceId()+ "String_Node_Str"+ Crypto.generateAlphanumericId(12,"String_Node_Str");
info.setPhysicalResourceId(physicalResourceId);
info.setReferenceValueJson(JsonHelper.getStringFromJsonNode(new TextNode(info.getPhysicalResourceId())));
break;
default :
throw new IllegalStateException("String_Node_Str" + stepNum);
}
}

Fixed version (ground truth):
@Override public void create(int stepNum) throws Exception {
switch (stepNum) {
case 0:
    ServiceConfiguration configuration=Topology.lookup(Compute.class);
  AttachVolumeType attachVolumeType=new AttachVolumeType();
attachVolumeType.setEffectiveUserId(info.getEffectiveUserId());
DescribeInstancesType describeInstancesType=new DescribeInstancesType();
describeInstancesType.setInstancesSet(Lists.newArrayList(properties.getInstanceId()));
describeInstancesType.setEffectiveUserId(info.getEffectiveUserId());
DescribeInstancesResponseType describeInstancesResponseType=AsyncRequests.<DescribeInstancesType,DescribeInstancesResponseType>sendSync(configuration,describeInstancesType);
if (describeInstancesResponseType.getReservationSet() == null || describeInstancesResponseType.getReservationSet().isEmpty()) {
throw new ValidationErrorException("String_Node_Str" + properties.getInstanceId());
}
attachVolumeType.setInstanceId(properties.getInstanceId());
DescribeVolumesType describeVolumesType=new DescribeVolumesType();
describeVolumesType.setVolumeSet(Lists.newArrayList(properties.getVolumeId()));
describeVolumesType.setEffectiveUserId(info.getEffectiveUserId());
DescribeVolumesResponseType describeVolumesResponseType=AsyncRequests.<DescribeVolumesType,DescribeVolumesResponseType>sendSync(configuration,describeVolumesType);
if (describeVolumesResponseType.getVolumeSet().size() == 0) throw new ValidationErrorException("String_Node_Str" + properties.getVolumeId());
if (!"String_Node_Str".equals(describeVolumesResponseType.getVolumeSet().get(0).getStatus())) {
throw new ValidationErrorException("String_Node_Str" + properties.getVolumeId() + "String_Node_Str");
}
attachVolumeType.setVolumeId(properties.getVolumeId());
attachVolumeType.setDevice(properties.getDevice());
AsyncRequests.<AttachVolumeType,AttachVolumeResponseType>sendSync(configuration,attachVolumeType);
boolean attached=false;
for (int i=0; i < 60; i++) {
Thread.sleep(5000L);
DescribeVolumesType describeVolumesType2=new DescribeVolumesType();
describeVolumesType2.setVolumeSet(Lists.newArrayList(properties.getVolumeId()));
describeVolumesType2.setEffectiveUserId(info.getEffectiveUserId());
DescribeVolumesResponseType describeVolumesResponseType2=AsyncRequests.<DescribeVolumesType,DescribeVolumesResponseType>sendSync(configuration,describeVolumesType2);
if (describeVolumesResponseType2.getVolumeSet().size() == 0) continue;
if (describeVolumesResponseType2.getVolumeSet().get(0).getAttachmentSet() == null || describeVolumesResponseType2.getVolumeSet().get(0).getAttachmentSet().isEmpty()) continue;
for (AttachedVolume attachedVolume : describeVolumesResponseType2.getVolumeSet().get(0).getAttachmentSet()) {
if (attachedVolume.getInstanceId().equals(properties.getInstanceId()) && attachedVolume.getDevice().equals(properties.getDevice()) && attachedVolume.getStatus().equals("String_Node_Str")) {
attached=true;
break;
}
}
if (attached == true) break;
}
if (!attached) throw new Exception("String_Node_Str");
info.setPhysicalResourceId(getDefaultPhysicalResourceId());
info.setReferenceValueJson(JsonHelper.getStringFromJsonNode(new TextNode(info.getPhysicalResourceId())));
break;
default :
throw new IllegalStateException("String_Node_Str" + stepNum);
}
}