Examples of UnsupportedTypeException


Examples of co.cask.cdap.internal.io.UnsupportedTypeException

    if (dataset instanceof RecordScannable) {
      return hiveSchemaFor(((RecordScannable) dataset).getRecordType());
    } else if (dataset instanceof RecordWritable) {
      return hiveSchemaFor(((RecordWritable) dataset).getRecordType());
    }
    throw new UnsupportedTypeException("Dataset neither implements RecordScannable not RecordWritable.");
  }
View Full Code Here

Examples of co.cask.cdap.internal.io.UnsupportedTypeException

    // This call will make sure that the type is not recursive
    new ReflectionSchemaGenerator().generate(type, false);

    ObjectInspector objectInspector = ObjectInspectorFactory.getReflectionObjectInspector(type);
    if (!(objectInspector instanceof StructObjectInspector)) {
      throw new UnsupportedTypeException(String.format("Type must be a RECORD, but is %s",
                                                       type.getClass().getName()));
    }
    StructObjectInspector structObjectInspector = (StructObjectInspector) objectInspector;

    StringBuilder sb = new StringBuilder("(");
View Full Code Here

Examples of com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException

                arraySerializer = Array2dJsonSerializer.class.getCanonicalName();
            } else {
                // more dimensions are not supported
                String message = "Arrays with 3 or more dimensions are not supported";
                logger.log( TreeLogger.Type.WARN, message );
                throw new UnsupportedTypeException( message );
            }
            JSerializerType parameterSerializerType = getJsonSerializerFromType( arrayType.getLeafType(), subtype );
            builder.parameters( ImmutableList.of( parameterSerializerType ) );
            return builder.instance( String.format( "%s.newInstance(%s)", arraySerializer, parameterSerializerType.getInstance() ) )
                    .build();
        }

        if ( null != type.isAnnotation() ) {
            String message = "Annotations are not supported";
            logger.log( TreeLogger.Type.WARN, message );
            throw new UnsupportedTypeException( message );
        }

        JClassType classType = type.isClassOrInterface();
        if ( null != classType ) {
            // it's a bean
            JClassType baseClassType = classType;
            JParameterizedType parameterizedType = classType.isParameterized();
            if ( null != parameterizedType ) {
                // it's a bean with generics, we create a serializer based on generic type
                baseClassType = parameterizedType.getBaseType();
            }

            BeanJsonSerializerCreator beanJsonSerializerCreator = new BeanJsonSerializerCreator( logger
                    .branch( Type.DEBUG, "Creating serializer for " + baseClassType
                            .getQualifiedSourceName() ), context, configuration, typeOracle );
            String qualifiedClassName = beanJsonSerializerCreator.create( baseClassType );

            ImmutableList<? extends JType> typeParameters = getTypeParameters( classType, subtype );
            StringBuilder joinedTypeParameterSerializers = new StringBuilder();
            if ( !typeParameters.isEmpty() ) {
                ImmutableList.Builder<JSerializerType> parametersSerializerBuilder = ImmutableList.builder();
                boolean first = true;
                for ( JType argType : typeParameters ) {
                    if ( first ) {
                        first = false;
                    } else {
                        joinedTypeParameterSerializers.append( ", " );
                    }

                    JSerializerType parameterSerializerType = getJsonSerializerFromType( argType, subtype );
                    parametersSerializerBuilder.add( parameterSerializerType );
                    joinedTypeParameterSerializers.append( parameterSerializerType.getInstance() );
                }
                builder.parameters( parametersSerializerBuilder.build() );
            }

            builder.beanMapper( true );
            builder.instance( String.format( "new %s(%s)", qualifiedClassName, joinedTypeParameterSerializers ) );
            return builder.build();
        }

        String message = "Type '" + type.getQualifiedSourceName() + "' is not supported";
        logger.log( TreeLogger.Type.WARN, message );
        throw new UnsupportedTypeException( message );
    }
View Full Code Here

Examples of com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException

            return builder.instance( String.format( "%s.getInstance()", EnumKeySerializer.class.getCanonicalName() ) ).build();
        }

        String message = "Type '" + type.getQualifiedSourceName() + "' is not supported as map's key";
        logger.log( TreeLogger.Type.WARN, message );
        throw new UnsupportedTypeException( message );
    }
