[ 
https://issues.apache.org/jira/browse/FALCON-159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13809783#comment-13809783
 ] 

Venkatesh Seetharam commented on FALCON-159:
--------------------------------------------

Srimanth looks good but I see a gap in this where in the method produces both 
TEXT and JSON but the results are in JSON only. 
{code}
    @GET
    @Path("version")
    @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    public String getVersion() { 
{code}

Not sure if this is a big deal but wondering if we should construct a 
PropertyList object and return that instead. 
{code}
    private PropertyList version;

    @GET
    @Path("version")
    @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    public PropertyList getVersion() {
        if (version == null) {
            List<Property> props = new ArrayList<Property>();
            
            Property property = new Property();
            property.key = "Version";
            property.value = BuildProperties.get().getProperty("build.version");
            props.add(property);

            property = new Property();
            property.key = "Mode";
            property.value = 
DeploymentProperties.get().getProperty("deploy.mode");
            props.add(property);

            version = new PropertyList();
            version.properties = props;
        }
        
        return version;
    }
{code}

Makes sense?

> Version API endpoint does not emit valid JSON
> ---------------------------------------------
>
>                 Key: FALCON-159
>                 URL: https://issues.apache.org/jira/browse/FALCON-159
>             Project: Falcon
>          Issue Type: Bug
>          Components: prism
>    Affects Versions: 0.3
>            Reporter: Srimanth Gunturi
>            Assignee: Srimanth Gunturi
>         Attachments: FALCON-159.patch
>
>
> {{/api/admin/version}} endpoint emits 
> {noformat}
> {Version:"0.4-incubating-SNAPSHOT-rb47788d1112fcf949c22a3860934167237b395b0",Mode:"distributed"}
> {noformat}
> which is not valid JSON. It should be
> {noformat}
> {"Version":"0.4-incubating-SNAPSHOT-rb47788d1112fcf949c22a3860934167237b395b0","Mode":"distributed"}
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to