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

Should the Decoding of the Attribute Name Surrogate within the initial vocabulary be more robust? #50

Open
Tomas-Kraus opened this issue Apr 10, 2013 · 6 comments

Comments

@Tomas-Kraus
Copy link
Member

We've been using a Fast Infoset document that contains a large initial vocabulary that was created by another tool and we're trying to parse it with the Java FI library. One interesting issue we've hit is that apparently the other tool encoded a final entry in the attribute-name surrogate table of the initial vocabulary where the prefix-string-index bit was present, and the index encoded referred to a null value in the prefixes table. The same thing happens for the namespace-name-prefix and the namespaceName table. This results in an exception in the call to the QualifiedName constructor inside of decodeTableItems(QualifiedNameArray array, boolean isAttribute) in the Decoder class. The exception(s) are the result of the prefix string and namespaceName strings being assigned a null value, which then causes a later exception in the QualifiedName constructor since the QualifiedName constructor assumes that various input variables are not null.

Since we've parsed this other file with a handful of over FI tools, we were thinking one approach might be to just add some additional robustness checking to decodeTableItems() to ensure that the prefix variable is set back to an empty string if the lookup in the prefix table returns null. The same could be done with the namespaceName attribute and the lookup in the namespaceName table. Alternatively, the constructor to QualifiedName could have more sanity checks and not assume that various parameters are not null.

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
Reported by khiggins

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
khiggins said:
Here's one fix that could be done to the decodeTableItems(QualifiedNameArray array, boolean isAttribute) function. Like I said above, probably the better way to tackle this is to just improve the QualifiedName constructor.

String prefix = "";
int prefixIndex = -1;
if ((b & EncodingConstants.NAME_SURROGATE_PREFIX_FLAG) > 0) {
prefixIndex = decodeIntegerIndexOnSecondBit();
prefix = _v.prefix.get(prefixIndex);
if (prefix == null)

{ prefix = ""; }

}

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
khiggins said:
Same thing, but for the namespaceName variable within decodeTableItems(QualifiedNameArray array, boolean isAttribute):

String namespaceName = "";
int namespaceNameIndex = -1;
if ((b & EncodingConstants.NAME_SURROGATE_NAME_FLAG) > 0) {
namespaceNameIndex = decodeIntegerIndexOnSecondBit();
namespaceName = _v.namespaceName.get(namespaceNameIndex);
if (namespaceName == null)

{ namespaceName = ""; }

}

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
khiggins said:
Actually, upon further look, it looks like the fix from #31 actually resolves this issue, and the values appear to make sense for our application. Can the fix from #31 be applied? Or have there been concerns about it?

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
This issue was imported from java.net JIRA FI-50

@Tomas-Kraus
Copy link
Member Author

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

No branches or pull requests

2 participants