[jbosstools-issues] [JBoss JIRA] (JBIDE-15399) openshift-java-client: dont fail on unknown link-type

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Fri Sep 6 16:56:03 EDT 2013


    [ https://issues.jboss.org/browse/JBIDE-15399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12802529#comment-12802529 ] 

Andre Dietisheim commented on JBIDE-15399:
------------------------------------------

openshift bot merged the PR into master
                
> openshift-java-client: dont fail on unknown link-type
> -----------------------------------------------------
>
>                 Key: JBIDE-15399
>                 URL: https://issues.jboss.org/browse/JBIDE-15399
>             Project: Tools (JBoss Tools)
>          Issue Type: Enhancement
>          Components: openshift
>    Affects Versions: 4.1.0.Final
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>              Labels: openshift-java-client
>
> When unmarshalling responses from the server there are among other objects links that shall get created. Links look like the following:
> {code}
>  "links":{
> "UPDATE":{
>                     "href":"/domains/foobar",
>                     "optional_params":[
>                         
>                     ],
>                     "required_params":[
>                         {
>                             "name":"id",
>                             "valid_options":[
>                                 
>                             ],
>                             "description":"Name of the domain",
>                             "type":"string"
>                         }
>                     ],
>                     "method":"PUT",
>                     "rel":"Update domain"
>                     ...
> {code}
> The unmarshalling code currently turns the "type" property into an enum. If the type that's provided is not known, then an exception is thrown:
> {code}
> public enum LinkParameterType {
> 	STRING, BOOLEAN, INTEGER, ARRAY;
> 	
> 	public static LinkParameterType valueOfIgnoreCase(String name) throws OpenShiftRequestException {
> 		if (name == null) {
> 			// no type provided (this is valid, not an error)
> 			return null;
> 		}
> 		try {
> 			return	valueOf(name.toUpperCase());
> 		} catch(IllegalArgumentException e) {
> 			throw new OpenShiftRequestException("Unknow request parameter type {0}", name);
> 		}
> 	}
> {code}
> This is not a good approach. The client library should be tolerant, it should ignore things it doesn't know to ensure it works with future responses. This is even more true as responses evolve over time even in the same protocol version: OpenShift is backporting new features (additions only) to old protocols!

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list