The Code Style site has evolved by gradual refinement and accumulation of features and content. This review is part of a fully backdated site log and archive that sheds light on when, why and how particular features were implemented.
This log is sometimes updated several times per week, sometimes with a long overdue backlog of items. Many log entries refer to the Code Style Java package that delivers the servlet services and utilities used to manage this site.
Subscribe to the news feed for this log:
Created a new page for readers to Donate money to support Code Style via PayPal, with value comparison and acknowledgement screen.
Added local navigation panel to the What is Code Style page, copyright and privacy statements.
Further investigation into the apparent Apache JServConnection bug from 23 January, shows its sendError catches any IOException and logs the problem, so returning early only prevents logging (see 24 January). This suggests subsequent problems may be to do with re-establishing the socket connection with the Apache Web server, which occurs in the class' init method at server start-up. Immediate workarounds to prevent this case and a switch to a different servlet container seem the most productive solution.
Introduced a new set of page footer include files without RSS links, so that only key pages have feeds: FAQs, contents, glossaries, site log and font survey results.
Archived Site log, December 2003 and added a new column to the archive menu table to start 2004 entries. Also added a new menu panel to the Site log contents for 2004.
Finalized the JavaDoc comments for the Parameters class for release, and the ResultKeyBuilder class in progress.
Added accessors to the draft RequestValve class for a request limit and sample period for calculating client request rate. Also added a field to the draft RequestHistory class to hold a reference the master RequestValve instance, so that exceptional request rates can be identified dynamically.
Tried adding a catch statement for SocketException to the Apache JServConnection class to work around the apparent bug identified on 23 January, rebuilt the package JAR and tested under heavy loading. The fix prevents further exceptions, but drops the connection for subsequent requests. Requires further investigation or workarounds.
Standardised a link in the Site log, January 2003 entry to the CSS media monitor section to use the virtual directory index rather than a blank directory reference. Explicit references improve initial server response and standardised document references enhance client cache efficiency.
Traced the source of the recent JServ servlet engine crashes to the following Apache HTTPd Web server error log entries (debug mode):
file .\main\buff.c, line 213, assertion "!rv" failed
[info] master_main: Child processed exited (due to MaxRequestsPerChild?). Restarting the child process.
[info] Parent: Created child process -1765497
[info] Parent: Duplicating socket 140 and sending it to child process -1765497
[info] BytesRead = 372 WSAProtocolInfo = 020
When the Apache Web server resets the socket, it creates an Apache JServ Protocol (AJP) error, logged by JServ as:
AJP Protocol Error: java.io.IOException: Stream closed prematurely
AJP Protocol Error: java.io.IOException: Stream closed prematurely
java.net.SocketException: Not connected: socket write error at [stack trace]
The AJP protocol errors at lines 1 and 2 are exacerbated by lines 183 to 186 in the Apache JServConnection class ($Revision: 1.80 $ $Date: 2000/05/21 19:46:14 $) below, which attempts to pass an error message to the client. Since the servlet output stream and socket closed with the IOException, this error response causes the socket write error at line 3 above and an internal server error.
} catch (Exception e) {
sendError(SC_BAD_REQUEST, "Malformed data sent to JServ");
return;
}
The original Exception e is thrown as IOException in the read method of the inner JServInputStream class. Since SocketException is a subclass of IOException, it would be better to make this distinction, catch a SocketException and simply return without calling sendError in this case.
Created a new set of classes to regulate servlet client requests:
RequestValve is a singleton class for monitoring the rate of client requests and flagging exceptional cases.
Client is composed of an IP address and user agent with a created timestamp.
RequestHistory records recent requests per client and reports their request rate
RequestException is a simple type extension of RuntimeException for reporting problems with HTTP servlet requests.
An error report from a reader revealed the JServ servlet engine had crashed again, so restarted and studied server logs for clues to the problem. Initial investigations suggested intense loading by a Web downloader application may have caused the problem, so added further specific exclusions to the site robots.txt file for spidering applications.
Created a new ResultCache singleton class to manage XSL transformation results for all clients. First instantiation validates the physical location of the cache and all subsequent calls return a reference to the same instance, held as a private field. Wrote an initial JUnit test suite for the singleton behaviour and locator validation.
Wrote a minimal SingletonException type extension of RuntimeException to flag problems with ResultCache instantiation.
Added a system property to the Apache Ant build file and filters to specify the JAXP EntityResolver class to be used for ParseServlet subclasses, org.codestyle.ResourceResolver, and renamed the property for physical cache location to cacheDir for clarity.
Modified the Ant build.properties file for the Code Style Java project to version 0.4 for the implementation of the XSL transformation result cache. Also updated the configuration filters for the development servlet engine to run under Java 1.3.1.
Removed the redundant DocumentTemplate configuration from the abstract ParseServlet, which is handled by the superclass, and updated the cacheDir property reference.
Added a static isWritableDirectory(String directoryPath) method to the IOUtilities class to support the new ResultCache class in validating its physical storage location. Updated the JUnit test cases to verify the new method.
Added mutator methods to the draft ResultKeyBuilder class for its advanced configuration fields: setXslParameter(String name, String value), setHttpHeader(String name, String value) and setServiceUrl(String serviceUrl). Also refactored and renamed the boolean status accessors to a more modular scheme: hasBasicConfiguration(), hasAdvancedConfiguration() and isReady().
Adapted the ResultKeyBuilderTest cases to the new status methods and signatures. Made a minor adjustment to the field order of the ResultLog getLogEntry method to bring the requested URL to the fore.
Created a new IOUtilities class from the draft ResultKeyBuilder to centralise these functions, initially boolean isReadableDirectory(String directoryPath) and isReadableFile(String systemId) methods. Also created a JUnit test suite for this class.
Updated the Code Style fonts database to add the Bitstream Vera fonts to the Unix family font sampler and survey. Also reformatted the layout for all surveys to a simpler SupraHeading style with a spanned heading for the Samples links. Added label elements to the "Yes" text for the checkboxes for improved accessibility.
Adjusted the padding-top value for the main page title in the print style sheet, CSPrint.css, and the right hand margins on pre elements to match headings, paragraphs and lists:
#Header{
padding-top: 0;
margin-top: 0;
}
.Title {
padding-top: 0.8em;
margin-top: 0;
}
#Content PRE, #Content PRE.Wide{
margin-right: 20%;
}
Completed the initial implementation of ResultKey, with a full set of unit test cases for the overridden hashCode and equals methods, and accessor methods for all fields. Also completed the initial implementation of ResultKeyBuilder, but without test cases so far.
Created a new ResultKeyBuilder class whose basic configuration state is cloneable. The public constructor provides one-time validation of the basic configuration arguments, which are not mutable. In this basic configuration state, the builder serves as a prototype for cloning; after advanced configuration fields have been set on a clone, it cannot be cloned again.
Completed the initial implementation of the Parameters class and unit test cases for the hashCode and equals methods, with accessor methods for parameter names and values by name.
Created a new ResultKey class as a unique key to an XSL transformation result. ResultKey operates as a key object in a ResultCache and a specification for the transformation of a fresh XML source document if required. Also created a new Parameters class based on a Hashtable, to hold a set of String name and value parameters. Both classes have overridden hashCode and equals methods that use String equivalence methods.
Wrote JUnit test suites for the new Parameters class and forthcoming ResultProxy class.
Created a new development servlet as an interface to an XSL transformation result cache, TRCServlet, and a ResultLog class to record the basic parameters and outcome of transformation service requests. The servlet initially implements basic request validation and diagnostic response only. Also created JUnit test suites for both to ensure correct operation, and a first draft ResultKeyTest for subsequent development testing.
Corrected some JavaDoc comments for the StreamBroker class.
Moved the FAQ answer on alternative style sheets and different media to the Media dependent style sheets FAQ, and added an alternative "Print preview" style set to the standard Code Style style sheets as described.
<link
rel="alternate stylesheet"
type="text/css"
href="/styles/CSStandard.css"
media="all"
title="Print preview" />
<link
rel="alternate stylesheet"
type="text/css"
href="/styles/CSPrint.css"
media="all"
title="Print preview" />
Added questions on Web font selection, Unix screen shots and the Terminal font to the Font sampler and survey FAQ and added further notes on the term Gothic to the CSS font-family glossary. Added new answers on Tomcat out of environment memory errors to FAQ: Java servlets, and the origin of HTTP 400, bad request, errors to FAQ: Site Manager.
Corrected some markup errors in the XHTML form interface for the private draft FontStats servlet, and the output file name references for the combined survey.
Added a finally block to the XML transformation in ParseServlet to free resources tied to the ByteArrayOutputStream used to pass the result to the servlet output stream. Also specified an initial size for the array of 7000 bytes. Replaced the general Exception catch block for the XML transformation with a more specific TransformerConfigurationException catch, to avoid a similar IllegalStateException to the case identified on 18 December.
Updated copyright dates throughout the site, date selection fields on the advanced search form and the expiry date of the Platform for Privacy Preferences P3P record.
These backdated pages record detailed changes to the Code Style Web site since July 2000, when development first got underway. Some pages may refer to documents or features that have since changed or are no longer part of the site, but the archive is checked to ensure there are no dead links.
For a summary overview, see the annotated site log contents.