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

Feature/add support for displaying unknown avps in diameterutilities #43

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.jdiameter.api.Message;
import org.jdiameter.api.validation.AvpRepresentation;
import org.jdiameter.api.validation.Dictionary;
import org.jdiameter.common.impl.validation.AvpRepresentationImpl;
import org.jdiameter.common.impl.validation.DictionaryImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -71,14 +72,18 @@ public static String printAvps(AvpSet avps, String pKeywordSep, String indentati
for (Avp avp : avps) {
AvpRepresentation avpRep = AVP_DICTIONARY.getAvp(avp.getCode(), avp.getVendorId());
if (avpRep == null) {
continue;
} //if
avpRep = new AvpRepresentationImpl("Unknown AVP "+avp.getCode(), "Unknown AVP",
avp.getCode(), false, null, null, null,
avp.getVendorId(),
AvpRepresentation.Type.UTF8String.toString(),
AvpRepresentation.Type.UTF8String.toString());
}

Object avpValue;
boolean isGrouped = false;

try {
String avpType = AVP_DICTIONARY.getAvp(avp.getCode(), avp.getVendorId()).getType();
String avpType = avpRep.getType();

if (null == avpType) {
avpValue = avp.getUTF8String().replace("\r", "").replace("\n", "");
Expand Down Expand Up @@ -136,7 +141,7 @@ public static String printAvps(AvpSet avps, String pKeywordSep, String indentati
LOG.debug(avpLine.toString());
} //if

stringBuilder.append(avpLine.toString()).append('\n');
stringBuilder.append(avpLine).append('\n');

if (isGrouped) {
try {
Expand Down