Skip to content

Commit

Permalink
shorten the git sha hash sums in info message
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskrause committed Oct 13, 2014
1 parent 1d1ed74 commit ae4ee60
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions annis-gui/src/main/java/annis/gui/SearchUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import annis.libgui.media.PDFControllerImpl;
import annis.service.objects.AnnisCorpus;
import annis.service.objects.CorpusConfig;
import com.google.common.base.Strings;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.escape.Escaper;
Expand Down Expand Up @@ -250,13 +251,26 @@ private void checkServiceVersion()
= Helper.getAnnisWebResource().path("version").path("revision");
String revisionService = resRevision.get(String.class);
String revisionGUI = VersionInfo.getBuildRevision();

if(!revisionService.equals(revisionGUI))
{
{
// shorten the strings
String commonPrefix = Strings.commonPrefix(revisionService,
revisionGUI);
int outputLength = Math.max(6, commonPrefix.length()+2);
String revisionServiceShort = revisionService.substring(0,
Math.min(revisionService.length()-1, outputLength));
String revisionGUIShort = revisionGUI.substring(0,
Math.min(revisionGUI.length()-1, outputLength));

Notification n = new Notification("Different service revision",
"The service uses revision " + revisionService
+ " but the user interface is using revision " + revisionGUI
+ ".",
"The service uses revision <code title=\"" + revisionGUI
+ "\">" + revisionServiceShort
+ "</code> but the user interface is using revision <code title=\""
+ revisionGUI + "\">" + revisionGUIShort
+ "</code>.",
Notification.Type.TRAY_NOTIFICATION);
n.setHtmlContentAllowed(true);
n.setDelayMsec(3000);
n.show(Page.getCurrent());
}
Expand Down

0 comments on commit ae4ee60

Please sign in to comment.