@@ -605,7 +605,7 @@ public int insertSequences(ParseContext context, Connection conn) throws SQLExce
605605 else
606606 {
607607 String tmp = curSeq .getDescription ();
608- if (tmp .length () >= 200 ) tmp = tmp . substring ( 0 , 190 ) + "..." ;
608+ if (tmp .length () >= 200 ) tmp = StringUtilsLabKey . leftSurrogatePairFriendly ( tmp , 190 ) + "..." ;
609609 _addSeq .setString (3 , tmp );
610610 }
611611 if (curSeq .getSourceChangeDate () == null )
@@ -657,7 +657,7 @@ public int insertSequences(ParseContext context, Connection conn) throws SQLExce
657657 else
658658 {
659659 String tmp = curSeq .getBestName ();
660- if (tmp .length () >= 50 ) tmp = tmp . substring ( 0 , 45 ) + "..." ;
660+ if (tmp .length () >= 50 ) tmp = StringUtilsLabKey . leftSurrogatePairFriendly ( tmp , 45 ) + "..." ;
661661 _addSeq .setString (11 , tmp );
662662 }
663663 if (curSeq .getBestGeneName () == null )
@@ -667,7 +667,7 @@ public int insertSequences(ParseContext context, Connection conn) throws SQLExce
667667 else
668668 {
669669 String tmp = curSeq .getBestGeneName ();
670- if (tmp .length () >= 50 ) tmp = tmp . substring ( 0 , 45 ) + "..." ;
670+ if (tmp .length () >= 50 ) tmp = StringUtilsLabKey . leftSurrogatePairFriendly ( tmp , 45 ) + "..." ;
671671 _addSeq .setString (12 , tmp );
672672 }
673673 // Timestamp at index 13 is set once for the whole prepared statement
@@ -709,7 +709,7 @@ public int insertIdentifiers(ParseContext context, Connection conn) throws SQLEx
709709 {
710710 transactionCount ++;
711711 String curIdentVal = curIdent .getIdentifier ();
712- if (curIdentVal .length () > 50 ) curIdentVal = curIdentVal . substring ( 0 , 45 ) + "..." ;
712+ if (curIdentVal .length () > 50 ) curIdentVal = StringUtilsLabKey . leftSurrogatePairFriendly ( curIdentVal , 45 ) + "..." ;
713713 _addIdent .setString (1 , curIdentVal );
714714 _addIdent .setString (2 , curIdent .getIdentType ());
715715 UniprotSequence curSeq = curIdent .getSequence ();
0 commit comments