nus-yam/ex-repair huggingface dataset:
Program: 17946
Project: 17946
Buggy source:
/** 
 * @see ServiceDocumentProcessor
 */
@Override public ODataResponse readServiceDocument(GetServiceDocumentUriInfo uriInfo,String contentType) throws ODataException {
  final Edm entityDataModel=getContext().getService().getEntityDataModel();
  final String serviceRoot=getContext().getPathInfo().getServiceRoot().toASCIIString();
  final ODataResponse response=EntityProvider.writeServiceDocument(contentType,entityDataModel,serviceRoot);
  final ODataResponseBuilder odataResponseBuilder=ODataResponse.fromResponse(response).header(ODataHttpHeaders.DATASERVICEVERSION,ODataServiceVersion.V10);
  if (!(contentType.equals(response.getContentHeader()) || (contentType.contains("String_Node_Str") && response.getContentHeader().contains("String_Node_Str")))) {
    odataResponseBuilder.contentHeader(contentType);
  }
  return odataResponseBuilder.build();
}

Fixed version (ground truth):
/** 
 * @see ServiceDocumentProcessor
 */
@Override public ODataResponse readServiceDocument(GetServiceDocumentUriInfo uriInfo,String contentType) throws ODataException {
  final Edm entityDataModel=getContext().getService().getEntityDataModel();
  final String serviceRoot=getContext().getPathInfo().getServiceRoot().toASCIIString();
  final ODataResponse response=EntityProvider.writeServiceDocument(contentType,entityDataModel,serviceRoot);
  final ODataResponseBuilder odataResponseBuilder=ODataResponse.fromResponse(response).header(ODataHttpHeaders.DATASERVICEVERSION,ODataServiceVersion.V10);
  if (isContentTypeUpdateNecessary(contentType,response)) {
    odataResponseBuilder.contentHeader(contentType);
  }
  return odataResponseBuilder.build();
}
Program: 17948
Project: 17948
Buggy source:
private ContentType mapFormat(final UriInfoImpl uriInfo){
  String format=uriInfo.getFormat();
  if ("String_Node_Str".equals(format)) {
    return ContentType.APPLICATION_XML;
  }
 else   if ("String_Node_Str".equals(format)) {
    return ContentType.APPLICATION_ATOM_XML;
  }
 else   if ("String_Node_Str".equals(format)) {
    return ContentType.APPLICATION_JSON;
  }
  return ContentType.create(format);
}

Fixed version (ground truth):
private ContentType mapFormat(final UriInfoImpl uriInfo){
  String format=uriInfo.getFormat();
  if ("String_Node_Str".equals(format)) {
    return ContentType.APPLICATION_XML;
  }
 else   if ("String_Node_Str".equals(format)) {
    if (uriInfo.getUriType() == UriType.URI0) {
      return ContentType.APPLICATION_ATOM_SVC;
    }
    return ContentType.APPLICATION_ATOM_XML;
  }
 else   if ("String_Node_Str".equals(format)) {
    return ContentType.APPLICATION_JSON;
  }
  return ContentType.create(format);
}
Program: 17949
Project: 17949
Buggy source:
@Override ODataSingleProcessor createProcessor() throws ODataException {
  final String contentType=HttpContentType.APPLICATION_ATOM_XML_UTF8;
  final ODataResponse responseAtomXml=ODataResponse.status(HttpStatusCodes.OK).contentHeader(contentType).entity("String_Node_Str").build();
  when(((ServiceDocumentProcessor)processor).readServiceDocument(any(GetServiceDocumentUriInfo.class),eq(contentType))).thenReturn(responseAtomXml);
  final ODataResponse value=ODataResponse.status(HttpStatusCodes.OK).contentHeader("String_Node_Str").build();
  when(((ServiceDocumentProcessor)processor).readServiceDocument(any(GetServiceDocumentUriInfo.class),eq("String_Node_Str"))).thenReturn(value);
  when(((CustomContentType)processor).getCustomContentTypes(ServiceDocumentProcessor.class)).thenReturn(Arrays.asList("String_Node_Str"));
  return processor;
}

Fixed version (ground truth):
@Override ODataSingleProcessor createProcessor() throws ODataException {
  final String contentType="String_Node_Str";
  final ODataResponse responseAtomXml=ODataResponse.status(HttpStatusCodes.OK).contentHeader(contentType).entity("String_Node_Str").build();
  when(((ServiceDocumentProcessor)processor).readServiceDocument(any(GetServiceDocumentUriInfo.class),eq(contentType))).thenReturn(responseAtomXml);
  final ODataResponse value=ODataResponse.status(HttpStatusCodes.OK).contentHeader("String_Node_Str").build();
  when(((ServiceDocumentProcessor)processor).readServiceDocument(any(GetServiceDocumentUriInfo.class),eq("String_Node_Str"))).thenReturn(value);
  when(((CustomContentType)processor).getCustomContentTypes(ServiceDocumentProcessor.class)).thenReturn(Arrays.asList("String_Node_Str"));
  return processor;
}
Program: 17950
Project: 17950
Buggy source:
@Test public void testAtomFormatForServiceDocument() throws Exception {
  final HttpResponse response=executeGetRequest("String_Node_Str");
  final String responseEntity=StringHelper.httpEntityToString(response.getEntity());
  assertEquals("String_Node_Str",responseEntity);
  assertEquals(HttpStatusCodes.OK.getStatusCode(),response.getStatusLine().getStatusCode());
  final Header header=response.getFirstHeader(HttpHeaders.CONTENT_TYPE);
  assertEquals(HttpContentType.APPLICATION_ATOM_XML_UTF8,header.getValue());
}

