61.

A Quick Reference for Troubleshooting

The list of symptoms in Table 6-1 can be used to lead you to the potential cause (and cure) of a problem that may currently be troubling you. You can also use it as a reference over the life of this book to help you quickly diagnose and fix problems that occurrences of these patterns may create.

Table 6-1: A Concept-Oriented Troubleshooting Guide

FOR THIS CONCEPT ...

SEE THIS PATTERN ...

adding new methods

Broken Dispatch, Chapter 14

assertion (definition and types)

Fictitious Implementation, Chapter 17

assertion (determining place in interface implementation)

Fictitious Implementation, Chapter 17

assertion (overhead)

Fictitious Implementation, Chapter 17

avoiding type mismatches with if-then-else block

Impostor Type, Chapter 15

best time to check the view properties

Liar View, Chapter 12

changes to the stop() method

Orphaned Thread, Chapter 18

checking for initialization without casting at runtime

Run-On Initializer, Chapter 19

checking the data on input | existing data

Saboteur Data, Chapter 13

class fields | null values | initialization

Run-On Initializer, Chapter 19

class state

Run-On Initializer, Chapter 19

ClassCastException | casting | null values

Null Pointers, Chapter 11

ClassCastException | recursive data descent

Double Descent, Chapter 11

ClassCastException | Visitor() method

Rogue Tile, Chapter 7

ClassCastException avoidance by wrapping cast in an instanceof check

Double Descent, Chapter 11

clean-up code

Split Cleaner, Chapter 16

code crash | same task, different data

Saboteur Data, Chapter 13

code dispatch after a method call

Double Descent, Chapter 11

code extension

Split Cleaner, Chapter 16

commenting invariants in code

Double Descent, Chapter 17

constructor signatures | legacy code

Run-On Initializer, Chapter 19

constructor signatures

Run-On Initializer, Chapter 19

constructor

Broken Dispatch, Chapter 19

copying code

Rogue Tile, Chapter 7

copy-and-paste errors

Rogue Tile, Chapter 7

data corruption (automatic file generation)

Saboteur Data, Chapter 13

data corruption (manual editing)

Saboteur Data, Chapter 13

data corruption (semantics)

Saboteur Data, Chapter 13

data corruption (syntax)

Saboteur Data, Chapter 13

data-input code

Saboteur Data, Chapter 13

determining version of method to invoke

Fictitious Implementation, Chapter 17

determining whether an instance is initialized

Run-On Initializer, Chapter 19

discovering corrupt data before a crash

Saboteur Data, Chapter 13

discrepancies in testing and runtime results

Liar View, Chapter 12

documenting invariants

Fictitious Implementation, Chapter 17

easily automating GUI tests

Liar View, Chapter 12

equals()

Double Descent, Chapter 11

execution paths

Split Cleaner, Chapter 16

expressiveness | type signatures | unit tests

Fictitious Implementation, Chapter 17

extension

Split Cleaner, Chapter 16

freeing resources

Split Cleaner, Chapter 16

general method constructor overloaded with a more specific method

Broken Dispatch, Chapter 14

GUI design pitfalls

Liar View, Chapter 12

GUI passes tests, fails in real world

Liar View, Chapter 12

how GUI tests work

Liar View, Chapter 12

ID semantically corrupt data | type checking

Saboteur Data, Chapter 13

including exception-throwing methods | initialization

Run-On Initializer, Chapter 19

inconsistent code on various JVMs

Platform-Dependent Bugs, Chapter 20

inconsistent code on various operating systems

Platform-Dependent Bugs, Chapter 20

inconsistent code on various versions of a JVM

Platform-Dependent Bugs, Chapter 20

infesting code with tests

Broken Dispatch, Chapter1 4

initialization | class fields | null values

Run-On Initializer, Chapter 19

initialization and new contexts

Run-On Initializer, Chapter 19

initialized/uninitialized fields

Run-On Initializer, Chapter 19

input with large data structure

Saboteur Data, Chapter 13

instanceof

Double Descent, Chapter 11

interface semantic requirements

Fictitious Implementation, Chapter 17

interface

Fictitious Implementation, Chapter 17

invariants

Double Descent, Chapter 17

