src/share/classes/javax/management/loading/MLet.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


1294          if (c != null) {
1295             try {
1296                 Constructor<?> cons =
1297                     c.getConstructor(String.class);
1298                 Object[] oo = new Object[1];
1299                 oo[0]=param;
1300                 return(cons.newInstance(oo));
1301 
1302             } catch (Exception  e) {
1303                 MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
1304                         "constructParameter", "Got unexpected exception", e);
1305             }
1306         }
1307         if (type.compareTo("java.lang.Boolean") == 0)
1308              return Boolean.valueOf(param);
1309         if (type.compareTo("java.lang.Byte") == 0)
1310              return new Byte(param);
1311         if (type.compareTo("java.lang.Short") == 0)
1312              return new Short(param);
1313         if (type.compareTo("java.lang.Long") == 0)
1314              return new Long(param);
1315         if (type.compareTo("java.lang.Integer") == 0)
1316              return new Integer(param);
1317         if (type.compareTo("java.lang.Float") == 0)
1318              return new Float(param);
1319         if (type.compareTo("java.lang.Double") == 0)
1320              return new Double(param);
1321         if (type.compareTo("java.lang.String") == 0)
1322              return param;
1323 
1324         return param;
1325      }
1326 
1327     private synchronized void setMBeanServer(final MBeanServer server) {
1328         this.server = server;
1329         PrivilegedAction<ClassLoaderRepository> act =
1330             new PrivilegedAction<ClassLoaderRepository>() {
1331                 public ClassLoaderRepository run() {
1332                     return server.getClassLoaderRepository();
1333                 }
1334             };


1294          if (c != null) {
1295             try {
1296                 Constructor<?> cons =
1297                     c.getConstructor(String.class);
1298                 Object[] oo = new Object[1];
1299                 oo[0]=param;
1300                 return(cons.newInstance(oo));
1301 
1302             } catch (Exception  e) {
1303                 MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
1304                         "constructParameter", "Got unexpected exception", e);
1305             }
1306         }
1307         if (type.compareTo("java.lang.Boolean") == 0)
1308              return Boolean.valueOf(param);
1309         if (type.compareTo("java.lang.Byte") == 0)
1310              return new Byte(param);
1311         if (type.compareTo("java.lang.Short") == 0)
1312              return new Short(param);
1313         if (type.compareTo("java.lang.Long") == 0)
1314              return Long.valueOf(param);
1315         if (type.compareTo("java.lang.Integer") == 0)
1316              return new Integer(param);
1317         if (type.compareTo("java.lang.Float") == 0)
1318              return new Float(param);
1319         if (type.compareTo("java.lang.Double") == 0)
1320              return new Double(param);
1321         if (type.compareTo("java.lang.String") == 0)
1322              return param;
1323 
1324         return param;
1325      }
1326 
1327     private synchronized void setMBeanServer(final MBeanServer server) {
1328         this.server = server;
1329         PrivilegedAction<ClassLoaderRepository> act =
1330             new PrivilegedAction<ClassLoaderRepository>() {
1331                 public ClassLoaderRepository run() {
1332                     return server.getClassLoaderRepository();
1333                 }
1334             };