@@ -261,10 +261,8 @@ protected void setOwnerDocument(final CoreDocumentImpl doc) {
261261 * @return the node number
262262 */
263263 protected int getNodeNumber () {
264- final int nodeNumber ;
265- final CoreDocumentImpl cd = (CoreDocumentImpl ) (this .getOwnerDocument ());
266- nodeNumber = cd .getNodeNumber (this );
267- return nodeNumber ;
264+ final CoreDocumentImpl cd = (CoreDocumentImpl ) getOwnerDocument ();
265+ return cd .getNodeNumber (this );
268266 }
269267
270268 /**
@@ -691,11 +689,11 @@ public short compareDocumentPosition(final Node other) throws DOMException {
691689 final Document thisOwnerDoc ;
692690 final Document otherOwnerDoc ;
693691 // get the respective Document owners.
694- if (this . getNodeType () == Node .DOCUMENT_NODE ) {
692+ if (getNodeType () == Node .DOCUMENT_NODE ) {
695693 thisOwnerDoc = (Document ) this ;
696694 }
697695 else {
698- thisOwnerDoc = this . getOwnerDocument ();
696+ thisOwnerDoc = getOwnerDocument ();
699697 }
700698 if (other .getNodeType () == Node .DOCUMENT_NODE ) {
701699 otherOwnerDoc = (Document ) other ;
@@ -1061,7 +1059,7 @@ public boolean isSameNode(final Node other) {
10611059 @ Override
10621060 public boolean isDefaultNamespace (final String namespaceURI ) {
10631061 // REVISIT: remove casts when DOM L3 becomes REC.
1064- final short type = this . getNodeType ();
1062+ final short type = getNodeType ();
10651063 switch (type ) {
10661064 case Node .ELEMENT_NODE : {
10671065 final String namespace = this .getNamespaceURI ();
@@ -1074,7 +1072,7 @@ public boolean isDefaultNamespace(final String namespaceURI) {
10741072 }
10751073 return namespaceURI .equals (namespace );
10761074 }
1077- if (this . hasAttributes ()) {
1075+ if (hasAttributes ()) {
10781076 final ElementImpl elem = (ElementImpl ) this ;
10791077 final NodeImpl attr = (NodeImpl ) elem .getAttributeNodeNS ("http://www.w3.org/2000/xmlns/" , "xmlns" );
10801078 if (attr != null ) {
@@ -1107,7 +1105,7 @@ public boolean isDefaultNamespace(final String namespaceURI) {
11071105 // type is unknown
11081106 return false ;
11091107 case Node .ATTRIBUTE_NODE : {
1110- if (this . ownerNode_ .getNodeType () == Node .ELEMENT_NODE ) {
1108+ if (ownerNode_ .getNodeType () == Node .ELEMENT_NODE ) {
11111109 return ownerNode_ .isDefaultNamespace (namespaceURI );
11121110
11131111 }
@@ -1142,11 +1140,10 @@ public String lookupPrefix(final String namespaceURI) {
11421140 return null ;
11431141 }
11441142
1145- final short type = this .getNodeType ();
1146-
1143+ final short type = getNodeType ();
11471144 switch (type ) {
11481145 case Node .ELEMENT_NODE : {
1149- this . getNamespaceURI (); // to flip out children
1146+ getNamespaceURI (); // to flip out children
11501147 return lookupNamespacePrefix (namespaceURI , (ElementImpl ) this );
11511148 }
11521149 case Node .DOCUMENT_NODE : {
@@ -1164,7 +1161,7 @@ public String lookupPrefix(final String namespaceURI) {
11641161 // type is unknown
11651162 return null ;
11661163 case Node .ATTRIBUTE_NODE : {
1167- if (this . ownerNode_ .getNodeType () == Node .ELEMENT_NODE ) {
1164+ if (ownerNode_ .getNodeType () == Node .ELEMENT_NODE ) {
11681165 return ownerNode_ .lookupPrefix (namespaceURI );
11691166
11701167 }
@@ -1189,13 +1186,11 @@ public String lookupPrefix(final String namespaceURI) {
11891186 */
11901187 @ Override
11911188 public String lookupNamespaceURI (final String specifiedPrefix ) {
1192- final short type = this .getNodeType ();
1193- switch (type ) {
1194- case Node .ELEMENT_NODE : {
1195-
1196- String namespace = this .getNamespaceURI ();
1197- final String prefix = this .getPrefix ();
1189+ switch (getNodeType ()) {
1190+ case Node .ELEMENT_NODE :
1191+ String namespace = getNamespaceURI ();
11981192 if (namespace != null ) {
1193+ final String prefix = getPrefix ();
11991194 // REVISIT: is it possible that prefix is empty string?
12001195 if (specifiedPrefix == null && prefix == null ) {
12011196 // looking for default namespace
@@ -1206,8 +1201,8 @@ else if (prefix != null && prefix.equals(specifiedPrefix)) {
12061201 return namespace ;
12071202 }
12081203 }
1209- if (this . hasAttributes ()) {
1210- final NamedNodeMap map = this . getAttributes ();
1204+ if (hasAttributes ()) {
1205+ final NamedNodeMap map = getAttributes ();
12111206 final int length = map .getLength ();
12121207 for (int i = 0 ; i < length ; i ++) {
12131208 final Node attr = map .item (i );
@@ -1221,7 +1216,7 @@ else if (prefix != null && prefix.equals(specifiedPrefix)) {
12211216 return value .length () > 0 ? value : null ;
12221217 }
12231218 else if ("xmlns" .equals (attrPrefix )
1224- && attr .getLocalName ().equals (specifiedPrefix )) {
1219+ && attr .getLocalName ().equals (specifiedPrefix )) {
12251220 // non default namespace
12261221 return value .length () > 0 ? value : null ;
12271222 }
@@ -1235,34 +1230,33 @@ else if ("xmlns".equals(attrPrefix)
12351230
12361231 return null ;
12371232
1238- }
1239- case Node .DOCUMENT_NODE : {
1233+ case Node .DOCUMENT_NODE :
12401234 final Element docElement = ((Document ) this ).getDocumentElement ();
12411235 if (docElement != null ) {
12421236 return docElement .lookupNamespaceURI (specifiedPrefix );
12431237 }
12441238 return null ;
1245- }
1239+
12461240 case Node .ENTITY_NODE :
12471241 case Node .NOTATION_NODE :
12481242 case Node .DOCUMENT_FRAGMENT_NODE :
12491243 case Node .DOCUMENT_TYPE_NODE :
12501244 // type is unknown
12511245 return null ;
1252- case Node .ATTRIBUTE_NODE : {
1253- if (this .ownerNode_ .getNodeType () == Node .ELEMENT_NODE ) {
1246+
1247+ case Node .ATTRIBUTE_NODE :
1248+ if (ownerNode_ .getNodeType () == Node .ELEMENT_NODE ) {
12541249 return ownerNode_ .lookupNamespaceURI (specifiedPrefix );
12551250
12561251 }
12571252 return null ;
1258- }
1259- default : {
1260- final NodeImpl ancestor = (NodeImpl ) getElementAncestor (this );
1261- if (ancestor != null ) {
1262- return ancestor .lookupNamespaceURI (specifiedPrefix );
1253+
1254+ default :
1255+ final NodeImpl ancestorDef = (NodeImpl ) getElementAncestor (this );
1256+ if (ancestorDef != null ) {
1257+ return ancestorDef .lookupNamespaceURI (specifiedPrefix );
12631258 }
12641259 return null ;
1265- }
12661260 }
12671261 }
12681262
@@ -1279,12 +1273,11 @@ Node getElementAncestor(final Node currentNode) {
12791273 }
12801274
12811275 String lookupNamespacePrefix (final String namespaceURI , final ElementImpl el ) {
1282- String namespace = this .getNamespaceURI ();
1283- // REVISIT: if no prefix is available is it null or empty string, or
1284- // could be both?
1285- final String prefix = this .getPrefix ();
1286-
1276+ String namespace = getNamespaceURI ();
12871277 if (namespace != null && namespace .equals (namespaceURI )) {
1278+ // REVISIT: if no prefix is available is it null or empty string, or
1279+ // could be both?
1280+ final String prefix = getPrefix ();
12881281 if (prefix != null ) {
12891282 final String foundNamespace = el .lookupNamespaceURI (prefix );
12901283 if (foundNamespace != null && foundNamespace .equals (namespaceURI )) {
@@ -1293,8 +1286,8 @@ String lookupNamespacePrefix(final String namespaceURI, final ElementImpl el) {
12931286
12941287 }
12951288 }
1296- if (this . hasAttributes ()) {
1297- final NamedNodeMap map = this . getAttributes ();
1289+ if (hasAttributes ()) {
1290+ final NamedNodeMap map = getAttributes ();
12981291 final int length = map .getLength ();
12991292 for (int i = 0 ; i < length ; i ++) {
13001293 final Node attr = map .item (i );
0 commit comments