Tabnine Logo
EncodingException.<init>
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using org.springframework.core.codec.EncodingException.<init> (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<init>

Javadoc

Create a new EncodingException.

Popular methods of EncodingException

    Popular in Java

    • Making http requests using okhttp
    • getContentResolver (Context)
    • getResourceAsStream (ClassLoader)
    • getSharedPreferences (Context)
    • Table (com.google.common.collect)
      A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
    • FileOutputStream (java.io)
      An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
    • Socket (java.net)
      Provides a client-side TCP socket.
    • Connection (java.sql)
      A connection represents a link from a Java application to a database. All SQL statements and results
    • Iterator (java.util)
      An iterator over a sequence of objects, such as a collection.If a collection has been changed since
    • Properties (java.util)
      A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
    • Top 12 Jupyter Notebook extensions
    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