Buggy code:
@ Override public void readServiceDocument ( ServiceDocumentRequest request , ServiceDocumentResponse response ) throws ODataApplicationException , ODataLibraryException { } class UniqueNameGenerator { private final AtomicInteger groupCount = new AtomicInteger ( 0 ) ; public String getNextGroup ( ) { } } @ Override public < T extends ServiceResponse > void read ( final DataRequest request , T response ) throws ODataApplicationException , ODataLibraryException { final ODataSQLBuilder visitor = new ODataSQLBuilder ( TeiidServiceHandler . getClient ( ) . getMetadataStore ( ) , this . prepared , true , request . getODataRequest ( ) . getRawBaseUri ( ) , this . serviceMetadata , this . nameGenerator ) ; visitor . visit ( request . getUriInfo ( ) ) ; final BaseResponse queryResponse ; try { Query query = visitor . selectQuery ( ) ; queryResponse = executeQuery ( request , visitor , query ) ; } catch ( Exception e ) { throw new ODataApplicationException ( e . getMessage ( ) , INTERNAL_SERVER_ERROR . getStatusCode ( ) , Locale . getDefault ( ) , e ) ; } response . accepts ( new ServiceResponseVisior ( ) { public void visit ( CountResponse response ) throws ODataApplicationException , ODataLibraryException { org . teiid . odata . api . CountResponse cr = ( ( org . teiid . odata . api . CountResponse ) ( queryResponse ) ) ; response . writeCount ( cr . getCount ( ) ) ; } public void visit ( PrimitiveValueResponse response ) throws ODataApplicationException , ODataLibraryException { EntityCollection entitySet = ( ( EntityCollection ) ( queryResponse ) ) ; Entity entity = entitySet . getEntities ( ) . get ( 0 ) ; EdmProperty edmProperty = request . getUriResourceProperty ( ) . getProperty ( ) ; Property property = entity . getProperty ( edmProperty . getName ( ) ) ; if ( property == null ) { response . writeNotFound ( true ) ; } else if ( ( property . getValue ( ) ) == null ) { response . writeNoContent ( true ) ; } response . write ( property . getValue ( ) ) ; } public void visit ( PropertyResponse response ) throws ODataApplicationException , ODataLibraryException { EntityCollection entitySet = ( ( EntityCollection ) ( queryResponse ) ) ; if ( ! ( entitySet . getEntities ( ) . isEmpty ( ) ) ) { Entity entity = entitySet . getEntities ( ) . get ( 0 ) ; EdmProperty edmProperty = request . getUriResourceProperty ( ) . getProperty ( ) ; Property property = entity . getProperty ( edmProperty . getName ( ) ) ; response . writeProperty ( edmProperty . getType ( ) , property ) ; } else { response . writeNotFound ( true ) ; } } public void visit ( StreamResponse response ) throws ODataApplicationException , ODataLibraryException { EntityCollectionResponse entitySet = ( ( EntityCollectionResponse ) ( queryResponse ) ) ; EdmProperty edmProperty = request . getUriResourceProperty ( ) . getProperty ( ) ; Object value = entitySet . getStream ( edmProperty . getName ( ) ) ; if ( value == null ) { response . writeNoContent ( true ) ; } else { try { handleLobResult ( TeiidServiceHandler . getClient ( ) . getProperty ( CHARSET ) , value , response ) ; } catch ( SQLException e ) { LogManager . logDetail ( CTX_ODATA , e ) ; response . writeServerError ( true ) ; } } } public void visit ( EntityResponse response ) throws ODataApplicationException , ODataLibraryException { EntityCollection entitySet = ( ( EntityCollection ) ( queryResponse ) ) ; if ( entitySet . getEntities ( ) . isEmpty ( ) ) { <START_BUG> response . writeNoContent ( true ) ; <END_BUG> } else { response . writeReadEntity ( visitor . getContext ( ) . getEdmEntityType ( ) , entitySet . getEntities ( ) . get ( 0 ) ) ; } } public void visit ( EntitySetResponse response ) throws ODataApplicationException , ODataLibraryException { sendResults ( request , visitor , queryResponse , response ) ; } } ) ; } private void sendResults ( final DataRequest request , final ODataSQLBuilder visitor , final BaseResponse queryResponse , EntitySetResponse response ) throws ODataApplicationException , SerializerException { } String buildNextToken ( final String queryPath , String nextToken ) throws MalformedURLException , URISyntaxException { } private void sendResults ( final DataRequest request , final ODataSQLBuilder visitor , final BaseResponse queryResponse , EdmComplexResponse response ) throws ODataApplicationException , SerializerException { } private BaseResponse executeQuery ( final DataRequest request , final ODataSQLBuilder visitor , Query query ) throws SQLException { } private void checkExpand ( UriInfoResource queryInfo ) { } private UpdateResponse performInsert ( String rawURI , UriInfo uriInfo , EdmEntityType entityType , Entity entity ) throws SQLException , TeiidException { } private UpdateResponse performDeepInsert ( String rawURI , UriInfo uriInfo , EdmEntityType entityType , Entity entity ) throws SQLException , TeiidException { } private Set < EdmNavigationProperty > deepInsertNames ( EdmEntityType entityType , Entity entity ) { } @ Override public void createEntity ( DataRequest request , Entity entity , EntityResponse response ) throws ODataApplicationException , ODataLibraryException { } @ Override public void updateEntity ( DataRequest request , Entity entity , boolean merge , String entityETag , EntityResponse response ) throws ODataApplicationException , ODataLibraryException { } private void checkETag ( String entityETag ) throws ODataApplicationException { } @ Override public void deleteEntity ( DataRequest request , String entityETag , EntityResponse response ) throws ODataApplicationException , ODataLibraryException { } @ Override public void updateProperty ( DataRequest request , Property property , boolean merge , String entityETag , PropertyResponse response ) throws ODataApplicationException , ODataLibraryException { } @ Override public void upsertStreamProperty ( DataRequest request , String entityETag , InputStream streamContent , NoContentResponse response ) throws ODataApplicationException , ODataLibraryException { } @ Override public < T extends ServiceResponse > void invoke ( final FunctionRequest request , HttpMethod method , T response ) throws ODataApplicationException , ODataLibraryException { }

Fix:
response . writeNotFound ( true ) ;