correct array math
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 3 Jan 2009 02:34:10 +0000 (02:34 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 3 Jan 2009 02:34:10 +0000 (02:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@730893 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java

index 05ccbb6..8ae0f81 100644 (file)
@@ -61,14 +61,11 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co
     
     @Override 
     public MBeanNotificationInfo[] getNotificationInfo() { 
-       MBeanNotificationInfo[] pres = super.getNotificationInfo();
-       MBeanNotificationInfo[] loc = getDefaultNotificationInfo();
-       MBeanNotificationInfo[] aug = new MBeanNotificationInfo[
-                                               pres.length + loc.length
-                                                       ];
-       System.arraycopy(pres, 0, aug, 0, pres.length);
-       System.arraycopy(loc, 0, aug, pres.length+1, loc.length);       
-       
+        MBeanNotificationInfo[] pres = super.getNotificationInfo();
+        MBeanNotificationInfo[] loc = getDefaultNotificationInfo();
+        MBeanNotificationInfo[] aug = new MBeanNotificationInfo[pres.length + loc.length];
+        if (pres.length>0) System.arraycopy(pres, 0, aug, 0, pres.length);
+        if (loc.length >0) System.arraycopy(loc, 0, aug, pres.length>0?pres.length+1:0, loc.length);    
         return aug; 
     }