Skip to content
Permalink
Browse files

fix: minor fixes from SonarLint

  • Loading branch information...
rhwood committed Sep 1, 2019
1 parent d00fed3 commit d1cbde14cea6678bf2038a8813bc0980708cff12
@@ -5,7 +5,6 @@
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.SortedSet;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import jmri.Disposable;
@@ -95,6 +94,7 @@ public boolean execute() {
*/
@Override
protected void registerSelf() {
// override to do nothing
}

@Override
@@ -171,9 +171,8 @@ public IdTag getByTagID(String tagID) {
protected IdTag createNewIdTag(String systemName, String userName) {
// Names start with the system prefix followed by D.
// Add the prefix if not present.
if (!systemName.startsWith(getSystemPrefix() + typeLetter() )) // NOI18N
{
systemName = getSystemPrefix() + typeLetter() + systemName; // NOI18N
if (!systemName.startsWith(getSystemPrefix() + typeLetter())) {
systemName = getSystemPrefix() + typeLetter() + systemName;
}
return new DefaultIdTag(systemName, userName);
}
@@ -58,15 +58,14 @@
@ServiceProvider(service = HttpServlet.class)
public class JsonServlet extends WebSocketServlet {

private transient ObjectMapper mapper;
private final transient ObjectMapper mapper = new ObjectMapper();
private final transient HashMap<String, HashSet<JsonHttpService>> services = new HashMap<>();
private final transient JsonServerPreferences preferences = InstanceManager.getDefault(JsonServerPreferences.class);
private static final Logger log = LoggerFactory.getLogger(JsonServlet.class);

@Override
public void init() throws ServletException {
this.superInit();
this.mapper = new ObjectMapper();
for (JsonServiceFactory<?, ?> factory : ServiceLoader.load(JsonServiceFactory.class)) {
JsonHttpService service = factory.getHttpService(this.mapper);
for (String type : factory.getTypes()) {
@@ -53,6 +53,9 @@
import jmri.TurnoutOperationManager;
import jmri.UserPreferencesManager;
import jmri.implementation.JmriConfigurationManager;
import jmri.jmrit.display.Editor;
import jmri.jmrit.display.EditorFrameOperator;
import jmri.jmrit.display.EditorManager;
import jmri.jmrit.display.layoutEditor.LayoutBlockManager;
import jmri.jmrit.logix.OBlockManager;
import jmri.jmrit.logix.WarrantManager;
@@ -921,7 +924,7 @@ public static void clearShutDownManager() {
ShutDownManager sm = InstanceManager.getNullableDefault(jmri.ShutDownManager.class);
if (sm == null) return;
List<ShutDownTask> list = sm.tasks();
while (list != null && list.size() > 0) {
while (!list.isEmpty()) {
sm.deregister(list.get(0));
list = sm.tasks(); // avoid ConcurrentModificationException
}
@@ -1308,17 +1311,18 @@ static void checkThreads() {

/* Global Panel operations */
/**
* Close all panels associated with the jmri.jmrit.display.EditorManager instance.
* Close all panels associated with the {@link EditorManager} default
* instance.
*/
public static void closeAllPanels(){
List<jmri.jmrit.display.Editor> l = (InstanceManager.getNullableDefault(jmri.jmrit.display.EditorManager.class)).getEditorsList();
for( jmri.jmrit.display.Editor e : l ){
jmri.jmrit.display.EditorFrameOperator efo = new jmri.jmrit.display.EditorFrameOperator(e);
efo.closeFrameWithConfirmations();
public static void closeAllPanels() {
EditorManager manager = InstanceManager.getNullableDefault(EditorManager.class);
if (manager != null) {
for (Editor e : manager.getEditorsList()) {
new EditorFrameOperator(e).closeFrameWithConfirmations();
}
}
}


/* GraphicsEnvironment utility methods */

/**

0 comments on commit d1cbde1

Please sign in to comment.
You can’t perform that action at this time.