i2psnark: Sort themes in config form

Don't return null from getThemes()
This commit is contained in:
zzz
2014-09-14 11:48:56 +00:00
parent cd2159b873
commit b9e383130e
2 changed files with 5 additions and 2 deletions

View File

@ -600,10 +600,10 @@ public class SnarkManager implements CompleteListener {
/**
* Get all themes
* @return String[] -- Array of all the themes found.
* @return String[] -- Array of all the themes found, non-null, unsorted
*/
public String[] getThemes() {
String[] themes = null;
String[] themes;
// "docs/themes/snark/"
File dir = new File(_context.getBaseDir(), "docs/themes/snark");
FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } };
@ -614,6 +614,8 @@ public class SnarkManager implements CompleteListener {
for(int i = 0; i < dirnames.length; i++) {
themes[i] = dirnames[i].getName();
}
} else {
themes = new String[0];
}
// return the map.
return themes;

View File

@ -2115,6 +2115,7 @@ public class I2PSnarkServlet extends BasicServlet {
out.write(": <td><select name='theme'>");
String theme = _manager.getTheme();
String[] themes = _manager.getThemes();
Arrays.sort(themes);
for(int i = 0; i < themes.length; i++) {
if(themes[i].equals(theme))
out.write("\n<OPTION value=\"" + themes[i] + "\" SELECTED>" + themes[i]);