From 5d683c34c73a6dd0492e5332744348f1c6aefd5e Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 2 Aug 2017 10:26:10 +0200 Subject: [PATCH] cleanups in Java examples advised by Sonar --- examples/java/app/bittorrent/Main.java | 1 - examples/java/app/tokenring/Main.java | 5 ++--- examples/java/async/dsend/Main.java | 6 ++---- examples/java/async/waitall/Main.java | 6 ++---- examples/java/async/yield/Main.java | 3 +-- examples/java/cloud/masterworker/Main.java | 3 +-- examples/java/cloud/migration/XVM.java | 1 - examples/java/dht/kademlia/Main.java | 1 - examples/java/energy/pstate/Main.java | 5 ++--- examples/java/io/file/Main.java | 6 ++---- examples/java/io/file/Node.java | 1 - examples/java/io/storage/Client.java | 1 - examples/java/io/storage/Main.java | 6 ++---- 13 files changed, 14 insertions(+), 31 deletions(-) diff --git a/examples/java/app/bittorrent/Main.java b/examples/java/app/bittorrent/Main.java index 091b6ec391..352addb1bf 100644 --- a/examples/java/app/bittorrent/Main.java +++ b/examples/java/app/bittorrent/Main.java @@ -6,7 +6,6 @@ package app.bittorrent; import org.simgrid.msg.Msg; -import org.simgrid.msg.MsgException; import org.simgrid.msg.RngStream; class Main{ diff --git a/examples/java/app/tokenring/Main.java b/examples/java/app/tokenring/Main.java index 754dad0c80..e63367632a 100644 --- a/examples/java/app/tokenring/Main.java +++ b/examples/java/app/tokenring/Main.java @@ -1,11 +1,10 @@ -/* Copyright (c) 2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ package app.tokenring; import org.simgrid.msg.Host; -import org.simgrid.msg.HostNotFoundException; import org.simgrid.msg.Msg; import org.simgrid.msg.Process; @@ -15,7 +14,7 @@ class Main { throw new IllegalAccessError("Utility class"); } - public static void main(String[] args) throws HostNotFoundException { + public static void main(String[] args) { Msg.init(args); String platform = "../platforms/small_platform.xml"; diff --git a/examples/java/async/dsend/Main.java b/examples/java/async/dsend/Main.java index 0822c42bac..cbdf523094 100644 --- a/examples/java/async/dsend/Main.java +++ b/examples/java/async/dsend/Main.java @@ -1,5 +1,4 @@ -/* Copyright (c) 2006-2014, 2016. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -13,7 +12,6 @@ package async.dsend; */ import org.simgrid.msg.Host; -import org.simgrid.msg.HostNotFoundException; import org.simgrid.msg.Msg; class Main { @@ -22,7 +20,7 @@ class Main { throw new IllegalAccessError("Utility class"); } - public static void main(String[] args) throws HostNotFoundException { + public static void main(String[] args) { Msg.init(args); String platform = "../platforms/small_platform.xml"; diff --git a/examples/java/async/waitall/Main.java b/examples/java/async/waitall/Main.java index 208e554456..0a54479645 100644 --- a/examples/java/async/waitall/Main.java +++ b/examples/java/async/waitall/Main.java @@ -1,5 +1,4 @@ -/* Copyright (c) 2006-2014, 2016. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -20,14 +19,13 @@ package async.waitall; import org.simgrid.msg.Msg; import org.simgrid.msg.Host; -import org.simgrid.msg.MsgException; class Main { private Main() { throw new IllegalAccessError("Utility class"); } - public static void main(String[] args) throws MsgException { + public static void main(String[] args) { Msg.init(args); String platform = "../platforms/small_platform.xml"; diff --git a/examples/java/async/yield/Main.java b/examples/java/async/yield/Main.java index 6e044a5f79..475fd3960e 100644 --- a/examples/java/async/yield/Main.java +++ b/examples/java/async/yield/Main.java @@ -12,7 +12,6 @@ package async.yield; */ import org.simgrid.msg.Host; -import org.simgrid.msg.HostNotFoundException; import org.simgrid.msg.Msg; class Main { @@ -21,7 +20,7 @@ class Main { throw new IllegalAccessError("Utility class"); } - public static void main(String[] args) throws HostNotFoundException { + public static void main(String[] args) { Msg.init(args); String platform = "../platforms/small_platform.xml"; diff --git a/examples/java/cloud/masterworker/Main.java b/examples/java/cloud/masterworker/Main.java index e78204ced7..a99dc21ab7 100644 --- a/examples/java/cloud/masterworker/Main.java +++ b/examples/java/cloud/masterworker/Main.java @@ -9,7 +9,6 @@ import java.io.File; import org.simgrid.msg.Msg; import org.simgrid.msg.Host; -import org.simgrid.msg.MsgException; class Main { public static final double TASK_COMP_SIZE = 10; @@ -21,7 +20,7 @@ class Main { throw new IllegalAccessError("Utility class"); } - public static void main(String[] args) throws MsgException { + public static void main(String[] args) { Msg.init(args); String platfFile = "../../examples/platforms/small_platform.xml"; diff --git a/examples/java/cloud/migration/XVM.java b/examples/java/cloud/migration/XVM.java index 9fcaa907f4..ded5e443b1 100644 --- a/examples/java/cloud/migration/XVM.java +++ b/examples/java/cloud/migration/XVM.java @@ -8,7 +8,6 @@ package cloud.migration; import org.simgrid.msg.Msg; import org.simgrid.msg.VM; import org.simgrid.msg.Host; -import org.simgrid.msg.HostNotFoundException; import org.simgrid.msg.HostFailureException; public class XVM extends VM { diff --git a/examples/java/dht/kademlia/Main.java b/examples/java/dht/kademlia/Main.java index 1474e551b9..9032779d16 100644 --- a/examples/java/dht/kademlia/Main.java +++ b/examples/java/dht/kademlia/Main.java @@ -5,7 +5,6 @@ package dht.kademlia; import org.simgrid.msg.Msg; -import org.simgrid.msg.MsgException; class Main { private Main() { diff --git a/examples/java/energy/pstate/Main.java b/examples/java/energy/pstate/Main.java index f6c3afa79a..01eedb8487 100644 --- a/examples/java/energy/pstate/Main.java +++ b/examples/java/energy/pstate/Main.java @@ -1,4 +1,4 @@ -/* Copyright (c) 2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -6,7 +6,6 @@ package energy.pstate; import org.simgrid.msg.Host; -import org.simgrid.msg.HostNotFoundException; import org.simgrid.msg.Msg; class Main { @@ -14,7 +13,7 @@ class Main { throw new IllegalAccessError("Utility class"); } - public static void main(String[] args) throws HostNotFoundException { + public static void main(String[] args) { Msg.energyInit(); Msg.init(args); diff --git a/examples/java/io/file/Main.java b/examples/java/io/file/Main.java index c1b72dd362..6134fe81ce 100644 --- a/examples/java/io/file/Main.java +++ b/examples/java/io/file/Main.java @@ -1,5 +1,4 @@ -/* Copyright (c) 2012-2014. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -8,14 +7,13 @@ package io.file; import org.simgrid.msg.Msg; import org.simgrid.msg.Host; -import org.simgrid.msg.MsgException; public class Main { private Main() { throw new IllegalAccessError("Utility class"); } - public static void main(String[] args) throws MsgException { + public static void main(String[] args) { Msg.init(args); if(args.length < 1) { Msg.info("Usage : IO platform_file "); diff --git a/examples/java/io/file/Node.java b/examples/java/io/file/Node.java index c1622cd599..edffbbcd63 100644 --- a/examples/java/io/file/Node.java +++ b/examples/java/io/file/Node.java @@ -21,7 +21,6 @@ import org.simgrid.msg.Msg; import org.simgrid.msg.File; import org.simgrid.msg.Host; import org.simgrid.msg.Process; -import org.simgrid.msg.HostNotFoundException; import org.simgrid.msg.MsgException; public class Node extends Process { diff --git a/examples/java/io/storage/Client.java b/examples/java/io/storage/Client.java index b031faac36..480ff86ebc 100644 --- a/examples/java/io/storage/Client.java +++ b/examples/java/io/storage/Client.java @@ -19,7 +19,6 @@ import org.simgrid.msg.Msg; import org.simgrid.msg.Host; import org.simgrid.msg.Process; import org.simgrid.msg.Storage; -import org.simgrid.msg.HostNotFoundException; import org.simgrid.msg.MsgException; public class Client extends Process { diff --git a/examples/java/io/storage/Main.java b/examples/java/io/storage/Main.java index 6755fa4b7f..306eee8442 100644 --- a/examples/java/io/storage/Main.java +++ b/examples/java/io/storage/Main.java @@ -1,5 +1,4 @@ -/* Copyright (c) 2012-2014. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -7,14 +6,13 @@ package io.storage; import org.simgrid.msg.Msg; import org.simgrid.msg.Host; -import org.simgrid.msg.MsgException; public class Main { private Main() { throw new IllegalAccessError("Utility class"); } - public static void main(String[] args) throws MsgException { + public static void main(String[] args) { Msg.init(args); if(args.length < 1) { Msg.info("Usage : Storage platform_file "); -- 2.20.1