Commits

J. Ryan Stinnett  committed a421e6e

Fixed assorted test failures

  • Participants
  • Parent commits 3c639ab

Comments (0)

Files changed (5)

File bazaarvoice-customizations

 # HG changeset patch
 # User J. Ryan Stinnett <jryans@gmail.com>
-# Date 1295358064 21600
+# Date 1295427006 21600
 # Node ID a0baf2a260b3a7d8c496cd32e7b323a571462f52
-# Parent 2aea1e860afb6948117eae07481956669df9aebd
+# Parent 2edff6e17155dd12ced3ae77475befe893c9bbe9
 Bazaarvoice-specific customizations
 
 diff --git a/src/org/opensolaris/opengrok/search/Results.java b/src/org/opensolaris/opengrok/search/Results.java
 --- a/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java
 +++ b/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java
 @@ -63,7 +63,7 @@
+      * This is what we expect to find before the content of a single line input.
       */
-     private static final String FIRST_LINE_PREAMBLE =
-                 "<a class=\"l\" name=\"1\" href=\"#1\">" +
--                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>";
-+                "1</a>";
+     private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">\n" +
+-            "<a class=\"l\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>\n" +
++            "<a class=\"l\" href=\"#1\">1</a>\n" +
+             "</td><td id=\"line_content\">\n" +
+             "<div id=\"f:1\">";
  
