supose34.patch

added by msuchy@redhat.com - manager -, 03/26/2008 03:51 PM

Download (1.8 KB)

 
./src/main/java/com/soebes/supose/scan/document/ScanDefaultDocument.java 2008-03-07 15:13:50.000000000 +0100
26 26
package com.soebes.supose.scan.document;
27 27

  
28 28
import java.io.ByteArrayOutputStream;
29
import java.io.*;
29 30

  
30 31
import org.apache.log4j.Logger;
31 32
import org.tmatesoft.svn.core.SVNDirEntry;
......
70 71
					ByteArrayOutputStream baos = new ByteArrayOutputStream();
71 72
					//This means we get the contents of the file only. No properties.
72 73
					repository.getRepository().getFile(path, revision, null, baos);
73
					addTokenizedField(FieldNames.CONTENTS, baos.toString());
74
                    addTokenizedField(FieldNames.CONTENTS, baos.toString());
74 75
				}
75 76
			}
76 77
		} catch (Exception e) {
77
			LOGGER.error("Something has gone wrong with WordDocuments " + e);
78
			LOGGER.error("Something has gone wrong during scanning of document: " + e);
79
            LOGGER.error("Most probably your SVN server do not support stat(). I'll try to call svn command directly.");
80
            // call svn cat svn+ssh://repo/file@revision
81
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
82
            try {
83
                Process p = Runtime.getRuntime().exec("svn cat "+ repository.getUrl() + path + "@" + revision);
84
                BufferedReader stdInput = new BufferedReader(new 
85
                     InputStreamReader(p.getInputStream()));
86
                String s = null;
87
                while ((s = stdInput.readLine()) != null) {
88
                    addTokenizedField(FieldNames.CONTENTS, s);;
89
                }
90
            } catch (IOException ee) {
91
                LOGGER.error("Execute of svn cat "+ repository.getUrl() + path + "@" + revision + "failed: " + ee);
92
            }
78 93
		}
79 94
	}
80
	
95

  
81 96
}