avoid npe when admin user has not been created

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1360435 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-11 22:02:51 +00:00
parent cd03511cc9
commit 450f03a6a6
5 changed files with 18 additions and 19 deletions

View File

@ -808,7 +808,8 @@
<appserver.base>${archivaAppServerBase}</appserver.base>
<appserver.home>${archivaAppServerBase}</appserver.home>
<derby.system.home>${archivaAppServerBase}/logs</derby.system.home>
<redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>
<!-- remove admin auto creation that must be tested too -->
<!--redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file-->
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
<archiva.user.configFileName>${archivaAppServerBase}/conf/archiva.xml</archiva.user.configFileName>
<archiva.devMode>${archiva.devMode}</archiva.devMode>

View File

@ -148,9 +148,6 @@
}
});
require(['jquery','i18n','sammy','startup','utils','domReady!'], function (domReady) {
loadi18n(function () {
$.ajax({
@ -162,13 +159,10 @@
window.archivaRuntimeInfo=data;
require(['sammy','archiva.main','domReady!'],function (domReady) {
$.log("startArchivaApplication");
startArchivaApplication();
$("#loadingDiv").hide();
$.log("startArchivaApplication");
startArchivaApplication();
$("#loadingDiv").hide();
})
}
})
})

View File

@ -269,7 +269,8 @@ function() {
});
this.get('#:folder', function () {
self.activeMenuId(this.params.folder);
ko.utils.arrayFirst(self.artifactMenuItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
var baseItems = self.artifactMenuItems?self.artifactMenuItems:[];
ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
if ( p.href == "#"+self.activeMenuId()) {
p.func();
return;
@ -277,21 +278,27 @@ function() {
});
});
this.get('#open-admin-create-box',function(){
$.log("#open-admin-create-box");
adminCreateBox();
});
//this.get('', function () { this.app.runRoute('get', '#search') });
} );
sammyArchivaApplication.run();
}
startArchivaApplication=function(){
$.log("startArchivaApplication");
$('#topbar-menu-container').html($("#topbar_menu_tmpl" ).tmpl());
$('#sidebar-content').html($("#main_menu_tmpl").tmpl());
ko.bindingHandlers.redbackP = {
init: function(element, valueAccessor) {
$(element).attr("redback-permissions",valueAccessor);
}
init: function(element, valueAccessor) {
$(element).attr("redback-permissions",valueAccessor);
}
};
ko.applyBindings(new MainMenuViewModel());
hideElementWithKarma();
@ -299,8 +306,6 @@ function() {
checkCreateAdminLink();
$('#footer-content').html($('#footer-tmpl').tmpl(window.archivaRuntimeInfo));
$( "#quick-search-autocomplete" ).autocomplete({
minLength: 3,
delay: 600,

View File

@ -28,7 +28,6 @@
<a data-bind="text: text, attr: { id: id, href: href}"></a>
</li>
<!-- /ko -->
</ul>
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-configuration']}" data-bind="foreach: administrationMenuItems">
@ -65,7 +64,7 @@
<div id="organisation-logo" class="pull-left"></div>
<ul class="nav pull-right">
<li id="create-admin-link" style="display: none">
<a href="#" onclick="adminCreateBox();" id="create-admin-link-a">
<a href="#open-admin-create-box" onclick="adminCreateBox();" id="create-admin-link-a">
<span class="label label-important">${$.i18n.prop('create.admin.page.link')}</span>
</a>
</li>

View File

@ -22,7 +22,7 @@
username="sa"
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:${catalina.base}/target/database/users;create=true"
url="jdbc:derby:${appserver.base}/database/users;create=true"
/>
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"