IsInitialized() method

Run-On Initializer, Chapter 19

iteration of data

Saboteur Data, Chapter 13

Java Robot class

Liar View, Chapter 12

Leaf class | Leaf nodes | null values | Branch | ClassCastException | casting

Null Pointers, Chapter 11

legacy code | constructor signatures

Run-On Initializer, Chapter 19

limited specification | extra invariants | interface

Fictitious Implementation, Chapter 17

memory leaks

Split Cleaner, Chapter 16

method arguments don't match

Broken Dispatch, Chapter 14

Model-View-Controller architecture (MVC)

Liar View, Chapter 12

modified method

Rogue Tile, Chapter 7

multiple identical instances of the same class.

Double Descent, Chapter 11

multithreaded code freezes up | (does not) print to standard error

Orphaned Thread, Chapter 18

null pointers

Dangling Composite, Chapter 9

null values | class fields | initialization

Run-On Initializer, Chapter 19

null values | Leaf class | Leaf nodes | Branch | ClassCastException | casting

Null Pointers, Chapter 11

NullPointerException.

Null Pointers, Chapter 19

overloaded methods

Broken Dispatch, Chapter 14

overloading method #1, breaking method #2

Broken Dispatch, Chapter 14

parsing | compilers

Saboteur Data, Chapter 13

passing unit tests, failing program

Liar View, Chapter 12

persistent bug

Rogue Tile, Chapter 7

previously corrected bug

Rogue Tile, Chapter 7

recursive data descent | ClassCastException

Double Descent, Chapter 11

recursively defined data types

Dangling Composite, Chapter 9

refactoring (other components)

Liar View, Chapter 12

refactoring (perpetual)

Liar View, Chapter 12

representing default values

Run-On Initializer, Chapter19

resource clean-up code

Split Cleaner, Chapter 16

restricting specification of interface invariants to type signatures

Fictitious Implementation, Chapter 17

semantic requirements

Fictitious Implementation, Chapter 17

single recursive call

Double Descent, Chapter11

single-threaded vs. multithreaded design

Orphaned Thread, Chapter18

special classes representing default values | performance hit

Run-On Initializer, Chapter19

specification of an interface

Fictitious Implementation, Chapter 17

specification- vs.

implementation-related bug

Bugs/Specs/Implement, Chapter 20

specification/implementation bug round-up

Platform-Dependent Bugs, Chapter 20

splitting a text line into two Strings

Saboteur Data, Chapter 13

statement execution order

Run-On Initializer, Chapter 19

static type system

Impostor Type, Chapter 15

stop() method

Orphaned Thread, Chapter 18

system resources

Split Cleaner, Chapter 16

tracing through execution paths

Split Cleaner, Chapter 16

treating all types of data as the same type

Impostor Type, Chapter 15

TreeVisitor | ClassCastException | Visitor() method

Rogue Tile, Chapter 7

TreeVisitor interface | accept() methods

Rogue Tile, Chapter 7

type | value field | class

Rogue Tile, Chapter 7

type checking | identifying semantically corrupt data

Saboteur Data, Chapter 13

type mismatches

Impostor Type, Chapter 15

uninitialized/initialized fields

Run-On Initializer, Chapter 19

unit tests | interface implementation | all possible inputs

Fictitious Implementation, Chapter 17

unit tests and runtime behavior don't match

Liar View, Chapter 12

unit tests

Broken Dispatch, Chapter 17

using automated tests to check GUI code

Liar View, Chapter 12

using instanceof and equals() to check for class and object identity

Double Descent, Chapter 11

using tags in special fields to distinguish data types

Impostor Type, Chapter 15

using the static type system to distinguish data types

Impostor Type, Chapter 15

value field | class | type

Rogue Tile, Chapter 7

variable assigned to null

Null Pointers, Chapter 8

Visitor() method | ClassCastException | TreeVisitor

Rogue Tile, Chapter 7

why so many unit tests

Liar View, Chapter 12

won't recognize some data types

Impostor Type, Chapter 15



Bug Patterns in Java
Bug Patterns In Java
ISBN: 1590590619
EAN: 2147483647
Year: N/A
Pages: 95
Authors: Eric Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net