Skip to content

Commit e6343b8

Browse files
MingYuanEricleomaatEric
authored andcommitted
add verification for tgName
1 parent 016f114 commit e6343b8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFTemplate.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ public ASTFTemplate(ASTFTCPClientTemplate astfTcpClientTemplate, ASTFTCPServerTe
6060
if (astfTcpClientTemplate.isStream() != astfTcpServerTemplate.isStream()) {
6161
throw new IllegalStateException(String.format(" Client template stream mode is %s and different from server template mode %s", astfTcpClientTemplate.isStream(), astfTcpServerTemplate.isStream()));
6262
}
63+
64+
if(tgName != null && (tgName.length() > 20 || tgName.isEmpty())){
65+
throw new IllegalArgumentException(String.format("tgName %s is empty or too long", tgName));
66+
}
67+
6368
this.astfTcpClientTemplate = astfTcpClientTemplate;
6469
this.astfTcpServerTemplate = astfTcpServerTemplate;
6570
this.tgName = tgName;

0 commit comments

Comments
 (0)