Program: 17126
Project: 17126
Buggy source:
/** 
 * convert a das2 source to a das 1 source. This only will work if is passes the Das2Source.isDas1Source() test  i.e. this is really a das1 server there
 * @param das2source a DAS2Source to be converted
 * @return a Das1Source 
 * @throws DASException
 */
public static Das1Source toDas1Source(Das2Source das2source) throws DASException {
  if (!das2source.hasDas1Capabilities())   throw new DASException("String_Node_Str");
  Das1Source ds=new Das1Source();
  ds.setAdminemail(das2source.getAdminemail());
  ds.setDescription(das2source.getDescription());
  ds.setHelperurl(das2source.getHelperurl());
  ds.setRegisterDate(das2source.getRegisterDate());
  ds.setLeaseDate(das2source.getLeaseDate());
  ds.setLabels(das2source.getLabels());
  ds.setCoordinateSystem(das2source.getCoordinateSystem());
  ds.setNickname(das2source.getNickname());
  ds.setId(das2source.getId());
  ds.setLabels(das2source.getLabels());
  Das2Capability[] caps=das2source.getDas2Capabilities();
  List<Capabilities> das1capabilitites=new ArrayList();
  int DASPREFIXLENGTH=Das2CapabilityImpl.DAS1_CAPABILITY_PREFIX.length();
  for (int i=0; i < caps.length; i++) {
    Das2Capability cap=caps[i];
    String c=cap.getCapability();
    das1capabilitites.add(Capabilities.valueOf((c.substring(DASPREFIXLENGTH,c.length())).toUpperCase()));
    String query_uri=cap.getQueryUri();
    if (query_uri.endsWith("String_Node_Str") || query_uri.endsWith("String_Node_Str")) {
    }
 else {
      String url=query_uri.substring(0,(query_uri.length() - c.length() + DASPREFIXLENGTH));
      ds.setUrl(url);
    }
  }
  ds.setCapabilities(das1capabilitites);
  List validCaps=das2source.getValidCapabilities();
  ds.setValidCapabilities(validCaps);
  return ds;
}

Fixed version (ground truth):
/** 
 * convert a das2 source to a das 1 source. This only will work if is passes the Das2Source.isDas1Source() test  i.e. this is really a das1 server there
 * @param das2source a DAS2Source to be converted
 * @return a Das1Source 
 * @throws DASException
 */
public static Das1Source toDas1Source(Das2Source das2source) throws DASException {
  if (!das2source.hasDas1Capabilities())   throw new DASException("String_Node_Str");
  Das1Source ds=new Das1Source();
  ds.setAdminemail(das2source.getAdminemail());
  ds.setDescription(das2source.getDescription());
  ds.setHelperurl(das2source.getHelperurl());
  ds.setRegisterDate(das2source.getRegisterDate());
  ds.setLeaseDate(das2source.getLeaseDate());
  ds.setLabels(das2source.getLabels());
  ds.setCoordinateSystem(das2source.getCoordinateSystem());
  ds.setNickname(das2source.getNickname());
  ds.setId(das2source.getId());
  ds.setLabels(das2source.getLabels());
  Das2Capability[] caps=das2source.getDas2Capabilities();
  List<Capabilities> das1capabilitites=new ArrayList();
  int DASPREFIXLENGTH=Das2CapabilityImpl.DAS1_CAPABILITY_PREFIX.length();
  for (int i=0; i < caps.length; i++) {
    Das2Capability cap=caps[i];
    String c=cap.getCapability();
    try {
      das1capabilitites.add(Capabilities.valueOf((c.substring(DASPREFIXLENGTH,c.length())).toUpperCase()));
    }
 catch (    IllegalArgumentException ex) {
      System.err.println("String_Node_Str" + c);
    }
    String query_uri=cap.getQueryUri();
    if (query_uri.endsWith("String_Node_Str") || query_uri.endsWith("String_Node_Str")) {
    }
 else {
      String url=query_uri.substring(0,(query_uri.length() - c.length() + DASPREFIXLENGTH));
      ds.setUrl(url);
    }
  }
  ds.setCapabilities(das1capabilitites);
  List validCaps=das2source.getValidCapabilities();
  ds.setValidCapabilities(validCaps);
  return ds;
}