Package org.xbill.DNS.utils.json.exception

Examples of org.xbill.DNS.utils.json.exception.JsonDeserializationException


      final String fieldName) {
    try {
      return NumberFormat.getInstance(Locale.getDefault()).parse(
          getNodeStringValue(recordNode, fieldName));
    } catch (final ParseException e) {
      throw new JsonDeserializationException(
          JsonDeserializationExceptionCode.invalidFieldValue, e,
          fieldName, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here


        return getAddressFromString(addressNode.textValue());
      } else {
        return null;
      }
    } catch (final Throwable e) {
      throw new JsonDeserializationException(
          JsonDeserializationExceptionCode.invalidFieldValue, e,
          fieldName, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

  protected TXTRecord createRecord(final Name name, final int dclass,
      final long ttl, final ObjectNode recordNode) {
    try {
            String strings = getNodeStringValue(recordNode, STRINGS_FIELD_NAME);
            if (!CharMatcher.ASCII.matchesAllOf(strings)) {
                throw new JsonDeserializationException(
                        JsonDeserializationExceptionCode.invalidFieldValue,
                        "strings", getTextualBeanType(), "Non-ASCII character found");
            }
            return (TXTRecord) TXTRecord.fromString(name, Type.TXT, dclass,
          ttl, strings, Name.root);
    } catch (final IOException e) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.unexpectedMappingError,
          e, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

      return new CERTRecord(name, dclass, ttl, getNodeIntegerValue(
          recordNode, "certType"), getNodeIntegerValue(recordNode,
          "keyTag"), getNodeIntegerValue(recordNode, "algorithm"),
          getNodeStringValue(recordNode, "cert"));
    } catch (final IOException e) {
      throw new JsonDeserializationException(
          JsonDeserializationExceptionCode.unexpectedMappingError,
          e, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

        DeserializationFeature.UNWRAP_ROOT_VALUE);
    final ObjectNode recordNode = reader.readTree(jsonParser);

    final JsonNode recordTypeNode = recordNode.get(TYPE_FIELD_NAME);
    if (recordTypeNode == null) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.missingField,
          TYPE_FIELD_NAME, "resource record");
    }
    final String recordType = recordTypeNode.textValue();
    final Class<? extends Record> recordClass = recordClassesRegistry
        .get(recordType);
    if (recordClass == null) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.unknownResourceRecordType,
          recordType);
    }
    return reader.withType(recordClass).readValue(recordNode.toString());
  }
View Full Code Here

          recordNode, "certificateUsage"), getNodeIntegerValue(
          recordNode, "selector"), getNodeIntegerValue(recordNode,
          "matchingType"), getNodeStringValue(recordNode,
          "certificateAssociationData"));
    } catch (final IOException e) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.unexpectedMappingError,
          e, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

          "longitude"), getNodeStringValue(recordNode, "altitude"),
          getNodeStringValue(recordNode, "size"), getNodeStringValue(
              recordNode, "hPrecision"), getNodeStringValue(
              recordNode, "vPrecision"));
    } catch (final IOException e) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.unexpectedMappingError,
          e, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

      return new SSHFPRecord(name, dclass, ttl, getNodeIntegerValue(
          recordNode, "algorithm"), getNodeIntegerValue(recordNode,
          "digestType"),
          getNodeStringValue(recordNode, "fingerprint"));
    } catch (final IOException e) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.unexpectedMappingError,
          e, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

      return new DSRecord(name, dclass, ttl, getNodeIntegerValue(
          recordNode, "footprint"), getNodeIntegerValue(recordNode,
          "algorithm"), getNodeIntegerValue(recordNode, "digestId"),
          getNodeStringValue(recordNode, "digest"));
    } catch (final IOException e) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.unexpectedMappingError,
          e, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

  protected SPFRecord createRecord(final Name name, final int dclass,
      final long ttl, final ObjectNode recordNode) {
    try {
            String strings = getNodeStringValue(recordNode, STRINGS_FIELD_NAME);
            if (!CharMatcher.ASCII.matchesAllOf(strings)) {
                throw new JsonDeserializationException(
                        JsonDeserializationExceptionCode.invalidFieldValue,
                        "strings", getTextualBeanType(), "Non-ASCII character found");
            }
            return (SPFRecord) SPFRecord.fromString(name, Type.SPF, dclass,
          ttl, strings, Name.root);
    } catch (final IOException e) {
      throw new JsonDeserializationException(
                    JsonDeserializationExceptionCode.unexpectedMappingError,
          e, getTextualBeanType(), e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of org.xbill.DNS.utils.json.exception.JsonDeserializationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.