Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Error parsing app.config with more complex custom-properties #79

Closed
cwiechmann opened this issue Jun 7, 2019 · 1 comment
Closed

Error parsing app.config with more complex custom-properties #79

cwiechmann opened this issue Jun 7, 2019 · 1 comment
Assignees
Labels
next release Planned for the next release

Comments

@cwiechmann
Copy link

When having defined the following custom properties the app.config file can't be parsed:

    customPropertiesConfig: {
        user: {
            // custom properties...
        },
        organization: {
            // custom properties...
        },
        application: {
            // custom properties...
        },
        api: {
            contentBasedRouting: {
                label: 'Content Based Routing',
                required: false,
                help: 'Example: xml|https://abc.company.com:8080/api',
                regex: '^[0-9]{4}$',
                error: 'Strange error'
            }, 
            securityClassification: {
                label: 'Security classification',
                required: true,
            	type: 'select',
            	options: [
                	{value: 'public', label: 'Public'},
                	{value: 'private', label: 'Private'},
                	{value: 'confidential', label: 'Confidential'}
            	],
                help: 'Controls the agreed security classification of this API',
            } 
        }
},

This leads to the following error:

com.axway.apim.lib.AppException: Can't parse API-Manager app.config.
        at com.axway.apim.swagger.APIManagerAdapter.parseAppConfig(APIManagerAdapter.java:841)
        at com.axway.apim.swagger.APIManagerAdapter.getCustomPropertiesConfig(APIManagerAdapter.java:817)
        at com.axway.apim.swagger.APIImportConfigAdapter.validateCustomProperties(APIImportConfigAdapter.java:411)
        at com.axway.apim.swagger.APIImportConfigAdapter.getDesiredAPI(APIImportConfigAdapter.java:149)
        at com.axway.apim.App.run(App.java:157)
        at com.axway.apim.App.main(App.java:42)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('á' (code 160)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name
 at [Source: (String)" {
        user: {
            // custom properties...
        },
        organization: {
            // custom properties...
        },
        application: {
            // custom properties...
        },
        api: {
contentBasedRouting: {
label: 'Content Based Routing',
required: false,
help: 'Test'
},
securityClassification: {
label: 'Security classification',
required: true,
type: 'select',
options: [
{value: 'public', label: 'Public'},
{value: 'private', label: 'Private'},
{value: 'con"[truncated 140 chars]; line: 27, column: 2]
        at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:693)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:591)
        at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddName(ReaderBasedJsonParser.java:1781)
        at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextFieldName(ReaderBasedJsonParser.java:917)
        at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:247)
        at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:255)
        at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:255)
        at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:68)
        at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:15)
        at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4056)
        at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2551)
        at com.axway.apim.swagger.APIManagerAdapter.parseAppConfig(APIManagerAdapter.java:839)
        ... 5 more
@cwiechmann cwiechmann self-assigned this Jun 7, 2019
@cwiechmann cwiechmann added the next release Planned for the next release label Jun 7, 2019
cwiechmann pushed a commit that referenced this issue Jun 7, 2019
is working as expected. Was caused by a miss-configuration in the
app.config.
@cwiechmann
Copy link
Author

App.config contained an error having some special invisible characters. Created a unit-test for that kind of app.config anyway to further prove it and it's working fine.

cwiechmann pushed a commit that referenced this issue Jun 7, 2019
…sue-#79

#79 Added a dedicated test to validate app.config can be parsed and it
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
next release Planned for the next release
Projects
None yet
Development

No branches or pull requests

1 participant