Skip to content

Commit d69eeba

Browse files
committed
cosmetic cleanup
1 parent 986efb3 commit d69eeba

File tree

6 files changed

+194
-200
lines changed

6 files changed

+194
-200
lines changed

src/main/java/com/ctc/wstx/api/CommonConfig.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ abstract class CommonConfig
4444
///////////////////////////////////////////////////////////////////////
4545
*/
4646

47-
final static int PROP_IMPL_NAME = 1;
48-
final static int PROP_IMPL_VERSION = 2;
47+
final static int CPROP_IMPL_NAME = 1;
48+
final static int CPROP_IMPL_VERSION = 2;
4949

50-
final static int PROP_SUPPORTS_XML11 = 3;
51-
final static int PROP_SUPPORT_XMLID = 4;
50+
final static int CPROP_SUPPORTS_XML11 = 3;
51+
final static int CPROP_SUPPORT_XMLID = 4;
5252

53-
final static int PROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE = 5;
53+
final static int CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE = 5;
5454

5555
/**
5656
* Map to use for converting from String property ids to enumeration
@@ -59,24 +59,24 @@ abstract class CommonConfig
5959
final static HashMap<String,Integer> sStdProperties = new HashMap<String,Integer>(16);
6060
static {
6161
// Basic information about the implementation:
62-
sStdProperties.put(XMLStreamProperties.XSP_IMPLEMENTATION_NAME, PROP_IMPL_NAME);
63-
sStdProperties.put(XMLStreamProperties.XSP_IMPLEMENTATION_VERSION, PROP_IMPL_VERSION);
62+
sStdProperties.put(XMLStreamProperties.XSP_IMPLEMENTATION_NAME, CPROP_IMPL_NAME);
63+
sStdProperties.put(XMLStreamProperties.XSP_IMPLEMENTATION_VERSION, CPROP_IMPL_VERSION);
6464

6565
// XML version support:
66-
sStdProperties.put(XMLStreamProperties.XSP_SUPPORTS_XML11, PROP_SUPPORTS_XML11);
66+
sStdProperties.put(XMLStreamProperties.XSP_SUPPORTS_XML11, CPROP_SUPPORTS_XML11);
6767

6868
// Xml:id support:
69-
sStdProperties.put(XMLStreamProperties.XSP_SUPPORT_XMLID, PROP_SUPPORT_XMLID);
69+
sStdProperties.put(XMLStreamProperties.XSP_SUPPORT_XMLID, CPROP_SUPPORT_XMLID);
7070

7171
sStdProperties.put(WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE,
72-
PROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE);
72+
CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE);
7373

7474
/* 23-Apr-2008, tatus: Additional interoperability property,
7575
* one that Sun implementation uses. Can map to Stax2
7676
* property quite easily.
7777
*/
7878
sStdProperties.put("http://java.sun.com/xml/stream/properties/implementation-name",
79-
PROP_IMPL_NAME);
79+
CPROP_IMPL_NAME);
8080
}
8181

