Skip to content

Commit

Permalink
Create UnsupportedAttribute and do not complain on stderr about that
Browse files Browse the repository at this point in the history
  • Loading branch information
omuravskiy committed Nov 18, 2021
1 parent ad003d8 commit b45c37c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/main/java/org/javamrt/mrt/Attributes.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,14 @@ private void decode(byte[] record, int attrLen, int attrBytes)
break;

default:
route_btoa.System_err_println("Ignoring unknown attribute type " + type);
// make sure to not overwrite other attributes in the Vector,
// as index in the Vector is not the same as type value
if (type > MRTConstants.ATTRIBUTE_LARGE_COMMUNITY && type < MRTConstants.ATTRIBUTE_TOTAL) {
final UnsupportedAttribute attribute = new UnsupportedAttribute(type, buffer);
attributes.set(type, attribute);
} else {
route_btoa.System_err_println("Ignoring unknown attribute type " + type);
}
break;
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/javamrt/mrt/UnsupportedAttribute.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.javamrt.mrt;

import org.javamrt.utils.RecordAccess;

import java.util.Arrays;

public class UnsupportedAttribute implements Attribute {
Expand All @@ -14,10 +16,7 @@ public UnsupportedAttribute(int type, byte[] buffer) {

@Override
public String toString() {
return "UnsupportedAttribute{" +
"type=" + type +
", buffer=" + Arrays.toString(buffer) +
'}';
return "Attribute type " + type + ": " + RecordAccess.arrayToString(buffer);
}

@Override
Expand Down

0 comments on commit b45c37c

Please sign in to comment.