taskadapter / redmine-java-api

Redmine Java API
Apache License 2.0
270 stars 163 forks source link

getAuthorName returns firstname + NULL when last name is null #275

Closed gengweifeng closed 7 years ago

gengweifeng commented 8 years ago

hi, when i get the issue's authorName, the return is strange. the api version is 3.0.0, and the return is "authorName null". when i use the api version 2.6.0, i found that the author's lastname is null and the firstName is truly full name. so the full name it return is "authorName null"

alexeyOnGitHub commented 7 years ago

I recall this was added as a workaround for Redmine REST API limitations when they clumped first and last name together in one field and we did some parsing to guess what was first and last there.

        if (author != null) {
            result.setAuthorId(author.getId());
            result.setAuthorName(author.getFullName());
        }

    public String getFullName() {
        return getFirstName() + " " + getLastName();
    }

I guess getFullName() can use an empty string if getLastName() returns NULL.

alexeyOnGitHub commented 7 years ago

fixed