nus-yam/ex-repair huggingface dataset:
Program: 99517
Project: 99517
Buggy source:
public static User parseUser(JSONObject content) throws JSONException {
  final User result=new User();
  result.setId(JsonInput.getIntOrNull(content,"String_Node_Str"));
  result.setLogin(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setPassword(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setFirstName(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setLastName(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setMail(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setCreatedOn(getDateOrNull(content,"String_Node_Str"));
  result.setLastLoginOn(getDateOrNull(content,"String_Node_Str"));
  result.setApiKey(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setCustomFields(JsonInput.getListOrEmpty(content,"String_Node_Str",CUSTOM_FIELD_PARSER));
  final String name=JsonInput.getStringOrNull(content,"String_Node_Str");
  if (name != null)   result.setFullName(name);
  result.setMemberships(JsonInput.getListOrEmpty(content,"String_Node_Str",MEMBERSHIP_PARSER));
  result.setGroups(JsonInput.getListOrEmpty(content,"String_Node_Str",GROUP_PARSER));
  for (  Membership m : result.getMemberships())   m.setUser(result);
  return result;
}

Fixed version (ground truth):
public static User parseUser(JSONObject content) throws JSONException {
  final User result=new User();
  result.setId(JsonInput.getIntOrNull(content,"String_Node_Str"));
  result.setLogin(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setPassword(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setFirstName(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setLastName(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setMail(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setAuthSourceId(JsonInput.getIntOrNull(content,"String_Node_Str"));
  result.setCreatedOn(getDateOrNull(content,"String_Node_Str"));
  result.setLastLoginOn(getDateOrNull(content,"String_Node_Str"));
  result.setApiKey(JsonInput.getStringOrNull(content,"String_Node_Str"));
  result.setCustomFields(JsonInput.getListOrEmpty(content,"String_Node_Str",CUSTOM_FIELD_PARSER));
  final String name=JsonInput.getStringOrNull(content,"String_Node_Str");
  if (name != null)   result.setFullName(name);
  result.setMemberships(JsonInput.getListOrEmpty(content,"String_Node_Str",MEMBERSHIP_PARSER));
  result.setGroups(JsonInput.getListOrEmpty(content,"String_Node_Str",GROUP_PARSER));
  for (  Membership m : result.getMemberships())   m.setUser(result);
  return result;
}
Program: 99518
Project: 99518
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  CustomField that=(CustomField)o;
  if (id != that.id)   return false;
  if (name != null ? !name.equals(that.name) : that.name != null)   return false;
  if (value != null ? !value.equals(that.value) : that.value != null)   return false;
  if (values != null ? !values.equals(that.value) : that.values != null)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  CustomField that=(CustomField)o;
  if (id != that.id)   return false;
  if (name != null ? !name.equals(that.name) : that.name != null)   return false;
  if (value != null ? !value.equals(that.value) : that.value != null)   return false;
  if (values != null ? !values.equals(that.values) : that.values != null)   return false;
  return true;
}
Program: 99519
Project: 99519
Buggy source:
@Override public <R>R sendRequest(HttpRequest request,ContentHandler<HttpResponse,R> handler) throws RedmineException {
  logger.debug(request.getRequestLine().toString());
  request.addHeader("String_Node_Str","String_Node_Str");
  final HttpClient httpclient=client;
  try {
    final HttpResponse httpResponse=httpclient.execute((HttpUriRequest)request);
    try {
      return handler.processContent(httpResponse);
    }
  finally {
      EntityUtils.consume(httpResponse.getEntity());
    }
  }
 catch (  ClientProtocolException e1) {
    throw new RedmineFormatException(e1);
  }
catch (  IOException e1) {
    throw new RedmineTransportException("String_Node_Str" + request.getRequestLine().getUri() + "String_Node_Str"+ e1.toString(),e1);
  }
}

Fixed version (ground truth):
@Override public <R>R sendRequest(HttpRequest request,ContentHandler<HttpResponse,R> handler) throws RedmineException {
  logger.debug(request.getRequestLine().toString());
  request.addHeader("String_Node_Str","String_Node_Str");
  final HttpClient httpclient=client;
  try {
    final HttpResponse httpResponse=httpclient.execute((HttpUriRequest)request);
    try {
      return handler.processContent(httpResponse);
    }
  finally {
      EntityUtils.consume(httpResponse.getEntity());
    }
  }
 catch (  ClientProtocolException e1) {
    throw new RedmineFormatException(e1);
  }
catch (  IOException e1) {
    throw new RedmineTransportException("String_Node_Str" + getMessageURI(request) + "String_Node_Str"+ e1.toString(),e1);
  }
}
Program: 99520
Project: 99520
Buggy source:
/** 
 * @param responseBody  sample parameter:<pre> &lt;?xml version="1.0" encoding="UTF-8"?> &lt;errors> &lt;error>Name can't be blank&lt;/error> &lt;error>Identifier has already been taken&lt;/error> &lt;/errors> </pre>
 */
public static List<String> parseErrors(String responseBody){
  List<String> errors=new ArrayList<String>();
  String lines[]=responseBody.split("String_Node_Str");
  int lineToStartWith=2;
  int lastLine=lines.length - 1;
  String openTag="String_Node_Str";
  String closeTag="String_Node_Str";
  for (int i=lineToStartWith; i < lastLine; i++) {
    int begin=lines[i].indexOf(openTag) + openTag.length();
    int end=lines[i].indexOf(closeTag);
    if (begin >= 0 && end >= 0) {
      errors.add(lines[i].substring(begin,end));
    }
  }
  return errors;
}

Fixed version (ground truth):
/** 
 * @param responseBody  sample parameter:<pre> &lt;?xml version="1.0" encoding="UTF-8"?> &lt;errors> &lt;error>Name can't be blank&lt;/error> &lt;error>Identifier has already been taken&lt;/error> &lt;/errors> </pre>
 */
public static List<String> parseErrors(String responseBody){
  List<String> errors=new ArrayList<String>();
  String lines[]=responseBody.split("String_Node_Str");
  int lineToStartWith=0;
  int lastLine=lines.length - 1;
  if (lines.length > 1) {
    lineToStartWith=2;
    lastLine=lines.length - 1;
  }
  String openTag="String_Node_Str";
  String closeTag="String_Node_Str";
  for (int i=lineToStartWith; i <= lastLine; i++) {
    int begin=lines[i].indexOf(openTag) + openTag.length();
    int end=lines[i].indexOf(closeTag);
    if (begin >= 0 && end >= 0) {
      errors.add(lines[i].substring(begin,end));
    }
  }
  return errors;
}
Program: 99521
Project: 99521
Buggy source:
public URI getUpdateURI(Class zz,String id,NameValuePair... param){
  String query=urls.get(zz) + "String_Node_Str" + id+ XML_URL_POSTFIX;
  return createURI(query,param);
}

Fixed version (ground truth):
public URI getUpdateURI(Class<?> zz,String id,NameValuePair... param){
  String query=getClassUrl(zz) + "String_Node_Str" + id+ XML_URL_POSTFIX;
  return createURI(query,param);
}
Program: 99522
Project: 99522
Buggy source:
public URIConfigurator(String host){
  this.host=host;
}

Fixed version (ground truth):
public URIConfigurator(String host){
  if (host == null || host.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    this.baseURL=new URL(host);
  }
 catch (  MalformedURLException e) {
    throw new IllegalArgumentException("String_Node_Str" + host,e);
  }
}
Program: 99523
Project: 99523
Buggy source:
public URI getRetrieveObjectsListURI(Class className,List<NameValuePair> param){
  String query=urls.get(className) + XML_URL_POSTFIX;
  return createURI(query,param);
}

Fixed version (ground truth):
public URI getRetrieveObjectsListURI(Class<?> className,List<NameValuePair> param){
  String query=getClassUrl(className) + XML_URL_POSTFIX;
  return createURI(query,param);
}
Program: 99524
Project: 99524
Buggy source:
/** 
 * @param query e.g. "/issues.xml"
 * @return URI with auth parameter "key" if not in "basic auth mode.
 */
public URI createURI(String query,List<NameValuePair> params){
  if (apiAccessKey != null) {
    params.add(new BasicNameValuePair("String_Node_Str",apiAccessKey));
  }
  URI uri;
  try {
    URL url=new URL(host);
    String path=url.getPath();
    if (!query.isEmpty()) {
      path+="String_Node_Str" + query;
    }
    uri=URIUtils.createURI(url.getProtocol(),url.getHost(),url.getPort(),path,URLEncodedUtils.format(params,"String_Node_Str"),null);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  return uri;
}

Fixed version (ground truth):
/** 
 * @param query e.g. "/issues.xml"
 * @return URI with auth parameter "key" if not in "basic auth mode.
 */
public URI createURI(String query,List<NameValuePair> params){
  if (apiAccessKey != null) {
    params=new ArrayList<NameValuePair>(params);
    params.add(new BasicNameValuePair("String_Node_Str",apiAccessKey));
  }
  URI uri;
  try {
    URL url=baseURL;
    String path=url.getPath();
    if (!query.isEmpty()) {
      path+="String_Node_Str" + query;
    }
    uri=URIUtils.createURI(url.getProtocol(),url.getHost(),url.getPort(),path,URLEncodedUtils.format(params,"String_Node_Str"),null);
  }
 catch (  URISyntaxException e) {
    throw new RuntimeException(e);
  }
  return uri;
}
Program: 99525
Project: 99525
Buggy source:
public URI getCreateURI(Class zz){
  String query=urls.get(zz) + XML_URL_POSTFIX;
  return createURI(query);
}

Fixed version (ground truth):
public URI getCreateURI(Class<?> zz){
  String query=getClassUrl(zz) + XML_URL_POSTFIX;
  return createURI(query);
}
Program: 99526
Project: 99526
Buggy source:
public URI getRetrieveObjectURI(Class className,Integer id,List<NameValuePair> param){
  String query=urls.get(className) + "String_Node_Str" + id+ XML_URL_POSTFIX;
  return createURI(query,param);
}

Fixed version (ground truth):
public URI getRetrieveObjectURI(Class<?> className,Integer id,List<NameValuePair> param){
  String query=getClassUrl(className) + "String_Node_Str" + id+ XML_URL_POSTFIX;
  return createURI(query,param);
}
Program: 99527
Project: 99527
Buggy source:
/** 
 * Downloads the content of an   {@link org.redmine.ta.beans.Attachment} from the Redmine server.
 * @param issueAttachment the {@link org.redmine.ta.beans.Attachment}
 * @return the content of the attachment as a byte[] array
 * @throws IOException thrown in case the download fails
 */
public byte[] downloadAttachmentContent(Attachment issueAttachment) throws IOException {
  byte[] result=null;
  URL url=new URL(issueAttachment.getContentURL());
  BufferedReader inputReader=null;
  try {
    inputReader=new BufferedReader(new InputStreamReader(url.openStream()));
    StringBuilder contentBuilder=new StringBuilder();
    String line;
    while ((line=inputReader.readLine()) != null) {
      contentBuilder.append(line);
    }
    result=contentBuilder.toString().getBytes();
  }
  finally {
    if (inputReader != null) {
      inputReader.close();
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Downloads the content of an   {@link org.redmine.ta.beans.Attachment} from the Redmine server.
 * @param issueAttachment the {@link org.redmine.ta.beans.Attachment}
 * @return the content of the attachment as a byte[] array
 * @throws RedmineCommunicationException thrown in case the download fails
 */
public byte[] downloadAttachmentContent(Attachment issueAttachment) throws RedmineCommunicationException {
  try {
    final URL url=new URL(issueAttachment.getContentURL());
    final InputStream is=url.openStream();
    try {
      final ByteArrayOutputStream baos=new ByteArrayOutputStream();
      final byte[] buffer=new byte[65536];
      int read;
      while ((read=is.read(buffer)) != -1)       baos.write(buffer,0,read);
      return baos.toByteArray();
    }
  finally {
      is.close();
    }
  }
 catch (  IOException e) {
    throw new RedmineTransportException(e);
  }
}
Program: 99528
Project: 99528
Buggy source:
/** 
 * append, if the value is not NULL
 */
private static void appendIfNotNull(StringBuilder b,String tag,Object value){
  if (value != null) {
    b.append("String_Node_Str" + tag + "String_Node_Str");
    if (value instanceof Date) {
      b.append(sdf.format(value));
    }
 else     if (value instanceof String) {
      b.append(encodeXML((String)value));
    }
 else {
      b.append(value);
    }
    b.append("String_Node_Str" + tag + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * append, if the value is not NULL
 */
private static void appendIfNotNull(StringBuilder b,String tag,Object value){
  if (value != null) {
    b.append("String_Node_Str" + tag + "String_Node_Str");
    if (value instanceof Date) {
      b.append(RedmineDateUtils.formatShortDate((Date)value));
    }
 else     if (value instanceof String) {
      b.append(encodeXML((String)value));
    }
 else {
      b.append(encodeXML(value.toString()));
    }
    b.append("String_Node_Str" + tag + "String_Node_Str");
  }
}
Program: 99529
Project: 99529
Buggy source:
public User getCurrentUser() throws IOException, AuthenticationException, RedmineException {
  URI uri=createURI("String_Node_Str");
  HttpGet http=new HttpGet(uri);
  Response response=sendRequest(http);
  return RedmineXMLParser.parseUserFromXML(response.getBody());
}

Fixed version (ground truth):
/** 
 * @return the current user logged into Redmine
 * @throws IOException
 * @throws AuthenticationException
 * @throws RedmineException
 * @throws NotFoundException
 */
public User getCurrentUser() throws IOException, AuthenticationException, RedmineException, NotFoundException {
  URI uri=createURI("String_Node_Str");
  HttpGet http=new HttpGet(uri);
  Response response=sendRequest(http);
  if (response.getCode() == HttpStatus.SC_NOT_FOUND) {
    throw new NotFoundException("String_Node_Str");
  }
  return RedmineXMLParser.parseUserFromXML(response.getBody());
}
Program: 99530
Project: 99530
Buggy source:
@Test public void testGetCurrentUser() throws IOException, AuthenticationException, RedmineException {
  User currentUser=mgr.getCurrentUser();
  Assert.assertEquals(getOurUser().getId(),currentUser.getId());
  Assert.assertEquals(getOurUser().getLogin(),currentUser.getLogin());
}

Fixed version (ground truth):
@Test public void testGetCurrentUser() throws IOException, AuthenticationException, RedmineException, NotFoundException {
  User currentUser=mgr.getCurrentUser();
  Assert.assertEquals(getOurUser().getId(),currentUser.getId());
  Assert.assertEquals(getOurUser().getLogin(),currentUser.getLogin());
}
Program: 99531
Project: 99531
Buggy source:
@SuppressWarnings("String_Node_Str") public static <T>List<T> parseObjectsFromXML(Class<T> classs,String body){
  verifyStartsAsXML(body);
  String configFile=fromRedmineMap.get(classs);
  Unmarshaller unmarshaller=getUnmarshaller(configFile,ArrayList.class);
  List<T> list=null;
  StringReader reader=null;
  try {
    reader=new StringReader(body);
    list=(ArrayList<T>)unmarshaller.unmarshal(reader);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    if (reader != null) {
      reader.close();
    }
  }
  return list;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <T>List<T> parseObjectsFromXML(Class<T> classs,String body){
  verifyStartsAsXML(body);
  StringBuilder builder=new StringBuilder(body);
  removeBadTags(builder);
  String configFile=fromRedmineMap.get(classs);
  Unmarshaller unmarshaller=getUnmarshaller(configFile,ArrayList.class);
  List<T> list=null;
  StringReader reader=null;
  try {
    reader=new StringReader(builder.toString());
    list=(ArrayList<T>)unmarshaller.unmarshal(reader);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    if (reader != null) {
      reader.close();
    }
  }
  return list;
}
Program: 99532
Project: 99532
Buggy source:
public static <T>T parseObjectFromXML(Class<T> classs,String xml){
  verifyStartsAsXML(xml);
  StringBuilder b=new StringBuilder(xml);
  removeBadTags(b);
  String configFile=fromRedmineMap.get(classs);
  Unmarshaller unmarshaller=getUnmarshaller(configFile,classs);
  T obj=null;
  StringReader reader=null;
  try {
    reader=new StringReader(b.toString());
    obj=(T)unmarshaller.unmarshal(reader);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    if (reader != null) {
      reader.close();
    }
  }
  return obj;
}

Fixed version (ground truth):
public static <T>T parseObjectFromXML(Class<T> classs,String xml){
  verifyStartsAsXML(xml);
  StringBuilder builder=new StringBuilder(xml);
  removeBadTags(builder);
  String configFile=fromRedmineMap.get(classs);
  Unmarshaller unmarshaller=getUnmarshaller(configFile,classs);
  T obj=null;
  StringReader reader=null;
  try {
    reader=new StringReader(builder.toString());
    obj=(T)unmarshaller.unmarshal(reader);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    if (reader != null) {
      reader.close();
    }
  }
  return obj;
}
Program: 99533
Project: 99533
Buggy source:
@Before public void setup() throws Exception {
  String str=MyIOUtils.getResourceAsString(REDMINE_1_1_FILE_1_ISSUES_XML_FILE_NAME);
  this.issuesList=RedmineXMLParser.parseIssuesFromXML(str);
  RedmineIssuesMap loader=new RedmineIssuesMap(issuesList);
  issuesMap=loader.getIssuesMap();
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  String str=MyIOUtils.getResourceAsString(REDMINE_1_1_FILE_1_ISSUES_XML_FILE_NAME);
  this.issuesList=RedmineXMLParser.parseObjectsFromXML(Issue.class,str);
  RedmineIssuesMap loader=new RedmineIssuesMap(issuesList);
  issuesMap=loader.getIssuesMap();
}
Program: 99534
Project: 99534
Buggy source:
private List<Issue> loadRedmine11IssuesXml() throws IOException {
  String xml=MyIOUtils.getResourceAsString(REDMINE_1_1_ISSUES_XML);
  return RedmineXMLParser.parseIssuesFromXML(xml);
}

Fixed version (ground truth):
private List<Issue> loadRedmine11IssuesXml() throws IOException {
  String xml=MyIOUtils.getResourceAsString(REDMINE_1_1_ISSUES_XML);
  return RedmineXMLParser.parseObjectsFromXML(Issue.class,xml);
}
Program: 99535
Project: 99535
Buggy source:
@Test public void testParseIssuesFromEmptyXML(){
  try {
    String str=MyIOUtils.getResourceAsString(FILE_EMPTY_ISSUES_XML);
    List<Issue> issues=RedmineXMLParser.parseIssuesFromXML(str);
    Assert.assertTrue(issues.isEmpty());
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
@Test public void testParseIssuesFromEmptyXML(){
  try {
    String str=MyIOUtils.getResourceAsString(FILE_EMPTY_ISSUES_XML);
    List<Issue> issues=RedmineXMLParser.parseObjectsFromXML(Issue.class,str);
    Assert.assertTrue(issues.isEmpty());
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail("String_Node_Str" + e);
  }
}
Program: 99536
Project: 99536
Buggy source:
@Test public void testParseInvalidPage(){
  try {
    String text=MyIOUtils.getResourceAsString("String_Node_Str");
    RedmineXMLParser.parseIssuesFromXML(text);
    Assert.fail("String_Node_Str");
  }
 catch (  IOException e) {
    Assert.fail(e.getMessage());
  }
catch (  RuntimeException e) {
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void testParseInvalidPage(){
  try {
    String text=MyIOUtils.getResourceAsString("String_Node_Str");
    RedmineXMLParser.parseObjectsFromXML(Issue.class,text);
    Assert.fail("String_Node_Str");
  }
 catch (  IOException e) {
    Assert.fail(e.getMessage());
  }
catch (  RuntimeException e) {
    System.out.println("String_Node_Str");
  }
}
Program: 99537
Project: 99537
Buggy source:
@Test @Ignore public void testParseIssueNonUnicodeSymbols(){
  try {
    String xml=MyIOUtils.getResourceAsString("String_Node_Str");
    String nonLatinSymbols="String_Node_Str";
    List<Issue> issues=RedmineXMLParser.parseIssuesFromXML(xml);
    Assert.assertTrue(issues.size() == 1);
    Issue issue=issues.get(0);
    Assert.assertEquals(nonLatinSymbols,issue.getSubject());
  }
 catch (  Exception e) {
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test @Ignore public void testParseIssueNonUnicodeSymbols(){
  try {
    String xml=MyIOUtils.getResourceAsString("String_Node_Str");
    String nonLatinSymbols="String_Node_Str";
    List<Issue> issues=RedmineXMLParser.parseObjectsFromXML(Issue.class,xml);
    Assert.assertTrue(issues.size() == 1);
    Issue issue=issues.get(0);
    Assert.assertEquals(nonLatinSymbols,issue.getSubject());
  }
 catch (  Exception e) {
    Assert.fail(e.getMessage());
  }
}
Program: 99538
Project: 99538
Buggy source:
@Test public void testLoadRelation(){
  try {
    IssueRelation relation=createTwoRelatedIssues();
    Issue issue=mgr.getIssueById(relation.getIssueId(),INCLUDE.relations);
    Issue issueTarget=mgr.getIssueById(relation.getIssueToId(),INCLUDE.relations);
    assertEquals(1,issue.getRelations().size());
    assertEquals(1,issueTarget.getRelations().size());
    IssueRelation relation1=issue.getRelations().get(0);
    assertEquals(issue.getId(),relation1.getIssueId());
    assertEquals(issueTarget.getId(),relation1.getIssueToId());
    assertEquals((Integer)0,relation1.getDelay());
    IssueRelation reverseRelation=issueTarget.getRelations().get(0);
    assertEquals(relation1,reverseRelation);
  }
 catch (  Exception e) {
    fail(e.toString());
  }
}

Fixed version (ground truth):
@Test public void testLoadRelation(){
  try {
    IssueRelation relation=createTwoRelatedIssues();
    Issue issue=mgr.getIssueById(relation.getIssueId(),INCLUDE.relations);
    Issue issueTarget=mgr.getIssueById(relation.getIssueToId(),INCLUDE.relations);
    assertEquals(1,issue.getRelations().size());
    assertEquals(1,issueTarget.getRelations().size());
    IssueRelation relation1=issue.getRelations().get(0);
    assertEquals(issue.getId(),relation1.getIssueToId());
    assertEquals("String_Node_Str",relation1.getType());
    assertEquals((Integer)0,relation1.getDelay());
    IssueRelation reverseRelation=issueTarget.getRelations().get(0);
    assertEquals(relation1,reverseRelation);
  }
 catch (  Exception e) {
    fail(e.toString());
  }
}
Program: 99539
Project: 99539
Buggy source:
public IssueRelation createRelation(String projectKey,Integer issueId,Integer issueToId,String type) throws IOException, AuthenticationException, NotFoundException, RedmineException {
  URI uri=createURI("String_Node_Str" + issueId + "String_Node_Str");
  HttpPost http=new HttpPost(uri);
  http.getParams().setParameter("String_Node_Str",issueToId.toString());
  http.getParams().setParameter("String_Node_Str",type);
  Response response=sendRequest(http);
  IssueRelation relation=RedmineXMLParser.parseRelationFromXML(response.getBody());
  return relation;
}

Fixed version (ground truth):
public IssueRelation createRelation(String projectKey,Integer issueId,Integer issueToId,String type) throws IOException, AuthenticationException, NotFoundException, RedmineException {
  URI uri=createURI("String_Node_Str" + issueId + "String_Node_Str");
  HttpPost http=new HttpPost(uri);
  IssueRelation toCreate=new IssueRelation();
  toCreate.setIssueId(issueId);
  toCreate.setIssueToId(issueToId);
  toCreate.setType(type);
  String xml=RedmineXMLGenerator.toXML(toCreate);
  setEntity((HttpEntityEnclosingRequest)http,xml);
  Response response=sendRequest(http);
  IssueRelation relation=RedmineXMLParser.parseRelationFromXML(response.getBody());
  return relation;
}
Program: 99540
Project: 99540
Buggy source:
public static String toXML(User o){
  StringBuilder b=new StringBuilder(XML_PREFIX + "String_Node_Str");
  appendIfNotNull(b,"String_Node_Str",o.getId());
  appendIfNotNull(b,"String_Node_Str",o.getLogin());
  appendIfNotNull(b,"String_Node_Str",o.getPassword());
  appendIfNotNull(b,"String_Node_Str",o.getFirstName());
  appendIfNotNull(b,"String_Node_Str",o.getLastName());
  appendIfNotNull(b,"String_Node_Str",o.getMail());
  b.append("String_Node_Str");
  return b.toString();
}

Fixed version (ground truth):
public static String toXML(IssueRelation o){
  StringBuilder b=new StringBuilder(XML_PREFIX + "String_Node_Str");
  appendIfNotNull(b,"String_Node_Str",o.getIssueToId());
  appendIfNotNull(b,"String_Node_Str",o.getType());
  b.append("String_Node_Str");
  return b.toString();
}
Program: 99541
Project: 99541
Buggy source:
/** 
 * Redmine 1.1 / Chiliproject 1.2 - specific version
 */
private <T>List<T> getObjectsListV11(Class<T> objectClass,Map<String,NameValuePair> params) throws IOException, AuthenticationException, NotFoundException, RedmineException {
  List<T> objects=new ArrayList<T>();
  int limit=25;
  params.put("String_Node_Str",new BasicNameValuePair("String_Node_Str",String.valueOf(limit)));
  int offset=0;
  int totalObjectsFoundOnServer;
  do {
    params.put("String_Node_Str",new BasicNameValuePair("String_Node_Str",String.valueOf(offset)));
    List<NameValuePair> paramsList=new ArrayList<NameValuePair>(params.values());
    String query=urls.get(objectClass) + URL_POSTFIX;
    URI uri=createURI(query,paramsList);
    HttpGet http=new HttpGet(uri);
    Response response=sendRequest(http);
    if (response.getCode() == HttpStatus.SC_NOT_FOUND) {
      throw new NotFoundException("String_Node_Str" + response.getBody());
    }
    String body=response.getBody();
    totalObjectsFoundOnServer=RedmineXMLParser.parseObjectsTotalCount(body);
    List<T> foundItems=RedmineXMLParser.parseObjectsFromXML(objectClass,body);
    if (foundItems.size() == 0) {
      break;
    }
    objects.addAll(foundItems);
    offset+=foundItems.size();
  }
 while (offset < totalObjectsFoundOnServer);
  return objects;
}

Fixed version (ground truth):
/** 
 * Redmine 1.1 / Chiliproject 1.2 - specific version
 */
private <T>List<T> getObjectsListV11(Class<T> objectClass,Map<String,NameValuePair> params) throws IOException, AuthenticationException, NotFoundException, RedmineException {
  List<T> objects=new ArrayList<T>();
  int limit=25;
  params.put("String_Node_Str",new BasicNameValuePair("String_Node_Str",String.valueOf(limit)));
  int offset=0;
  int totalObjectsFoundOnServer;
  do {
    params.put("String_Node_Str",new BasicNameValuePair("String_Node_Str",String.valueOf(offset)));
    List<NameValuePair> paramsList=new ArrayList<NameValuePair>(params.values());
    String query=urls.get(objectClass) + URL_POSTFIX;
    URI uri=createURI(query,paramsList);
    debug("String_Node_Str" + uri);
    HttpGet http=new HttpGet(uri);
    Response response=sendRequest(http);
    if (response.getCode() == HttpStatus.SC_NOT_FOUND) {
      throw new NotFoundException("String_Node_Str" + response.getBody());
    }
    String body=response.getBody();
    totalObjectsFoundOnServer=RedmineXMLParser.parseObjectsTotalCount(body);
    List<T> foundItems=RedmineXMLParser.parseObjectsFromXML(objectClass,body);
    if (foundItems.size() == 0) {
      break;
    }
    objects.addAll(foundItems);
    offset+=foundItems.size();
  }
 while (offset < totalObjectsFoundOnServer);
  return objects;
}
Program: 99542
Project: 99542
Buggy source:
/** 
 * @param query e.g. "/issues.xml"
 * @return URI with auth parameter "key" if not in "basic auth mode.
 */
private URI createURI(String query,List<NameValuePair> params){
  if (!useBasicAuth) {
    params.add(new BasicNameValuePair("String_Node_Str",apiAccessKey));
  }
  URI uri;
  try {
    URL url=new URL(host);
    uri=URIUtils.createURI(url.getProtocol(),url.getHost(),url.getPort(),query,URLEncodedUtils.format(params,"String_Node_Str"),null);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  return uri;
}

Fixed version (ground truth):
/** 
 * @param query e.g. "/issues.xml"
 * @return URI with auth parameter "key" if not in "basic auth mode.
 */
private URI createURI(String query,List<NameValuePair> params){
  if (!useBasicAuth) {
    params.add(new BasicNameValuePair("String_Node_Str",apiAccessKey));
  }
  URI uri;
  try {
    URL url=new URL(host);
    String path=url.getPath();
    if (!query.isEmpty()) {
      path+="String_Node_Str" + query;
    }
    uri=URIUtils.createURI(url.getProtocol(),url.getHost(),url.getPort(),path,URLEncodedUtils.format(params,"String_Node_Str"),null);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  return uri;
}
Program: 99543
Project: 99543
Buggy source:
public static void testShortDate(Date expectedDate,int year,int month,int day){
  testLongDate(expectedDate,year,month,day,0,0,0,"String_Node_Str");
}

Fixed version (ground truth):
public static void testShortDate(int year,int month,int day,Date expectedDate){
  testLongDate(year,month,day,0,0,0,"String_Node_Str",expectedDate);
}
Program: 99544
Project: 99544
Buggy source:
public static void testLongDate(Date expectedDate,int year,int month,int day,int hour,int min,int sec,String timeZone){
  Calendar c=Calendar.getInstance();
  c.set(Calendar.YEAR,year);
  c.set(Calendar.MONTH,month);
  c.set(Calendar.DAY_OF_MONTH,day);
  c.set(Calendar.HOUR_OF_DAY,hour);
  c.set(Calendar.MINUTE,min);
  c.set(Calendar.SECOND,sec);
  c.set(Calendar.MILLISECOND,0);
  if (timeZone.length() > 0) {
    c.setTimeZone(TimeZone.getTimeZone(timeZone));
  }
  Date expectedTime=c.getTime();
  assertEquals("String_Node_Str",expectedTime,expectedDate);
}

Fixed version (ground truth):
public static void testLongDate(int year,int month,int day,int hour,int min,int sec,String timeZone,Date expectedDate){
  Calendar c=Calendar.getInstance();
  c.set(Calendar.YEAR,year);
  c.set(Calendar.MONTH,month);
  c.set(Calendar.DAY_OF_MONTH,day);
  c.set(Calendar.HOUR_OF_DAY,hour);
  c.set(Calendar.MINUTE,min);
  c.set(Calendar.SECOND,sec);
  c.set(Calendar.MILLISECOND,0);
  if (timeZone.length() > 0) {
    c.setTimeZone(TimeZone.getTimeZone(timeZone));
  }
  Date actualDate=c.getTime();
  assertEquals("String_Node_Str",actualDate,expectedDate);
}
Program: 99545
Project: 99545
Buggy source:
@Test public void testCountIssues(){
  try {
    String xml=MyIOUtils.getResourceAsString(REDMINE_1_1_ISSUES_XML);
    List<Issue> issues=RedmineXMLParser.parseIssuesFromXML(xml);
    assertEquals(26,issues.size());
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testCountIssues(){
  try {
    List<Issue> issues=loadRedmine11IssuesXml();
    assertEquals(26,issues.size());
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}
Program: 99546
Project: 99546
Buggy source:
@Test public void testParseDescription(){
  try {
    String xml=MyIOUtils.getResourceAsString(REDMINE_1_1_ISSUES_XML);
    List<Issue> issues=RedmineXMLParser.parseIssuesFromXML(xml);
    Issue issue65=RedmineTestUtils.findIssueInList(issues,65);
    assertTrue(issue65.getDescription().startsWith("String_Node_Str"));
    assertTrue(issue65.getDescription().endsWith("String_Node_Str"));
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testParseDescription(){
  try {
    List<Issue> issues=loadRedmine11IssuesXml();
    Issue issue65=RedmineTestUtils.findIssueInList(issues,65);
    assertTrue(issue65.getDescription().startsWith("String_Node_Str"));
    assertTrue(issue65.getDescription().endsWith("String_Node_Str"));
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}
Program: 99547
Project: 99547
Buggy source:
@Test public void testNullEstimatedTime(){
  String str;
  try {
    str=MyIOUtils.getResourceAsString(REDMINE_1_1_ISSUES_XML);
    List<Issue> issues=RedmineXMLParser.parseIssuesFromXML(str);
    Integer issueID=52;
    Issue issue52=RedmineTestUtils.findIssueInList(issues,issueID);
    assertNotNull(issue52);
    assertNull("String_Node_Str",issue52.getEstimatedHours());
  }
 catch (  IOException e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testNullEstimatedTime(){
  try {
    List<Issue> issues=loadRedmine11IssuesXml();
    Integer issueID=52;
    Issue issue52=RedmineTestUtils.findIssueInList(issues,issueID);
    assertNotNull(issue52);
    assertNull("String_Node_Str",issue52.getEstimatedHours());
  }
 catch (  IOException e) {
    fail(e.getMessage());
  }
}
Program: 99548
Project: 99548
Buggy source:
@Test public void testParseIssues() throws IOException {
  String xml=MyIOUtils.getResourceAsString("String_Node_Str");
  List<Issue> objects=RedmineXMLParser.parseIssuesFromXML(xml);
  Integer issueId=68;
  Issue issue68=RedmineTestUtils.findIssueInList(objects,issueId);
  assertNotNull(issue68);
  assertEquals(issueId,issue68.getId());
  Integer statusId=1;
  assertEquals(statusId,issue68.getStatusId());
  assertEquals("String_Node_Str",issue68.getStatusName());
  User author=issue68.getAuthor();
  assertNotNull(author);
  Integer userId=1;
  assertEquals(userId,author.getId());
}

Fixed version (ground truth):
@Test public void testParseIssues() throws IOException {
  List<Issue> objects=loadRedmine11IssuesXml();
  Integer issueId=68;
  Issue issue68=RedmineTestUtils.findIssueInList(objects,issueId);
  assertNotNull(issue68);
  assertEquals(issueId,issue68.getId());
  Integer statusId=1;
  assertEquals(statusId,issue68.getStatusId());
  assertEquals("String_Node_Str",issue68.getStatusName());
  User author=issue68.getAuthor();
  assertNotNull(author);
  Integer userId=1;
  assertEquals(userId,author.getId());
}
Program: 99549
Project: 99549
Buggy source:
@Test public void testParseTimeEntries() throws IOException {
  String xml=MyIOUtils.getResourceAsString("String_Node_Str");
  List<TimeEntry> objects=RedmineXMLParser.parseTimeEntries(xml);
  for (  TimeEntry timeEntry : objects) {
    System.out.println(timeEntry);
  }
  Integer objId=2;
  TimeEntry obj2=RedmineTestUtils.findTimeEntry(objects,objId);
  assertNotNull(obj2);
  Integer expectedIssueId=44;
  String expectedProjectName="String_Node_Str";
  Integer expectedProjectId=1;
  String expectedUserName="String_Node_Str";
  Integer expectedUserId=1;
  String expectedActivityName="String_Node_Str";
  Integer expectedActivityId=8;
  Float expectedHours=2f;
  assertEquals(objId,obj2.getId());
  assertEquals(expectedIssueId,obj2.getIssueId());
  assertEquals(expectedProjectName,obj2.getProjectName());
  assertEquals(expectedProjectId,obj2.getProjectId());
  assertEquals(expectedUserName,obj2.getUserName());
  assertEquals(expectedUserId,obj2.getUserId());
  assertEquals(expectedActivityName,obj2.getActivityName());
  assertEquals(expectedActivityId,obj2.getActivityId());
  assertEquals(expectedHours,obj2.getHours());
  assertEquals("String_Node_Str",obj2.getComment());
  MyIOUtils.testLongDate(obj2.getCreatedOn(),2011,Calendar.JANUARY,31,11,10,40,"String_Node_Str");
  MyIOUtils.testLongDate(obj2.getUpdatedOn(),2011,Calendar.JANUARY,31,11,12,32,"String_Node_Str");
  MyIOUtils.testShortDate(obj2.getSpentOn(),2011,Calendar.JANUARY,30);
}

Fixed version (ground truth):
@Test public void testParseTimeEntries() throws IOException {
  String xml=MyIOUtils.getResourceAsString("String_Node_Str");
  List<TimeEntry> objects=RedmineXMLParser.parseTimeEntries(xml);
  for (  TimeEntry timeEntry : objects) {
    System.out.println(timeEntry);
  }
  Integer objId=2;
  TimeEntry obj2=RedmineTestUtils.findTimeEntry(objects,objId);
  assertNotNull(obj2);
  Integer expectedIssueId=44;
  String expectedProjectName="String_Node_Str";
  Integer expectedProjectId=1;
  String expectedUserName="String_Node_Str";
  Integer expectedUserId=1;
  String expectedActivityName="String_Node_Str";
  Integer expectedActivityId=8;
  Float expectedHours=2f;
  assertEquals(objId,obj2.getId());
  assertEquals(expectedIssueId,obj2.getIssueId());
  assertEquals(expectedProjectName,obj2.getProjectName());
  assertEquals(expectedProjectId,obj2.getProjectId());
  assertEquals(expectedUserName,obj2.getUserName());
  assertEquals(expectedUserId,obj2.getUserId());
  assertEquals(expectedActivityName,obj2.getActivityName());
  assertEquals(expectedActivityId,obj2.getActivityId());
  assertEquals(expectedHours,obj2.getHours());
  assertEquals("String_Node_Str",obj2.getComment());
  MyIOUtils.testLongDate(2011,Calendar.JANUARY,31,11,10,40,"String_Node_Str",obj2.getCreatedOn());
  MyIOUtils.testLongDate(2011,Calendar.JANUARY,31,11,12,32,"String_Node_Str",obj2.getUpdatedOn());
  MyIOUtils.testShortDate(2011,Calendar.JANUARY,30,obj2.getSpentOn());
}
Program: 99550
Project: 99550
Buggy source:
public static void main(String[] args){
  RedmineManager mgr=new RedmineManager(redmineHost,login,password);
  try {
    tryCreateRelation(mgr);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  RedmineManager mgr=new RedmineManager(redmineHost,login,password);
  try {
    tryGetAllIssues(mgr);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 99552
Project: 99552
Buggy source:
@Test public void testWrongCredentialsOnCreateIssue() throws RuntimeException {
  RedmineManager redmineMgrEmpty=new RedmineManager(Config.getHost(),null);
  Issue issue=new Issue();
  issue.setSubject("String_Node_Str");
  try {
    redmineMgrEmpty.createIssue(projectKey,issue);
    fail("String_Node_Str");
  }
 catch (  AuthenticationException e) {
    System.out.println("String_Node_Str");
  }
catch (  Exception e) {
    fail("String_Node_Str" + e);
  }
  RedmineManager redmineMgrInvalidKey=new RedmineManager(Config.getHost(),"String_Node_Str");
  try {
    redmineMgrInvalidKey.createIssue(projectKey,issue);
    fail("String_Node_Str");
  }
 catch (  AuthenticationException e) {
    System.out.println("String_Node_Str");
  }
catch (  Exception e) {
    fail("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
@Test public void testWrongCredentialsOnCreateIssue() throws RuntimeException {
  RedmineManager redmineMgrEmpty=new RedmineManager(Config.getURI(),null);
  Issue issue=new Issue();
  issue.setSubject("String_Node_Str");
  try {
    redmineMgrEmpty.createIssue(projectKey,issue);
    fail("String_Node_Str");
  }
 catch (  AuthenticationException e) {
    System.out.println("String_Node_Str");
  }
catch (  Exception e) {
    fail("String_Node_Str" + e);
  }
  RedmineManager redmineMgrInvalidKey=new RedmineManager(Config.getURI(),"String_Node_Str");
  try {
    redmineMgrInvalidKey.createIssue(projectKey,issue);
    fail("String_Node_Str");
  }
 catch (  AuthenticationException e) {
    System.out.println("String_Node_Str");
  }
catch (  Exception e) {
    fail("String_Node_Str" + e);
  }
}
Program: 99553
Project: 99553
Buggy source:
@BeforeClass public static void oneTimeSetUp(){
  System.out.println("String_Node_Str" + Config.getHost());
  mgr=new RedmineManager(Config.getHost(),Config.getLogin(),Config.getPassword());
  Project junitTestProject=new Project();
  junitTestProject.setName("String_Node_Str");
  junitTestProject.setIdentifier("String_Node_Str" + Calendar.getInstance().getTimeInMillis());
  try {
    Project createdProject=mgr.createProject(junitTestProject);
    projectKey=createdProject.getIdentifier();
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
@BeforeClass public static void oneTimeSetUp(){
  System.out.println("String_Node_Str" + Config.getURI());
  mgr=new RedmineManager(Config.getURI(),Config.getLogin(),Config.getPassword());
  Project junitTestProject=new Project();
  junitTestProject.setName("String_Node_Str");
  junitTestProject.setIdentifier("String_Node_Str" + Calendar.getInstance().getTimeInMillis());
  try {
    Project createdProject=mgr.createProject(junitTestProject);
    projectKey=createdProject.getIdentifier();
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail("String_Node_Str" + e.getMessage());
  }
}
Program: 99554
Project: 99554
Buggy source:
/** 
 * append, if the value is not NULL
 */
private static final void append(StringBuilder b,String tag,Object value){
  if (value != null) {
    b.append("String_Node_Str" + tag + "String_Node_Str");
    if (value instanceof Date) {
      b.append(sdf.format(value));
    }
    if (value instanceof String) {
      b.append(encodeXML((String)value));
    }
 else {
      b.append(value);
    }
    b.append("String_Node_Str" + tag + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * append, if the value is not NULL
 */
private static final void append(StringBuilder b,String tag,Object value){
  if (value != null) {
    b.append("String_Node_Str" + tag + "String_Node_Str");
    if (value instanceof Date) {
      b.append(sdf.format(value));
    }
 else     if (value instanceof String) {
      b.append(encodeXML((String)value));
    }
 else {
      b.append(value);
    }
    b.append("String_Node_Str" + tag + "String_Node_Str");
  }
}
Program: 99555
Project: 99555
Buggy source:
private static void tryGetIssues(RedmineManager mgr) throws IOException, AuthenticationException, NotFoundException, URISyntaxException, RedmineException {
  List<Issue> issues=mgr.getIssues(projectKey,queryId);
  for (  Issue issue : issues) {
    System.out.println(issue.toString());
  }
}

Fixed version (ground truth):
private static void tryGetIssues(RedmineManager mgr) throws Exception {
  List<Issue> issues=mgr.getIssues(projectKey,queryId);
  for (  Issue issue : issues) {
    System.out.println(issue.toString());
  }
}
Program: 99556
Project: 99556
Buggy source:
public static void main(String[] args){
  RedmineManager mgr=new RedmineManager(redmineHost,apiAccessKey);
  try {
    tryGetIssues(mgr);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  RedmineManager mgr=new RedmineManager(redmineHost,apiAccessKey);
  try {
    generateXMLForTimeEntry();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 99557
Project: 99557
Buggy source:
@Test public void testParseIssueNonUnicodeSymbols(){
  try {
    String xml=MyIOUtils.getResourceAsString("String_Node_Str");
    String nonLatinSymbols="String_Node_Str";
    List<Issue> issues=RedmineXMLParser.parseIssuesFromXML(xml);
    assertTrue(issues.size() == 1);
    Issue issue=issues.get(0);
    assertEquals(nonLatinSymbols,issue.getSubject());
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test @Ignore public void testParseIssueNonUnicodeSymbols(){
  try {
    String xml=MyIOUtils.getResourceAsString("String_Node_Str");
    String nonLatinSymbols="String_Node_Str";
    List<Issue> issues=RedmineXMLParser.parseIssuesFromXML(xml);
    assertTrue(issues.size() == 1);
    Issue issue=issues.get(0);
    assertEquals(nonLatinSymbols,issue.getSubject());
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}
Program: 99558
Project: 99558
Buggy source:
private <T extends Identifiable>void updateObject(Class<T> classs,T obj) throws IOException, AuthenticationException, NotFoundException, RedmineException {
  Map<String,NameValuePair> params=new HashMap<String,NameValuePair>();
  addAuthParameters(params);
  List<NameValuePair> paramsList=new ArrayList<NameValuePair>(params.values());
  URI uri=getUpdateURI(obj.getClass(),Integer.toString(obj.getId()),paramsList);
  HttpPut http=new HttpPut(uri);
  String xml=RedmineXMLParser.convertObjectToXML(obj);
  setEntity((HttpEntityEnclosingRequest)http,xml);
  Response response=sendRequest(http);
  if (response.getCode() == HttpStatus.SC_NOT_FOUND) {
    throw new NotFoundException("String_Node_Str" + response.getBody());
  }
}

Fixed version (ground truth):
private <T extends Identifiable>void updateObject(Class<T> classs,T obj) throws IOException, AuthenticationException, NotFoundException, RedmineException {
  Map<String,NameValuePair> params=new HashMap<String,NameValuePair>();
  addAuthParameters(params);
  List<NameValuePair> paramsList=new ArrayList<NameValuePair>(params.values());
  URI uri=getUpdateURI(obj.getClass(),Integer.toString(obj.getId()),paramsList);
  HttpPut http=new HttpPut(uri);
  String xml=RedmineXMLGenerator.toXML(obj);
  setEntity((HttpEntityEnclosingRequest)http,xml);
  Response response=sendRequest(http);
  if (response.getCode() == HttpStatus.SC_NOT_FOUND) {
    throw new NotFoundException("String_Node_Str" + response.getBody());
  }
}
Program: 99559
Project: 99559
Buggy source:
/** 
 * Sample usage: <p> <pre>  {@code Project project = new Project(); Long timeStamp = Calendar.getInstance().getTimeInMillis(); String key = &quot;projkey&quot; + timeStamp; String name = &quot;project number &quot; + timeStamp; String description = &quot;some description for the project&quot;; project.setIdentifier(key); project.setName(name); project.setDescription(description); Project createdProject = mgr.createProject(project);}</pre>
 * @param project project to create on the server
 * @return the newly created Project object.
 * @throws IOException
 * @throws AuthenticationException invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
 * @throws RedmineException 
 */
public Project createProject(Project project) throws IOException, AuthenticationException, RedmineException {
  String query=buildCreateProjectURI();
  query+="String_Node_Str";
  HttpPost httpPost=new HttpPost(query);
  String createProjectXML=RedmineXMLParser.convertObjectToXML(project);
  setEntity(httpPost,createProjectXML);
  Response response=sendRequest(httpPost);
  Project createdProject=RedmineXMLParser.parseProjectFromXML(response.getBody());
  return createdProject;
}

Fixed version (ground truth):
/** 
 * Sample usage: <p> <pre>  {@code Project project = new Project(); Long timeStamp = Calendar.getInstance().getTimeInMillis(); String key = &quot;projkey&quot; + timeStamp; String name = &quot;project number &quot; + timeStamp; String description = &quot;some description for the project&quot;; project.setIdentifier(key); project.setName(name); project.setDescription(description); Project createdProject = mgr.createProject(project);}</pre>
 * @param project project to create on the server
 * @return the newly created Project object.
 * @throws IOException
 * @throws AuthenticationException invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.
 * @throws RedmineException 
 */
public Project createProject(Project project) throws IOException, AuthenticationException, RedmineException {
  String query=buildCreateProjectURI();
  query+="String_Node_Str";
  HttpPost httpPost=new HttpPost(query);
  String createProjectXML=RedmineXMLGenerator.toXML(project);
  setEntity(httpPost,createProjectXML);
  Response response=sendRequest(httpPost);
  Project createdProject=RedmineXMLParser.parseProjectFromXML(response.getBody());
  return createdProject;
}