Codota Logo
JsonLocation
Code IndexAdd Codota to your IDE (free)

How to use
JsonLocation
in
com.fasterxml.jackson.core

Best Java code snippets using com.fasterxml.jackson.core.JsonLocation (Showing top 20 results out of 909)

Refine searchRefine arrow

  • IOContext
  • JsonProcessingException
  • JsonParser
  • Common ways to obtain JsonLocation
private void myMethod () {
JsonLocation j =
  • Codota IconJsonParser delegate;delegate.getCurrentLocation()
  • Codota IconJsonParser delegate;delegate.getTokenLocation()
  • Codota IconJsonProcessingException jsonProcessingException;jsonProcessingException.getLocation()
  • Smart code suggestions by Codota
}
origin: apache/hive

private Object parseInternal(JsonParser parser) throws SerDeException {
 try {
  parser.nextToken();
  Object res = parseDispatcher(parser, oi);
  return res;
 } catch (Exception e) {
  String locationStr = parser.getCurrentLocation().getLineNr() + "," + parser.getCurrentLocation().getColumnNr();
  throw new SerDeException("at[" + locationStr + "]: " + e.getMessage(), e);
 }
}
origin: redisson/redisson

protected JsonLocation _locationFor(Mark m)
{
  if (m == null) {
    return new JsonLocation(_ioContext.getSourceReference(),
        -1, -1, -1);
  }
  return new JsonLocation(_ioContext.getSourceReference(),
      -1,
      m.getLine() + 1, // from 0- to 1-based
      m.getColumn() + 1); // ditto
}
origin: redisson/redisson

@Override
public int getInputPos() {
  JsonLocation currentLocation = input.getCurrentLocation();
  long byteOffset = currentLocation.getByteOffset();
  if ( input.getCurrentToken() == JsonToken.FIELD_NAME )
    byteOffset-=2; // eager parsing of jackson ':' + '['/'{'
  return (int) byteOffset;
}
origin: dropwizard/dropwizard

Builder setLocation(JsonLocation location) {
  return location == null
      ? this
      : setLocation(location.getLineNr(), location.getColumnNr());
}
origin: immutables/immutables

private String getLocationString() {
 JsonLocation l = parser.getCurrentLocation();
 List<String> parts = new ArrayList<>(4);
 parts.add("line: " + l.getLineNr());
 parts.add("column: " + l.getColumnNr());
 if (l.getByteOffset() >= 0) {
  parts.add("byte offset: " + l.getByteOffset());
 }
 return parts.toString();
}
origin: org.jasig.portlet.notification/notification-portlet-api

@Override
public List<NotificationAttribute> deserialize(JsonParser parser, DeserializationContext ctx)
    throws JsonParseException, IOException {
  List<NotificationAttribute> result = new ArrayList<NotificationAttribute>();
  JsonToken token = parser.getCurrentToken();
  // v1.0: array of objects
  if (token == JsonToken.START_ARRAY) {
    NotificationAttribute[] attributes = parser.readValueAs(NotificationAttribute[].class);
    result.addAll(Arrays.asList(attributes));
  } else if (token == JsonToken.START_OBJECT) {
    // v2.0: series of string arrays
    while (parser.nextToken() != JsonToken.END_OBJECT) {
      NotificationAttribute attr = new NotificationAttribute();
      attr.setName(parser.getCurrentName());
      parser.nextToken();  // Should be the array of values
      String[] values = parser.readValueAs(String[].class);
      attr.setValues(Arrays.asList(values));
      result.add(attr);
    }
  } else throw new IllegalArgumentException("Invalid attributes value. Expected array of NotificationAttribute"
      + " objects or object with a series of string arrays. See https://issues.jasig.org/browse/NOTIFPLT-32"
      + " for format." + parser.getCurrentLocation().toString());
  return result;
  
}
origin: org.ogema.ref-impl/util

