mirror of https://github.com/apache/lucene.git
fix for bug 27423
slightly modified version of Daniel?s patch git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150297 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d00487507e
commit
420d1d7c07
|
@ -10,7 +10,8 @@ public class HTMLParser implements HTMLParserConstants {
|
||||||
StringBuffer title = new StringBuffer(SUMMARY_LENGTH);
|
StringBuffer title = new StringBuffer(SUMMARY_LENGTH);
|
||||||
StringBuffer summary = new StringBuffer(SUMMARY_LENGTH * 2);
|
StringBuffer summary = new StringBuffer(SUMMARY_LENGTH * 2);
|
||||||
Properties metaTags=new Properties();
|
Properties metaTags=new Properties();
|
||||||
String currentMetaTag="";
|
String currentMetaTag=null;
|
||||||
|
String currentMetaContent=null;
|
||||||
int length = 0;
|
int length = 0;
|
||||||
boolean titleComplete = false;
|
boolean titleComplete = false;
|
||||||
boolean inTitle = false;
|
boolean inTitle = false;
|
||||||
|
@ -120,11 +121,6 @@ InterruptedException {
|
||||||
void addText(String text) throws IOException {
|
void addText(String text) throws IOException {
|
||||||
if (inStyle)
|
if (inStyle)
|
||||||
return;
|
return;
|
||||||
if (inMetaTag)
|
|
||||||
{
|
|
||||||
metaTags.setProperty(currentMetaTag, text);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (inTitle)
|
if (inTitle)
|
||||||
title.append(text);
|
title.append(text);
|
||||||
else {
|
else {
|
||||||
|
@ -143,6 +139,13 @@ InterruptedException {
|
||||||
afterSpace = false;
|
afterSpace = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addMetaTag() throws IOException {
|
||||||
|
metaTags.setProperty(currentMetaTag, currentMetaContent);
|
||||||
|
currentMetaTag = null;
|
||||||
|
currentMetaContent = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void addSpace() throws IOException {
|
void addSpace() throws IOException {
|
||||||
if (!afterSpace) {
|
if (!afterSpace) {
|
||||||
if (inTitle)
|
if (inTitle)
|
||||||
|
@ -262,11 +265,17 @@ InterruptedException {
|
||||||
&& t2 != null)
|
&& t2 != null)
|
||||||
{
|
{
|
||||||
currentMetaTag=t2.image.toLowerCase();
|
currentMetaTag=t2.image.toLowerCase();
|
||||||
|
if(currentMetaTag != null && currentMetaContent != null) {
|
||||||
|
addMetaTag();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(inMetaTag && t1.image.equalsIgnoreCase("content") && t2 !=
|
if(inMetaTag && t1.image.equalsIgnoreCase("content") && t2 !=
|
||||||
null)
|
null)
|
||||||
{
|
{
|
||||||
addText(t2.image);
|
currentMetaContent=t2.image.toLowerCase();
|
||||||
|
if(currentMetaTag != null && currentMetaContent != null) {
|
||||||
|
addMetaTag();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -441,18 +450,18 @@ null)
|
||||||
finally { jj_save(1, xla); }
|
finally { jj_save(1, xla); }
|
||||||
}
|
}
|
||||||
|
|
||||||
final private boolean jj_3_2() {
|
|
||||||
if (jj_scan_token(ArgQuote2)) return true;
|
|
||||||
if (jj_scan_token(CloseQuote2)) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final private boolean jj_3_1() {
|
final private boolean jj_3_1() {
|
||||||
if (jj_scan_token(ArgQuote1)) return true;
|
if (jj_scan_token(ArgQuote1)) return true;
|
||||||
if (jj_scan_token(CloseQuote1)) return true;
|
if (jj_scan_token(CloseQuote1)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final private boolean jj_3_2() {
|
||||||
|
if (jj_scan_token(ArgQuote2)) return true;
|
||||||
|
if (jj_scan_token(CloseQuote2)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public HTMLParserTokenManager token_source;
|
public HTMLParserTokenManager token_source;
|
||||||
SimpleCharStream jj_input_stream;
|
SimpleCharStream jj_input_stream;
|
||||||
public Token token, jj_nt;
|
public Token token, jj_nt;
|
||||||
|
|
|
@ -74,7 +74,8 @@ public class HTMLParser {
|
||||||
StringBuffer title = new StringBuffer(SUMMARY_LENGTH);
|
StringBuffer title = new StringBuffer(SUMMARY_LENGTH);
|
||||||
StringBuffer summary = new StringBuffer(SUMMARY_LENGTH * 2);
|
StringBuffer summary = new StringBuffer(SUMMARY_LENGTH * 2);
|
||||||
Properties metaTags=new Properties();
|
Properties metaTags=new Properties();
|
||||||
String currentMetaTag="";
|
String currentMetaTag=null;
|
||||||
|
String currentMetaContent=null;
|
||||||
int length = 0;
|
int length = 0;
|
||||||
boolean titleComplete = false;
|
boolean titleComplete = false;
|
||||||
boolean inTitle = false;
|
boolean inTitle = false;
|
||||||
|
@ -184,11 +185,6 @@ InterruptedException {
|
||||||
void addText(String text) throws IOException {
|
void addText(String text) throws IOException {
|
||||||
if (inStyle)
|
if (inStyle)
|
||||||
return;
|
return;
|
||||||
if (inMetaTag)
|
|
||||||
{
|
|
||||||
metaTags.setProperty(currentMetaTag, text);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (inTitle)
|
if (inTitle)
|
||||||
title.append(text);
|
title.append(text);
|
||||||
else {
|
else {
|
||||||
|
@ -207,6 +203,13 @@ InterruptedException {
|
||||||
afterSpace = false;
|
afterSpace = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addMetaTag() throws IOException {
|
||||||
|
metaTags.setProperty(currentMetaTag, currentMetaContent);
|
||||||
|
currentMetaTag = null;
|
||||||
|
currentMetaContent = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void addSpace() throws IOException {
|
void addSpace() throws IOException {
|
||||||
if (!afterSpace) {
|
if (!afterSpace) {
|
||||||
if (inTitle)
|
if (inTitle)
|
||||||
|
@ -284,11 +287,17 @@ void Tag() throws IOException :
|
||||||
&& t2 != null)
|
&& t2 != null)
|
||||||
{
|
{
|
||||||
currentMetaTag=t2.image.toLowerCase();
|
currentMetaTag=t2.image.toLowerCase();
|
||||||
|
if(currentMetaTag != null && currentMetaContent != null) {
|
||||||
|
addMetaTag();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(inMetaTag && t1.image.equalsIgnoreCase("content") && t2 !=
|
if(inMetaTag && t1.image.equalsIgnoreCase("content") && t2 !=
|
||||||
null)
|
null)
|
||||||
{
|
{
|
||||||
addText(t2.image);
|
currentMetaContent=t2.image.toLowerCase();
|
||||||
|
if(currentMetaTag != null && currentMetaContent != null) {
|
||||||
|
addMetaTag();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)?
|
)?
|
||||||
|
|
Loading…
Reference in New Issue