In the following code of HdfsBroker.java

<code>
    public void Read(ResponseCallbackRead cb, int fd, int amount) {
        int error = Error.OK;
        OpenFileData ofd;

        try {

            if ((ofd = mOpenFileMap.Get(fd)) == null) {
                error = Error.DFSBROKER_BAD_FILE_HANDLE;
                throw new IOException("Invalid file handle " + fd);
            }

            /**
            if (mVerbose)
                log.info("Reading " + amount + " bytes from fd=" +
fd);
            */

            if (ofd.is == null) {
                error = Error.DFSBROKER_INVALID_ARGUMENT;
                throw new IOException("File handle " + fd + " not open
for reading");
            }

            long offset = ofd.is.getPos();

            byte [] data = new byte [ amount ];
            int nread = 0;

            error = Error.DFSBROKER_IO_ERROR;

            while (nread < amount) {
                int r = ofd.is.read(data, nread, amount - nread);

                if (r < 0) break;

                nread += r;
            }

            error = cb.response(offset, nread, data);

        }
        catch (IOException e) {
            log.info("I/O exception - " + e.getMessage());
            error = cb.error(error, e.getMessage());
        }
        catch (BufferUnderflowException e) {
            e.printStackTrace();
            error = cb.error(Error.PROTOCOL_ERROR, e.getMessage());
        }

        if (error != Error.OK)
            log.severe("Error sending WRITE response back");
    }
</code>

If ofd.is.read(data, nread, amount - nread) throws an IOException, the
error code returned through cb.error(error, ...) would be Error.OK.
Close(), Write(), PositionedRead() and Remove() also have similar
problems.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Hypertable Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/hypertable-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to