Project

General

Profile

« Previous | Next » 

Revision 50909

avoid NPEs

View differences:

modules/dnet-openaire-datasource-manager/trunk/src/main/java/eu/dnetlib/enabling/datasources/LocalOpenaireDatasourceManagerImpl.java
309 309

  
310 310
		datasourceManagerClients.updateSQL(api.getDatasource(), insertApi, AfterSqlUpdate.NONE, DatasourceFunctions.apiToMap(api));
311 311

  
312
		api.getApiParams().forEach(p -> {
313
			final ImmutableMap<String, Object> sqlParams = ImmutableMap.of("param", p.getParam(), "value", p.getValue(), "api", api.getId());
314
			try {
315
				datasourceManagerClients.updateSQL(api.getDatasource(), insertApiParam, AfterSqlUpdate.NONE, sqlParams);
316
			} catch (final DsmException e) {
317
				throw new RuntimeException(e);
318
			}
319
		});
312
		if (api.getApiParams() != null) {
313
			api.getApiParams().forEach(p -> {
314
				final ImmutableMap<String, Object> sqlParams = ImmutableMap.of("param", p.getParam(), "value", p.getValue(), "api", api.getId());
315
				try {
316
					datasourceManagerClients.updateSQL(api.getDatasource(), insertApiParam, AfterSqlUpdate.NONE, sqlParams);
317
				} catch (final DsmException e) {
318
					throw new RuntimeException(e);
319
				}
320
			});
321
		}
320 322

  
321 323
		setManaged(api.getDatasource(), true); // It also update the IS profile
322 324
	}

Also available in: Unified diff