Browse Source

Remove Logger.assertTrue.

Use Guava's Preconditions instead, which throw appropriate exceptions
rather than AssertionErrors (whose idea was that?!)

Also fix weirdness in CommandArguments where start was allowed to be
1 greater than end when getting words.

Change-Id: Icce38e36da6507f645fb8b3b872dfe2c60c43ea7
Reviewed-on: http://gerrit.dmdirc.com/2961
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8rc1
Chris Smith 10 years ago
parent
commit
7a1c4aa299

+ 9
- 10
src/com/dmdirc/FrameContainerComparator.java View File

@@ -22,16 +22,15 @@
22 22
 
23 23
 package com.dmdirc;
24 24
 
25
-import com.dmdirc.logger.Logger;
26
-
27 25
 import java.io.Serializable;
28 26
 import java.util.Comparator;
29 27
 
28
+import static com.google.common.base.Preconditions.checkNotNull;
29
+
30 30
 /**
31 31
  * Compares FrameContainers by name.
32 32
  */
33
-public final class FrameContainerComparator implements Comparator<FrameContainer>,
34
-        Serializable {
33
+public class FrameContainerComparator implements Comparator<FrameContainer>, Serializable {
35 34
 
36 35
     /**
37 36
      * A version number for this class. It should be changed whenever the class
@@ -56,10 +55,10 @@ public final class FrameContainerComparator implements Comparator<FrameContainer
56 55
         "item2.toString() returns a non-null value"
57 56
     })
58 57
     public int compare(final FrameContainer item1, final FrameContainer item2) {
59
-        Logger.assertTrue(item1 != null);
60
-        Logger.assertTrue(item2 != null);
61
-        Logger.assertTrue(item1.getName() != null);
62
-        Logger.assertTrue(item2.getName() != null);
58
+        checkNotNull(item1);
59
+        checkNotNull(item2);
60
+        checkNotNull(item1.getName());
61
+        checkNotNull(item2.getName());
63 62
 
64 63
         if (sortBefore(item1, item2)) {
65 64
             return -1;
@@ -84,9 +83,9 @@ public final class FrameContainerComparator implements Comparator<FrameContainer
84 83
      * @param item2 The existing container to test against
85 84
      * @return True iff the new container should be before the old container
86 85
      */
87
-    private static boolean sortBefore(final FrameContainer item1,
86
+    private static boolean sortBefore(
87
+            final FrameContainer item1,
88 88
             final FrameContainer item2) {
89
-
90 89
         return getPosition(item1) < getPosition(item2);
91 90
     }
92 91
 

+ 5
- 2
src/com/dmdirc/Server.java View File

@@ -87,6 +87,9 @@ import javax.net.ssl.TrustManager;
87 87
 
88 88
 import lombok.extern.slf4j.Slf4j;
89 89
 
90
+import static com.google.common.base.Preconditions.checkArgument;
91
+import static com.google.common.base.Preconditions.checkNotNull;
92
+
90 93
 /**
91 94
  * The Server class represents the client's view of a server. It maintains
92 95
  * a list of all channels, queries, etc, and handles parser callbacks pertaining
@@ -830,8 +833,8 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
830 833
         "The current profile specifies at least one nickname"
831 834
     })
832 835
     private MyInfo buildMyInfo() {
833
-        Logger.assertTrue(profile != null);
834
-        Logger.assertTrue(!profile.getOptionList(DOMAIN_PROFILE, "nicknames").isEmpty());
836
+        checkNotNull(profile);
837
+        checkArgument(!profile.getOptionList(DOMAIN_PROFILE, "nicknames").isEmpty());
835 838
 
836 839
         final MyInfo myInfo = new MyInfo();
837 840
         myInfo.setNickname(profile.getOptionList(DOMAIN_PROFILE, "nicknames").get(0));

+ 3
- 1
src/com/dmdirc/ServerManager.java View File

@@ -45,6 +45,8 @@ import javax.inject.Inject;
45 45
 import javax.inject.Provider;
46 46
 import javax.inject.Singleton;
47 47
 
48
+import static com.google.common.base.Preconditions.checkArgument;
49
+
48 50
 /**
49 51
  * The ServerManager maintains a list of all servers, and provides methods to
50 52
  * search or iterate over them.
@@ -210,7 +212,7 @@ public class ServerManager implements ServerFactory {
210 212
      * @since 0.6.3
211 213
      */
212 214
     public Server connectToAddress(final URI uri, final ConfigProvider profile) {
213
-        Logger.assertTrue(profile.isProfile());
215
+        checkArgument(profile.isProfile());
214 216
         Server server = null;
215 217
 
216 218
         for (Server loopServer : servers) {

+ 6
- 5
src/com/dmdirc/actions/ActionComponentChain.java View File

@@ -25,11 +25,12 @@ package com.dmdirc.actions;
25 25
 import com.dmdirc.Precondition;
26 26
 import com.dmdirc.interfaces.ActionController;
27 27
 import com.dmdirc.interfaces.actions.ActionComponent;
28
-import com.dmdirc.logger.Logger;
29 28
 
30 29
 import java.util.ArrayList;
31 30
 import java.util.List;
32 31
 
32
+import static com.google.common.base.Preconditions.checkArgument;
33
+
33 34
 /**
34 35
  * An action component chain supports chaining of multiple action components
35 36
  * together.
@@ -89,7 +90,7 @@ public class ActionComponentChain implements ActionComponent {
89 90
     @Precondition("This component chain has one or more components")
90 91
     @Override
91 92
     public Class<?> appliesTo() {
92
-        Logger.assertTrue(!components.isEmpty());
93
+        checkArgument(!components.isEmpty());
93 94
 
94 95
         return components.get(0).appliesTo();
95 96
     }
@@ -98,7 +99,7 @@ public class ActionComponentChain implements ActionComponent {
98 99
     @Precondition("This component chain has one or more components")
99 100
     @Override
100 101
     public Class<?> getType() {
101
-        Logger.assertTrue(!components.isEmpty());
102
+        checkArgument(!components.isEmpty());
102 103
 
103 104
         return components.get(components.size() - 1).getType();
104 105
     }
@@ -107,7 +108,7 @@ public class ActionComponentChain implements ActionComponent {
107 108
     @Precondition("This component chain has one or more components")
108 109
     @Override
109 110
     public String getName() {
110
-        Logger.assertTrue(!components.isEmpty());
111
+        checkArgument(!components.isEmpty());
111 112
 
112 113
         final StringBuilder name = new StringBuilder();
113 114
 
@@ -123,7 +124,7 @@ public class ActionComponentChain implements ActionComponent {
123 124
     @Override
124 125
     @Precondition("This component chain has one or more components")
125 126
     public String toString() {
126
-        Logger.assertTrue(!components.isEmpty());
127
+        checkArgument(!components.isEmpty());
127 128
 
128 129
         final StringBuilder name = new StringBuilder();
129 130
 

+ 5
- 3
src/com/dmdirc/actions/ActionGroup.java View File

@@ -24,7 +24,6 @@ package com.dmdirc.actions;
24 24
 
25 25
 import com.dmdirc.Precondition;
26 26
 import com.dmdirc.config.prefs.PreferencesSetting;
27
-import com.dmdirc.logger.Logger;
28 27
 import com.dmdirc.updater.Version;
29 28
 
30 29
 import java.util.ArrayList;
@@ -33,6 +32,9 @@ import java.util.Iterator;
33 32
 import java.util.List;
34 33
 import java.util.Map;
35 34
 
35
+import static com.google.common.base.Preconditions.checkArgument;
36
+import static com.google.common.base.Preconditions.checkNotNull;
37
+
36 38
 /**
37 39
  * Represents a group of actions, along with their meta-data.
38 40
  */
@@ -230,8 +232,8 @@ public class ActionGroup implements Iterable<Action> {
230 232
     })
231 233
     @SuppressWarnings("deprecation")
232 234
     public void deleteAction(final Action action) {
233
-        Logger.assertTrue(action != null);
234
-        Logger.assertTrue(actions.contains(action));
235
+        checkNotNull(action);
236
+        checkArgument(actions.contains(action));
235 237
 
236 238
         ActionManager.getActionManager().removeAction(action);
237 239
         action.delete();

+ 34
- 32
src/com/dmdirc/actions/ActionManager.java View File

@@ -34,7 +34,6 @@ import com.dmdirc.interfaces.actions.ActionType;
34 34
 import com.dmdirc.interfaces.config.IdentityController;
35 35
 import com.dmdirc.logger.ErrorLevel;
36 36
 import com.dmdirc.logger.Logger;
37
-import com.dmdirc.updater.UpdateChecker;
38 37
 import com.dmdirc.updater.components.ActionGroupComponent;
39 38
 import com.dmdirc.updater.manager.UpdateManager;
40 39
 import com.dmdirc.util.collections.MapList;
@@ -53,6 +52,9 @@ import javax.inject.Provider;
53 52
 
54 53
 import lombok.extern.slf4j.Slf4j;
55 54
 
55
+import static com.google.common.base.Preconditions.checkArgument;
56
+import static com.google.common.base.Preconditions.checkNotNull;
57
+
56 58
 /**
57 59
  * Manages all actions for the client.
58 60
  */
@@ -215,7 +217,7 @@ public class ActionManager implements ActionController {
215 217
     @Override
216 218
     public void registerTypes(final ActionType[] newTypes) {
217 219
         for (ActionType type : newTypes) {
218
-            Logger.assertTrue(type != null);
220
+            checkNotNull(type);
219 221
 
220 222
             if (!types.contains(type)) {
221 223
                 log.debug("Registering action type: {}", type);
@@ -229,7 +231,7 @@ public class ActionManager implements ActionController {
229 231
     @Override
230 232
     public void registerComponents(final ActionComponent[] comps) {
231 233
         for (ActionComponent comp : comps) {
232
-            Logger.assertTrue(comp != null);
234
+            checkNotNull(comp);
233 235
 
234 236
             log.debug("Registering action component: {}", comp);
235 237
             components.add(comp);
@@ -240,7 +242,7 @@ public class ActionManager implements ActionController {
240 242
     @Override
241 243
     public void registerComparisons(final ActionComparison[] comps) {
242 244
         for (ActionComparison comp : comps) {
243
-            Logger.assertTrue(comp != null);
245
+            checkNotNull(comp);
244 246
 
245 247
             log.debug("Registering action comparison: {}", comp);
246 248
             comparisons.add(comp);
@@ -313,8 +315,8 @@ public class ActionManager implements ActionController {
313 315
      */
314 316
     @Precondition("The specified File is not null and represents a directory")
315 317
     private void loadActions(final File dir) {
316
-        Logger.assertTrue(dir != null);
317
-        Logger.assertTrue(dir.isDirectory());
318
+        checkNotNull(dir);
319
+        checkArgument(dir.isDirectory());
318 320
 
319 321
         log.debug("Loading actions from directory: {}", dir.getAbsolutePath());
320 322
 
@@ -330,7 +332,7 @@ public class ActionManager implements ActionController {
330 332
     /** {@inheritDoc} */
331 333
     @Override
332 334
     public void addAction(final Action action) {
333
-        Logger.assertTrue(action != null);
335
+        checkNotNull(action);
334 336
 
335 337
         log.debug("Registering action: {}/{} (status: {})",
336 338
                 new Object[] { action.getGroup(), action.getName(), action.getStatus() });
@@ -358,7 +360,7 @@ public class ActionManager implements ActionController {
358 360
     /** {@inheritDoc} */
359 361
     @Override
360 362
     public void removeAction(final Action action) {
361
-        Logger.assertTrue(action != null);
363
+        checkNotNull(action);
362 364
 
363 365
         actions.removeFromAll(action);
364 366
         getOrCreateGroup(action.getGroup()).remove(action);
@@ -375,9 +377,9 @@ public class ActionManager implements ActionController {
375 377
     @Override
376 378
     public boolean triggerEvent(final ActionType type,
377 379
             final StringBuffer format, final Object ... arguments) {
378
-        Logger.assertTrue(type != null);
379
-        Logger.assertTrue(type.getType() != null);
380
-        Logger.assertTrue(type.getType().getArity() == arguments.length);
380
+        checkNotNull(type);
381
+        checkNotNull(type.getType());
382
+        checkArgument(type.getType().getArity() == arguments.length);
381 383
 
382 384
         log.trace("Calling listeners for event of type {}", type);
383 385
 
@@ -413,7 +415,7 @@ public class ActionManager implements ActionController {
413 415
     @Precondition("The specified ActionType is not null")
414 416
     private boolean triggerActions(final ActionType type,
415 417
             final StringBuffer format, final Object ... arguments) {
416
-        Logger.assertTrue(type != null);
418
+        checkNotNull(type);
417 419
 
418 420
         boolean res = false;
419 421
 
@@ -457,9 +459,9 @@ public class ActionManager implements ActionController {
457 459
     /** {@inheritDoc} */
458 460
     @Override
459 461
     public ActionGroup createGroup(final String group) {
460
-        Logger.assertTrue(group != null);
461
-        Logger.assertTrue(!group.isEmpty());
462
-        Logger.assertTrue(!groups.containsKey(group));
462
+        checkNotNull(group);
463
+        checkArgument(!group.isEmpty());
464
+        checkArgument(!groups.containsKey(group));
463 465
 
464 466
         final File file = new File(getDirectory() + group);
465 467
         if (file.isDirectory() || file.mkdir()) {
@@ -475,9 +477,9 @@ public class ActionManager implements ActionController {
475 477
     /** {@inheritDoc} */
476 478
     @Override
477 479
     public void deleteGroup(final String group) {
478
-        Logger.assertTrue(group != null);
479
-        Logger.assertTrue(!group.isEmpty());
480
-        Logger.assertTrue(groups.containsKey(group));
480
+        checkNotNull(group);
481
+        checkArgument(!group.isEmpty());
482
+        checkArgument(groups.containsKey(group));
481 483
 
482 484
         for (Action action : groups.get(group).getActions()) {
483 485
             removeAction(action);
@@ -507,13 +509,13 @@ public class ActionManager implements ActionController {
507 509
     /** {@inheritDoc} */
508 510
     @Override
509 511
     public void changeGroupName(final String oldName, final String newName) {
510
-        Logger.assertTrue(oldName != null);
511
-        Logger.assertTrue(!oldName.isEmpty());
512
-        Logger.assertTrue(newName != null);
513
-        Logger.assertTrue(!newName.isEmpty());
514
-        Logger.assertTrue(groups.containsKey(oldName));
515
-        Logger.assertTrue(!groups.containsKey(newName));
516
-        Logger.assertTrue(!newName.equals(oldName));
512
+        checkNotNull(oldName);
513
+        checkArgument(!oldName.isEmpty());
514
+        checkNotNull(newName);
515
+        checkArgument(!newName.isEmpty());
516
+        checkArgument(groups.containsKey(oldName));
517
+        checkArgument(!groups.containsKey(newName));
518
+        checkArgument(!newName.equals(oldName));
517 519
 
518 520
         createGroup(newName);
519 521
 
@@ -545,7 +547,7 @@ public class ActionManager implements ActionController {
545 547
     /** {@inheritDoc} */
546 548
     @Override
547 549
     public List<ActionType> findCompatibleTypes(final ActionType type) {
548
-        Logger.assertTrue(type != null);
550
+        checkNotNull(type);
549 551
 
550 552
         final List<ActionType> res = new ArrayList<>();
551 553
         for (ActionType target : types) {
@@ -560,7 +562,7 @@ public class ActionManager implements ActionController {
560 562
     /** {@inheritDoc} */
561 563
     @Override
562 564
     public List<ActionComponent> findCompatibleComponents(final Class<?> target) {
563
-        Logger.assertTrue(target != null);
565
+        checkNotNull(target);
564 566
 
565 567
         final List<ActionComponent> res = new ArrayList<>();
566 568
         for (ActionComponent subject : components) {
@@ -575,7 +577,7 @@ public class ActionManager implements ActionController {
575 577
     /** {@inheritDoc} */
576 578
     @Override
577 579
     public List<ActionComparison> findCompatibleComparisons(final Class<?> target) {
578
-        Logger.assertTrue(target != null);
580
+        checkNotNull(target);
579 581
 
580 582
         final List<ActionComparison> res = new ArrayList<>();
581 583
         for (ActionComparison subject : comparisons) {
@@ -590,8 +592,8 @@ public class ActionManager implements ActionController {
590 592
     /** {@inheritDoc} */
591 593
     @Override
592 594
     public ActionComponent getComponent(final String type) {
593
-        Logger.assertTrue(type != null);
594
-        Logger.assertTrue(!type.isEmpty());
595
+        checkNotNull(type);
596
+        checkArgument(!type.isEmpty());
595 597
 
596 598
         for (ActionComponent target : components) {
597 599
             if (target.name().equals(type)) {
@@ -605,8 +607,8 @@ public class ActionManager implements ActionController {
605 607
     /** {@inheritDoc} */
606 608
     @Override
607 609
     public ActionComparison getComparison(final String type) {
608
-        Logger.assertTrue(type != null);
609
-        Logger.assertTrue(!type.isEmpty());
610
+        checkNotNull(type);
611
+        checkArgument(!type.isEmpty());
610 612
 
611 613
         for (ActionComparison target : comparisons) {
612 614
             if (target.name().equals(type)) {

+ 4
- 3
src/com/dmdirc/commandparser/CommandArguments.java View File

@@ -24,13 +24,14 @@ package com.dmdirc.commandparser;
24 24
 
25 25
 import com.dmdirc.Precondition;
26 26
 import com.dmdirc.interfaces.CommandController;
27
-import com.dmdirc.logger.Logger;
28 27
 
29 28
 import java.util.Arrays;
30 29
 import java.util.Collection;
31 30
 import java.util.regex.Matcher;
32 31
 import java.util.regex.Pattern;
33 32
 
33
+import static com.google.common.base.Preconditions.checkPositionIndex;
34
+
34 35
 /**
35 36
  * Represents a command and its arguments. In this class, input is split into
36 37
  * 'words' which are separated by any number of whitespace characters;
@@ -156,7 +157,7 @@ public class CommandArguments {
156 157
     public String getArgumentsAsString(final int start) {
157 158
         parse();
158 159
 
159
-        return getArgumentsAsString(start, words.length - 2);
160
+        return getArgumentsAsString(start, Math.max(start, words.length - 2));
160 161
     }
161 162
 
162 163
     /**
@@ -195,7 +196,7 @@ public class CommandArguments {
195 196
      */
196 197
     @Precondition("Start index is less than or equal to end index")
197 198
     public String getWordsAsString(final int start, final int end) {
198
-        Logger.assertTrue(start <= end + 1);
199
+        checkPositionIndex(start, end);
199 200
 
200 201
         final Pattern pattern = Pattern.compile("(\\S+\\s+){" + start + "}"
201 202
                 + "((\\S+\\s+){" + Math.max(0, end - start) + "}\\S+(\\s+$)?).*?");

+ 9
- 6
src/com/dmdirc/config/IdentityManager.java View File

@@ -50,6 +50,9 @@ import java.util.Set;
50 50
 
51 51
 import lombok.extern.slf4j.Slf4j;
52 52
 
53
+import static com.google.common.base.Preconditions.checkArgument;
54
+import static com.google.common.base.Preconditions.checkNotNull;
55
+
53 56
 /**
54 57
  * The identity manager manages all known identities, providing easy methods
55 58
  * to access them.
@@ -268,8 +271,8 @@ public class IdentityManager implements IdentityFactory, IdentityController {
268 271
         "The specified File is a directory"
269 272
     })
270 273
     private void loadUser(final File dir) {
271
-        Logger.assertTrue(dir != null);
272
-        Logger.assertTrue(dir.isDirectory());
274
+        checkNotNull(dir);
275
+        checkArgument(dir.isDirectory());
273 276
 
274 277
         if (dir.listFiles() == null) {
275 278
             Logger.userError(ErrorLevel.MEDIUM,
@@ -421,7 +424,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
421 424
     /** {@inheritDoc} */
422 425
     @Override
423 426
     public void addConfigProvider(final ConfigProvider identity) {
424
-        Logger.assertTrue(identity != null);
427
+        checkNotNull(identity);
425 428
 
426 429
         final String target = getGroup(identity);
427 430
 
@@ -446,11 +449,11 @@ public class IdentityManager implements IdentityFactory, IdentityController {
446 449
     /** {@inheritDoc} */
447 450
     @Override
448 451
     public void removeConfigProvider(final ConfigProvider identity) {
449
-        Logger.assertTrue(identity != null);
452
+        checkNotNull(identity);
450 453
 
451 454
         final String group = getGroup(identity);
452 455
 
453
-        Logger.assertTrue(identities.containsValue(group, identity));
456
+        checkArgument(identities.containsValue(group, identity));
454 457
 
455 458
         synchronized (identities) {
456 459
             identities.remove(group, identity);
@@ -478,7 +481,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
478 481
     /** {@inheritDoc} */
479 482
     @Override
480 483
     public void registerIdentityListener(final String type, final ConfigProviderListener listener) {
481
-        Logger.assertTrue(listener != null);
484
+        checkNotNull(listener);
482 485
 
483 486
         synchronized (listeners) {
484 487
             listeners.add(type, listener);

+ 0
- 12
src/com/dmdirc/logger/Logger.java View File

@@ -82,18 +82,6 @@ public final class Logger {
82 82
         getErrorManager().addError(level, message, exception, true);
83 83
     }
84 84
 
85
-    /**
86
-     * Asserts that the specified value is true. If not, an AssertionError
87
-     * exception is thrown.
88
-     *
89
-     * @param value The value to be tested
90
-     */
91
-    public static void assertTrue(final boolean value) {
92
-        if (!value) {
93
-            throw new AssertionError();
94
-        }
95
-    }
96
-
97 85
     /**
98 86
      * Gets the manager that should be used to report errors.
99 87
      *

+ 16
- 15
src/com/dmdirc/ui/WindowManager.java View File

@@ -27,7 +27,6 @@ import com.dmdirc.FrameContainer;
27 27
 import com.dmdirc.Precondition;
28 28
 import com.dmdirc.interfaces.FrameCloseListener;
29 29
 import com.dmdirc.interfaces.ui.FrameListener;
30
-import com.dmdirc.logger.Logger;
31 30
 import com.dmdirc.util.collections.ListenerList;
32 31
 
33 32
 import java.util.Collection;
@@ -38,6 +37,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
38 37
 import javax.inject.Inject;
39 38
 import javax.inject.Singleton;
40 39
 
40
+import static com.google.common.base.Preconditions.checkArgument;
41
+import static com.google.common.base.Preconditions.checkNotNull;
42
+
41 43
 /**
42 44
  * The WindowManager maintains a list of all open windows, and their
43 45
  * parent/child relations.
@@ -68,7 +70,7 @@ public class WindowManager {
68 70
      */
69 71
     @Precondition("The specified FrameListener is not null")
70 72
     public void addListener(final FrameListener frameListener) {
71
-        Logger.assertTrue(frameListener != null);
73
+        checkNotNull(frameListener);
72 74
 
73 75
         listeners.add(FrameListener.class, frameListener);
74 76
     }
@@ -146,8 +148,8 @@ public class WindowManager {
146 148
         "The specified Window has not already been added"
147 149
     })
148 150
     public void addWindow(final FrameContainer window, final boolean focus) {
149
-        Logger.assertTrue(window != null);
150
-        Logger.assertTrue(!rootWindows.contains(window));
151
+        checkNotNull(window);
152
+        checkArgument(!rootWindows.contains(window));
151 153
 
152 154
         rootWindows.add(window);
153 155
 
@@ -184,10 +186,10 @@ public class WindowManager {
184 186
     })
185 187
     public void addWindow(final FrameContainer parent,
186 188
             final FrameContainer child, final boolean focus) {
187
-        Logger.assertTrue(parent != null);
188
-        Logger.assertTrue(isInHierarchy(parent));
189
-        Logger.assertTrue(child != null);
190
-        Logger.assertTrue(!isInHierarchy(child));
189
+        checkNotNull(parent);
190
+        checkArgument(isInHierarchy(parent));
191
+        checkNotNull(child);
192
+        checkArgument(!isInHierarchy(child));
191 193
 
192 194
         parent.addChild(child);
193 195
 
@@ -224,8 +226,8 @@ public class WindowManager {
224 226
         "The specified window is in the window hierarchy"
225 227
     })
226 228
     public void removeWindow(final FrameContainer window) {
227
-        Logger.assertTrue(isInHierarchy(window));
228
-        Logger.assertTrue(window != null);
229
+        checkNotNull(window != null);
230
+        checkArgument(isInHierarchy(window));
229 231
 
230 232
         for (FrameContainer child : window.getChildren()) {
231 233
             child.close();
@@ -252,7 +254,7 @@ public class WindowManager {
252 254
      */
253 255
     @Precondition("The specified window name is not null")
254 256
     public FrameContainer findCustomWindow(final String name) {
255
-        Logger.assertTrue(name != null);
257
+        checkNotNull(name);
256 258
 
257 259
         return findCustomWindow(rootWindows, name);
258 260
     }
@@ -270,10 +272,9 @@ public class WindowManager {
270 272
         "The specified parent window is not null",
271 273
         "The specified parent window has been added to the Window Manager"
272 274
     })
273
-    public FrameContainer findCustomWindow(final FrameContainer parent,
274
-            final String name) {
275
-        Logger.assertTrue(parent != null);
276
-        Logger.assertTrue(name != null);
275
+    public FrameContainer findCustomWindow(final FrameContainer parent, final String name) {
276
+        checkNotNull(parent);
277
+        checkNotNull(name);
277 278
 
278 279
         return findCustomWindow(parent.getChildren(), name);
279 280
     }

Loading…
Cancel
Save