8282
/*
@@ -255,7 +255,7 @@ protected boolean setStdProperty(String propName, int id, Object value)
255255
{
256256
// Only one settable property...
257257
switch (id) {
258-
case PROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE:
258+
case CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE:
259259
mReturnNullForDefaultNamespace = ArgUtil.convertToBoolean(propName, value);
260260
return true;
261261
}
@@ -265,15 +265,15 @@ protected boolean setStdProperty(String propName, int id, Object value)
265265
protected Object getStdProperty(int id)
266266
{
267267
switch (id) {
268-
case PROP_IMPL_NAME:
268+
case CPROP_IMPL_NAME:
269269
return IMPL_NAME;
270-
case PROP_IMPL_VERSION:
270+
case CPROP_IMPL_VERSION:
271271
return IMPL_VERSION;
272-
case PROP_SUPPORTS_XML11:
272+
case CPROP_SUPPORTS_XML11:
273273
return doesSupportXml11() ? Boolean.TRUE : Boolean.FALSE;
274-
case PROP_SUPPORT_XMLID:
274+
case CPROP_SUPPORT_XMLID:
275275
return doesSupportXmlId() ? Boolean.TRUE : Boolean.FALSE;
276-
case PROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE:
276+
case CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE:
277277
return returnNullForDefaultNamespace() ? Boolean.TRUE : Boolean.FALSE;
278278
default: // sanity check, should never happen
279279
throw new IllegalStateException("Internal error: no handler for property with internal id "+id+".");

src/main/java/com/ctc/wstx/api/ReaderConfig.java

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -251,101 +251,98 @@ public final class ReaderConfig
251251
final static HashMap<String,Integer> sProperties = new HashMap<String,Integer>(64); // we have about 40 entries
252252
static {
253253
// Standard ones; support for features
254-
sProperties.put(XMLInputFactory.IS_COALESCING,
255-
DataUtil.Integer(PROP_COALESCE_TEXT));
254+
sProperties.put(XMLInputFactory.IS_COALESCING, PROP_COALESCE_TEXT);
256255
sProperties.put(XMLInputFactory.IS_NAMESPACE_AWARE,
257-
DataUtil.Integer(PROP_NAMESPACE_AWARE));
256+
PROP_NAMESPACE_AWARE);
258257
sProperties.put(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
259-
DataUtil.Integer(PROP_REPLACE_ENTITY_REFS));
258+
PROP_REPLACE_ENTITY_REFS);
260259
sProperties.put(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES,
261-
DataUtil.Integer(PROP_SUPPORT_EXTERNAL_ENTITIES));
260+
PROP_SUPPORT_EXTERNAL_ENTITIES);
262261
sProperties.put(XMLInputFactory.IS_VALIDATING,
263-
DataUtil.Integer(PROP_VALIDATE_AGAINST_DTD));
262+
PROP_VALIDATE_AGAINST_DTD);
264263
sProperties.put(XMLInputFactory.SUPPORT_DTD,
265-
DataUtil.Integer(PROP_SUPPORT_DTD));
264+
PROP_SUPPORT_DTD);
266265

267266
// Standard ones; pluggable components
268267
sProperties.put(XMLInputFactory.ALLOCATOR,
269-
DataUtil.Integer(PROP_EVENT_ALLOCATOR));
268+
PROP_EVENT_ALLOCATOR);
270269
sProperties.put(XMLInputFactory.REPORTER,
271-
DataUtil.Integer(PROP_WARNING_REPORTER));
270+
PROP_WARNING_REPORTER);
272271
sProperties.put(XMLInputFactory.RESOLVER,
273-
DataUtil.Integer(PROP_XML_RESOLVER));
272+
PROP_XML_RESOLVER);
274273

275274
// StAX2-introduced flags:
276275
sProperties.put(XMLInputFactory2.P_INTERN_NAMES,
277-
DataUtil.Integer(PROP_INTERN_NAMES));
276+
PROP_INTERN_NAMES);
278277
sProperties.put(XMLInputFactory2.P_INTERN_NS_URIS,
279-
DataUtil.Integer(PROP_INTERN_NS_URIS));
278+
PROP_INTERN_NS_URIS);
280279
sProperties.put(XMLInputFactory2.P_REPORT_CDATA,
281-
DataUtil.Integer(PROP_REPORT_CDATA));
280+
PROP_REPORT_CDATA);
282281
sProperties.put(XMLInputFactory2.P_REPORT_PROLOG_WHITESPACE,
283-
DataUtil.Integer(PROP_REPORT_PROLOG_WS));
282+
PROP_REPORT_PROLOG_WS);
284283
sProperties.put(XMLInputFactory2.P_PRESERVE_LOCATION,
285-
DataUtil.Integer(PROP_PRESERVE_LOCATION));
284+
PROP_PRESERVE_LOCATION);
286285
sProperties.put(XMLInputFactory2.P_AUTO_CLOSE_INPUT,
287-
DataUtil.Integer(PROP_AUTO_CLOSE_INPUT));
286+
PROP_AUTO_CLOSE_INPUT);
288287
sProperties.put(XMLInputFactory2.XSP_SUPPORT_XMLID,
289-
DataUtil.Integer(PROP_SUPPORT_XMLID));
288+
PROP_SUPPORT_XMLID);
290289
sProperties.put(XMLInputFactory2.P_DTD_OVERRIDE,
291-
DataUtil.Integer(PROP_DTD_OVERRIDE));
290+
PROP_DTD_OVERRIDE);
292291

293292
// Non-standard ones, flags:
294293

295-
sProperties.put(WstxInputProperties.P_CACHE_DTDS,
296-
DataUtil.Integer(PROP_CACHE_DTDS));
294+
sProperties.put(WstxInputProperties.P_CACHE_DTDS, PROP_CACHE_DTDS);
297295
sProperties.put(WstxInputProperties.P_CACHE_DTDS_BY_PUBLIC_ID,
298-
DataUtil.Integer(PROP_CACHE_DTDS_BY_PUBLIC_ID));
299-
sProperties.put(XMLInputFactory2.P_LAZY_PARSING,
300-
DataUtil.Integer(PROP_LAZY_PARSING));
296+
PROP_CACHE_DTDS_BY_PUBLIC_ID);
297+
sProperties.put(XMLInputFactory2.P_LAZY_PARSING, PROP_LAZY_PARSING);
298+
/*
301299
sProperties.put(WstxInputProperties.P_SUPPORT_DTDPP,
302-
DataUtil.Integer(PROP_SUPPORT_DTDPP));
300+
PROP_SUPPORT_DTDPP));
301+
*/
303302
sProperties.put(WstxInputProperties.P_TREAT_CHAR_REFS_AS_ENTS,
304-
DataUtil.Integer(PROP_TREAT_CHAR_REFS_AS_ENTS));
305-
sProperties.put(WstxInputProperties.P_NORMALIZE_LFS,
306-
DataUtil.Integer(PROP_NORMALIZE_LFS));
303+
PROP_TREAT_CHAR_REFS_AS_ENTS);
304+
sProperties.put(WstxInputProperties.P_NORMALIZE_LFS, PROP_NORMALIZE_LFS);
307305

