File tree Expand file tree Collapse file tree 7 files changed +18
-14
lines changed
Expand file tree Collapse file tree 7 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,16 @@ void throwIllegalStateException(String message) {
1818 try {
1919 throw exception ;
2020 } catch (IllegalStateException e ) {
21- try {
22- outStream .write (Arrays
23- .stream (e .getStackTrace ())
24- .map (s -> s .toString () + "\n " )
25- .collect (Collectors .joining ())
26- .getBytes ());
27- } catch (IOException ex ) {
28- ex .printStackTrace ();
21+ if (outStream != null ) {
22+ try {
23+ outStream .write (Arrays
24+ .stream (e .getStackTrace ())
25+ .map (s -> s .toString () + "\n " )
26+ .collect (Collectors .joining ())
27+ .getBytes ());
28+ } catch (IOException ex ) {
29+ ex .printStackTrace ();
30+ }
2931 }
3032 }
3133 }
Original file line number Diff line number Diff line change 2323 * By default BWEM throws when an invalid state is encountered.
2424 * But if you know what you are doing, you can skip these throws by setting
2525 * {@link #setFailOnError} to `false`.
26+ * These errors will then be outputted to {@link System.err}, but this can also be changed
27+ * with {@link #setFailOutputStream} (if you set it to `null` the errors will be completely ignored).
2628 */
2729public final class BWEM {
2830 private final BWMap map ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public abstract class BWMap {
3737 Altitude highestAltitude ;
3838 final Asserter asserter ;
3939
40- BWMap (final Game game , Asserter asserter ) {
40+ BWMap (final Game game , final Asserter asserter ) {
4141 this .game = game ;
4242 this .players = game .getPlayers ();
4343 this .mineralPatches = game .getMinerals ();
Original file line number Diff line number Diff line change @@ -42,9 +42,9 @@ public final class MiniTile {
4242 areaId ; // 0 -> unwalkable ; > 0 -> index of some Area ; < 0 -> some walkable terrain, but
4343 // too small to be part of an Area
4444
45- private Asserter asserter ;
45+ private final Asserter asserter ;
4646
47- MiniTile (Asserter asserter ) {
47+ MiniTile (final Asserter asserter ) {
4848 this .altitude = Altitude .UNINITIALIZED ;
4949 this .areaId = UNINITIALIZED ;
5050 this .asserter = asserter ;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class TempAreaInfo {
3333
3434 private final Asserter asserter ;
3535
36- TempAreaInfo (Asserter asserter ) {
36+ TempAreaInfo (final Asserter asserter ) {
3737 this .isValid = false ;
3838 this .id = AreaId .ZERO ;
3939 this .walkPositionWithHighestAltitude = new WalkPosition (0 , 0 );
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public final class Tile {
4141 private boolean isBuildable ;
4242 private boolean isDoodad ;
4343
44- private Asserter asserter ;
44+ private final Asserter asserter ;
4545
4646 Tile (final Asserter asserter ) {
4747 this .markable = new Markable (Tile .staticMarkable );
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ final class TileData {
1919
2020 final Asserter asserter ;
2121
22- TileData (final int tileCount , final int miniTileCount , Asserter asserter ) {
22+ TileData (final int tileCount , final int miniTileCount , final Asserter asserter ) {
2323 tiles = new Tile [tileCount ];
2424 this .asserter = asserter ;
2525 for (int i = 0 ; i < tileCount ; ++i ) {
You can’t perform that action at this time.
0 commit comments