Tabnine Logo
EncodingException
Code IndexAdd Tabnine to your IDE (free)

How to use
EncodingException
in
org.springframework.core.codec

Best Java code snippets using org.springframework.core.codec.EncodingException (Showing top 15 results out of 315)

origin: spring-projects/spring-framework

return Flux.error(new EncodingException(
    "Could not marshal " + value.getClass() + " to XML", ex));
origin: spring-projects/spring-framework

throw new EncodingException("JSON encoding error: " + ex.getOriginalMessage(), ex);
origin: spring-projects/spring-framework

@Override
public Flux<DataBuffer> encode(Publisher<? extends CharSequence> inputStream,
    DataBufferFactory bufferFactory, ResolvableType elementType,
    @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
  Charset charset = getCharset(mimeType);
  return Flux.from(inputStream).map(charSequence -> {
    if (!Hints.isLoggingSuppressed(hints)) {
      LogFormatUtils.traceDebug(logger, traceOn -> {
        String formatted = LogFormatUtils.formatValue(charSequence, !traceOn);
        return Hints.getLogPrefix(hints) + "Writing " + formatted;
      });
    }
    boolean release = true;
    int capacity = calculateCapacity(charSequence, charset);
    DataBuffer dataBuffer = bufferFactory.allocateBuffer(capacity);
    try {
      dataBuffer.write(charSequence, charset);
      release = false;
    }
    catch (CoderMalfunctionError ex) {
      throw new EncodingException("String encoding error: " + ex.getMessage(), ex);
    }
    finally {
      if (release) {
        DataBufferUtils.release(dataBuffer);
      }
    }
    return dataBuffer;
  });
}
origin: spring-projects/spring-framework

.flatMapMany(region -> {
  if (!region.getResource().isReadable()) {
    return Flux.error(new EncodingException("Resource " +
        region.getResource() + " is not readable"));
concatMap(region -> {
  if (!region.getResource().isReadable()) {
    return Flux.error(new EncodingException("Resource " +
        region.getResource() + " is not readable"));
origin: org.springframework/spring-core

@Override
public Flux<DataBuffer> encode(Publisher<? extends CharSequence> inputStream,
    DataBufferFactory bufferFactory, ResolvableType elementType,
    @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
  Charset charset = getCharset(mimeType);
  return Flux.from(inputStream).map(charSequence -> {
    if (!Hints.isLoggingSuppressed(hints)) {
      LogFormatUtils.traceDebug(logger, traceOn -> {
        String formatted = LogFormatUtils.formatValue(charSequence, !traceOn);
        return Hints.getLogPrefix(hints) + "Writing " + formatted;
      });
    }
    boolean release = true;
    int capacity = calculateCapacity(charSequence, charset);
    DataBuffer dataBuffer = bufferFactory.allocateBuffer(capacity);
    try {
      dataBuffer.write(charSequence, charset);
      release = false;
    }
    catch (CoderMalfunctionError ex) {
      throw new EncodingException("String encoding error: " + ex.getMessage(), ex);
    }
    finally {
      if (release) {
        DataBufferUtils.release(dataBuffer);
      }
    }
    return dataBuffer;
  });
}
origin: org.springframework/spring-web

return Flux.error(new EncodingException(
    "Could not marshal " + value.getClass() + " to XML", ex));
origin: org.springframework/spring-web

throw new EncodingException("JSON encoding error: " + ex.getOriginalMessage(), ex);
origin: org.springframework/spring-core

.flatMapMany(region -> {
  if (!region.getResource().isReadable()) {
    return Flux.error(new EncodingException("Resource " +
        region.getResource() + " is not readable"));
concatMap(region -> {
  if (!region.getResource().isReadable()) {
    return Flux.error(new EncodingException("Resource " +
        region.getResource() + " is not readable"));
origin: apache/servicemix-bundles

@Override
protected Flux<DataBuffer> encode(Object value, DataBufferFactory dataBufferFactory,
    ResolvableType type, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
  try {
    DataBuffer buffer = dataBufferFactory.allocateBuffer(1024);
    OutputStream outputStream = buffer.asOutputStream();
    Class<?> clazz = ClassUtils.getUserClass(value);
    Marshaller marshaller = this.jaxbContexts.createMarshaller(clazz);
    marshaller.setProperty(Marshaller.JAXB_ENCODING, StandardCharsets.UTF_8.name());
    marshaller.marshal(value, outputStream);
    return Flux.just(buffer);
  }
  catch (MarshalException ex) {
    return Flux.error(new EncodingException("Could not marshal " + value.getClass() + " to XML", ex));
  }
  catch (JAXBException ex) {
    return Flux.error(new CodecException("Invalid JAXB configuration", ex));
  }
}
origin: apache/servicemix-bundles

private DataBuffer encodeValue(Object value, @Nullable MimeType mimeType, DataBufferFactory bufferFactory,
    ResolvableType elementType, @Nullable Map<String, Object> hints, JsonEncoding encoding) {
  JavaType javaType = getJavaType(elementType.getType(), null);
  Class<?> jsonView = (hints != null ? (Class<?>) hints.get(Jackson2CodecSupport.JSON_VIEW_HINT) : null);
  ObjectWriter writer = (jsonView != null ?
      getObjectMapper().writerWithView(jsonView) : getObjectMapper().writer());
  if (javaType.isContainerType()) {
    writer = writer.forType(javaType);
  }
  writer = customizeWriter(writer, mimeType, elementType, hints);
  DataBuffer buffer = bufferFactory.allocateBuffer();
  OutputStream outputStream = buffer.asOutputStream();
  try {
    JsonGenerator generator = getObjectMapper().getFactory().createGenerator(outputStream, encoding);
    writer.writeValue(generator, value);
  }
  catch (InvalidDefinitionException ex) {
    throw new CodecException("Type definition error: " + ex.getType(), ex);
  }
  catch (JsonProcessingException ex) {
    throw new EncodingException("JSON encoding error: " + ex.getOriginalMessage(), ex);
  }
  catch (IOException ex) {
    throw new IllegalStateException("Unexpected I/O error while writing to data buffer", ex);
  }
  return buffer;
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

throw new EncodingException("JSON encoding error: " + ex.getOriginalMessage(), ex);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

return Flux.error(new EncodingException(
    "Could not marshal " + value.getClass() + " to XML", ex));
origin: apache/servicemix-bundles

@Override
public Flux<DataBuffer> encode(Publisher<? extends CharSequence> inputStream,
    DataBufferFactory bufferFactory, ResolvableType elementType,
    @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
  Charset charset = getCharset(mimeType);
  return Flux.from(inputStream).map(charSequence -> {
    if (!Hints.isLoggingSuppressed(hints)) {
      LogFormatUtils.traceDebug(logger, traceOn -> {
        String formatted = LogFormatUtils.formatValue(charSequence, !traceOn);
        return Hints.getLogPrefix(hints) + "Writing " + formatted;
      });
    }
    boolean release = true;
    int capacity = calculateCapacity(charSequence, charset);
    DataBuffer dataBuffer = bufferFactory.allocateBuffer(capacity);
    try {
      dataBuffer.write(charSequence, charset);
      release = false;
    }
    catch (CoderMalfunctionError ex) {
      throw new EncodingException("String encoding error: " + ex.getMessage(), ex);
    }
    finally {
      if (release) {
        DataBufferUtils.release(dataBuffer);
      }
    }
    return dataBuffer;
  });
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

.flatMapMany(region -> {
  if (!region.getResource().isReadable()) {
    return Flux.error(new EncodingException("Resource " +
        region.getResource() + " is not readable"));
concatMap(region -> {
  if (!region.getResource().isReadable()) {
    return Flux.error(new EncodingException("Resource " +
        region.getResource() + " is not readable"));
origin: apache/servicemix-bundles

.flatMapMany(region -> {
  if (!region.getResource().isReadable()) {
    return Flux.error(new EncodingException("Resource " +
        region.getResource() + " is not readable"));
concatMap(region -> {
  if (!region.getResource().isReadable()) {
    return Flux.error(new EncodingException("Resource " +
        region.getResource() + " is not readable"));
org.springframework.core.codecEncodingException

Javadoc

Indicates an issue with encoding the input Object stream with a focus on not being able to encode Objects. As opposed to a more general I/O errors or a CodecException such as a configuration issue that an Encoder may also choose to raise.

Most used methods

  • <init>
    Create a new EncodingException.

Popular in Java

  • Reading from database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • BoxLayout (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now