More Java Pitfalls 50 New Time-Saving Solutions and Workarounds

Free Download

Authors:

Edition: 1

ISBN: 9780471237518, 0471237515

Size: 4 MB (4067280 bytes)

Pages: 477/477

File format:

Language:

Publishing Year:

Category: Tags: , ,

Michael C. Daconta, Kevin T. Smith, Donald Avondolio, W. Clay Richardson9780471237518, 0471237515

Highlighting 50 of Java’s imperfections, this sequel to Java Pitfalls helps programmers avoid weaknesses in the language and its related technologies that can cause programs to go haywire. Four programmers contribute detailed code-level solutions for each topic, including mouse button portability, when File.renameTo() won’t, and message-driven beans. The reference covers the latest J2II and JDK 1.4 specifications; J2EE technologies, including EJBs, JSPs, and Servlets; Java Web service APIs including JAXP, JAXR, and JAXM; and problem areas for J2ME, GUI programming, and input/output (NIO).

Table of contents :
@Team LiB……Page 1
Cover……Page 2
Contents……Page 9
Introduction……Page 13
Acknowledgments……Page 19
PART
One The Client Tier……Page 23
Item 1: When Runtime.exec() Won’t……Page 26
Item 2: NIO Performance and Pitfalls……Page 39
Canonical File Copy……Page 42
Little-Endian Byte Operations……Page 43
Non-Blocking Server IO……Page 48
Item 3: I Prefer Not to Use Properties……Page 56
Item 4: When Information Hiding Hides Too Much……Page 61
Item 5: Avoiding Granularity
Pitfalls in java.util.logging……Page 66
Item 6: When Implementations of
Standard APIs Collide……Page 75
How to Use Assertions……Page 81
Item 8: The Wrong Way to Search a DOM……Page 88
Item 9: The Saving-a-DOM Dilemma……Page 95
Item 10: Mouse Button Portability……Page 102
Item 11: Apache Ant and Lifecycle Management……Page 110
Item 12: JUnit: Unit Testing Made Simple……Page 122
Item 13: The Failure to Execute……Page 130
Deploying Java Applications……Page 131
The Java Extension Mechanism……Page 132
Sealed Packages……Page 133
Item 14: What Do You Collect?……Page 134
Item 15: Avoiding Singleton Pitfalls……Page 139
When Multiple Singletons in Your VM Happen……Page 141
When Singletons are Used as Global Variables,
or Become Non-Singletons……Page 142
Item 16: When setSize() Won’t Work……Page 144
Connecting via HTTP with the java.net Classes……Page 148
An Alternative Open Source HTTP Client……Page 159
Item 18: Effective String Tokenizing……Page 162
Item 19: JLayered Pane Pitfalls……Page 168
Item 20: When File.renameTo() Won’t……Page 173
Item 21: Use Iteration over Enumeration……Page 179
Item 22: J2ME Performance and Pitfalls……Page 184
PART
Two The Web Tier……Page 221
Item 23: Cache, It’s Money……Page 222
Request/Response Paradigm……Page 230
Maintaining State……Page 231
JSP the Old Way……Page 232
JSP Development with Beans (Model 1 Architecture)……Page 236
Item 25: When Servlet HttpSessions Collide……Page 242
Item 26: When Applets Go Bad……Page 249
Item 27: Transactional LDAP—Don’t
Make that Commitment……Page 257
Item 28: Problems with Filters……Page 266
Item 29: Some Direction about
JSP Reuse and Content Delivery……Page 277
Item 30: Form Validation Using Regular Expressions……Page 283
Item 31: Instance Variables in Servlets……Page 291
Item 32: Design Flaws with Creating Database
Connections within Servlets……Page 301
Item 33: Attempting to Use Both Output
Mechanisms in Servlets……Page 313
Item 34: The Mysterious File Protocol……Page 319
Item 35: Reading Files from Servlets……Page 324
Web Application Deployment Descriptors……Page 330
Item 36: Too Many Submits……Page 334
Preventing Multiple Submits……Page 336
Handling Multiple Submits……Page 338
PART
Three The Enterprise Tier……Page 349
Item 37: J2EE Architecture Considerations……Page 351
Item 38: Design Strategies for Eliminating
Network Bottleneck Pitfalls……Page 357
General Design Considerations……Page 358
EJB Design Considerations……Page 362
Item 39: I’ll Take the Local……Page 363
Item 40: Image Obsession……Page 370
Item 41: The Problem with Multiple
Concurrent Result Sets……Page 375
A Simple Scenario……Page 381
A “Client Control” Approach……Page 382
The Singleton Approach……Page 384
Database Autogeneration Approaches……Page 385
Other Approaches……Page 386
Item 43: The Stateful Stateless Session Bean……Page 387
Entity Bean……Page 388
Stateless Session Bean……Page 390
Item 44: The Unprepared PreparedStatement……Page 394
Item 45: Take a Dip in the Resource Pool……Page 400
Item 46: JDO and Data Persistence……Page 407
Item 47: Where’s the WSDL? Pitfalls of
Using JAXR with UDDI……Page 420
Where’s the WSDL?……Page 426
Item 48: Performance Pitfalls in
JAX-RPC Application Clients……Page 439
Example Web Service……Page 440
A Simple Client That Uses Precompiled Stub Classes……Page 442
A Client That Uses Dynamic Proxies for Access……Page 443
Two Clients Using the Dynamic Invocation Interface (DII)……Page 445
Performance Results……Page 449
Conclusion……Page 450
Item 49: Get Your Beans Off My Filesystem!……Page 451
Item 50: When Transactions Go Awry, or Consistent
State in Stateful Session EJBs……Page 455
The Memento Pattern……Page 460
Index……Page 465

Reviews

There are no reviews yet.

Be the first to review “More Java Pitfalls 50 New Time-Saving Solutions and Workarounds”
Shopping Cart
Scroll to Top