Spring Cloud Version:Greenwich.SR6

Caused by: java.lang.NullPointerException: null

    at feign.form.util.PojoUtil.isUserPojo(PojoUtil.java:50)

    at feign.form.multipart.PojoWriter.isApplicable(PojoWriter.java:40)

    at feign.form.MultipartFormContentProcessor.findApplicableWriter(MultipartFormContentProcessor.java:159)

    at feign.form.MultipartFormContentProcessor.process(MultipartFormContentProcessor.java:86)

    at feign.form.FormEncoder.encode(FormEncoder.java:105)

    at com.xxx.reach.admin.config.feign.SpringMultipartEncoder.encode(SpringMultipartEncoder.java:61)

    at feign.ReflectiveFeign$BuildEncodedTemplateFromArgs.resolve(ReflectiveFeign.java:372)

    ... 120 common frames omitted

@SuppressWarnings("all")
@Configuration
public class SpringMultipartEncoder extends FormEncoder {

    /**
     * Constructor with the default Feign's encoder as a delegate.
     */
    public SpringMultipartEncoder() {
        this(new Default());
    }

    /**
     * Constructor with specified delegate encoder.
     *
     * @param delegate delegate encoder, if this encoder couldn't encode object.
     */
    public SpringMultipartEncoder(Encoder delegate) {
        super(delegate);

        MultipartFormContentProcessor processor = (MultipartFormContentProcessor) getContentProcessor(ContentType.MULTIPART);
        processor.addWriter(new SpringSingleMultipartFileWriter());
        processor.addWriter(new SpringManyMultipartFilesWriter());
    }


    @Override
    public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException {
        // 单MultipartFile判断
        if (bodyType.equals(MultipartFile.class)) {
            MultipartFile file = (MultipartFile) object;
            Map data = Collections.singletonMap(file.getName(), object);
            super.encode(data, MAP_STRING_WILDCARD, template);
            return;
        } else if (bodyType.equals(MultipartFile[].class)) {
            // MultipartFile数组处理
            MultipartFile[] file = (MultipartFile[]) object;
            if (file != null) {
                Map data = Collections.singletonMap(file.length == 0 ? "" : file[0].getName(), object);
                super.encode(data, MAP_STRING_WILDCARD, template);
                return;
            }
        }
        // 其他类型调用父类默认处理方法
        super.encode(object, bodyType, template);
    }

}

@spencergibb

Comment From: spencergibb

how do I recreate the stack trace?

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.