Fixed version (ground truth):
@Test public void testAtomFormatForServiceDocument() throws Exception {
  final HttpResponse response=executeGetRequest("String_Node_Str");
  final String responseEntity=StringHelper.httpEntityToString(response.getEntity());
  assertEquals("String_Node_Str",responseEntity);
  assertEquals(HttpStatusCodes.OK.getStatusCode(),response.getStatusLine().getStatusCode());
  final Header header=response.getFirstHeader(HttpHeaders.CONTENT_TYPE);
  assertEquals("String_Node_Str",header.getValue());
}
Program: 17951
Project: 17951
Buggy source:
@Test public void serviceDocumentAcceptHeaderAtom() throws Exception {
  HttpResponse response=callUri("String_Node_Str",HttpHeaders.ACCEPT,HttpContentType.APPLICATION_ATOM_XML);
  checkMediaType(response,HttpContentType.APPLICATION_ATOM_SVC_UTF8);
  validateXmlServiceDocument(getBody(response));
}

Fixed version (ground truth):
@Test public void serviceDocumentAcceptHeaderAtom() throws Exception {
  final HttpResponse response=callUri("String_Node_Str",HttpHeaders.ACCEPT,HttpContentType.APPLICATION_ATOM_XML,HttpStatusCodes.NOT_ACCEPTABLE);
  assertXmlErrorResponse(response);
}
Program: 17952
Project: 17952
Buggy source:
@Test public void serviceDocumentAcceptHeaderUtf8Atom() throws Exception {
  HttpResponse response=callUri("String_Node_Str",HttpHeaders.ACCEPT,HttpContentType.APPLICATION_ATOM_XML_UTF8);
  checkMediaType(response,HttpContentType.APPLICATION_ATOM_SVC_UTF8);
  validateXmlServiceDocument(getBody(response));
}

Fixed version (ground truth):
@Test public void serviceDocumentAcceptHeaderUtf8Atom() throws Exception {
  final HttpResponse response=callUri("String_Node_Str",HttpHeaders.ACCEPT,HttpContentType.APPLICATION_ATOM_XML_UTF8,HttpStatusCodes.NOT_ACCEPTABLE);
  assertXmlErrorResponse(response);
}
Program: 17953
Project: 17953
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args) throws Exception {
  final List<String> paths=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  final String header=HttpHeaders.ACCEPT;
  final List<String> headerValues=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  final List<TestPath> testPaths=TestPath.createTestPaths(paths,header,headerValues);
  final CallerResultHandler handler=new CallerResultHandler();
  final String localBaseUrl="String_Node_Str";
  final CallerConfig localConfig=new CallerConfig(localBaseUrl,handler,testPaths);
  AcceptHeaderCaller.create(localConfig).call();
  final String result=handler.getResult();
  System.out.println(result);
}

Fixed version (ground truth):
/** 
 * @param args
 */
public static void main(String[] args) throws Exception {
  final List<String> paths=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  final String header=HttpHeaders.ACCEPT;
  final List<String> headerValues=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  final List<TestPath> testPaths=TestPath.createTestPaths(paths,header,headerValues);
  final CallerResultHandler handler=new CallerResultHandler();
  final String localBaseUrl="String_Node_Str";
  final CallerConfig localConfig=new CallerConfig(localBaseUrl,handler,testPaths);
  AcceptHeaderCaller.create(localConfig).call();
  final String result=handler.getResult();
  System.out.println(result);
}
Program: 17954
Project: 17954
Buggy source:
/** 
 * @see ServiceDocumentProcessor
 */
@Override public ODataResponse readServiceDocument(GetServiceDocumentUriInfo uriInfo,String contentType) throws ODataException {
  final Edm entityDataModel=getContext().getService().getEntityDataModel();
  final String serviceRoot=getContext().getPathInfo().getServiceRoot().toASCIIString();
  final ODataResponse response=EntityProvider.writeServiceDocument(contentType,entityDataModel,serviceRoot);
  final ODataResponseBuilder odataResponseBuilder=ODataResponse.fromResponse(response).header(ODataHttpHeaders.DATASERVICEVERSION,Edm.DATA_SERVICE_VERSION_10);
  if (!(contentType.equals(response.getContentHeader()) || (contentType.contains("String_Node_Str") && response.getContentHeader().contains("String_Node_Str")))) {
    odataResponseBuilder.contentHeader(contentType);
  }
  return odataResponseBuilder.build();
}

Fixed version (ground truth):
/** 
 * @see ServiceDocumentProcessor
 */
