@@ -86,6 +86,9 @@ public String format(String text, int strRef) {
8686 /** Strref start index for virtual strings referenced by ENGINEST.2DA (EE only) */
8787 public static final int STRREF_VIRTUAL = 0xf00000 ;
8888
89+ /** Default string returned if a requested string is unavailable. */
90+ public static final String DEFAULT_STRING = "No such index" ;
91+
8992 private static final EnumMap <Type , StringTable > TLK_TABLE = new EnumMap <>(Type .class );
9093
9194 private static Charset charset = null ;
@@ -326,7 +329,7 @@ public static String getStringRef(Type type, int index) throws IndexOutOfBoundsE
326329 try {
327330 return instance (type )._getStringRef (index , getDisplayFormat ());
328331 } catch (StringTableUnavailableException e ) {
329- throw new IndexOutOfBoundsException (index + " >= 0 " );
332+ throw new IndexOutOfBoundsException ("String table does not exist " );
330333 }
331334 }
332335
@@ -349,7 +352,7 @@ public static String getStringRef(Type type, int index, Format fmt) throws Index
349352 try {
350353 return instance (type )._getStringRef (index , fmt );
351354 } catch (StringTableUnavailableException e ) {
352- throw new IndexOutOfBoundsException (index + " >= 0 " );
355+ throw new IndexOutOfBoundsException ("String table does not exist " );
353356 }
354357 }
355358
@@ -394,7 +397,7 @@ public static void setStringRef(Type type, int index, String text) throws IndexO
394397 try {
395398 instance (type )._setStringRef (index , text );
396399 } catch (StringTableUnavailableException e ) {
397- throw new IndexOutOfBoundsException (index + " >= 0 " );
400+ throw new IndexOutOfBoundsException ("String table does not exist " );
398401 }
399402 }
400403
@@ -418,7 +421,7 @@ public static String getSoundResource(Type type, int index) throws IndexOutOfBou
418421 try {
419422 return instance (type )._getSoundResource (index );
420423 } catch (StringTableUnavailableException e ) {
421- throw new IndexOutOfBoundsException (index + " >= 0 " );
424+ throw new IndexOutOfBoundsException ("String table does not exist " );
422425 }
423426 }
424427
@@ -444,7 +447,7 @@ public static void setSoundResource(Type type, int index, String resRef) throws
444447 try {
445448 instance (type )._setSoundResource (index , resRef );
446449 } catch (StringTableUnavailableException e ) {
447- throw new IndexOutOfBoundsException (index + " >= 0 " );
450+ throw new IndexOutOfBoundsException ("String table does not exist " );
448451 }
449452 }
450453
@@ -466,7 +469,7 @@ public static short getFlags(Type type, int index) throws IndexOutOfBoundsExcept
466469 try {
467470 return instance (type )._getFlags (index );
468471 } catch (StringTableUnavailableException e ) {
469- throw new IndexOutOfBoundsException (index + " >= 0 " );
472+ throw new IndexOutOfBoundsException ("String table does not exist " );
470473 }
471474 }
472475
@@ -492,7 +495,7 @@ public static void setFlags(Type type, int index, short value) throws IndexOutOf
492495 try {
493496 instance (type )._setFlags (index , value );
494497 } catch (StringTableUnavailableException e ) {
495- throw new IndexOutOfBoundsException (index + " >= 0 " );
498+ throw new IndexOutOfBoundsException ("String table does not exist " );
496499 }
497500 }
498501
@@ -514,7 +517,7 @@ public static int getVolume(Type type, int index) throws IndexOutOfBoundsExcepti
514517 try {
515518 return instance (type )._getVolume (index );
516519 } catch (StringTableUnavailableException e ) {
517- throw new IndexOutOfBoundsException (index + " >= 0 " );
520+ throw new IndexOutOfBoundsException ("String table does not exist " );
518521 }
519522 }
520523
@@ -540,7 +543,7 @@ public static void setVolume(Type type, int index, int value) throws IndexOutOfB
540543 try {
541544 instance (type )._setVolume (index , value );
542545 } catch (StringTableUnavailableException e ) {
543- throw new IndexOutOfBoundsException (index + " >= 0 " );
546+ throw new IndexOutOfBoundsException ("String table does not exist " );
544547 }
545548 }
546549
@@ -562,7 +565,7 @@ public static int getPitch(Type type, int index) throws IndexOutOfBoundsExceptio
562565 try {
563566 return instance (type )._getPitch (index );
564567 } catch (StringTableUnavailableException e ) {
565- throw new IndexOutOfBoundsException (index + " >= 0 " );
568+ throw new IndexOutOfBoundsException ("String table does not exist " );
566569 }
567570 }
568571
@@ -588,7 +591,7 @@ public static void setPitch(Type type, int index, int value) throws IndexOutOfBo
588591 try {
589592 instance (type )._setPitch (index , value );
590593 } catch (StringTableUnavailableException e ) {
591- throw new IndexOutOfBoundsException (index + " >= 0 " );
594+ throw new IndexOutOfBoundsException ("String table does not exist " );
592595 }
593596 }
594597
@@ -602,7 +605,7 @@ public static StringEntry getStringEntry(Type type, int index) throws IndexOutOf
602605 try {
603606 return instance (type )._getEntry (index );
604607 } catch (StringTableUnavailableException e ) {
605- throw new IndexOutOfBoundsException (index + " >= 0 " );
608+ throw new IndexOutOfBoundsException ("String table does not exist " );
606609 }
607610 }
608611
@@ -721,7 +724,7 @@ public static int insertEntry(Type type, int index) throws IndexOutOfBoundsExcep
721724 try {
722725 return instance (type )._insertEntry (index );
723726 } catch (StringTableUnavailableException e ) {
724- throw new IndexOutOfBoundsException (index + " >= 0 " );
727+ throw new IndexOutOfBoundsException ("String table does not exist " );
725728 }
726729 }
727730
@@ -757,7 +760,7 @@ public static int insertEntry(Type type, int index, StringEntry newEntry) throws
757760 try {
758761 return instance (type )._insertEntry (index , newEntry );
759762 } catch (StringTableUnavailableException e ) {
760- throw new IndexOutOfBoundsException (index + " >= 0 " );
763+ throw new IndexOutOfBoundsException ("String table does not exist " );
761764 }
762765 }
763766
@@ -786,7 +789,7 @@ public static void removeEntry(Type type, int index) throws IndexOutOfBoundsExce
786789 try {
787790 instance (type )._removeEntry (index );
788791 } catch (StringTableUnavailableException e ) {
789- throw new IndexOutOfBoundsException (index + " >= 0 " );
792+ throw new IndexOutOfBoundsException ("String table does not exist " );
790793 }
791794 }
792795
@@ -1608,7 +1611,7 @@ private void _exportText(Path outFile, ProgressCallback callback) throws IOExcep
16081611 // Manages a single string entry
16091612 public static class StringEntry extends AbstractStruct {
16101613 // Default entry for non-existing indices
1611- private static final StringEntry INVALID = new StringEntry (null , FLAGS_HAS_TEXT , "" , 0 , 0 , "No such index" , null );
1614+ private static final StringEntry INVALID = new StringEntry (null , FLAGS_HAS_TEXT , "" , 0 , 0 , StringTable . DEFAULT_STRING , null );
16121615
16131616 private StringTable parent ;
16141617 private short flags ;
0 commit comments