kstaken 2002/07/24 18:01:02
Modified: java/src/org/apache/xindice/core/fulltext
FullTextIndexer.java
java/src/org/apache/xindice/core/request URIMapper.java
Log:
Adding Fernando's patches to remove deprecation warnings.
Submitted by: Fernando Padilla
Reviewed by: Kimbro Staken
Revision Changes Path
1.6 +13 -7
xml-xindice/java/src/org/apache/xindice/core/fulltext/FullTextIndexer.java
Index: FullTextIndexer.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/fulltext/FullTextIndexer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FullTextIndexer.java 12 Jun 2002 17:51:28 -0000 1.5
+++ FullTextIndexer.java 25 Jul 2002 01:01:02 -0000 1.6
@@ -143,18 +143,24 @@
stopWords = new HashSet();
File stopFile = new File(stopName);
FileInputStream fis = new FileInputStream(stopFile);
- BufferedInputStream bis = new BufferedInputStream(fis, 4096);
- DataInputStream dis = new DataInputStream(bis);
- while ( dis.available() > 0 ) {
- String word = dis.readLine();
+ InputStreamReader isr = new InputStreamReader( fis );
+ BufferedReader br = new BufferedReader( isr );
+ String word = br.readLine();
+ while ( word != null ) {
if ( word != null && word.trim().length() > 0 )
stopWords.add(word);
+ word = br.readLine();
}
+ br.close();
+ isr.close();
fis.close();
}
- catch ( Exception e ) {
- org.apache.xindice.Debug.println("Stop Word list
'"+stopName+"' Not Found");
+ catch ( FileNotFoundException e ) {
+ org.apache.xindice.Debug.println("Exception while configuring
Stop Word: file '"+stopName+"' Not Found");
}
+ catch ( Exception ex ) {
+ org.apache.xindice.Debug.println("Exception while configuring
Stop Word");
+ }
}
fileHeader.setPageSize(config.getIntAttribute(PAGESIZE,
fileHeader.getPageSize()));
1.3 +16 -10
xml-xindice/java/src/org/apache/xindice/core/request/URIMapper.java
Index: URIMapper.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/request/URIMapper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- URIMapper.java 21 Jul 2002 02:52:18 -0000 1.2
+++ URIMapper.java 25 Jul 2002 01:01:02 -0000 1.3
@@ -84,6 +84,8 @@
public static final int COLLECTION = 2;
public static final int DOCUMENT = 3;
+ public static final String DEFAULT_ENCODING = "UTF-8";
+
private static final String[] EmptyStrings = new String[0];
private ObjectPool pool = null;
@@ -162,7 +164,7 @@
/**
Returns an input stream that reads from this open connection.
*/
- public InputStream getInputStream() {
+ public InputStream getInputStream() throws IOException {
String output = null ;
Object result = null ;
@@ -199,11 +201,11 @@
inputstreamset = true ;
// Send the result to the client, sending blank string if NULL
- if ( output == null)
- return new StringBufferInputStream("");
- else
- return new StringBufferInputStream(output);
-
+ if ( output == null) {
+ return new ByteArrayInputStream( new byte[0] );
+ } else {
+ return new ByteArrayInputStream( output.getBytes( DEFAULT_ENCODING )
);
+ }
}
@@ -213,8 +215,7 @@
* the content encoding of the resource that the URL references, or
null if not known.
*/
public String getContentEncoding() {
- // For now this method only returns null values since we are not
currenlty encoding documents
- return null;
+ return DEFAULT_ENCODING;
}
@@ -236,7 +237,12 @@
public int getContentLength() {
// Check to see if this document has already been resolved, if not
call getInputStream
if ( ! inputstreamset ) {
- this.getInputStream();
+ try {
+ this.getInputStream();
+ }
+ catch ( IOException ex ) {
+ return 0;
+ }
}
// Return the lenght of this document/XMLObject call