@Override public ODataResponse readServiceDocument(GetServiceDocumentUriInfo uriInfo,String contentType) throws ODataException {
  final Edm entityDataModel=getContext().getService().getEntityDataModel();
  final String serviceRoot=getContext().getPathInfo().getServiceRoot().toASCIIString();
  final ODataResponse response=EntityProvider.writeServiceDocument(contentType,entityDataModel,serviceRoot);
  final ODataResponseBuilder odataResponseBuilder=ODataResponse.fromResponse(response).header(ODataHttpHeaders.DATASERVICEVERSION,ODataServiceVersion.V10);
  if (!(contentType.equals(response.getContentHeader()) || (contentType.contains("String_Node_Str") && response.getContentHeader().contains("String_Node_Str")))) {
    odataResponseBuilder.contentHeader(contentType);
  }
  return odataResponseBuilder.build();
}
Program: 17955
Project: 17955
Buggy source:
@Override public InputStream getMetadata() throws ODataException {
  if (schemas == null) {
    schemas=edmProvider.getSchemas();
  }
  OutputStreamWriter writer=null;
  CircleStreamBuffer csb=new CircleStreamBuffer();
  try {
    DataServices metadata=new DataServices().setSchemas(schemas).setDataServiceVersion(getDataServiceVersion());
    writer=new OutputStreamWriter(csb.getOutputStream(),"String_Node_Str");
    EdmMetadata.writeMetadata(metadata,writer);
    return csb.getInputStream();
  }
 catch (  UnsupportedEncodingException e) {
    throw new EntityProviderException(EntityProviderException.COMMON,e);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        LOG.error(e.getLocalizedMessage(),e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public InputStream getMetadata() throws ODataException {
  if (schemas == null) {
    schemas=edmProvider.getSchemas();
  }
  OutputStreamWriter writer=null;
  CircleStreamBuffer csb=new CircleStreamBuffer();
  try {
    DataServices metadata=new DataServices().setSchemas(schemas).setDataServiceVersion(getDataServiceVersion());
    writer=new OutputStreamWriter(csb.getOutputStream(),"String_Node_Str");
    XmlMetadataProducer.writeMetadata(metadata,writer,null);
    return csb.getInputStream();
  }
 catch (  UnsupportedEncodingException e) {
    throw new EntityProviderException(EntityProviderException.COMMON,e);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        LOG.error(e.getLocalizedMessage(),e);
      }
    }
  }
}
Program: 17957
Project: 17957
Buggy source:
private static void writeAnnotationAttributes(Collection<AnnotationAttribute> annotationAttributes,XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
  if (annotationAttributes != null) {
    for (    AnnotationAttribute annotationAttribute : annotationAttributes) {
      xmlStreamWriter.writeAttribute(annotationAttribute.getPrefix(),annotationAttribute.getNamespace(),annotationAttribute.getName(),annotationAttribute.getText());
      xmlStreamWriter.writeNamespace(annotationAttribute.getPrefix(),annotationAttribute.getNamespace());
    }
  }
}

Fixed version (ground truth):
private static void writeAnnotationAttributes(Collection<AnnotationAttribute> annotationAttributes,XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
  if (annotationAttributes != null) {
    ArrayList<String> setNamespaces=new ArrayList<String>();
    for (    AnnotationAttribute annotationAttribute : annotationAttributes) {
      xmlStreamWriter.writeAttribute(annotationAttribute.getPrefix(),annotationAttribute.getNamespace(),annotationAttribute.getName(),annotationAttribute.getText());
      if (!setNamespaces.contains(annotationAttribute.getNamespace())) {
        xmlStreamWriter.writeNamespace(annotationAttribute.getPrefix(),annotationAttribute.getNamespace());
        setNamespaces.add(annotationAttribute.getNamespace());
      }
    }
  }
}
Program: 17958
Project: 17958
Buggy source:
private static void writeAnnotationElements(Collection<AnnotationElement> annotationElements,XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
  if (annotationElements != null) {
    for (    AnnotationElement annotationElement : annotationElements) {
      xmlStreamWriter.writeStartElement(annotationElement.getPrefix(),annotationElement.getName(),annotationElement.getNamespace());
      xmlStreamWriter.writeNamespace(annotationElement.getPrefix(),annotationElement.getNamespace());
      xmlStreamWriter.writeCharacters(annotationElement.getXmlData());
      xmlStreamWriter.writeEndElement();
    }
  }
}

Fixed version (ground truth):
private static void writeAnnotationElements(Collection<AnnotationElement> annotationElements,XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
  if (annotationElements != null) {
    ArrayList<String> setNamespaces=new ArrayList<String>();
    for (    AnnotationElement annotationElement : annotationElements) {
      xmlStreamWriter.writeStartElement(annotationElement.getPrefix(),annotationElement.getName(),annotationElement.getNamespace());
      if (!setNamespaces.contains(annotationElement.getNamespace())) {
        xmlStreamWriter.writeNamespace(annotationElement.getPrefix(),annotationElement.getNamespace());
        setNamespaces.add(annotationElement.getNamespace());
      }
      xmlStreamWriter.writeCharacters(annotationElement.getXmlData());
      xmlStreamWriter.writeEndElement();
    }
  }
}
Program: 17959
Project: 17959
Buggy source:
@Test public void testSchemaStructure() throws Exception {
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
}

Fixed version (ground truth):
@Test public void testSchemaStructure() throws Exception {
  System.out.println(metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
  assertXpathExists("String_Node_Str",metadata);
}
Program: 17960
Project: 17960
Buggy source:
@BeforeClass public static void setup() throws Exception {
  EdmImplProv edmImplProv=new EdmImplProv(new EdmProviderMock());
  EdmServiceMetadata serviceMetadata=edmImplProv.getServiceMetadata();
  metadata=StringHelper.inputStreamToString(serviceMetadata.getMetadata());
  Map<String,String> prefixMap=new HashMap<String,String>();
  prefixMap.put(null,"String_Node_Str");
  prefixMap.put("String_Node_Str","String_Node_Str");
  prefixMap.put("String_Node_Str","String_Node_Str");
  prefixMap.put("String_Node_Str","String_Node_Str");
  prefixMap.put("String_Node_Str","String_Node_Str");
  NamespaceContext ctx=new SimpleNamespaceContext(prefixMap);
  XMLUnit.setXpathNamespaceContext(ctx);
}

Fixed version (ground truth):
@BeforeClass public static void setup() throws Exception {
  EdmImplProv edmImplProv=new EdmImplProv(new EdmTestProvider());
  EdmServiceMetadata serviceMetadata=edmImplProv.getServiceMetadata();
  metadata=StringHelper.inputStreamToString(serviceMetadata.getMetadata());
  Map<String,String> prefixMap=new HashMap<String,String>();
  prefixMap.put(null,"String_Node_Str");
  prefixMap.put("String_Node_Str","String_Node_Str");
  prefixMap.put("String_Node_Str","String_Node_Str");
  prefixMap.put("String_Node_Str","String_Node_Str");
  prefixMap.put("String_Node_Str","String_Node_Str");
  NamespaceContext ctx=new SimpleNamespaceContext(prefixMap);
  XMLUnit.setXpathNamespaceContext(ctx);
}
Program: 17962
Project: 17962
Buggy source:
/** 
 * Add given content to message reference.
 */
public MessageReference addContent(Object... content){
  return new SimpleMessageReference(this.key,content);
}

Fixed version (ground truth):
/** 
 * Add given content to message reference.
 */
public MessageReference addContent(Object... content){
  if (this.content == null) {
    return new SimpleMessageReference(this.key,content);
  }
 else {
    List<Object> mergedContent=new ArrayList<Object>(this.content.size() + content.length);
    mergedContent.addAll(this.content);
    mergedContent.addAll(Arrays.asList(content));
    return new SimpleMessageReference(this.key,mergedContent);
  }
}
Program: 17963
Project: 17963
Buggy source:
private Response buildResponseForApplicationException(ODataApplicationException exception){
  ResponseBuilder responseBuilder=Response.noContent();
  Status status=extractStatus(exception);
  return responseBuilder.entity(exception.getMessage()).status(status).build();
}

Fixed version (ground truth):
private Response buildResponseForApplicationException(ODataApplicationException exception){
  ResponseBuilder responseBuilder=Response.noContent();
  int statusCode=extractStatus(exception);
  return responseBuilder.entity(exception.getMessage()).status(statusCode).build();
}
Program: 17964
Project: 17964
Buggy source:
private Status extractStatus(ODataException exception){
  Status extractedStatus=Status.INTERNAL_SERVER_ERROR;
  HttpStatusCodes httpStatus=null;
  if (exception instanceof ODataHttpException) {
    httpStatus=((ODataHttpException)exception).getHttpStatus();
  }
 else   if (exception instanceof ODataApplicationException) {
    httpStatus=((ODataApplicationException)exception).getHttpStatus();
  }
  if (httpStatus != null) {
    try {
      extractedStatus=Status.valueOf(httpStatus.name());
    }
 catch (    IllegalArgumentException e) {
      LOG.error("String_Node_Str",e);
    }
  }
  return extractedStatus;
}

Fixed version (ground truth):
private int extractStatus(ODataException exception){
  int extractedStatusCode=HttpStatusCodes.INTERNAL_SERVER_ERROR.getStatusCode();
  if (exception instanceof ODataHttpException) {
    extractedStatusCode=((ODataHttpException)exception).getHttpStatus().getStatusCode();
  }
 else   if (exception instanceof ODataApplicationException) {
    extractedStatusCode=((ODataApplicationException)exception).getHttpStatus().getStatusCode();
  }
  return extractedStatusCode;
}
Program: 17965
Project: 17965
Buggy source:
@Test public void testGenericHttpExceptions() throws ClientProtocolException, IOException, ODataException {
  List<ODataHttpException> toTestExceptions=new ArrayList<ODataHttpException>();
  toTestExceptions.add(new ODataNotFoundException(ODataNotFoundException.ENTITY));
  toTestExceptions.add(new ODataBadRequestException(ODataBadRequestException.COMMON));
  toTestExceptions.add(new ODataForbiddenException(ODataForbiddenException.COMMON));
  int firstKey=1;
  for (  ODataHttpException oDataException : toTestExceptions) {
    String key=String.valueOf(firstKey++);
    Matcher<GetEntityView> match=new EntityKeyMatcher(key);
    when(processor.readEntity(Matchers.argThat(match))).thenThrow(oDataException);
    String uri=getEndpoint().toString() + "String_Node_Str" + key+ "String_Node_Str";
    HttpGet get=new HttpGet(URI.create(uri));
    HttpResponse response=getHttpClient().execute(get);
    assertEquals("String_Node_Str" + oDataException.getClass().getSimpleName() + "String_Node_Str",oDataException.getHttpStatus().getStatusCode(),response.getStatusLine().getStatusCode());
    get.releaseConnection();
  }
}

Fixed version (ground truth):
@Test public void testGenericHttpExceptions() throws Exception {
  List<ODataHttpException> toTestExceptions=getHttpExceptionsForTest();
  int firstKey=1;
  for (  ODataHttpException oDataException : toTestExceptions) {
    String key=String.valueOf(firstKey++);
    Matcher<GetEntityView> match=new EntityKeyMatcher(key);
    when(processor.readEntity(Matchers.argThat(match))).thenThrow(oDataException);
    String uri=getEndpoint().toString() + "String_Node_Str" + key+ "String_Node_Str";
    HttpGet get=new HttpGet(URI.create(uri));
    HttpResponse response=getHttpClient().execute(get);
    assertEquals("String_Node_Str" + oDataException.getClass().getSimpleName() + "String_Node_Str",oDataException.getHttpStatus().getStatusCode(),response.getStatusLine().getStatusCode());
    get.releaseConnection();
  }
}
Program: 17966
Project: 17966
Buggy source:
@Override public Response toResponse(Exception exception){
  final Response response;
  Exception toHandleException=extractException(exception);
  exception.printStackTrace();
  if (toHandleException instanceof ODataApplicationException) {
    response=buildResponseForApplicationException((ODataApplicationException)toHandleException);
  }
 else   if (toHandleException instanceof ODataHttpException) {
    response=buildResponseForHttpException((ODataHttpException)toHandleException);
  }
 else {
    response=buildResponseForException(exception);
  }
  if (isInternalServerError(response)) {
    ODataExceptionMapperImpl.LOG.error(exception.getMessage(),exception);
  }
  return response;
}

Fixed version (ground truth):
@Override public Response toResponse(Exception exception){
  final Response response;
  Exception toHandleException=extractException(exception);
  if (toHandleException instanceof ODataApplicationException) {
    response=buildResponseForApplicationException((ODataApplicationException)toHandleException);
  }
 else   if (toHandleException instanceof ODataHttpException) {
    response=buildResponseForHttpException((ODataHttpException)toHandleException);
  }
 else {
    response=buildResponseForException(exception);
  }
  if (isInternalServerError(response)) {
    ODataExceptionMapperImpl.LOG.error(exception.getMessage(),exception);
  }
  return response;
}
Program: 17967
Project: 17967
Buggy source:
@Test public void test500RuntimeError() throws ClientProtocolException, IOException, ODataException {
  HttpGet get=new HttpGet(URI.create(this.getEndpoint().toString()));
  HttpResponse response=this.getHttpClient().execute(get);
  assertEquals(500,response.getStatusLine().getStatusCode());
  this.log.debug(StringHelper.inputStreamToString(response.getEntity().getContent()));
}

Fixed version (ground truth):
@Test public void test500RuntimeError() throws ClientProtocolException, IOException, ODataException {
  disableLogging(ODataExceptionMapperImpl.class);
  HttpGet get=new HttpGet(URI.create(this.getEndpoint().toString()));
  HttpResponse response=this.getHttpClient().execute(get);
  assertEquals(500,response.getStatusLine().getStatusCode());
  this.log.debug(StringHelper.inputStreamToString(response.getEntity().getContent()));
}
Program: 17968
Project: 17968
Buggy source:
@After public void after(){
  try {
    this.server.stopServer();
  }
  finally {
    FitStaticServiceFactory.setService(null);
  }
}

Fixed version (ground truth):
@After public void after(){
  reEnableLogging();
  try {
    this.server.stopServer();
  }
  finally {
    FitStaticServiceFactory.setService(null);
  }
}
Program: 17969
Project: 17969
Buggy source:
private void splitPath(InitParameter param) throws ODataException {
  List<PathSegment> precedingPathSegements;
  List<PathSegment> odataPathSegements;
  if (param.getPathSplit() == 0) {
    precedingPathSegements=Collections.emptyList();
    odataPathSegements=param.getPathSegments();
  }
 else {
    if (param.getPathSegments().size() < param.getPathSplit()) {
      throw new ODataBadRequestException(ODataBadRequestException.URLTOSHORT);
    }
    precedingPathSegements=param.getPathSegments().subList(0,param.getPathSplit());
    int pathSegmentCount=param.getPathSegments().size();
    odataPathSegements=param.getPathSegments().subList(param.getPathSplit(),pathSegmentCount);
  }
  for (  PathSegment ps : odataPathSegements) {
    if (!ps.getMatrixParameters().isEmpty()) {
      throw new ODataNotFoundException(ODataNotFoundException.MATRIX);
    }
  }
  this.context.setODataPathSegment(this.convertPathSegmentList(odataPathSegements));
  this.context.setPrecedingPathSegment(this.convertPathSegmentList(precedingPathSegements));
}

Fixed version (ground truth):
private void splitPath(InitParameter param) throws ODataException {
  List<PathSegment> precedingPathSegements;
  List<PathSegment> odataPathSegements;
  if (param.getPathSplit() == 0) {
    precedingPathSegements=Collections.emptyList();
    odataPathSegements=param.getPathSegments();
  }
 else {
    if (param.getPathSegments().size() < param.getPathSplit()) {
      throw new ODataBadRequestException(ODataBadRequestException.URLTOSHORT);
    }
    precedingPathSegements=param.getPathSegments().subList(0,param.getPathSplit());
    int pathSegmentCount=param.getPathSegments().size();
    odataPathSegements=param.getPathSegments().subList(param.getPathSplit(),pathSegmentCount);
  }
  for (  PathSegment ps : odataPathSegements) {
    if (ps.getMatrixParameters() != null && !ps.getMatrixParameters().isEmpty()) {
      throw new ODataNotFoundException(ODataNotFoundException.MATRIX);
    }
  }
  this.context.setODataPathSegment(this.convertPathSegmentList(odataPathSegements));
  this.context.setPrecedingPathSegment(this.convertPathSegmentList(precedingPathSegements));
}
Program: 17970
Project: 17970
Buggy source:
public EdmElementImplProv(EdmImplProv edm,String name,FullQualifiedName typeName,EdmFacets edmFacets,EdmMapping edmMapping) throws EdmException {
  super(edm,name,typeName,edmFacets == null || edmFacets.isNullable() ? EdmMultiplicity.ZERO_TO_ONE : EdmMultiplicity.ONE);
}

Fixed version (ground truth):
public EdmElementImplProv(EdmImplProv edm,String name,FullQualifiedName typeName,EdmFacets edmFacets,EdmMapping edmMapping) throws EdmException {
  super(edm,name,typeName,edmFacets == null || edmFacets.isNullable() ? EdmMultiplicity.ZERO_TO_ONE : EdmMultiplicity.ONE);
  this.edmFacets=edmFacets;
  this.edmMapping=edmMapping;
}
Program: 17971
Project: 17971
Buggy source:
@Override protected EdmEntityContainer createEntityContainer(String name) throws ODataException {
  return new EdmEntityContainerImplProv(this,edmProvider.getEntityContainer(name));
}

Fixed version (ground truth):
@Override protected EdmEntityContainer createEntityContainer(String name) throws ODataException {
  EntityContainerInfo enitityContainerInfo=edmProvider.getEntityContainer(name);
  if (enitityContainerInfo == null) {
    throw new EdmException(EdmException.COMMON);
  }
  return new EdmEntityContainerImplProv(this,enitityContainerInfo);
}
Program: 17972
Project: 17972
Buggy source:
@Override protected EdmComplexType createComplexType(FullQualifiedName fqName) throws ODataException {
  return new EdmComplexTypeImplProv(this,edmProvider.getComplexType(fqName),fqName.getNamespace());
}

Fixed version (ground truth):
@Override protected EdmComplexType createComplexType(FullQualifiedName fqName) throws ODataException {
  ComplexType complexType=edmProvider.getComplexType(fqName);
  if (complexType == null) {
    throw new EdmException(EdmException.COMMON);
  }
  return new EdmComplexTypeImplProv(this,complexType,fqName.getNamespace());
}
Program: 17973
Project: 17973
Buggy source:
@Override protected EdmAssociation createAssociation(FullQualifiedName fqName) throws ODataException {
  return new EdmAssociationImplProv(this,edmProvider.getAssociation(fqName),fqName.getNamespace());
}

Fixed version (ground truth):
@Override protected EdmAssociation createAssociation(FullQualifiedName fqName) throws ODataException {
  Association association=edmProvider.getAssociation(fqName);
  if (association == null) {
    throw new EdmException(EdmException.COMMON);
  }
  return new EdmAssociationImplProv(this,association,fqName.getNamespace());
}
Program: 17974
Project: 17974
Buggy source:
@Override protected EdmEntityType createEntityType(FullQualifiedName fqName) throws ODataException {
  return new EdmEntityTypeImplProv(this,edmProvider.getEntityType(fqName),fqName.getNamespace());
}

Fixed version (ground truth):
@Override protected EdmEntityType createEntityType(FullQualifiedName fqName) throws ODataException {
  EntityType entityType=edmProvider.getEntityType(fqName);
  if (entityType == null) {
    throw new EdmException(EdmException.COMMON);
  }
  return new EdmEntityTypeImplProv(this,entityType,fqName.getNamespace());
}
Program: 17975
Project: 17975
Buggy source:
private void handleNormalInitialSegment() throws UriParserException, EdmException {
  final Matcher matcher=INITIAL_SEGMENT_PATTERN.matcher(currentPathSegment);
  if (!matcher.matches())   throw new UriParserException("String_Node_Str" + currentPathSegment);
  final String entityContainerName=matcher.group(1);
  final String segmentName=matcher.group(2);
  final String keyPredicate=matcher.group(3);
  final String emptyParentheses=matcher.group(4);
  UriParserImpl.LOG.debug("String_Node_Str" + currentPathSegment + "String_Node_Str"+ entityContainerName+ "String_Node_Str"+ segmentName+ "String_Node_Str"+ keyPredicate+ "String_Node_Str"+ emptyParentheses);
  uriResult.setEntityContainer(entityContainerName == null ? edm.getDefaultEntityContainer() : edm.getEntityContainer(entityContainerName));
  EdmEntitySet entitySet=null;
  EdmFunctionImport functionImport=null;
  try {
    entitySet=uriResult.getEntityContainer().getEntitySet(segmentName);
  }
 catch (  EdmException e) {
    functionImport=uriResult.getEntityContainer().getFunctionImport(segmentName);
  }
  if (entitySet != null) {
    uriResult.setStartEntitySet(entitySet);
    handleEntitySet(entitySet,keyPredicate);
  }
 else {
    uriResult.setFunctionImport(functionImport);
    handleFunctionImport(functionImport,emptyParentheses,keyPredicate);
  }
}

Fixed version (ground truth):
private void handleNormalInitialSegment() throws UriParserException, EdmException {
  final Matcher matcher=INITIAL_SEGMENT_PATTERN.matcher(currentPathSegment);
  if (!matcher.matches())   throw new UriParserException("String_Node_Str" + currentPathSegment);
  final String entityContainerName=matcher.group(1);
  final String segmentName=matcher.group(2);
  final String keyPredicate=matcher.group(3);
  final String emptyParentheses=matcher.group(4);
  UriParserImpl.LOG.debug("String_Node_Str" + currentPathSegment + "String_Node_Str"+ entityContainerName+ "String_Node_Str"+ segmentName+ "String_Node_Str"+ keyPredicate+ "String_Node_Str"+ emptyParentheses);
  uriResult.setEntityContainer(entityContainerName == null ? edm.getDefaultEntityContainer() : edm.getEntityContainer(entityContainerName));
  EdmEntitySet entitySet=null;
  EdmFunctionImport functionImport=null;
  try {
    entitySet=uriResult.getEntityContainer().getEntitySet(segmentName);
  }
 catch (  EdmException e) {
    functionImport=uriResult.getEntityContainer().getFunctionImport(segmentName);
  }
  if (entitySet != null) {
    uriResult.setStartEntitySet(entitySet);
    handleEntitySet(entitySet,keyPredicate);
  }
 else   if (functionImport != null) {
    uriResult.setFunctionImport(functionImport);
    handleFunctionImport(functionImport,emptyParentheses,keyPredicate);
  }
 else {
    throw new UriParserException("String_Node_Str" + segmentName);
  }
}
Program: 17976
Project: 17976
Buggy source:
@Override public EdmEntitySet getRelatedEntitySet(EdmNavigationProperty navigationProperty) throws EdmException {
  return null;
}

Fixed version (ground truth):
@Override public EdmEntitySet getRelatedEntitySet(EdmNavigationProperty navigationProperty) throws EdmException {
  EdmAssociationSet associationSet=edmEntityContainer.getAssociationSet(edmEntityContainer.getEntitySet(entitySet.getName()),navigationProperty);
  if (associationSet == null)   throw new EdmException();
  EdmAssociationSetEnd toEnd=associationSet.getEnd(navigationProperty.getToRole());
  if (toEnd == null)   throw new EdmException();
  EdmEntitySet targetEntitySet=toEnd.getEntitySet();
  if (targetEntitySet == null)   throw new EdmException();
  return targetEntitySet;
}
Program: 17977
Project: 17977
Buggy source:
@Override public Collection<String> getKeyPropertyNames() throws EdmException {
  return entityType.getKey().getKeys().keySet();
}

Fixed version (ground truth):
@Override public Collection<String> getKeyPropertyNames() throws EdmException {
  if (entityType.getKey() == null)   return Collections.<String>emptyList();
 else   return entityType.getKey().getKeys().keySet();
}
Program: 17978
Project: 17978
Buggy source:
@Override public List<EdmProperty> getKeyProperties() throws EdmException {
  if (edmKeyProperties == null) {
    String keyPropertyName;
    EdmProperty edmProperty;
    Collection<String> keyPropertyNames=getKeyPropertyNames();
    for (Iterator<String> iterator=keyPropertyNames.iterator(); iterator.hasNext(); ) {
      keyPropertyName=iterator.next();
      try {
        edmProperty=(EdmProperty)getProperty(keyPropertyName);
      }
 catch (      ClassCastException e) {
        throw new EdmException(e);
      }
      if (edmProperty != null) {
        edmKeyProperties.add(edmProperty);
      }
 else {
        throw new EdmException();
      }
    }
  }
  return edmKeyProperties;
}

Fixed version (ground truth):
@Override public List<EdmProperty> getKeyProperties() throws EdmException {
  if (edmKeyProperties == null) {
    EdmProperty edmProperty;
    edmKeyProperties=new ArrayList<EdmProperty>();
    for (    String keyPropertyName : getKeyPropertyNames()) {
      try {
        edmProperty=(EdmProperty)getProperty(keyPropertyName);
      }
 catch (      ClassCastException e) {
        throw new EdmException(e);
      }
      if (edmProperty != null) {
        edmKeyProperties.add(edmProperty);
      }
 else {
        throw new EdmException();
      }
    }
    if (edmBaseType != null)     edmKeyProperties.addAll(((EdmEntityType)edmBaseType).getKeyProperties());
  }
  return edmKeyProperties;
}
Program: 17980
Project: 17980
Buggy source:
private Integer applySystemQueryOptions(final EdmEntitySet targetEntitySet,List<?> data,final InlineCount inlineCount,final String filter,final String orderBy,final String skipToken,final int skip,final Integer top){
  if (filter != null)   for (  Object element : data)   if (!appliesFilter(element,filter))   data.remove(element);
  final Integer count=inlineCount == InlineCount.ALLPAGES ? data.size() : null;
  if (orderBy != null)   ;
 else   if (skipToken != null || skip != 0 || top != null)   ;
  if (skipToken != null)   ;
  for (int i=0; i < skip; i++)   data.remove(0);
  if (top != null)   while (data.size() > top)   data.remove(top.intValue());
  return count;
}

Fixed version (ground truth):
private Integer applySystemQueryOptions(final EdmEntitySet targetEntitySet,List<?> data,final InlineCount inlineCount,final String filter,final String orderBy,final String skipToken,final int skip,final Integer top) throws ODataException {
  if (filter != null)   for (  Object element : data)   if (!appliesFilter(element,filter))   data.remove(element);
  final Integer count=inlineCount == InlineCount.ALLPAGES ? data.size() : null;
  if (orderBy != null)   ;
 else   if (skipToken != null || skip != 0 || top != null)   if (data instanceof Comparable<?>)   Collections.sort((List<? extends Comparable<Object>>)data);
 else   throw new ODataException();
  if (skipToken != null)   ;
  for (int i=0; i < skip; i++)   data.remove(0);
  if (top != null)   while (data.size() > top)   data.remove(top.intValue());
  return count;
}
Program: 17981
Project: 17981
Buggy source:
@Override public Object readRelatedData(final EdmEntitySet sourceEntitySet,final Object sourceData,final EdmEntitySet targetEntitySet,final Map<String,Object> targetKeys) throws ODataException {
  if ("String_Node_Str".equals(targetEntitySet.getName())) {
    ArrayList<Object> data=new ArrayList<Object>();
    if ("String_Node_Str".equals(sourceEntitySet.getName())) {
      for (      final Employee employee : dataContainer.getEmployeeSet())       if (employee.getTeam().getId().equals(((Team)sourceData).getId()))       data.add(employee);
    }
 else     if ("String_Node_Str".equals(sourceEntitySet.getName())) {
      for (      final Employee employee : dataContainer.getEmployeeSet())       if (employee.getRoom().getId().equals(((Room)sourceData).getId()))       data.add(employee);
    }
 else     if ("String_Node_Str".equals(sourceEntitySet.getName())) {
      for (      final Employee employee : dataContainer.getEmployeeSet())       if (employee.getManager().getId().equals(((Manager)sourceData).getId()))       data.add(employee);
    }
    if (data.isEmpty())     throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
 else     return data;
  }
 else {
    throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
  }
}

Fixed version (ground truth):
@Override public Object readRelatedData(final EdmEntitySet sourceEntitySet,final Object sourceData,final EdmEntitySet targetEntitySet,final Map<String,Object> targetKeys) throws ODataException {
  if ("String_Node_Str".equals(targetEntitySet.getName())) {
    ArrayList<Object> data=new ArrayList<Object>();
    if ("String_Node_Str".equals(sourceEntitySet.getName())) {
      for (      final Employee employee : dataContainer.getEmployeeSet())       if (employee.getTeam().getId().equals(((Team)sourceData).getId()))       data.add(employee);
    }
 else     if ("String_Node_Str".equals(sourceEntitySet.getName())) {
      for (      final Employee employee : dataContainer.getEmployeeSet())       if (employee.getRoom().getId().equals(((Room)sourceData).getId()))       data.add(employee);
    }
 else     if ("String_Node_Str".equals(sourceEntitySet.getName())) {
      for (      final Employee employee : dataContainer.getEmployeeSet())       if (employee.getManager().getId().equals(((Manager)sourceData).getId()))       data.add(employee);
    }
    if (data.isEmpty())     throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
 else     return data;
  }
 else   if ("String_Node_Str".equals(targetEntitySet.getName())) {
    if (((Employee)sourceData).getTeam() == null)     throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
 else     return ((Employee)sourceData).getTeam();
  }
 else   if ("String_Node_Str".equals(targetEntitySet.getName())) {
    return null;
  }
 else {
    throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
  }
}
Program: 17982
Project: 17982
Buggy source:
private void handleFunctionImport(final EdmFunctionImport functionImport,final String emptyParentheses,final String keyPredicate) throws UriParserException, EdmException {
  final EdmTyped returnType=functionImport.getReturnType();
  final EdmType type=returnType.getType();
  final boolean isCollection=returnType.getMultiplicity() == EdmMultiplicity.MANY;
  if (type.getKind() == EdmTypeKind.ENTITY && isCollection) {
    handleEntitySet(functionImport.getEntitySet(),keyPredicate);
    return;
  }
  if (emptyParentheses != null)   throw new UriParserException("String_Node_Str");
  this.uriResult.setTargetType(type);
switch (type.getKind()) {
case SIMPLE:
    uriResult.setUriType(isCollection ? UriType.URI13 : UriType.URI14);
  break;
case COMPLEX:
uriResult.setUriType(isCollection ? UriType.URI11 : UriType.URI12);
break;
case ENTITY:
uriResult.setUriType(UriType.URI10);
break;
default :
throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ pathSegments);
}
if (!this.pathSegments.isEmpty()) if (this.uriResult.getUriType() == UriType.URI14) {
currentPathSegment=pathSegments.remove(0).getPath();
if ("String_Node_Str".equals(currentPathSegment)) uriResult.setValue(true);
 else throw new UriParserException("String_Node_Str" + currentPathSegment);
}
if (!pathSegments.isEmpty()) throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ this.pathSegments);
}

