2222import org .apache .iotdb .common .rpc .thrift .TRegionReplicaSet ;
2323import org .apache .iotdb .common .rpc .thrift .TSeriesPartitionSlot ;
2424import org .apache .iotdb .common .rpc .thrift .TTimePartitionSlot ;
25+ import org .apache .iotdb .commons .i18n .CommonMessages ;
2526import org .apache .iotdb .commons .utils .PathUtils ;
2627import org .apache .iotdb .commons .utils .TimePartitionUtils ;
2728
@@ -223,25 +224,20 @@ public List<TRegionReplicaSet> getDataRegionReplicaSetForWriting(
223224 dataBasePartitionMap = dataPartitionMap .get (databaseName );
224225 if (dataBasePartitionMap == null ) {
225226 throw new RuntimeException (
226- "Database "
227- + databaseName
228- + " not exists and failed to create automatically because enable_auto_create_schema is FALSE." );
227+ String .format (CommonMessages .DATABASE_NOT_EXISTS_AND_AUTO_CREATE_DISABLED , databaseName ));
229228 }
230229 final Map <TTimePartitionSlot , List <TRegionReplicaSet >> slotReplicaSetMap =
231230 dataBasePartitionMap .get (seriesPartitionSlot );
232231 if (slotReplicaSetMap == null ) {
233232 throw new RuntimeException (
234233 String .format (
235- "Data partition is empty. device: %s, seriesSlot: %s, database: %s" ,
236- deviceID , seriesPartitionSlot , databaseName ));
234+ CommonMessages .DATA_PARTITION_EMPTY , deviceID , seriesPartitionSlot , databaseName ));
237235 }
238236 for (final TTimePartitionSlot timePartitionSlot : timePartitionSlotList ) {
239237 final List <TRegionReplicaSet > targetRegionList = slotReplicaSetMap .get (timePartitionSlot );
240238 if (targetRegionList == null || targetRegionList .isEmpty ()) {
241239 throw new RuntimeException (
242- String .format (
243- "targetRegionList is empty. device: %s, timeSlot: %s" ,
244- deviceID , timePartitionSlot ));
240+ String .format (CommonMessages .TARGET_REGION_LIST_EMPTY , deviceID , timePartitionSlot ));
245241 } else {
246242 dataRegionReplicaSets .add (targetRegionList .get (targetRegionList .size () - 1 ));
247243 }
@@ -262,9 +258,7 @@ public TRegionReplicaSet getDataRegionReplicaSetForWriting(
262258 databasePartitionMap = dataPartitionMap .get (databaseName );
263259 if (databasePartitionMap == null ) {
264260 throw new RuntimeException (
265- "Database "
266- + databaseName
267- + " not exists and failed to create automatically because enable_auto_create_schema is FALSE." );
261+ String .format (CommonMessages .DATABASE_NOT_EXISTS_AND_AUTO_CREATE_DISABLED , databaseName ));
268262 }
269263 final List <TRegionReplicaSet > regions =
270264 databasePartitionMap .get (seriesPartitionSlot ).get (timePartitionSlot );
0 commit comments