308306

309307
// Non-standard ones, non-flags:
310308

311309
sProperties.put(WstxInputProperties.P_INPUT_BUFFER_LENGTH,
312-
DataUtil.Integer(PROP_INPUT_BUFFER_LENGTH));
310+
PROP_INPUT_BUFFER_LENGTH);
313311
sProperties.put(WstxInputProperties.P_MIN_TEXT_SEGMENT,
314-
DataUtil.Integer(PROP_MIN_TEXT_SEGMENT));
312+
PROP_MIN_TEXT_SEGMENT);
315313
sProperties.put(WstxInputProperties.P_MAX_ATTRIBUTES_PER_ELEMENT,
316-
DataUtil.Integer(PROP_MAX_ATTRIBUTES_PER_ELEMENT));
314+
PROP_MAX_ATTRIBUTES_PER_ELEMENT);
317315
sProperties.put(WstxInputProperties.P_MAX_ATTRIBUTE_SIZE,
318-
DataUtil.Integer(PROP_MAX_ATTRIBUTE_SIZE));
316+
PROP_MAX_ATTRIBUTE_SIZE);
319317
sProperties.put(WstxInputProperties.P_MAX_CHILDREN_PER_ELEMENT,
320-
DataUtil.Integer(PROP_MAX_CHILDREN_PER_ELEMENT));
318+
PROP_MAX_CHILDREN_PER_ELEMENT);
321319
sProperties.put(WstxInputProperties.P_MAX_TEXT_LENGTH,
322-
DataUtil.Integer(PROP_MAX_TEXT_LENGTH));
320+
PROP_MAX_TEXT_LENGTH);
323321
sProperties.put(WstxInputProperties.P_MAX_ELEMENT_COUNT,
324-
DataUtil.Integer(PROP_MAX_ELEMENT_COUNT));
322+
PROP_MAX_ELEMENT_COUNT);
325323
sProperties.put(WstxInputProperties.P_MAX_ELEMENT_DEPTH,
326-
DataUtil.Integer(PROP_MAX_ELEMENT_DEPTH));
324+
PROP_MAX_ELEMENT_DEPTH);
327325
sProperties.put(WstxInputProperties.P_MAX_ENTITY_DEPTH,
328-
DataUtil.Integer(PROP_MAX_ENTITY_DEPTH));
326+
PROP_MAX_ENTITY_DEPTH);
329327
sProperties.put(WstxInputProperties.P_MAX_ENTITY_COUNT,
330-
DataUtil.Integer(PROP_MAX_ENTITY_COUNT));
331-
sProperties.put(WstxInputProperties.P_MAX_CHARACTERS,
332-
DataUtil.Integer(PROP_MAX_CHARACTERS));
328+
PROP_MAX_ENTITY_COUNT);
329+
sProperties.put(WstxInputProperties.P_MAX_CHARACTERS, PROP_MAX_CHARACTERS);
333330