Fixed version (ground truth):
private void handleFunctionImport(final EdmFunctionImport functionImport,final String emptyParentheses,final String keyPredicate) throws UriParserException, EdmException {
  final EdmTyped returnType=functionImport.getReturnType();
  final EdmType type=returnType.getType();
  final boolean isCollection=returnType.getMultiplicity() == EdmMultiplicity.MANY;
  if (type.getKind() == EdmTypeKind.ENTITY && isCollection) {
    handleEntitySet(functionImport.getEntitySet(),keyPredicate);
    return;
  }
  if (emptyParentheses != null)   throw new UriParserException("String_Node_Str");
  uriResult.setTargetType(type);
switch (type.getKind()) {
case SIMPLE:
    uriResult.setUriType(isCollection ? UriType.URI13 : UriType.URI14);
  break;
case COMPLEX:
uriResult.setUriType(isCollection ? UriType.URI11 : UriType.URI12);
break;
case ENTITY:
uriResult.setUriType(UriType.URI10);
break;
default :
throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ pathSegments);
}
if (!pathSegments.isEmpty()) if (uriResult.getUriType() == UriType.URI14) {
currentPathSegment=pathSegments.remove(0).getPath();
if ("String_Node_Str".equals(currentPathSegment)) uriResult.setValue(true);
 else throw new UriParserException("String_Node_Str" + currentPathSegment);
}
ensureLastSegment();
}
Program: 17983
Project: 17983
Buggy source:
private void handleEntitySet(final EdmEntitySet entitySet,final String keyPredicate) throws UriParserException, EdmException {
  final EdmEntityType entityType=entitySet.getEntityType();
  this.uriResult.setTargetType(entityType);
  this.uriResult.setTargetEntitySet(entitySet);
  if (keyPredicate == null) {
    if (this.pathSegments.isEmpty()) {
      this.uriResult.setUriType(UriType.URI1);
    }
 else {
      currentPathSegment=pathSegments.remove(0).getPath();
      checkCount();
      if (uriResult.isCount())       uriResult.setUriType(UriType.URI15);
 else       throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ this.pathSegments);
    }
  }
 else {
    this.uriResult.setKeyPredicates(this.parseKey(keyPredicate,entityType));
    if (this.pathSegments.isEmpty())     this.uriResult.setUriType(UriType.URI2);
 else     handleNavigationPathOptions();
  }
}

