Alex created DIRAPI-409: --------------------------- Summary: unchecked function result in JavaStoredProcUtils.java Key: DIRAPI-409 URL: https://issues.apache.org/jira/browse/DIRAPI-409 Project: Directory Client API Issue Type: Bug Reporter: Alex
if in.read(buf) returns -1, the try block will not work because the exception will not be raised. If in.read(buf) returns -1, it means that the end of the stream has been reached or an error occurred while reading (From the documentation: "If no bytes are available because the stream is at the end of the file, the value -1 is returned"). There will be no exception in this case There is no check in the getClassFileAsStream(Class<?> clazz) function that in.read(buf) returned -1. The function will continue executing the code and return the buf value. The finally block will fire, but in will be closed even if not all data has been read. This function is called in loadStoredProcedureClass( LdapContext ctx, Class<?> clazz), where there is also a check for the received buf value. That is, if the stream is at the end of the file, then the function will write "-1" instead of writing the byte code. It is necessary to add additional checks for the return value in.read(buf ). https://github.com/apache/directory-ldap-api/blob/ff9b56ecb984bdbed0f4df25da1485e8a4b4a870/ldap/extras/sp/src/main/java/org/apache/directory/api/ldap/sp/JavaStoredProcUtils.java#L72-L88 -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org For additional commands, e-mail: dev-h...@directory.apache.org