334331
{
335332
@SuppressWarnings("deprecation")
336-
String key = WstxInputProperties.P_CUSTOM_INTERNAL_ENTITIES;
337-
sProperties.put(key, Integer.valueOf(PROP_CUSTOM_INTERNAL_ENTITIES));
333+
String key = WstxInputProperties.P_CUSTOM_INTERNAL_ENTITIES;
334+
sProperties.put(key, Integer.valueOf(PROP_CUSTOM_INTERNAL_ENTITIES));
338335
}
339336
sProperties.put(WstxInputProperties.P_DTD_RESOLVER,
340-
DataUtil.Integer(PROP_DTD_RESOLVER));
337+
PROP_DTD_RESOLVER);
341338
sProperties.put(WstxInputProperties.P_ENTITY_RESOLVER,
342-
DataUtil.Integer(PROP_ENTITY_RESOLVER));
339+
PROP_ENTITY_RESOLVER);
343340
sProperties.put(WstxInputProperties.P_UNDECLARED_ENTITY_RESOLVER,
344-
DataUtil.Integer(PROP_UNDECLARED_ENTITY_RESOLVER));
341+
PROP_UNDECLARED_ENTITY_RESOLVER);
345342
sProperties.put(WstxInputProperties.P_BASE_URL,
346-
DataUtil.Integer(PROP_BASE_URL));
343+
PROP_BASE_URL);
347344
sProperties.put(WstxInputProperties.P_INPUT_PARSING_MODE,
348-
DataUtil.Integer(PROP_INPUT_PARSING_MODE));
345+
PROP_INPUT_PARSING_MODE);
349346
}
350347

