Jun Gong, thanks for the patch.
A couple of comments :
AM RPC address in AppInfo.java is being filled inside the check for master container not being null.
But Master container is set when its allocated by scheduler, whereas AM host and RPC port is set when AM registers. There will be some time difference between both these events. I think we can explicitly check if host is not "N/A" and RPC port is not -1 to fill AM RPC address in response.
Moreover, the additional field added can be added in documentation too in hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md. That is add the field in the response under the apps and app REST endpoint sections.