Clover icon

Coverage Report

  1. Project Clover database Mon Oct 6 2025 17:39:40 BST
  2. Package jalview.util

File UserAgent.java

 

Coverage histogram

../../img/srcFileCovDistChart9.png
13% of files have more coverage

Code metrics

8
32
2
1
82
55
6
0.19
16
2
3

Classes

Class Line # Actions
UserAgent 25 32 6
0.904761990.5%
 

Contributing tests

This file is covered by 70 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.util;
22   
23    import jalview.bin.Cache;
24   
 
25    public class UserAgent
26    {
27    private static String userAgentFormat = null;
28   
 
29  144 toggle public static String getUserAgent(String className)
30    {
31  144 if (userAgentFormat == null)
32    {
33  54 StringBuilder sb = new StringBuilder();
34  54 sb.append(ChannelProperties.getProperty("app_name"));
35  54 if (Platform.isJS())
36    {
37  0 sb.append(" JS");
38    }
39    else
40    {
41  54 sb.append(" Desktop");
42    }
43  54 sb.append('/');
44  54 sb.append(Cache.getDefault("VERSION", "Unknown"));
45  54 sb.append(" (");
46  54 sb.append(System.getProperty("os.name"));
47  54 sb.append("; ");
48  54 sb.append(System.getProperty("os.arch"));
49  54 sb.append(' ');
50  54 sb.append(System.getProperty("os.name"));
51  54 sb.append(' ');
52  54 sb.append(System.getProperty("os.version"));
53  54 sb.append("; ");
54  54 sb.append("java/");
55  54 sb.append(System.getProperty("java.version"));
56  54 sb.append("; ");
57  54 sb.append("jalview/");
58  54 sb.append(ChannelProperties.getProperty("channel"));
59  54 sb.append("%s");
60  54 String installation = Cache.applicationProperties
61    .getProperty("INSTALLATION");
62  54 if (installation != null)
63    {
64  54 sb.append("; ");
65  54 sb.append(installation);
66    }
67  54 sb.append(')');
68  54 sb.append(" help@jalview.org");
69   
70  54 userAgentFormat = sb.toString();
71    }
72   
73  144 return String.format(userAgentFormat,
74  144 className == null ? "" : "; " + className);
75    }
76   
 
77  144 toggle public static String getUserAgent()
78    {
79  144 return getUserAgent(null);
80    }
81   
82    }