351348
/*
@@ -1414,28 +1411,28 @@ public Object getProperty(int id)
14141411

14151412
// then object values:
14161413
case PROP_INPUT_BUFFER_LENGTH:
1417-
return DataUtil.Integer(getInputBufferLength());
1414+
return getInputBufferLength();
14181415
case PROP_MAX_ATTRIBUTES_PER_ELEMENT:
1419-
return DataUtil.Integer(getMaxAttributesPerElement());
1416+
return getMaxAttributesPerElement();
14201417
case PROP_MAX_ATTRIBUTE_SIZE:
1421-
return DataUtil.Integer(getMaxAttributeSize());
1418+
return getMaxAttributeSize();
14221419
case PROP_MAX_CHILDREN_PER_ELEMENT:
1423-
return DataUtil.Integer(getMaxChildrenPerElement());
1420+
return getMaxChildrenPerElement();
14241421
case PROP_MAX_ELEMENT_DEPTH:
1425-
return DataUtil.Integer(getMaxElementDepth());
1422+
return getMaxElementDepth();
14261423
case PROP_MAX_ELEMENT_COUNT:
1427-
return Long.valueOf(getMaxElementCount());
1424+
return getMaxElementCount();
14281425
case PROP_MAX_CHARACTERS:
1429-
return Long.valueOf(getMaxCharacters());
1426+
return getMaxCharacters();
14301427
case PROP_MAX_TEXT_LENGTH:
1431-
return Long.valueOf(getMaxTextLength());
1428+
return getMaxTextLength();
14321429
case PROP_MAX_ENTITY_DEPTH:
1433-
return DataUtil.Integer(getMaxEntityDepth());
1430+
return getMaxEntityDepth();
14341431
case PROP_MAX_ENTITY_COUNT:
1435-
return Long.valueOf(getMaxEntityCount());
1432+
return getMaxEntityCount();
14361433

14371434
case PROP_MIN_TEXT_SEGMENT:
1438-
return DataUtil.Integer(getShortestReportedTextSegment());
1435+
return getShortestReportedTextSegment();
14391436
case PROP_CUSTOM_INTERNAL_ENTITIES:
14401437
return getCustomInternalEntities();
14411438
case PROP_DTD_RESOLVER:

src/main/java/com/ctc/wstx/api/WstxInputProperties.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public final class WstxInputProperties
2323
public final static String UNKNOWN_ATTR_TYPE = "CDATA";
2424

2525
/*
26-
///////////////////////////////////////////////////////
26+
///////////////////////////////////////////////////////////////////////
2727
// Simple on/off settings:
28-
///////////////////////////////////////////////////////
28+
///////////////////////////////////////////////////////////////////////
2929
*/
3030

3131
// // // Normalization:
@@ -54,13 +54,22 @@ public final class WstxInputProperties
5454
* that they are valid (including white space); if false, will not
5555
* check.
5656
*<p>
57+
* Note that this property will NOT have effect on all encoding problems,
58+
* specifically:
59+
*<ul>
60+
* <li>UTF-8 decoder will still report invalid UTF-8 byte sequences (and same
61+
* for other character encodings).
62+
* </li>
63+
* <li>XML Name character rules follow separate validation which will not be affected
64+
* </li>
65+
*</ul>
66+
*<p>
5767
* Turning this option off may improve parsing performance; leaving
5868
* it on guarantees compatibility with XML 1.0 specs regarding character
5969
* validity rules.
6070
*/
6171
public final static String P_VALIDATE_TEXT_CHARS = "com.ctc.wstx.validateTextChars";
6272

63-
6473
// // // Caching:
6574

6675
/**
@@ -148,9 +157,9 @@ public final class WstxInputProperties
148157
//public final static String P_AUTOMATIC_W3C_SCHEMA = 0x00100000;
149158

150159
/*
151-
///////////////////////////////////////////////////////
160+
///////////////////////////////////////////////////////////////////////
152161
// More complex settings
153-
///////////////////////////////////////////////////////
162+
///////////////////////////////////////////////////////////////////////
154163
*/
155164

156165
// // // Buffer sizes;
@@ -308,9 +317,9 @@ public final class WstxInputProperties
308317
// // // DTD defaulting, overriding
309318

310319
/*
311-
////////////////////////////////////////////////////////////////////
320+
///////////////////////////////////////////////////////////////////////
312321
// Helper classes, values enumerations
313-
////////////////////////////////////////////////////////////////////
322+
///////////////////////////////////////////////////////////////////////
314323
*/
315324

316325
public final static ParsingMode PARSING_MODE_DOCUMENT = new ParsingMode();

0 commit comments

Comments
 (0)