Skip to content

Commit

Permalink
Merge pull request #7 from Piszmog/develop
Browse files Browse the repository at this point in the history
Release 2.3
  • Loading branch information
Piszmog authored Aug 5, 2018
2 parents 062cffc + e28a71b commit d41bf71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>io.github.piszmog</groupId>
<artifactId>cloud-config-client-autoconfig</artifactId>
<version>2.2</version>
<version>2.3</version>
<packaging>jar</packaging>

<!--====================================-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ private Map getYAMLFile( final String directoryPath, final String fileName ) thr
{
final Map file;
final byte[] yamlFile = fileConfigClient.getFileFromDefaultBranch( fileName, directoryPath, byte[].class );
if ( yamlFile == null )
{
throw new ConfigResourceException( "Failed to find file " + fileName + " from the Config Server. Ensure the file exists." );
}
try
{
file = YAML_MAPPER.readValue( yamlFile, Map.class );
Expand All @@ -182,9 +186,14 @@ private Map getYAMLFile( final String directoryPath, final String fileName ) thr
private Map getPropertiesFile( final String directoryPath, final String fileName ) throws ConfigException
{
final Map file;
final byte[] propertiesFile = fileConfigClient.getFileFromDefaultBranch( fileName, directoryPath, byte[].class );
if ( propertiesFile == null )
{
throw new ConfigResourceException( "Failed to find file " + fileName + " from the Config Server. Ensure the file exists." );
}
try
{
file = PROPERTIES_MAPPER.readValue( fileConfigClient.getFileFromDefaultBranch( fileName, directoryPath, byte[].class ), Map.class );
file = PROPERTIES_MAPPER.readValue( propertiesFile, Map.class );
}
catch ( IOException e )
{
Expand All @@ -195,6 +204,11 @@ private Map getPropertiesFile( final String directoryPath, final String fileName

private Map getJSONFile( final String directoryPath, final String fileName ) throws ConfigException
{
return fileConfigClient.getFileFromDefaultBranch( fileName, directoryPath, Map.class );
final Map jsonFile = fileConfigClient.getFileFromDefaultBranch( fileName, directoryPath, Map.class );
if ( jsonFile == null )
{
throw new ConfigResourceException( "Failed to find file " + fileName + " from the Config Server. Ensure the file exists." );
}
return jsonFile;
}
}

0 comments on commit d41bf71

Please sign in to comment.