Skip to content

Commit 959cfd2

Browse files
committed
checkstyle
1 parent a569576 commit 959cfd2

File tree

4 files changed

+67
-15
lines changed

4 files changed

+67
-15
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/Annotation.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,26 @@
2424

2525
package org.opengrok.indexer.history;
2626

27+
import org.opengrok.indexer.logger.LoggerFactory;
28+
import org.opengrok.indexer.util.Color;
29+
import org.opengrok.indexer.util.LazilyInstantiate;
30+
import org.opengrok.indexer.util.RainbowColorGenerator;
31+
import org.opengrok.indexer.web.Util;
32+
2733
import java.io.IOException;
2834
import java.io.StringWriter;
2935
import java.io.Writer;
30-
import java.util.*;
36+
import java.util.ArrayList;
37+
import java.util.Comparator;
38+
import java.util.HashMap;
39+
import java.util.HashSet;
40+
import java.util.Iterator;
41+
import java.util.List;
42+
import java.util.Map;
3143
import java.util.Map.Entry;
44+
import java.util.Set;
3245
import java.util.logging.Logger;
3346
import java.util.stream.Collectors;
34-
import org.opengrok.indexer.logger.LoggerFactory;
35-
import org.opengrok.indexer.util.Color;
36-
import org.opengrok.indexer.util.LazilyInstantiate;
37-
import org.opengrok.indexer.util.RainbowColorGenerator;
38-
import org.opengrok.indexer.web.Util;
3947

4048
/**
4149
* Class representing file annotation, i.e., revision and author for the last

opengrok-indexer/src/main/java/org/opengrok/indexer/util/ColorUtil.java

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* CDDL HEADER START
3+
*
4+
* The contents of this file are subject to the terms of the
5+
* Common Development and Distribution License (the "License").
6+
* You may not use this file except in compliance with the License.
7+
*
8+
* See LICENSE.txt included in this distribution for the specific
9+
* language governing permissions and limitations under the License.
10+
*
11+
* When distributing Covered Code, include this CDDL HEADER in each
12+
* file and include the License file at LICENSE.txt.
13+
* If applicable, add the following below this CDDL HEADER, with the
14+
* fields enclosed by brackets "[]" replaced with your own identifying
15+
* information: Portions Copyright [yyyy] [name of copyright owner]
16+
*
17+
* CDDL HEADER END
18+
*/
19+
120
/*
221
* Copyright 2000-2016 JetBrains s.r.o.
322
*
@@ -45,9 +64,15 @@ private static int parseHexNumber(String str, int pos) {
4564

4665
private static int convertToDecimal(String str, int pos) {
4766
char ch = str.charAt(pos);
48-
if (ch >= '0' && ch <= '9') return ch - '0';
49-
if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10;
50-
if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10;
67+
if (ch >= '0' && ch <= '9') {
68+
return ch - '0';
69+
}
70+
if (ch >= 'A' && ch <= 'F') {
71+
return ch - 'A' + 10;
72+
}
73+
if (ch >= 'a' && ch <= 'f') {
74+
return ch - 'a' + 10;
75+
}
5176
throw new IllegalArgumentException("unsupported char at " + pos + ":" + str);
5277
}
5378
}

opengrok-indexer/src/main/java/org/opengrok/indexer/util/RainbowColorGenerator.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* CDDL HEADER START
3+
*
4+
* The contents of this file are subject to the terms of the
5+
* Common Development and Distribution License (the "License").
6+
* You may not use this file except in compliance with the License.
7+
*
8+
* See LICENSE.txt included in this distribution for the specific
9+
* language governing permissions and limitations under the License.
10+
*
11+
* When distributing Covered Code, include this CDDL HEADER in each
12+
* file and include the License file at LICENSE.txt.
13+
* If applicable, add the following below this CDDL HEADER, with the
14+
* fields enclosed by brackets "[]" replaced with your own identifying
15+
* information: Portions Copyright [yyyy] [name of copyright owner]
16+
*
17+
* CDDL HEADER END
18+
*/
19+
120
/*
221
* Copyright 2000-2016 JetBrains s.r.o.
322
*
@@ -31,7 +50,7 @@
3150
public class RainbowColorGenerator {
3251

3352
private static final int COLORS_BETWEEN_ANCHORS = 4;
34-
private final static Color[] STOP_COLORS = new Color[]{
53+
private static final Color[] STOP_COLORS = new Color[]{
3554
fromHex("eaffe2"),
3655
fromHex("d9e4f9"),
3756
fromHex("d1d1d1"),

opengrok-indexer/src/test/java/org/opengrok/indexer/history/AnnotationTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void testColorPalette() {
162162
annotation.addLine("1.0", "Me", true);
163163
annotation.addLine("1.1", "Me", true);
164164
annotation.addLine("1.2", "Me", true);
165-
Assert.assertEquals(21, annotation.getColors().size());
165+
Assert.assertEquals(3, annotation.getColors().size());
166166
}
167167

168168
@Test
@@ -173,11 +173,11 @@ public void testSortedColorPalette() {
173173
annotation.addLine("1.2", "Me", true);
174174
annotation.addFileVersion("1.0", 3);
175175
annotation.addFileVersion("1.2", 2);
176-
Assert.assertEquals(21, annotation.getColors().size());
176+
Assert.assertEquals(3, annotation.getColors().size());
177177
// tracked by history entries
178-
Assert.assertEquals("hsl(60, 90%, 80%)", annotation.getColors().get("1.0"));
179-
Assert.assertEquals("hsl(180, 80%, 70%)", annotation.getColors().get("1.2"));
178+
Assert.assertEquals("rgb(234, 255, 226)", annotation.getColors().get("1.0"));
179+
Assert.assertEquals("rgb(213, 220, 233)", annotation.getColors().get("1.2"));
180180
// 1.1 us untracked by history entries (no addFileVersion called)
181-
Assert.assertEquals("hsl(300, 90%, 80%)", annotation.getColors().get("1.1"));
181+
Assert.assertEquals("rgb(255, 191, 195)", annotation.getColors().get("1.1"));
182182
}
183183
}

0 commit comments

Comments
 (0)