Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODE-1562 changed getResourceLength impl #451

Merged
merged 1 commit into from Jul 24, 2012
Merged

Conversation

@kosch
Copy link
Contributor

kosch commented Jul 22, 2012

Reading the stream to determine size is extremly slow. I think it was originally implemented due lack of getLength() or different node structure...

@rhauch
rhauch reviewed Jul 23, 2012
View changes
...odeshape-web-jcr-webdav/src/main/java/org/modeshape/web/jcr/webdav/DefaultContentMapper.java Outdated
while (-1 != (bytesRead = is.read(buff, 0, 255))) {
size += bytesRead;
if(node == null){
throw new IOException("node is null");
}

This comment has been minimized.

Copy link
@rhauch

rhauch Jul 23, 2012

Contributor

Strictly speaking, this null check isn't required per the contract of the ContentMapper interface, which says that Node should never be null. Plus, the place where it's called will never pass in a null Node reference.

@rhauch

This comment has been minimized.

Copy link
Contributor

rhauch commented Jul 23, 2012

This is a good fix for the issue. Thanks, @kosch!

@kosch

This comment has been minimized.

Copy link
Contributor Author

kosch commented Jul 24, 2012

Removed null check as requested.

@rhauch rhauch merged commit 3514935 into ModeShape:master Jul 24, 2012
@rhauch

This comment has been minimized.

Copy link
Contributor

rhauch commented Jul 24, 2012

Merged onto the 'master' branch and cherry-picked onto the '2.x' branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.