View Full Code Here

Examples of com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException

        }

        if ( Enum.class.getName().equals( type.getQualifiedSourceName() ) ) {
            String message = "Type java.lang.Enum is not supported by deserialization";
            logger.log( TreeLogger.Type.WARN, message );
            throw new UnsupportedTypeException( message );
        }

        JArrayType arrayType = type.isArray();
        if ( null != arrayType ) {
            String method = "%s.newInstance(%s, %s)";
            String arrayCreator;
            String arrayDeserializer;
            JType leafType = arrayType.getLeafType();

            if ( arrayType.getRank() == 1 ) {
                // one dimension array
                arrayCreator = "new " + ArrayCreator.class.getCanonicalName() + "<" + leafType
                        .getParameterizedQualifiedSourceName() + ">(){\n" +
                        "  @Override\n" +
                        "  public " + arrayType.getParameterizedQualifiedSourceName() + " create( int length ) {\n" +
                        "    return new " + leafType.getQualifiedSourceName() + "[length];\n" +
                        "  }\n" +
                        "}";
                arrayDeserializer = ArrayJsonDeserializer.class.getCanonicalName();

            } else if ( arrayType.getRank() == 2 ) {
                // 2 dimensions array
                arrayCreator = "new " + Array2dCreator.class.getCanonicalName() + "<" + leafType
                        .getParameterizedQualifiedSourceName() + ">(){\n" +
                        "  @Override\n" +
                        "  public " + arrayType.getParameterizedQualifiedSourceName() + " create( int first, int second ) {\n" +
                        "    return new " + leafType.getQualifiedSourceName() + "[first][second];\n" +
                        "  }\n" +
                        "}";
                arrayDeserializer = Array2dJsonDeserializer.class.getCanonicalName();

            } else {
                // more dimensions are not supported
                String message = "Arrays with 3 or more dimensions are not supported";
                logger.log( TreeLogger.Type.WARN, message );
                throw new UnsupportedTypeException( message );
            }

            JDeserializerType parameterDeserializerType = getJsonDeserializerFromType( leafType, subtype );
            builder.parameters( ImmutableList.of( parameterDeserializerType ) );
            return builder.instance( String.format( method, arrayDeserializer, parameterDeserializerType.getInstance(), arrayCreator ) )
                    .build();
        }

        if ( null != type.isAnnotation() ) {
            String message = "Annotations are not supported";
            logger.log( TreeLogger.Type.WARN, message );
            throw new UnsupportedTypeException( message );
        }

        JClassType classType = type.isClassOrInterface();
        if ( null != classType ) {
            // it's a bean
            JClassType baseClassType = classType;
            JParameterizedType parameterizedType = classType.isParameterized();
            if ( null != parameterizedType ) {
                // it's a bean with generics, we create a deserializer based on generic type
                baseClassType = parameterizedType.getBaseType();
            }

            BeanJsonDeserializerCreator beanJsonDeserializerCreator = new BeanJsonDeserializerCreator( logger
                    .branch( Type.DEBUG, "Creating deserializer for " + baseClassType
                            .getQualifiedSourceName() ), context, configuration, typeOracle );
            String qualifiedClassName = beanJsonDeserializerCreator.create( baseClassType );

            ImmutableList<? extends JType> typeParameters = getTypeParameters( classType, subtype );
            StringBuilder joinedTypeParameterDeserializers = new StringBuilder();
            if ( !typeParameters.isEmpty() ) {
                ImmutableList.Builder<JDeserializerType> parametersDeserializerBuilder = ImmutableList.builder();
                boolean first = true;
                for ( JType argType : typeParameters ) {
                    if ( first ) {
                        first = false;
                    } else {
                        joinedTypeParameterDeserializers.append( ", " );
                    }

                    JDeserializerType parameterDeserializerType = getJsonDeserializerFromType( argType, subtype );
                    parametersDeserializerBuilder.add( parameterDeserializerType );
                    joinedTypeParameterDeserializers.append( parameterDeserializerType.getInstance() );
                }
                builder.parameters( parametersDeserializerBuilder.build() );
            }

            builder.beanMapper( true );
            builder.instance( String.format( "new %s(%s)", qualifiedClassName, joinedTypeParameterDeserializers ) );
            return builder.build();
        }

        String message = "Type '" + type.getQualifiedSourceName() + "' is not supported";
        logger.log( TreeLogger.Type.WARN, message );
        throw new UnsupportedTypeException( message );
    }