-     @BeforeClass
-     public static void setUpClass() throws Exception {
+diff --git a/test/org/opensolaris/opengrok/search/context/ContextTest.java b/test/org/opensolaris/opengrok/search/context/ContextTest.java
+--- a/test/org/opensolaris/opengrok/search/context/ContextTest.java
++++ b/test/org/opensolaris/opengrok/search/context/ContextTest.java
+@@ -23,15 +23,6 @@
+ 
+ package org.opensolaris.opengrok.search.context;
+ 
+-import java.io.ByteArrayInputStream;
+-import java.io.CharArrayReader;
+-import java.io.Reader;
+-import java.io.StringReader;
+-import java.io.StringWriter;
+-import java.util.ArrayList;
+-import java.util.Arrays;
+-import java.util.List;
+-import javax.xml.parsers.DocumentBuilderFactory;
+ import org.apache.lucene.queryParser.ParseException;
+ import org.junit.After;
+ import org.junit.Before;
+@@ -41,7 +32,21 @@
+ import org.opensolaris.opengrok.search.Hit;
+ import org.opensolaris.opengrok.search.QueryBuilder;
+ import org.w3c.dom.Document;
+-import static org.junit.Assert.*;
++
++import javax.xml.parsers.DocumentBuilderFactory;
++import java.io.ByteArrayInputStream;
++import java.io.CharArrayReader;
++import java.io.Reader;
++import java.io.StringReader;
++import java.io.StringWriter;
++import java.util.ArrayList;
++import java.util.Arrays;
++import java.util.List;
++
++import static org.junit.Assert.assertEquals;
++import static org.junit.Assert.assertFalse;
++import static org.junit.Assert.assertNotNull;
++import static org.junit.Assert.assertTrue;
+ 
+ public class ContextTest {
+     /**
+@@ -166,7 +171,7 @@
+         expectedOutput = hitList ?
+             "abc <b>def</b> ghi" :
+             "<a class=\"s\" href=\"#1\"><span class=\"l\">1</span> " +
+-                     "abc <b>def</b> ghi</a> <i> type</i> <br/>";
++                     "abc <b>def</b> ghi</a> <span class=\"symbolType\"> type definition</span> <br/>";
+         actualOutput = hitList ? hits.get(0).getLine() : out.toString();
+         assertEquals(expectedOutput, actualOutput);
+ 
+@@ -186,7 +191,7 @@
+         expectedOutput = hitList ?
+             "text" :
+             "<a class=\"s\" href=\"#1\"><span class=\"l\">1</span> " +
+-                     "text</a> <i> type </i><br/>";
++                     "text</a> <span class=\"symbolType\"> type definition</span><br/>";
+         actualOutput = hitList ? hits.get(0).getLine() : out.toString();
+         assertEquals(expectedOutput, actualOutput);
+ 
+@@ -267,7 +272,7 @@
+                 c.getContext(in, out, "", "", "", null, true, null);
+         assertTrue("No match found", match);
+         String s = out.toString();
+-        assertTrue("No [all...] link", s.contains(">all</a>...]"));
++        assertTrue("No [all...] link", s.contains(">all...</a>]"));
+     }
+ 
+     /**
 diff --git a/test/org/opensolaris/opengrok/web/UtilTest.java b/test/org/opensolaris/opengrok/web/UtilTest.java
 --- a/test/org/opensolaris/opengrok/web/UtilTest.java
 +++ b/test/org/opensolaris/opengrok/web/UtilTest.java
-@@ -126,12 +126,12 @@
+@@ -129,12 +129,12 @@
      public void readableLine() throws Exception {
          StringWriter out = new StringWriter();
          Util.readableLine(42, out, null);
--        assertEquals("\n<a class=\"l\" name=\"42\" href=\"#42\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42&nbsp;</a>",
-+        assertEquals("\n<a class=\"l\" name=\"42\" href=\"#42\">42</a>",
+-        assertEquals("\n<a class=\"l\" href=\"#42\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42&nbsp;</a>",
++        assertEquals("\n<a class=\"l\" href=\"#42\">42</a>",
                       out.toString());
  
          out.getBuffer().setLength(0); // clear buffer
          Util.readableLine(110, out, null);
--        assertEquals("\n<a class=\"hl\" name=\"110\" href=\"#110\">&nbsp;&nbsp;&nbsp;&nbsp;110&nbsp;</a>",
-+        assertEquals("\n<a class=\"hl\" name=\"110\" href=\"#110\">110</a>",
+-        assertEquals("\n<a class=\"hl\" href=\"#110\">&nbsp;&nbsp;&nbsp;&nbsp;110&nbsp;</a>",
++        assertEquals("\n<a class=\"hl\" href=\"#110\">110</a>",
                       out.toString());
      }
  

File enhanced-xml-support

 # HG changeset patch
-# Date 1295286196 21600
+# Date 1295424143 21600
 # User J. Ryan Stinnett <jryans@gmail.com>
 # Parent 3ce12cc4378c5ea6747e9b42b2666940a40a22db
 Adds support for Spring features in XML files
 +        currentLine.append(text);
 +    }
 +}
+diff --git a/src/org/opensolaris/opengrok/analysis/JFlexXref.java b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
+--- a/src/org/opensolaris/opengrok/analysis/JFlexXref.java
++++ b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
+@@ -23,6 +23,12 @@
+ 
+ package org.opensolaris.opengrok.analysis;
+ 
++import org.opensolaris.opengrok.analysis.Definitions.Tag;
++import org.opensolaris.opengrok.configuration.Project;
++import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
++import org.opensolaris.opengrok.history.Annotation;
++import org.opensolaris.opengrok.web.Util;
++
+ import java.io.CharArrayReader;
+ import java.io.IOException;
+ import java.io.Reader;
+@@ -34,11 +40,6 @@
+ import java.util.Set;
+ import java.util.SortedSet;
+ import java.util.TreeSet;
+-import org.opensolaris.opengrok.analysis.Definitions.Tag;
+-import org.opensolaris.opengrok.configuration.Project;
+-import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
+-import org.opensolaris.opengrok.history.Annotation;
+-import org.opensolaris.opengrok.web.Util;
+ 
+ /**
+  * Base class for Xref lexers.
 diff --git a/src/org/opensolaris/opengrok/analysis/plain/XMLAnalyzer.java b/src/org/opensolaris/opengrok/analysis/xml/XMLAnalyzer.java
 rename from src/org/opensolaris/opengrok/analysis/plain/XMLAnalyzer.java
 rename to src/org/opensolaris/opengrok/analysis/xml/XMLAnalyzer.java
 --- a/src/org/opensolaris/opengrok/analysis/plain/XMLAnalyzer.java
 +++ b/src/org/opensolaris/opengrok/analysis/xml/XMLAnalyzer.java
-@@ -20,75 +20,95 @@
+@@ -20,75 +20,94 @@
  /*
   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   */
 +import org.opensolaris.opengrok.analysis.Hash2TokenStream;
 +import org.opensolaris.opengrok.analysis.TextAnalyzer;
 +import org.opensolaris.opengrok.analysis.plain.PlainFullTokenizer;
-+import org.opensolaris.opengrok.analysis.plain.PlainXref;
 +import org.opensolaris.opengrok.configuration.Project;
 +import org.opensolaris.opengrok.history.Annotation;
  
      /**
       * Write a cross referenced HTML file.
       * @param out Writer to write HTML cross-reference
-@@ -96,9 +116,10 @@
+@@ -96,9 +115,10 @@
      public void writeXref(Writer out) throws IOException {
          xref.reInit(content, len);
          xref.project = project;
      /**
       * Write a cross referenced HTML file reads the source from in
       * @param in Input source
-@@ -106,8 +127,8 @@
+@@ -106,7 +126,7 @@
       * @param defs definitions for the file (could be null)
       * @param annotation annotation for the file (could be null)
       */
 -    static void writeXref(Reader in, Writer out, Definitions defs, Annotation annotation, Project project) throws IOException {
--        XMLXref xref = new XMLXref(in);
 +    public static void writeXref(Reader in, Writer out, Definitions defs, Annotation annotation, Project project) throws IOException {
-+        PlainXref xref = new PlainXref(in);
+         XMLXref xref = new XMLXref(in);
          xref.annotation = annotation;
          xref.project = project;
-         xref.setDefs(defs);
 diff --git a/src/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerFactory.java b/src/org/opensolaris/opengrok/analysis/xml/XMLAnalyzerFactory.java
 rename from src/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerFactory.java
 rename to src/org/opensolaris/opengrok/analysis/xml/XMLAnalyzerFactory.java
 diff --git a/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java b/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
 --- a/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
 +++ b/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
-@@ -28,6 +28,8 @@
+@@ -24,11 +24,15 @@
+ 
+ package org.opensolaris.opengrok.analysis.plain;
+ 
++import org.junit.Test;
++import org.opensolaris.opengrok.analysis.xml.XMLAnalyzer;
++
+ import java.io.IOException;
  import java.io.StringReader;
  import java.io.StringWriter;
- import org.junit.Test;
-+import org.opensolaris.opengrok.analysis.xml.XMLAnalyzer;
+-import org.junit.Test;
+-import static org.junit.Assert.*;
 +
- import static org.junit.Assert.*;
++import static org.junit.Assert.assertFalse;
++import static org.junit.Assert.assertTrue;
  
  public class XMLAnalyzerTest {
+     @Test
+@@ -36,8 +40,8 @@
+         String xmlText =
+                 "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>\n" +
+                 "<foo>\n" +
+-                "  <bar name=\"com.foo.bar.MyClass\"/>\n" +
+-                "  <bar name=\"README.txt\"/>\n" +
++                "  <bar file=\"com.foo.bar.MyClass\"/>\n" +
++                "  <bar file=\"README.txt\"/>\n" +
+                 "</foo>";
+         StringReader sr = new StringReader(xmlText);
+         StringWriter sw = new StringWriter();
+@@ -49,6 +53,24 @@
+         assertTrue(xref[3].contains("path=README.txt"));
+     }
+ 
++    @Test
++    public void xrefSymbols() throws IOException {
++        String xmlText =
++                "<?xml version=\"1.0\" encoding=\"US-ASCII\"?>\n" +
++                "<foo>\n" +
++                "  <bar name=\"bob\"/>\n" +
++                "  <bar address=\"tom\"/>\n" +
++                "</foo>";
++        StringReader sr = new StringReader(xmlText);
++        StringWriter sw = new StringWriter();
++        XMLAnalyzer.writeXref(sr, sw, null, null, null);
++        String[] xref = sw.toString().split("\n");
++        // Name is one the recognized symbol attributes
++        assertTrue(xref[2].contains("defs=bob"));
++        // Address is not a special attribute
++        assertFalse(xref[3].contains("<a href"));
++    }
++
+     /**
+      * XML special chars inside a string were not escaped if single quotes
+      * were used around the string. Bug #15859.
 # HG changeset patch
 # User J. Ryan Stinnett <jryans@gmail.com>
-# Date 1295076995 21600
+# Date 1295428144 21600
 # Node ID af951aeaeba8e7971f4143c1958d37e2b7e493e2
-# Parent  2c7b12cd8f5fd7a72b2543cf90020027366c3894
+# Parent d4c6cc48bf48b573281e0c17826d3bdadb55c3ae
 Fixed SVN issues with symlink handling
 
 diff --git a/src/org/opensolaris/opengrok/configuration/Project.java b/src/org/opensolaris/opengrok/configuration/Project.java
  
          List<String> cmd = new ArrayList<String>();
          cmd.add(getCommand());
+diff --git a/test/org/opensolaris/opengrok/history/SubversionHistoryParserTest.java b/test/org/opensolaris/opengrok/history/SubversionHistoryParserTest.java
+--- a/test/org/opensolaris/opengrok/history/SubversionHistoryParserTest.java
++++ b/test/org/opensolaris/opengrok/history/SubversionHistoryParserTest.java
+@@ -28,6 +28,8 @@
+ import org.junit.Before;
+ import org.junit.BeforeClass;
+ import org.junit.Test;
++import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
++
+ import static org.junit.Assert.*;
+ 
+ /**
+@@ -51,6 +53,7 @@
+ 
+     @Before
+     public void setUp() {
++        RuntimeEnvironment.getInstance().setSourceRoot("");
+         instance = new SubversionHistoryParser();
+     }
+ 
 diff --git a/web/raw.jsp b/web/raw.jsp
 --- a/web/raw.jsp
 +++ b/web/raw.jsp

File tabular-xref

 # HG changeset patch
 # User J. Ryan Stinnett <jryans@gmail.com>
-# Date 1295272439 21600
+# Date 1295427373 21600
 # Node ID e531bb8f756c408c77f86fd719de68ad2fe83aba
-# Parent a9397dabb118f5ee6cb8380320656a60e35767a2
+# Parent bf737176de80fab0dd0939140ae9a5e146e539c6
 Change to a table for xrefs for easier copying
 
 diff --git a/src/org/opensolaris/opengrok/analysis/JFlexXref.java b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
 --- a/src/org/opensolaris/opengrok/analysis/JFlexXref.java
 +++ b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
-@@ -23,9 +23,16 @@
- 
- package org.opensolaris.opengrok.analysis;
- 
-+import org.opensolaris.opengrok.analysis.Definitions.Tag;
-+import org.opensolaris.opengrok.configuration.Project;
-+import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
-+import org.opensolaris.opengrok.history.Annotation;
-+import org.opensolaris.opengrok.web.Util;
-+
+@@ -32,6 +32,7 @@
  import java.io.CharArrayReader;
  import java.io.IOException;
  import java.io.Reader;
  import java.io.Writer;
  import java.lang.reflect.Field;
  import java.util.Comparator;
-@@ -33,12 +40,8 @@
+@@ -39,6 +40,7 @@
  import java.util.Map;
  import java.util.Set;
  import java.util.SortedSet;
 +import java.util.Stack;
  import java.util.TreeSet;
--import org.opensolaris.opengrok.analysis.Definitions.Tag;
--import org.opensolaris.opengrok.configuration.Project;
--import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
--import org.opensolaris.opengrok.history.Annotation;
--import org.opensolaris.opengrok.web.Util;
  
  /**
-  * Base class for Xref lexers.
-@@ -46,14 +49,20 @@
-  * @author Lubos Kosco
-  */
- public abstract class JFlexXref {
--    public Writer out;
-+    public StringWriter out;
-     public String urlPrefix = RuntimeEnvironment.getInstance().getUrlPrefix();
+@@ -52,9 +54,14 @@
      public Annotation annotation;
      public Project project;
      protected Definitions defs;
      /** EOF value returned by yylex(). */
      private final int yyeof;
  
-+    private int lastOutSize;
 +    private Writer xrefOut;
 +
 +    private Stack<String> spanClasses = new Stack<String>();
      /**
       * Description of styles to use for different types of definitions. Each
       * element in the array contains a three-element string array with the
-@@ -113,6 +122,7 @@
+@@ -114,6 +121,7 @@
      public void reInit(char[] contents, int length) {
          yyreset(new CharArrayReader(contents, 0, length));
          annotation = null;
      }
  
      public void setDefs(Definitions defs) {
-@@ -145,17 +155,31 @@
+@@ -146,17 +154,31 @@
      /**
       * Write xref to the specified {@code Writer}.
       *
          writeSymbolTable();
 +
 +        // Start table and line number column
-+        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>");
++        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\n");
          setLineNumber(0);
          startNewLine();
          while (yylex() != yyeof) { // NOPMD while statement intentionally empty
 +        endCurrentLine();
 +
 +        // End line number column and write the file contents
-+        xrefOut.write("</td><td>");
++        xrefOut.write("\n</td><td>\n");
 +        xrefOut.write(out.toString());
 +        xrefOut.write("</td></tr></table>");
      }
  
      /**
-@@ -200,41 +224,41 @@
+@@ -201,41 +223,41 @@
              }
          }
  
      }
  
      /**
-@@ -262,9 +286,40 @@
+@@ -263,9 +285,37 @@
       * @throws IOException on error when writing the xref
       */
      protected void startNewLine() throws IOException {
 +                out.append("<span class=\"").append(spanClass).append("\">");
 +            }
 +        }
-+        
-+        lastOutSize = out.getBuffer().length();
 +    }
 +
-+    private void endCurrentLine() {
-+        if (out.getBuffer().length() == lastOutSize) {
-+            out.write("<br/>");
-+        }
++    private void endCurrentLine() throws IOException {
++        // Ensure every line has at least some output
++        out.write("<br/>");
 +
 +        // Temporarily close any open spans
 +        for (String spanClass : spanClasses) {
 +            out.write("</span>");
 +        }
 +
-+        out.write("</div>");
++        out.write("</div>\n");
      }
  
      /**
-@@ -374,4 +429,28 @@
+@@ -375,4 +425,28 @@
              out.write(address);
          }
      }
 +     *
 +     * @param spanClass class attribute of the span
 +     */
-+    protected void enterSpan(String spanClass) {
++    protected void enterSpan(String spanClass) throws IOException {
 +        if (spanClass == null) {
 +            out.append("<span>");
 +        } else {
 +     * Write a span end tag. This will also pop the corresponding class from the
 +     * stack.
 +     */
-+    protected void exitSpan() {
++    protected void exitSpan() throws IOException {
 +        spanClasses.pop();
 +        out.append("</span>");
 +    }
 diff --git a/src/org/opensolaris/opengrok/analysis/document/TroffXref.lex b/src/org/opensolaris/opengrok/analysis/document/TroffXref.lex
 --- a/src/org/opensolaris/opengrok/analysis/document/TroffXref.lex
 +++ b/src/org/opensolaris/opengrok/analysis/document/TroffXref.lex
-@@ -35,6 +35,8 @@
- %unicode
- %int
- %{ 
-+  public Writer out;
-+
-   boolean p = false;
- 
-   @Override
-@@ -63,7 +65,7 @@
+@@ -63,7 +63,7 @@
  %%
  <YYINITIAL> {
  ^\.(SH|TH|SS|IP|NH|TL|UH)       { yybegin(HEADER);out.write("<div class=\"b\">");}
  }
  
  <HEADER> {
-@@ -71,24 +73,24 @@
+@@ -71,24 +71,24 @@
  }
  
  <COMMENT> {
      }
  }
  
+diff --git a/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java b/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java
+--- a/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java
++++ b/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java
+@@ -23,12 +23,6 @@
+ 
+ package org.opensolaris.opengrok.analysis;
+ 
+-import java.io.File;
+-import java.io.FileInputStream;
+-import java.io.InputStreamReader;
+-import java.io.Reader;
+-import java.io.StringReader;
+-import java.io.StringWriter;
+ import org.junit.AfterClass;
+ import org.junit.BeforeClass;
+ import org.junit.Test;
+@@ -40,14 +34,22 @@
+ import org.opensolaris.opengrok.analysis.lisp.LispXref;
+ import org.opensolaris.opengrok.analysis.perl.PerlXref;
+ import org.opensolaris.opengrok.analysis.plain.PlainXref;
+-import org.opensolaris.opengrok.analysis.xml.XMLXref;
+ import org.opensolaris.opengrok.analysis.sh.ShXref;
+ import org.opensolaris.opengrok.analysis.sql.SQLXref;
+ import org.opensolaris.opengrok.analysis.tcl.TclXref;
++import org.opensolaris.opengrok.analysis.xml.XMLXref;
+ import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
+ import org.opensolaris.opengrok.util.TestRepository;
+ 
+-import static org.junit.Assert.*;
++import java.io.File;
++import java.io.FileInputStream;
++import java.io.InputStreamReader;
++import java.io.Reader;
++import java.io.StringReader;
++import java.io.StringWriter;
++
++import static org.junit.Assert.assertEquals;
++import static org.junit.Assert.assertTrue;
+ 
+ /**
+  * Unit tests for JFlexXref.
+@@ -58,12 +60,18 @@
+     private static TestRepository repository;
+ 
+     /**
+-     * This is what we expect to find at the beginning of the first line
+-     * returned by an xref.
++     * This is what we expect to find before the content of a single line input.
+      */
+-    private static final String FIRST_LINE_PREAMBLE =
+-                "<a class=\"l\" name=\"1\" href=\"#1\">" +
+-                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>";
++    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\n" +
++            "<a class=\"l\" name=\"1\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>\n" +
++            "</td><td>\n" +
++            "<div>";
++
++    /**
++     * This is what we expect to find after the content of a single line input.
++     */
++    private static final String SINGLE_LINE_SUFFIX = "<br/></div>\n" +
++            "</td></tr></table>";
+ 
+     @BeforeClass
+     public static void setUpClass() throws Exception {
+@@ -202,7 +210,7 @@
+         StringWriter output = new StringWriter();
+         xref.write(output);
+ 
+-        assertEquals(FIRST_LINE_PREAMBLE + expectedOutput, output.toString());
++        assertEquals(SINGLE_LINE_PREFIX + expectedOutput + SINGLE_LINE_SUFFIX, output.toString());
+     }
+ 
+     /**
+@@ -217,10 +225,7 @@
+         ShXref xref = new ShXref(new StringReader("echo \"xyz"));
+         StringWriter out = new StringWriter();
+         xref.write(out);
+-        assertEquals(
+-                FIRST_LINE_PREAMBLE +
+-                    "<b>echo</b> <span class=\"s\">\"xyz</span>",
+-                out.toString());
++        assertEquals(SINGLE_LINE_PREFIX + "<b>echo</b> <span class=\"s\">\"xyz</span>" + SINGLE_LINE_SUFFIX, out.toString());
+ 
+         // Reuse the xref and verify that the broken syntax in the previous
+         // file doesn't cause broken highlighting in the next file
+@@ -228,9 +233,6 @@
+         String contents = "echo \"hello\"";
+         xref.reInit(contents.toCharArray(), contents.length());
+         xref.write(out);
+-        assertEquals(
+-                FIRST_LINE_PREAMBLE +
+-                    "<b>echo</b> <span class=\"s\">\"hello\"</span>",
+-                out.toString());
++        assertEquals(SINGLE_LINE_PREFIX + "<b>echo</b> <span class=\"s\">\"hello\"</span>" + SINGLE_LINE_SUFFIX, out.toString());
+     }
+ }
+diff --git a/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java b/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
+--- a/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
++++ b/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
+@@ -48,9 +48,9 @@
+         XMLAnalyzer.writeXref(sr, sw, null, null, null);
+         String[] xref = sw.toString().split("\n");
+         // Reference to a Java class should have / instead of . in the path
+-        assertTrue(xref[2].contains("path=com/foo/bar/MyClass"));
++        assertTrue(xref[9].contains("path=com/foo/bar/MyClass"));
+         // Ordinary file names should not have .'s replaced
+-        assertTrue(xref[3].contains("path=README.txt"));
++        assertTrue(xref[10].contains("path=README.txt"));
+     }
+ 
+     @Test
+@@ -66,9 +66,9 @@
+         XMLAnalyzer.writeXref(sr, sw, null, null, null);
+         String[] xref = sw.toString().split("\n");
+         // Name is one the recognized symbol attributes
+-        assertTrue(xref[2].contains("defs=bob"));
++        assertTrue(xref[9].contains("defs=bob"));
+         // Address is not a special attribute
+-        assertFalse(xref[3].contains("<a href"));
++        assertFalse(xref[10].contains("<a href"));
+     }
+ 
+     /**
+diff --git a/test/org/opensolaris/opengrok/configuration/RuntimeEnvironmentTest.java b/test/org/opensolaris/opengrok/configuration/RuntimeEnvironmentTest.java
+--- a/test/org/opensolaris/opengrok/configuration/RuntimeEnvironmentTest.java
++++ b/test/org/opensolaris/opengrok/configuration/RuntimeEnvironmentTest.java
+@@ -22,6 +22,14 @@
+  */
+ package org.opensolaris.opengrok.configuration;
+ 
++import org.junit.After;
++import org.junit.AfterClass;
++import org.junit.Before;
++import org.junit.BeforeClass;
++import org.junit.Test;
++import org.opensolaris.opengrok.analysis.plain.PlainXref;
++import org.opensolaris.opengrok.history.RepositoryInfo;
++
+ import java.io.File;
+ import java.io.IOException;
+ import java.io.StringReader;
+@@ -30,14 +38,14 @@
+ import java.net.SocketAddress;
+ import java.util.ArrayList;
+ import java.util.List;
+-import org.junit.After;
+-import org.junit.AfterClass;
+-import org.junit.Before;
+-import org.junit.BeforeClass;
+-import org.junit.Test;
+-import org.opensolaris.opengrok.analysis.plain.PlainXref;
+-import org.opensolaris.opengrok.history.RepositoryInfo;
+-import static org.junit.Assert.*;
++
++import static org.junit.Assert.assertEquals;
++import static org.junit.Assert.assertFalse;
++import static org.junit.Assert.assertNotNull;
++import static org.junit.Assert.assertNull;
++import static org.junit.Assert.assertSame;
++import static org.junit.Assert.assertTrue;
++import static org.junit.Assert.fail;
+ 
+ /**
+  * Test the RuntimeEnvironment class
+@@ -422,12 +430,9 @@
+         String expectedAddress = expected ?
+             address.replace("@", " (at) ") : address;
+ 
+-        String expectedOutput =
+-                "<a class=\"l\" name=\"1\" href=\"#1\">"
+-                + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>"
+-                + expectedAddress;
++        String expectedOutput = "<div>" + expectedAddress + "<br/></div>";
+ 
+-        assertEquals(expectedOutput, out.toString());
++        assertTrue(out.toString().contains(expectedOutput));
+     }
+ 
+     @Test

File xref-line-highlight

 # HG changeset patch
 # User J. Ryan Stinnett <jryans@gmail.com>
-# Date 1295076995 21600
+# Date 1295427427 21600
 # Node ID cb9e8afb804c53f32f271da04674c823adf31f0f
-# Parent d737761cb3e4e4a9fddafcb56827e706dfc2cfbc
+# Parent cf2503704c50e92030a4403d3ebc804d1ee08a53
 Adding centering and highlighting when targeting specific lines
 
 diff --git a/src/org/opensolaris/opengrok/analysis/JFlexXref.java b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
 --- a/src/org/opensolaris/opengrok/analysis/JFlexXref.java
 +++ b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
-@@ -166,7 +166,7 @@
+@@ -165,7 +165,7 @@
          writeSymbolTable();
  
          // Start table and line number column
--        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>");
-+        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">");
+-        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\n");
++        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">\n");
          setLineNumber(0);
          startNewLine();
          while (yylex() != yyeof) { // NOPMD while statement intentionally empty
-@@ -177,7 +177,7 @@
+@@ -176,7 +176,7 @@
          endCurrentLine();
  
          // End line number column and write the file contents
--        xrefOut.write("</td><td>");
-+        xrefOut.write("</td><td id=\"line_content\">");
+-        xrefOut.write("\n</td><td>\n");
++        xrefOut.write("\n</td><td id=\"line_content\">\n");
          xrefOut.write(out.toString());
          xrefOut.write("</td></tr></table>");
      }
-@@ -295,7 +295,7 @@
+@@ -294,7 +294,7 @@
          if (line > 1) {
              endCurrentLine();
          }
  
          // Reopen any existing spans
          for (String spanClass : spanClasses) {
-@@ -350,17 +350,7 @@
+@@ -346,17 +346,7 @@
                  style_class = style[1];
              }
  
              out.append("<a href=\"");
              out.append(urlPrefix);
              out.append("refs=");
-@@ -368,6 +358,8 @@
+@@ -364,6 +354,8 @@
              appendProject();
              out.append("\" class=\"");
              out.append(style_class);
          out.write("\" href=\"#");
          out.write(snum);
          out.write(closeQuotedTag);
+diff --git a/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java b/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java
+--- a/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java
++++ b/test/org/opensolaris/opengrok/analysis/JFlexXrefTest.java
+@@ -62,10 +62,10 @@
+     /**
+      * This is what we expect to find before the content of a single line input.
+      */
+-    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\n" +
+-            "<a class=\"l\" name=\"1\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>\n" +
+-            "</td><td>\n" +
+-            "<div>";
++    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">\n" +
++            "<a class=\"l\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>\n" +
++            "</td><td id=\"line_content\">\n" +
++            "<div id=\"f:1\">";
+ 
+     /**
+      * This is what we expect to find after the content of a single line input.
+@@ -167,7 +167,7 @@
+         //TODO improve below to reflect all possible classes of a definition
+         assertTrue(
+                 "No anchor found",
+-                out.toString().contains("\" name=\"bug15890\"/><a href="));
++                out.toString().contains("id=\"f:bug15890\">bug15890</a>"));
+     }
+ 
+     /**
+diff --git a/test/org/opensolaris/opengrok/configuration/RuntimeEnvironmentTest.java b/test/org/opensolaris/opengrok/configuration/RuntimeEnvironmentTest.java
+--- a/test/org/opensolaris/opengrok/configuration/RuntimeEnvironmentTest.java
++++ b/test/org/opensolaris/opengrok/configuration/RuntimeEnvironmentTest.java
+@@ -430,7 +430,7 @@
+         String expectedAddress = expected ?
+             address.replace("@", " (at) ") : address;
+ 
+-        String expectedOutput = "<div>" + expectedAddress + "<br/></div>";
++        String expectedOutput = "<div id=\"f:1\">" + expectedAddress + "<br/></div>";
+ 
+         assertTrue(out.toString().contains(expectedOutput));
+     }
+diff --git a/test/org/opensolaris/opengrok/web/UtilTest.java b/test/org/opensolaris/opengrok/web/UtilTest.java
+--- a/test/org/opensolaris/opengrok/web/UtilTest.java
++++ b/test/org/opensolaris/opengrok/web/UtilTest.java
+@@ -22,14 +22,17 @@
+  */
+ package org.opensolaris.opengrok.web;
+ 
++import org.junit.AfterClass;
++import org.junit.BeforeClass;
++import org.junit.Test;
++
++import javax.xml.parsers.DocumentBuilderFactory;
+ import java.io.ByteArrayInputStream;
+ import java.io.StringWriter;
+ import java.util.Locale;
+-import javax.xml.parsers.DocumentBuilderFactory;
+-import org.junit.AfterClass;
+-import org.junit.BeforeClass;
+-import org.junit.Test;
+-import static org.junit.Assert.*;
++
++import static org.junit.Assert.assertEquals;
++import static org.junit.Assert.assertTrue;
+ 
+ /**
+  * Test of the methods in <code>org.opensolaris.opengrok.web.Util</code>.
+@@ -126,12 +129,12 @@
+     public void readableLine() throws Exception {
+         StringWriter out = new StringWriter();
+         Util.readableLine(42, out, null);
+-        assertEquals("\n<a class=\"l\" name=\"42\" href=\"#42\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42&nbsp;</a>",
++        assertEquals("\n<a class=\"l\" href=\"#42\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42&nbsp;</a>",
+                      out.toString());
+ 
+         out.getBuffer().setLength(0); // clear buffer
+         Util.readableLine(110, out, null);
+-        assertEquals("\n<a class=\"hl\" name=\"110\" href=\"#110\">&nbsp;&nbsp;&nbsp;&nbsp;110&nbsp;</a>",
++        assertEquals("\n<a class=\"hl\" href=\"#110\">&nbsp;&nbsp;&nbsp;&nbsp;110&nbsp;</a>",
+                      out.toString());
+     }
+ 
 diff --git a/web/default/style.css b/web/default/style.css
 --- a/web/default/style.css
 +++ b/web/default/style.css