prevent StringIndexOutOfBoundsException on AuditEvent creation

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1308257 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-04-02 07:19:20 +00:00
parent 9f0c0b178b
commit 67bf9acaff
2 changed files with 4 additions and 4 deletions

View File

@ -147,10 +147,7 @@ public abstract class AbstractRestService
protected void triggerAuditEvent( String repositoryId, String filePath, String action ) protected void triggerAuditEvent( String repositoryId, String filePath, String action )
{ {
AuditEvent auditEvent = new AuditEvent( action, repositoryId ); AuditEvent auditEvent = new AuditEvent( repositoryId, getPrincipal(), filePath, action );
auditEvent.setAction( action );
auditEvent.setRepositoryId( repositoryId );
auditEvent.setResource( filePath );
AuditInformation auditInformation = getAuditInformation(); AuditInformation auditInformation = getAuditInformation();
auditEvent.setUserId( auditInformation.getUser() == null ? "" : auditInformation.getUser().getUsername() ); auditEvent.setUserId( auditInformation.getUser() == null ? "" : auditInformation.getUser().getUsername() );
auditEvent.setRemoteIP( auditInformation.getRemoteAddr() ); auditEvent.setRemoteIP( auditInformation.getRemoteAddr() );

View File

@ -101,6 +101,9 @@ define("archiva.artifacts-management",["jquery","i18n","order!utils","order!jque
$('#fileupload').bind('fileuploadsubmit', function (e, data) { $('#fileupload').bind('fileuploadsubmit', function (e, data) {
var pomFile = data.context.find('#pomFile' ).attr("checked"); var pomFile = data.context.find('#pomFile' ).attr("checked");
var classifier = data.context.find('#classifier' ).val(); var classifier = data.context.find('#classifier' ).val();
if (!data.formData){
data.formData={};
}
data.formData.pomFile = pomFile; data.formData.pomFile = pomFile;
data.formData.classifier = classifier; data.formData.classifier = classifier;
}); });