Examples of EncodingException


Examples of com.foundationdb.server.rowdata.encoding.EncodingException

                    vlength += varWidth;
                } catch (Exception e) {
                    throw EncodingException.dueTo(e);
                }
                if (varWidth > fieldMax) {
                    throw new EncodingException(
                        String.format("Value for field %s has size %s, exceeding maximum allowed: %s",
                                      fieldDef.column(), varWidth, fieldMax));
                }
                fieldFixedWidth = AkServerUtil.varWidth(vmax);
                byte[] bytes = rowData.getBytes();
View Full Code Here

Examples of com.openshift.internal.client.httpclient.EncodingException

      this.firstParameter = true;
      for (Parameter parameter : parameterMap.getValue().values()) {
        writeTo(parameter.getName(), parameter.getValue(), out);
      }
    } catch (IOException e) {
      throw new EncodingException(
          MessageFormat.format("Could not encode parameters {0}", parameterMap.toString()), e);
    }
  }
View Full Code Here

Examples of de.fu_berlin.inf.dpp.videosharing.exceptions.EncodingException

                // log.warn("Encoding too slow for framerate. " + trace
                // + " ms behind. " + (SLOW_ENCODING_ERROR - slowEncoding)
                // + " warnings in row remaining.");
                if (++slowEncoding > SLOW_ENCODING_ERROR) {
                    videoSharingSession
                        .reportError(new EncodingException(
                            "Can't encode that fast. Please choose lower frames per second."));
                    return;
                }
            }
        }
View Full Code Here

Examples of de.fu_berlin.inf.dpp.videosharing.exceptions.EncodingException

                // PIXELFORMAT, width, height, bgrImage.getWidth(), bgrImage
                // .getHeight());
                converter = ConverterFactory.createConverter("XUGGLER-BGR-24",
                    pixelformat, width, height, width, height);
            } catch (UnsupportedOperationException e) {
                videoSharingSession.reportError(new EncodingException(e));
                return;
            }
        }

        image = Decoder.resample(image, new Dimension(width, height));

        long timeStamp = (now - firstTimestamp) * 1000; // convert to
        // microseconds
        com.xuggle.xuggler.IVideoPicture outFrame = converter.toPicture(
            convertToType(image, BufferedImage.TYPE_3BYTE_BGR), timeStamp);

        if ((errorNumber = coder.encodeVideo(packet, outFrame, 0)) < 0) {
            videoSharingSession.reportError(new EncodingException(IError.make(
                errorNumber).getDescription()));
            return;
        }

        if (packet.isComplete()) {
            if ((errorNumber = container.writePacket(packet)) < 0) {
                videoSharingSession.reportError(new EncodingException(IError
                    .make(errorNumber).getDescription()));
                return;
            }
        }
    }
View Full Code Here

Examples of de.fu_berlin.inf.dpp.videosharing.exceptions.EncodingException

            } catch (IOException e) {
                log.error(e.getMessage(), e);
                stopEncodingInternal();
                if (!(e instanceof EOFException))
                    videoSharingSession.reportError(new EncodingException(e));
                return;
            } catch (Exception e) {
                log.error(e.getMessage(), e);
                videoSharingSession.reportError(new EncodingException(e));
                return;
            }

            long elapsedTime = System.currentTimeMillis() - startTime;
            long frameIntervall = (1000L / framerate);
View Full Code Here

