Skip to content

extract additional methods in SecurityHandler to reduce checks number#424

Open
valerybokov wants to merge 2 commits intoapache:trunkfrom
valerybokov:refactor-SecurityHandler
Open

extract additional methods in SecurityHandler to reduce checks number#424
valerybokov wants to merge 2 commits intoapache:trunkfrom
valerybokov:refactor-SecurityHandler

Conversation

@valerybokov
Copy link

I've extracted several methods because the decryptDictionary(COSDictionary, long, long) method has type checks (old code, line 616), and the decrypt(COSBase, long, long) method has the same type checks. So, there is double type check in the code. The new implementation of the decryptDictionary method calls overloads of the decrypt method for each type (COSString, COSArray, COSDictionary) to avoid double type check.

Perhaps all of these new methods should be made public (or all of them private). You're the one in charge.

@THausherr
Copy link
Contributor

Around 616 the old code was calling the general method. The new code is calling the specific method, but now it will no longer execute the code part that checks whether that part has already been decrypted before?!

@valerybokov
Copy link
Author

Around 616 the old code was calling the general method. The new code is calling the specific method, but now it will no longer execute the code part that checks whether that part has already been decrypted before?!

Thank you! I've fixed the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants