@ -32,6 +32,7 @@ import java.io.IOException;
import java.io.InputStream ;
import java.io.InputStream ;
import java.io.InputStreamReader ;
import java.io.InputStreamReader ;
import java.io.Reader ;
import java.io.Reader ;
import java.util.Map ;
import java.util.concurrent.ArrayBlockingQueue ;
import java.util.concurrent.ArrayBlockingQueue ;
import java.util.concurrent.BlockingQueue ;
import java.util.concurrent.BlockingQueue ;
import java.util.zip.GZIPInputStream ;
import java.util.zip.GZIPInputStream ;
@ -140,7 +141,7 @@ public class SurrogateReader extends DefaultHandler implements Runnable {
} else if ( "value" . equals ( tag ) ) {
} else if ( "value" . equals ( tag ) ) {
this . buffer . setLength ( 0 ) ;
this . buffer . setLength ( 0 ) ;
this . parsingValue = true ;
this . parsingValue = true ;
} else if ( tag . startsWith ( "dc:" ) | | tag . startsWith ( "geo:" ) ) {
} else if ( tag . startsWith ( "dc:" ) | | tag . startsWith ( "geo:" ) | | tag . startsWith ( "md:" ) ) {
// parse dublin core attribute
// parse dublin core attribute
this . elementName = tag ;
this . elementName = tag ;
this . parsingValue = true ;
this . parsingValue = true ;
@ -173,15 +174,18 @@ public class SurrogateReader extends DefaultHandler implements Runnable {
}
}
this . buffer . setLength ( 0 ) ;
this . buffer . setLength ( 0 ) ;
this . parsingValue = false ;
this . parsingValue = false ;
} else if ( tag . startsWith ( "dc:" ) | | tag . startsWith ( "geo:" ) ) {
} else if ( tag . startsWith ( "dc:" ) | | tag . startsWith ( "geo:" ) | | tag . startsWith ( "md:" ) ) {
final String value = buffer . toString ( ) . trim ( ) ;
final String value = buffer . toString ( ) . trim ( ) ;
if ( this . elementName ! = null & & tag . equals ( this . elementName ) ) {
if ( this . elementName ! = null & & tag . equals ( this . elementName ) ) {
value. replaceAll ( ";" , "," ) ;
Map< String , String [ ] > map = this . surrogate . getMap ( ) ;
String oldcontent = this . surrogate . get ( this . elementName ) ;
String [ ] oldcontent = map . get ( this . elementName ) ;
if ( oldcontent = = null ) {
if ( oldcontent = = null | | oldcontent . length = = 0 ) {
this . surrogate . getMap ( ) . put ( this . elementName , new String [ ] { value } ) ;
map . put ( this . elementName , new String [ ] { value } ) ;
} else {
} else {
this . surrogate . getMap ( ) . put ( this . elementName , new String [ ] { oldcontent + ";" + value } ) ;
String [ ] newcontent = new String [ oldcontent . length + 1 ] ;
System . arraycopy ( oldcontent , 0 , newcontent , 0 , oldcontent . length ) ;
newcontent [ oldcontent . length ] = value ;
map . put ( this . elementName , newcontent ) ;
}
}
}
}
this . buffer . setLength ( 0 ) ;
this . buffer . setLength ( 0 ) ;