]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5967 Decrease the source code size to disable highlighting
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 5 Jan 2015 13:09:53 +0000 (14:09 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 5 Jan 2015 13:09:53 +0000 (14:09 +0100)
server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java
server/sonar-server/src/test/java/org/sonar/server/source/SourceServiceTest.java

index ea8b7ad3c5072c30abeb50253913d7ec8f9a2b2c..56587c5cedb210343b58cb6f23e0e7aec3477a15 100644 (file)
@@ -43,6 +43,8 @@ import static com.google.common.collect.Lists.newArrayList;
 
 public class SourceService implements ServerComponent {
 
+  private static final int THREE_THOUSAND_LINES_SIZE = 3000 * 20;
+
   private final DbClient dbClient;
   private final SnapshotSourceDao snapshotSourceDao;
   private final HtmlSourceDecorator sourceDecorator;
@@ -119,7 +121,7 @@ public class SourceService implements ServerComponent {
   }
 
   private static boolean sizeBiggerThan3000Lines (String source){
-    return source.length() > 120000;
+    return source.length() > THREE_THOUSAND_LINES_SIZE;
   }
 
   private static List<String> getLinesAsTxt(@Nullable String source) {
index 9a329004a1a35622c05260b791007dd48b3ece7d..5320c7d9f2e757fde8e461b292bed73490c45b6c 100644 (file)
@@ -170,7 +170,7 @@ public class SourceServiceTest {
   public void return_txt_when_source_is_too_big() throws Exception {
     MockUserSession.set().addComponentPermission(UserRole.CODEVIEWER, PROJECT_KEY, COMPONENT_KEY);
 
-    when(snapshotSourceDao.selectSnapshotSourceByComponentKey(COMPONENT_KEY, session)).thenReturn(Strings.repeat("a\n", 130000));
+    when(snapshotSourceDao.selectSnapshotSourceByComponentKey(COMPONENT_KEY, session)).thenReturn(Strings.repeat("a\n", 70000));
 
     List<String> lines = service.getLinesAsHtml(COMPONENT_KEY);
     assertThat(lines).isNotEmpty();