From fb7248d86bc6b540567a2dcc8ee9cad6a615e254 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Vilain Date: Tue, 16 Apr 2013 16:15:52 +0200 Subject: SONAR-3893 Fixed snapshot data persistence issue --- .../java/org/sonar/core/source/HtmlSourceDecorator.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'sonar-core') diff --git a/sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java b/sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java index 4fb4925a6f0..e8772ee357c 100644 --- a/sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java +++ b/sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java @@ -20,6 +20,7 @@ package org.sonar.core.source; +import com.google.common.base.Strings; import org.sonar.core.persistence.MyBatis; import org.sonar.core.source.jdbc.SnapshotDataDao; import org.sonar.core.source.jdbc.SnapshotDataDto; @@ -48,11 +49,7 @@ public class HtmlSourceDecorator { if (snapshotSource != null && snapshotDataEntries != null) { DecorationDataHolder decorationDataHolder = new DecorationDataHolder(); for (SnapshotDataDto snapshotDataEntry : snapshotDataEntries) { - if (snapshotDataEntry.isSyntaxHighlightingData()) { - decorationDataHolder.loadSyntaxHighlightingData(snapshotDataEntry.getData()); - } else if (snapshotDataEntry.isSymbolData()) { - decorationDataHolder.loadSymbolReferences(snapshotDataEntry.getData()); - } + loadSnapshotData(decorationDataHolder, snapshotDataEntry); } HtmlTextDecorator textDecorator = new HtmlTextDecorator(); @@ -60,4 +57,14 @@ public class HtmlSourceDecorator { } return null; } + + private void loadSnapshotData(DecorationDataHolder decorationDataHolder, SnapshotDataDto snapshotDataEntry) { + if(!Strings.isNullOrEmpty(snapshotDataEntry.getData())) { + if (snapshotDataEntry.isSyntaxHighlightingData()) { + decorationDataHolder.loadSyntaxHighlightingData(snapshotDataEntry.getData()); + } else if (snapshotDataEntry.isSymbolData()) { + decorationDataHolder.loadSymbolReferences(snapshotDataEntry.getData()); + } + } + } } -- cgit v1.2.3