@@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
1818
1919CDDL HEADER END
2020
21- Copyright (c) 2009, 2022 , Oracle and/or its affiliates. All rights reserved.
21+ Copyright (c) 2009, 2025 , Oracle and/or its affiliates. All rights reserved.
2222Portions Copyright 2011 Jens Elkner.
2323Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected] >. 2424
@@ -45,21 +45,16 @@ include file="/projects.jspf"
4545
4646 // Optimize for URLs up to 128 characters.
4747 StringBuilder url = new StringBuilder (128 );
48- String scheme = request. getScheme();
49- int port = request. getServerPort();
50-
48+ final String scheme = request. getScheme();
5149 url. append(scheme). append(" ://" );
52-
53- String serverName = cfg. getServerName();
54- url. append(serverName);
50+ url. append(cfg. getServerName());
5551
5652 // Append port if needed.
53+ int port = request. getServerPort();
5754 if ((port != 80 && scheme. equals(" http" )) || (port != 443 && scheme. equals(" https" ))) {
5855 url. append(' :' ). append(port);
5956 }
6057
61- String imgUrl = url + cfg. getCssDir() + " /img/icon.png" ;
62-
6358 /* TODO Bug 11749 ??? */
6459 StringBuilder text = new StringBuilder ();
6560 url. append(request. getContextPath()). append(Prefix . SEARCH_P ). append(' ?' );
@@ -68,15 +63,15 @@ include file="/projects.jspf"
6863 text. append(name). append(' ,' );
6964 Util . appendQuery(url, QueryParameters . PROJECT_SEARCH_PARAM , name);
7065 }
71- if (text. length() != 0 ) {
72- text. setLength(text. length()- 1 );
66+ if (! text. isEmpty() ) {
67+ text. setLength(text. length() - 1 );
7368 }
7469% > <?xml version =" 1.0" encoding =" UTF-8" ?>
7570<OpenSearchDescription xmlns =" http://a9.com/-/spec/opensearch/1.1/" >
7671 <ShortName >OpenGrok <%= text. toString() % > </ShortName >
7772 <Description >Search in OpenGrok <%= text. toString() % > </Description >
7873 <InputEncoding >UTF-8</InputEncoding >
79- <Image height =" 16" width =" 16" type =" image/png" ><%= imgUrl % > </Image >
74+ <Image height =" 16" width =" 16" type =" image/png" ><%= url + cfg . getCssDir() + " /img/icon.png " % > </Image >
8075<%-- <Url type="application/x-suggestions+json" template="suggestionURL"/>--%>
8176 <Url template =" <%= url. toString() % >& ; <%= QueryParameters . FULL_SEARCH_PARAM_EQ % > {searchTerms}"
8277 type =" text/html" />
0 commit comments