From 67bf9acaffb278b23a87b7d3d8434f67bdc1a0cb Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 2 Apr 2012 07:19:20 +0000 Subject: [PATCH] prevent StringIndexOutOfBoundsException on AuditEvent creation git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1308257 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/rest/services/AbstractRestService.java | 5 +---- .../src/main/webapp/js/archiva/artifacts-management.js | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java index 49c9bdbb1..bd9372bb3 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java @@ -147,10 +147,7 @@ public abstract class AbstractRestService protected void triggerAuditEvent( String repositoryId, String filePath, String action ) { - AuditEvent auditEvent = new AuditEvent( action, repositoryId ); - auditEvent.setAction( action ); - auditEvent.setRepositoryId( repositoryId ); - auditEvent.setResource( filePath ); + AuditEvent auditEvent = new AuditEvent( repositoryId, getPrincipal(), filePath, action ); AuditInformation auditInformation = getAuditInformation(); auditEvent.setUserId( auditInformation.getUser() == null ? "" : auditInformation.getUser().getUsername() ); auditEvent.setRemoteIP( auditInformation.getRemoteAddr() ); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/artifacts-management.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/artifacts-management.js index 5ef5b34fd..53e5880ae 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/artifacts-management.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/artifacts-management.js @@ -101,6 +101,9 @@ define("archiva.artifacts-management",["jquery","i18n","order!utils","order!jque $('#fileupload').bind('fileuploadsubmit', function (e, data) { var pomFile = data.context.find('#pomFile' ).attr("checked"); var classifier = data.context.find('#classifier' ).val(); + if (!data.formData){ + data.formData={}; + } data.formData.pomFile = pomFile; data.formData.classifier = classifier; }); -- 2.39.5