private void acceptEndArray(JsonParser p) throws IOException {
  if (p.getCurrentToken() == JsonToken.END_ARRAY) {
    return;
  }
  if (p.nextToken() != JsonToken.END_ARRAY) {
    throw new IOException("malformed document, expected array end but found "
        + p.getCurrentToken() + " at " + p.getCurrentLocation().toString());
  }
}
origin: Esri/spatial-framework-for-hadoop

  parser = new JsonFactory().createJsonParser(inputStream);
  parser.setCodec(new ObjectMapper());
  token = parser.nextToken();
      parser.getCurrentName() != null && parser.getCurrentName().equals("features"))) {
    token = parser.nextToken();
key.set(parser.getCurrentLocation().getCharOffset());
token = parser.nextToken();
origin: org.ogema.ref-impl/util

private void readArrayValues(CompositeResource res, JsonParser p) throws IOException {
  JsonToken next = p.nextToken();
  if (null == next) {
    throw new IOException("malformed document, not a supported array value at "
        + p.getCurrentLocation().toString());
  } else switch (next) {
    case VALUE_STRING:
      res.value = p.getText();
      break;
    case START_ARRAY:
      if (p.nextToken() == JsonToken.END_ARRAY) {
        res.value = Collections.EMPTY_LIST;
      } else {
        ArrayList<String> a = new ArrayList<>();
        res.value = a;
        do {
          a.add(p.getText());
        } while (p.nextToken() != JsonToken.END_ARRAY);
      }   break;
    default:
      throw new IOException("malformed document, not a supported array value at "
          + p.getCurrentLocation().toString());
  }
}
origin: rakam-io/rakam

private EventList readEvents(JsonParser jp, Event.EventContext context, DeserializationContext deserializationContext)
    throws IOException {
  Object inputSource = jp.getInputSource();
  long start = jp.getTokenLocation().getByteOffset();
  if (jp.getCurrentToken() != JsonToken.START_ARRAY) {
    throw new RakamException("events field must be array", BAD_REQUEST);
  long end = jp.getTokenLocation().getByteOffset();
    Object sourceRef = jp.getTokenLocation().getSourceRef();
    if (sourceRef instanceof byte[]) {
      validateChecksum((byte[]) sourceRef, start, end, context);
origin: org.ogema.ref-impl/util

private void acceptStartArray(JsonParser p) throws IOException {
  if (p.nextToken() != JsonToken.START_ARRAY) {
    throw new IOException("malformed document, expected array at " + p.getCurrentLocation().toString());
  }
}
origin: dremio/dremio-oss

private static int findJsonEndBoundary(String plan, int indexInPlan) throws IOException {
 // read the json pushdown query with jackson to find it's total length, wasn't sure how to do this with just regex
 // as it will span across a variable number of lines
 ObjectMapper map = new ObjectMapper(); //for later inner object data binding
 JsonParser p = map.getFactory().createParser(plan.substring(indexInPlan));
 JsonToken token = p.nextToken();
 if (token != JsonToken.START_ARRAY) {
  throw new RuntimeException("Error finding elastic pushdown query JSON in plan text, " +
   "did not find start array as expected, instead found " + token);
 }
 int startEndCounter = 1;
 while (startEndCounter != 0) {
  token = p.nextToken();
  if (token == JsonToken.START_ARRAY) {
   startEndCounter++;
  } else if (token == JsonToken.END_ARRAY) {
   startEndCounter--;
  }
 }
 long pushdownEndIndexInPlan = p.getTokenLocation().getCharOffset() + 1;
 return indexInPlan + (int) pushdownEndIndexInPlan;
}
origin: org.refcodes/refcodes-configuration

/**
 * {@inheritDoc}
 */
@Override
public Properties loadFrom( InputStream aInputStream, char... aDelimiters ) throws IOException, ParseException {
  ObjectMapper theMapper = new ObjectMapper( new YAMLFactory() );
  // theMapper.enable( SerializationFeature.WRITE_ENUMS_USING_TO_STRING );
  // theMapper.enable( DeserializationFeature.READ_ENUMS_USING_TO_STRING );
  try {
    Map<String, String> theProperties = theMapper.readValue( aInputStream, new TypeReference<Map<?, ?>>() {} );
    PropertiesBuilder theResult = new PropertiesBuilderImpl( theProperties );
    postProcessAttributes( theResult );
    putAll( (Properties) theResult );
    return theResult;
  }
  catch ( JsonMappingException | JsonParseException e ) {
    throw new ParseException( e.getMessage(), e.getLocation().getColumnNr() );
  }
}
origin: RepreZen/KaiZen-OpenAPI-Editor

public static SwaggerError newJsonError(JsonProcessingException exception) {
  int line = (exception.getLocation() != null) ? exception.getLocation().getLineNr() : 1;
  return new SwaggerError(line, IMarker.SEVERITY_ERROR, 0, exception.getMessage());
}
origin: mangstadt/ez-vcard

/**
 * Gets the current line number.
 * @return the line number
 */
public int getLineNum() {
  return (parser == null) ? 0 : parser.getCurrentLocation().getLineNr();
}
origin: ferstl/depgraph-maven-plugin

private static StyleConfiguration readConfig(ObjectReader reader, StyleResource config) {
 try (InputStream is = config.openStream()) {
  return reader.readValue(is);
 } catch (JsonProcessingException e) {
  String message = String.format("Unable to read style configuration %s.\nLocation: line %s, column %s\nDetails: %s",
    config, e.getLocation().getLineNr(), e.getLocation().getColumnNr(), e.getOriginalMessage());
  throw new RuntimeException(message);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
}
origin: com.reprezen.jsonoverlay/jsonoverlay

public PositionEndpoint(JsonLocation location) {
  this(location.getCharOffset(), location.getLineNr(), location.getColumnNr());
}
origin: org.emfjson/emfjson-jackson

public JSONException(Exception e, JsonLocation location) {
  super(e);
  this.location = location.toString();
  this.line = location.getLineNr();
  this.column = location.getColumnNr();
}
origin: com.strapdata.elasticsearch/elasticsearch

@Override
public XContentLocation getTokenLocation() {
  JsonLocation loc = parser.getTokenLocation();
  if (loc == null) {
    return null;
  }
  return new XContentLocation(loc.getLineNr(), loc.getColumnNr());
}
origin: org.apache.drill.exec/drill-java-exec

@Override
public String toString() {
 JsonLocation location = parser.getCurrentLocation();
 return getClass().getSimpleName() + "[Line=" + location.getLineNr()
   + ", Column=" + (location.getColumnNr() + 1)
   + ", Field=" + getCurrentField()
   + "]";
}
com.fasterxml.jackson.coreJsonLocation

Javadoc

Object that encapsulates Location information used for reporting parsing (or potentially generation) errors, as well as current location within input streams.

Most used methods

  • getLineNr
  • getColumnNr
  • <init>
  • getCharOffset
  • getByteOffset
  • toString
  • getSourceRef
    Reference to the original resource being read, if one available. For example, when a parser has been
  • _append
  • _appendSourceDesc
  • equals
  • hashCode
  • hashCode

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • addToBackStack (FragmentTransaction)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • Reference (javax.naming)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now