Fixed version (ground truth):
private void handleEntitySet(final EdmEntitySet entitySet,final String keyPredicate) throws UriParserException, EdmException {
  final EdmEntityType entityType=entitySet.getEntityType();
  uriResult.setTargetType(entityType);
  uriResult.setTargetEntitySet(entitySet);
  if (keyPredicate == null) {
    if (pathSegments.isEmpty()) {
      uriResult.setUriType(UriType.URI1);
    }
 else {
      currentPathSegment=pathSegments.remove(0).getPath();
      checkCount();
      if (uriResult.isCount())       uriResult.setUriType(UriType.URI15);
 else       throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ this.pathSegments);
    }
  }
 else {
    uriResult.setKeyPredicates(parseKey(keyPredicate,entityType));
    if (pathSegments.isEmpty())     uriResult.setUriType(UriType.URI2);
 else     handleNavigationPathOptions();
  }
}
Program: 17985
Project: 17985
Buggy source:
private void handlePropertyPath(final EdmProperty property) throws UriParserException, EdmException {
  this.uriResult.addProperty(property);
  final EdmType type=property.getType();
  if (pathSegments.isEmpty()) {
    if (type.getKind() == EdmTypeKind.SIMPLE)     if (this.uriResult.getPropertyPath().size() == 1)     this.uriResult.setUriType(UriType.URI5);
 else     this.uriResult.setUriType(UriType.URI4);
 else     if (type.getKind() == EdmTypeKind.COMPLEX)     this.uriResult.setUriType(UriType.URI3);
 else     throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ pathSegments);
    this.uriResult.setTargetType(type);
  }
 else {
    currentPathSegment=pathSegments.remove(0).getPath();
switch (type.getKind()) {
case SIMPLE:
      if ("String_Node_Str".equals(currentPathSegment))       if (this.pathSegments.isEmpty()) {
        this.uriResult.setValue(true);
        if (this.uriResult.getPropertyPath().size() == 1)         this.uriResult.setUriType(UriType.URI5);
 else         this.uriResult.setUriType(UriType.URI4);
      }
 else {
        throw new UriParserException("String_Node_Str");
      }
 else       throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ this.pathSegments);
    this.uriResult.setTargetType(type);
  break;
case COMPLEX:
final EdmProperty nextProperty=(EdmProperty)((EdmComplexType)type).getProperty(currentPathSegment);
handlePropertyPath(nextProperty);
break;
default :
throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ pathSegments);
}
}
}

