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

MODE-1562 changed getResourceLength impl #451

merged 1 commit into from Jul 24, 2012

Conversation

kosch
Copy link
Contributor

@kosch 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...

while (-1 != (bytesRead = is.read(buff, 0, 255))) {
size += bytesRead;
if(node == null){
throw new IOException("node is null");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

rhauch commented Jul 23, 2012

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

@kosch
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
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
Labels
None yet
Projects
None yet
2 participants