Examples of de.fu_berlin.inf.dpp.videosharing.exceptions.EncodingException

        }
    }

    private void reportMaxDroppedFramesReached() {
        videoSharingSession
            .reportError(new EncodingException(
                "Your PC cannot handle the current frame rate. Maximum bandwidth used was "
                    + (maxBandwidthUsed / 1024)
                    + " KiB per frame and can result in "
                    + ((maxBandwidthUsed / 1024) * framerate)
                    + " KiB/s at the current frame rate("
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingException

      throws EncodingException
  {
    try {
      final String contentType = message.getContentType ();
      if (!HttpgQueueConnectorProxy.expectedContentType.equals (contentType)) {
        throw (new EncodingException ("invalid content type"));
      }
      final String contentEncoding = message.getContentEncoding ();
      if (!HttpgQueueConnectorProxy.expectedContentEncoding.equals (contentEncoding)) {
        throw (new EncodingException ("invalid content encoding"));
      }
      final byte[] rawBytes = message.getData ();
      if (rawBytes.length < 4) {
        throw (new EncodingException ("invalid message length"));
      }
      final DataInputStream rawStream = new DataInputStream (new ByteArrayInputStream (rawBytes));
      final int metadataLength = rawStream.readInt ();
      if (metadataLength > rawBytes.length) {
        throw (new EncodingException ("invalid metadata length"));
      }
      final byte[] metadataBytes = new byte[metadataLength];
      rawStream.readFully (metadataBytes);
      final JSONObject metadata;
      try {
        metadata = SerDesUtils.jsonToRawObject (metadataBytes, Charsets.UTF_8);
      } catch (final JSONException exception) {
        throw (new EncodingException ("invalid metadata"));
      }
      final int version;
      try {
        version = metadata.getInt ("version");
      } catch (final JSONException exception) {
        throw (new EncodingException ("invalid metadata version", exception));
      }
      if (version != 1) {
        throw (new EncodingException (String.format ("unexpected metadata version `%d`", Integer.valueOf (version))));
      }
      final String callbackIdentifier;
      final String callbackExchange;
      final String callbackRoutingKey;
      try {
        callbackIdentifier = metadata.getString ("callback-identifier");
        callbackExchange = metadata.getString ("callback-exchange");
        callbackRoutingKey = metadata.getString ("callback-routing-key");
      } catch (final JSONException exception) {
        throw (new EncodingException ("invalid callback metadata", exception));
      }
      final String httpVersion;
      final String httpMethod;
      final String httpPath;
      final ImmutableMap<String, String> httpHeaders;
      final String httpBodyEncoding;
      try {
        httpVersion = metadata.getString ("http-version");
        httpMethod = metadata.getString ("http-method");
        httpPath = metadata.getString ("http-uri");
        final ImmutableMap.Builder<String, String> httpHeadersBuilder = ImmutableMap.<String, String>builder ();
        final JSONObject httpHeadersRaw = metadata.getJSONObject ("http-headers");
        final Iterator<?> httpHeadersIterator = httpHeadersRaw.keys ();
        while (httpHeadersIterator.hasNext ()) {
          final String httpHeaderName = ((String) httpHeadersIterator.next ());
          final String httpHeaderValue = httpHeadersRaw.getString (httpHeaderName);
          httpHeadersBuilder.put (httpHeaderName.toLowerCase (), httpHeaderValue);
        }
        httpHeaders = httpHeadersBuilder.build ();
        httpBodyEncoding = metadata.getString ("http-body");
      } catch (final JSONException exception) {
        throw (new EncodingException ("invalid http metadata", exception));
      }
      final byte[] httpBodyBytes;
      if (httpBodyEncoding.equals ("empty")) {
        httpBodyBytes = null;
      } else if (httpBodyEncoding.equals ("following")) {
        final int bodyLength = rawStream.readInt ();
        if (bodyLength != (rawBytes.length - metadataLength)) {
          throw (new EncodingException ("invalid body length"));
        }
        httpBodyBytes = new byte[bodyLength];
        rawStream.readFully (httpBodyBytes);
      } else if (httpBodyEncoding.equals ("embedded")) {
        try {
          httpBodyBytes = metadata.getString ("http-body-content").getBytes ();
        } catch (final JSONException exception) {
          throw (new EncodingException ("invalid http body", exception));
        }
      } else {
        throw (new EncodingException (String.format ("invalid body encoding `%s`", httpBodyEncoding)));
      }
      final EncodingMetadata bodyEncodingMetadata = new EncodingMetadata (httpHeaders.get ("content-type"), httpHeaders.get ("content-encoding"));
      final TRequestBody httpBody;
      if (httpBodyBytes != null) {
        try {
          httpBody = this.requestBodyEncoder.decode (httpBodyBytes, bodyEncodingMetadata);
        } catch (final EncodingException exception) {
          throw (new EncodingException ("invalid body", exception));
        }
      } else {
        httpBody = null;
      }
      final DeliveryToken token = new DeliveryToken (this, message.getDelivery (), callbackExchange, callbackRoutingKey, callbackIdentifier);
      final HttpgRequestMessage<TRequestBody> request = HttpgRequestMessage.create (httpVersion, httpMethod, httpPath, httpHeaders, httpBody, token);
      return (request);
    } catch (final EncodingException exception) {
      throw (exception);
    } catch (final Throwable exception) {
      throw (new EncodingException ("unexpected exception", exception));
    }
  }
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingException

      final byte[] httpBodyBytes;
      try {
        final EncodeOutcome outcome = this.responseBodyEncoder.encode (response.body, httpBodyEncodingMetadata);
        httpBodyBytes = outcome.data;
      } catch (final EncodingException exception) {
        throw (new EncodingException ("invalid body", exception));
      }
      metadata.put ("version", 1);
      metadata.put ("callback-identifier", token.callbackIdentifier);
      metadata.put ("http-version", response.version);
      metadata.put ("http-code", response.status);
      metadata.put ("http-status", "mosaic-http-response");
      metadata.put ("http-headers", httpHeaders);
      metadata.put ("http-body", "following");
      final byte[] metadataBytes;
      try {
        metadataBytes = SerDesUtils.toJsonBytes (metadata, Charsets.UTF_8);
      } catch (final JSONException exception) {
        throw (new EncodingException ("invalid metadata"));
      }
      final int messageLength = metadataBytes.length + httpBodyBytes.length + 8;
      final ByteArrayOutputStream rawBytesStream = new ByteArrayOutputStream (messageLength);
      final DataOutputStream rawStream = new DataOutputStream (rawBytesStream);
      rawStream.writeInt (metadataBytes.length);
      rawStream.write (metadataBytes);
      rawStream.writeInt (httpBodyBytes.length);
      rawStream.write (httpBodyBytes);
      final byte[] rawData = rawBytesStream.toByteArray ();
      final AmqpOutboundMessage rawMessage = new AmqpOutboundMessage (token.callbackExchange, token.callbackRoutingKey, rawData, HttpgQueueConnectorProxy.expectedContentEncoding, HttpgQueueConnectorProxy.expectedContentType);
      return (rawMessage);
    } catch (final EncodingException exception) {
      throw (exception);
    } catch (final Throwable exception) {
      throw (new EncodingException ("unexpected exception", exception));
    }
  }
View Full Code Here

Examples of org.apache.isis.applib.adapters.EncodingException

                final long millis = Long.parseLong(data.substring(1));
                cal.setTimeInMillis(millis);
                clearFields(cal);
                return setDate(cal.getTime());
            } else {
                throw new EncodingException(e);
            }
        }
    }
View Full Code Here

Examples of org.apache.isis.applib.adapters.EncodingException

    @Override
    protected LocalDate doRestore(final String data) {
        try {
            return parse(data);
        } catch (final IllegalArgumentException e) {
            throw new EncodingException(e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.