Fixed version (ground truth):
private void handlePropertyPath(final EdmProperty property) throws UriParserException, EdmException {
  this.uriResult.addProperty(property);
  final EdmType type=property.getType();
  if (pathSegments.isEmpty()) {
    if (type.getKind() == EdmTypeKind.SIMPLE)     if (this.uriResult.getPropertyPath().size() == 1)     this.uriResult.setUriType(UriType.URI5);
 else     this.uriResult.setUriType(UriType.URI4);
 else     if (type.getKind() == EdmTypeKind.COMPLEX)     this.uriResult.setUriType(UriType.URI3);
 else     throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ pathSegments);
    this.uriResult.setTargetType(type);
  }
 else {
    currentPathSegment=pathSegments.remove(0).getPath();
switch (type.getKind()) {
case SIMPLE:
      if ("String_Node_Str".equals(currentPathSegment)) {
        ensureLastSegment();
        uriResult.setValue(true);
        if (uriResult.getPropertyPath().size() == 1)         uriResult.setUriType(UriType.URI5);
 else         uriResult.setUriType(UriType.URI4);
      }
 else {
        throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ this.pathSegments);
      }
    uriResult.setTargetType(type);
  break;
case COMPLEX:
final EdmProperty nextProperty=(EdmProperty)((EdmComplexType)type).getProperty(currentPathSegment);
handlePropertyPath(nextProperty);
break;
default :
throw new UriParserException("String_Node_Str" + currentPathSegment + "String_Node_Str"+ pathSegments);
}
}
}