View Full Code Here

Examples of com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException

            return builder.build();
        }

        String message = "Type '" + type.getQualifiedSourceName() + "' is not supported as map's key";
        logger.log( TreeLogger.Type.WARN, message );
        throw new UnsupportedTypeException( message );
    }
View Full Code Here

Examples of com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException

    private void generateInstanceBuilderForConstructorOrFactoryMethodDelegation( SourceWriter source, BeanInfo info, ImmutableMap<String,
            PropertyInfo> properties ) throws UnsupportedTypeException {
        // TODO @JsonCreator with delegation
        String message = "The delegation is not supported yet";
        logger.log( TreeLogger.Type.WARN, message );
        throw new UnsupportedTypeException( message );
    }
View Full Code Here

Examples of net.sourceforge.jiu.codecs.UnsupportedTypeException

  {
    Integer compression = new Integer(ifd.getCompression());
    Class decoderClass = (Class)decoders.get(compression);
    if (decoderClass == null)
    {
      throw new UnsupportedTypeException("Could not create decoder for this compression type: " +
        compression.intValue());
    }
    Object instance;
    try
    {
      instance = decoderClass.newInstance();
    }
    catch (Exception e)
    {
      throw new UnsupportedTypeException("Could not create decoder for this compression type.");
    }
    if (instance instanceof TIFFDecoder)
    {
      TIFFDecoder decoder = (TIFFDecoder)instance;
      decoder.setCodec(codec);
      decoder.setTileIndex(tileIndex);
      decoder.setImageFileDirectory(ifd);
      try
      {
        decoder.initialize();
      }
      catch (MissingParameterException mpe)
      {
        throw new UnsupportedTypeException("Unable to initialize decoder: " + mpe.toString());
      }
      return decoder;
    }
    else
    {
      throw new UnsupportedTypeException("Could not create decoder for this compression type.");
    }
  }
View Full Code Here

Examples of net.sourceforge.jiu.codecs.UnsupportedTypeException

          image = new MemoryRGB48Image(width, height);
          break;
        }
        default:
        {
          throw new UnsupportedTypeException("Unsupported image type.");
        }
      }
      setImage(image);
    }
    int tileIndex = 0;
View Full Code Here

Examples of net.sourceforge.jiu.codecs.UnsupportedTypeException

        bytesPerRow = width * 3;
        break;
      }
      default:
      {
        throw new UnsupportedTypeException("Depths other than 1, 8 and 24 " +
          "unsupported when reading RAS stream; found " + depth);
      }
    }
    paddingBytes = (bytesPerRow % 2);
    numColors = 1 << depth;
    //length = ArrayConverter.getIntBE(header, 16);
    type = ArrayConverter.getIntBE(header, 20);
    if (type != COMPRESSION_NONE)
    {
      throw new UnsupportedTypeException("Only uncompressed " +
        "RAS streams are read; found " + type);
    }
    mapType = ArrayConverter.getIntBE(header, 24);
    mapLength = ArrayConverter.getIntBE(header, 28);
    if (mapLength != 0)
    {
      if (depth != 8)
      {
        throw new UnsupportedTypeException("Cannot handle Sun RAS " +
          "input streams with color maps and a depth other than " +
          "8 (found " + depth + ").");
      }
      if (mapLength != 768)
      {
        throw new UnsupportedTypeException("Cannot handle Sun RAS " +
          "input streams with color maps of a length different " +
          "than 768; found " + mapLength);
      }
      if (mapType != 1)
      {
        throw new UnsupportedTypeException("Cannot handle Sun RAS " +
          "input streams with color maps of a type other than " +
          "1; found " + mapType);
      }
      palette = readPalette();
    }
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.