1 /* |
1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
445 switch (attr) { |
445 switch (attr) { |
446 case NAME: |
446 case NAME: |
447 if (currTag != HtmlTag.A) { |
447 if (currTag != HtmlTag.A) { |
448 break; |
448 break; |
449 } |
449 } |
450 // fallthrough |
450 // fallthrough |
451 case ID: |
451 case ID: |
452 String value = getAttrValue(tree); |
452 String value = getAttrValue(tree); |
453 if (!validName.matcher(value).matches()) { |
453 if (value == null) { |
454 env.messages.error(HTML, tree, "dc.invalid.anchor", value); |
454 env.messages.error(HTML, tree, "dc.anchor.value.missing"); |
455 } |
455 } else { |
456 if (!foundAnchors.add(value)) { |
456 if (!validName.matcher(value).matches()) { |
457 env.messages.error(HTML, tree, "dc.anchor.already.defined", value); |
457 env.messages.error(HTML, tree, "dc.invalid.anchor", value); |
|
458 } |
|
459 if (!foundAnchors.add(value)) { |
|
460 env.messages.error(HTML, tree, "dc.anchor.already.defined", value); |
|
461 } |
458 } |
462 } |
459 break; |
463 break; |
460 |
464 |
461 case HREF: |
465 case HREF: |
462 if (currTag == HtmlTag.A) { |
466 if (currTag == HtmlTag.A) { |