@@ -713,82 +713,88 @@ public static void readableLine(int num, Writer out, Annotation annotation, Stri
713713 out .write (closeQuotedTag );
714714 out .write (snum );
715715 out .write (anchorEnd );
716+
716717 if (annotation != null ) {
717- String r = annotation .getRevision (num );
718- boolean enabled = annotation .isEnabled (num );
719- out .write ("<span class=\" blame\" >" );
720- if (enabled ) {
721- out .write (anchorClassStart );
722- out .write ("r" );
723- out .write ("\" style=\" background-color: " );
724- out .write (annotation .getColors ().getOrDefault (r , "inherit" ));
725- out .write ("\" href=\" " );
726- out .write (URIEncode (annotation .getFilename ()));
727- out .write ("?a=true&r=" );
728- out .write (URIEncode (r ));
729- String msg = annotation .getDesc (r );
730- out .write ("\" title=\" " );
731- if (msg != null ) {
732- out .write (msg );
733- }
734- if (annotation .getFileVersion (r ) != 0 ) {
735- out .write ("<br/>version: " + annotation .getFileVersion (r ) + "/"
736- + annotation .getRevisions ().size ());
737- }
738- out .write (closeQuotedTag );
739- }
740- StringBuilder buf = new StringBuilder ();
741- final boolean most_recent_revision = annotation .getFileVersion (r ) == annotation .getRevisions ().size ();
742- // print an asterisk for the most recent revision
743- if (most_recent_revision ) {
744- buf .append ("<span class=\" most_recent_revision\" >" );
745- buf .append ('*' );
718+ writeAnnotation (num , out , annotation , userPageLink , userPageSuffix , project );
719+ }
720+ }
721+
722+ private static void writeAnnotation (int num , Writer out , Annotation annotation , String userPageLink ,
723+ String userPageSuffix , String project ) throws IOException {
724+ String r = annotation .getRevision (num );
725+ boolean enabled = annotation .isEnabled (num );
726+ out .write ("<span class=\" blame\" >" );
727+ if (enabled ) {
728+ out .write (anchorClassStart );
729+ out .write ("r" );
730+ out .write ("\" style=\" background-color: " );
731+ out .write (annotation .getColors ().getOrDefault (r , "inherit" ));
732+ out .write ("\" href=\" " );
733+ out .write (URIEncode (annotation .getFilename ()));
734+ out .write ("?a=true&r=" );
735+ out .write (URIEncode (r ));
736+ String msg = annotation .getDesc (r );
737+ out .write ("\" title=\" " );
738+ if (msg != null ) {
739+ out .write (Util .encode (msg ));
746740 }
747- htmlize ( r , buf );
748- if ( most_recent_revision ) {
749- buf . append ( "</span>" ); // recent revision span
741+ if ( annotation . getFileVersion ( r ) != 0 ) {
742+ out . write ( "<br/>version: " + annotation . getFileVersion ( r ) + "/"
743+ + annotation . getRevisions (). size ());
750744 }
745+ out .write (closeQuotedTag );
746+ }
747+ StringBuilder buf = new StringBuilder ();
748+ final boolean most_recent_revision = annotation .getFileVersion (r ) == annotation .getRevisions ().size ();
749+ // print an asterisk for the most recent revision
750+ if (most_recent_revision ) {
751+ buf .append ("<span class=\" most_recent_revision\" >" );
752+ buf .append ('*' );
753+ }
754+ htmlize (r , buf );
755+ if (most_recent_revision ) {
756+ buf .append ("</span>" ); // recent revision span
757+ }
758+ out .write (buf .toString ());
759+ buf .setLength (0 );
760+ if (enabled ) {
761+ RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
762+
763+ out .write (anchorEnd );
764+
765+ // Write link to search the revision in current project.
766+ out .write (anchorClassStart );
767+ out .write ("search\" href=\" " + env .getUrlPrefix ());
768+ out .write ("defs=&refs=&path=" );
769+ out .write (project );
770+ out .write ("&hist="" + URIEncode (r ) + """ );
771+ out .write ("&type=\" title=\" Search history for this changeset" );
772+ out .write (closeQuotedTag );
773+ out .write ("S" );
774+ out .write (anchorEnd );
775+ }
776+ String a = annotation .getAuthor (num );
777+ if (userPageLink == null ) {
778+ out .write (HtmlConsts .SPAN_A );
779+ htmlize (a , buf );
751780 out .write (buf .toString ());
781+ out .write (HtmlConsts .ZSPAN );
752782 buf .setLength (0 );
753- if (enabled ) {
754- RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
755-
756- out .write (anchorEnd );
757-
758- // Write link to search the revision in current project.
759- out .write (anchorClassStart );
760- out .write ("search\" href=\" " + env .getUrlPrefix ());
761- out .write ("defs=&refs=&path=" );
762- out .write (project );
763- out .write ("&hist="" + URIEncode (r ) + """ );
764- out .write ("&type=\" title=\" Search history for this changeset" );
765- out .write (closeQuotedTag );
766- out .write ("S" );
767- out .write (anchorEnd );
768- }
769- String a = annotation .getAuthor (num );
770- if (userPageLink == null ) {
771- out .write (HtmlConsts .SPAN_A );
772- htmlize (a , buf );
773- out .write (buf .toString ());
774- out .write (HtmlConsts .ZSPAN );
775- buf .setLength (0 );
776- } else {
777- out .write (anchorClassStart );
778- out .write ("a\" href=\" " );
779- out .write (userPageLink );
780- out .write (URIEncode (a ));
781- if (userPageSuffix != null ) {
782- out .write (userPageSuffix );
783- }
784- out .write (closeQuotedTag );
785- htmlize (a , buf );
786- out .write (buf .toString ());
787- buf .setLength (0 );
788- out .write (anchorEnd );
783+ } else {
784+ out .write (anchorClassStart );
785+ out .write ("a\" href=\" " );
786+ out .write (userPageLink );
787+ out .write (URIEncode (a ));
788+ if (userPageSuffix != null ) {
789+ out .write (userPageSuffix );
789790 }
790- out .write ("</span>" );
791+ out .write (closeQuotedTag );
792+ htmlize (a , buf );
793+ out .write (buf .toString ());
794+ buf .setLength (0 );
795+ out .write (anchorEnd );
791796 }
797+ out .write ("</span>" );
792798 }
793799
794800 /**
0 commit comments