Bulk: null strong turn and IOS null crash

Source: Internet
Author: User

Question 1

Look at springmvc source Profiling (v)-Message converter Httpmessageconverter , in the See the following code in Org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor:

protected Abstractmessageconvertermethodprocessor (list converters) {        This (Converters, (Contentnegotiationmanager)null);}

The time did not react to why the strong turn null.

The static method of the corresponding class can be called after the null has been strongly transferred since it was previously tested. A moment to think of a fork---especially no longer notice here is the construction method.

Internet help, someone reply sharply, this is to distinguish different construction methods.

Because, if there is a construction method as follows:

 Public class x {    x (a A, b b) {...};       X (A A, C c) {...};   }

Then, when you call X (A, null ), you don't know which method to construct!

Therefore, it is necessary to turn a strong, so as to distinguish.

Question 2

Talk to coworkers. iOS parsing JSON crashes when it encounters null.

Although I firmly believe that this is the iOS parsing tool is too weak-after all, JSON is a common format, but the problem still needs to be solved.

The easy way is to use Jackson to label the entity class, ignoring the null-valued attribute.

Reference

Jackson entity to JSON null or NULL to not participate in serialization

SPRINGMVC Source Analysis (v)-Message converter Httpmessageconverter

Null issues with JSON parsing in iOS

Bulk: null strong turn and IOS null crash

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.