src/share/jaxws_classes/com/sun/org/glassfish/external/statistics/impl/StatisticImpl.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -24,12 +24,12 @@
  */
 
 
 package com.sun.org.glassfish.external.statistics.impl;
 import com.sun.org.glassfish.external.statistics.Statistic;
-import java.io.Serializable;
-import java.util.concurrent.atomic.AtomicLong;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author Sreenivas Munnangi

@@ -131,6 +131,15 @@
     }
 
     protected static boolean isValidString(String str) {
         return (str!=null && str.length()>0);
     }
+
+    protected void checkMethod(Method method) {
+        if (method == null || method.getDeclaringClass() == null
+                || !Statistic.class.isAssignableFrom(method.getDeclaringClass())
+                || Modifier.isStatic(method.getModifiers())) {
+            throw new RuntimeException("Invalid method on invoke");
+        }
+    }
+
 }