[
https://issues.apache.org/jira/browse/IGNITE-15350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vladimir Steshin updated IGNITE-15350:
--------------------------------------
Description:
Current EncryptedFileIO has wierd implementations of several methods. Like
{code:java}
@Override public int write(byte[] buf, int off, int len) throws IOException {
throw new UnsupportedOperationException("Encrypted File doesn't support
this operation");
}
{code}
@Override public int read(byte[] buf, int off, int len) throws IOException {
throw new UnsupportedOperationException("Encrypted File doesn't support
this operation");
}
Why not supported?
Or:
{code:java}
@Override public int read(ByteBuffer destBuf) throws IOException {
assert position() == 0;
return plainFileIO.read(destBuf);
}
{code}
Why encrypted reading is not supported beyond the header? Why `assert
position() == 0`
The class contains several writes and reading implemented differently. Some of
them are not supported.
*Suggestion:* Make one write(...) and one read(...) implementation and call
them passing correct arguments. Read/write the header without encryption.
Read/write everything beyond the header with encryption.
was:
Current EncryptedFileIO has wierd implementations of several methods. Like
{code:java}
@Override public int write(byte[] buf, int off, int len) throws IOException {
throw new UnsupportedOperationException("Encrypted File doesn't support
this operation");
}
{code}
@Override public int read(byte[] buf, int off, int len) throws IOException {
throw new UnsupportedOperationException("Encrypted File doesn't support
this operation");
}
Why not supported?
Or:
{code:java}
@Override public int read(ByteBuffer destBuf) throws IOException {
assert position() == 0;
return plainFileIO.read(destBuf);
}
{code}
Why encrypted reading is not supported beyond the header? Why `assert
position() == 0`
The class contains several writes and reading implemented differently. Some of
them are not supported.
Suggestion: Make one write(...) and one read(...) implementation and call them
passing correct arguments. Read/write the header without encryption. Read/write
everything beyond the header with encryption.
> Refactor EncryptedFileIO
> ------------------------
>
> Key: IGNITE-15350
> URL: https://issues.apache.org/jira/browse/IGNITE-15350
> Project: Ignite
> Issue Type: Task
> Reporter: Vladimir Steshin
> Priority: Minor
>
> Current EncryptedFileIO has wierd implementations of several methods. Like
> {code:java}
> @Override public int write(byte[] buf, int off, int len) throws IOException {
> throw new UnsupportedOperationException("Encrypted File doesn't
> support this operation");
> }
> {code}
> @Override public int read(byte[] buf, int off, int len) throws
> IOException {
> throw new UnsupportedOperationException("Encrypted File doesn't
> support this operation");
> }
> Why not supported?
> Or:
> {code:java}
> @Override public int read(ByteBuffer destBuf) throws IOException {
> assert position() == 0;
> return plainFileIO.read(destBuf);
> }
> {code}
> Why encrypted reading is not supported beyond the header? Why `assert
> position() == 0`
> The class contains several writes and reading implemented differently. Some
> of them are not supported.
> *Suggestion:* Make one write(...) and one read(...) implementation and call
> them passing correct arguments. Read/write the header without encryption.
> Read/write everything beyond the header with encryption.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)