X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fdbcapi.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fservice%2FTopicService.java;h=eed502268474372dbdb7c0b88e22f9663be08caa;hp=d3c849cc36dcdbaf2da31e53994e6a0fd6068add;hb=8f54f37825746cf82b33a21ff356950eb682d290;hpb=955500a4aa5c86a1ccc8c4bdf81c65daff41070a diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java index d3c849c..eed5022 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java +++ b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java @@ -43,6 +43,7 @@ import org.onap.dmaap.dbcapi.model.ReplicationType; import org.onap.dmaap.dbcapi.model.Topic; import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status; import org.onap.dmaap.dbcapi.util.DmaapConfig; +import org.onap.dmaap.dbcapi.util.Fqdn; import org.onap.dmaap.dbcapi.util.Graph; public class TopicService extends BaseLoggingClass { @@ -124,6 +125,20 @@ public class TopicService extends BaseLoggingClass { return null; } } + if ( topic.getReplicationCase().involvesGlobal() ) { + if ( topic.getGlobalMrURL() == null ) { + topic.setGlobalMrURL(defaultGlobalMrHost); + } + if ( ! Fqdn.isValid( topic.getGlobalMrURL())) { + logger.error( "GlobalMR FQDN not valid: " + topic.getGlobalMrURL()); + topic.setStatus( DmaapObject_Status.INVALID); + err.setCode(500); + err.setMessage("Value is not a valid FQDN:" + topic.getGlobalMrURL() ); + err.setFields("globalMrURL"); + + return null; + } + } if ( topic.getNumClients() > 0 ) { @@ -146,11 +161,7 @@ public class TopicService extends BaseLoggingClass { topic.setClients(clients2); } - if ( topic.getReplicationCase().involvesGlobal() ) { - if ( topic.getGlobalMrURL() == null ) { - topic.setGlobalMrURL(defaultGlobalMrHost); - } - } + Topic ntopic = checkForBridge( topic, err ); if ( ntopic == null ) { topic.setStatus( DmaapObject_Status.INVALID);