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

fix bug in opc ua driver response handling when fields are not found #75

Merged
merged 2 commits into from
Aug 2, 2019

Conversation

stefah
Copy link

@stefah stefah commented Aug 1, 2019

Fixes a bug within the check for returned fields in the opc ua driver connection response, where the status code was wrongly compared.
Updates the milo dependencies.

@chrisdutz
Copy link
Contributor

Looks good to me ... and I did see it fail before and work with the change ;-)

@@ -346,7 +346,7 @@ public void unregister(PlcConsumerRegistration registration) {
for(int counter = 0; counter < readValueIds.size(); counter++){
PlcResponseCode resultCode = PlcResponseCode.OK;
BaseDefaultFieldItem stringItem = null;
if(readValues == null || readValues.size() <= counter || readValues.get(counter).getStatusCode() != StatusCode.GOOD){
if(readValues == null || counter > readValues.size() || !readValues.get(counter).getStatusCode().isGood()){
Copy link
Contributor

@nalim2 nalim2 Aug 1, 2019

Choose a reason for hiding this comment

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

Correct but it has to be counter >= readValues.size() or?
So that we do not get a out of bounds if counter == .size()

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I think you are right as if it's equal to size it must produce an array index out of bounds exception. Stefan, could you please re evaluate that?

Copy link
Author

Choose a reason for hiding this comment

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

you are correct, will fix that.. :)

@chrisdutz chrisdutz merged commit b8511b9 into apache:develop Aug 2, 2019
nalim2 added a commit that referenced this pull request Dec 18, 2019
PLC4X-164: Fix wrong NOT FOUND exception in OPC-UA driver

Correct fix for similliar issue like #75. This will lead into a code refactor.
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.

None yet

3 participants