]> source.dussan.org Git - gitblit.git/commitdiff
Properly decode blobs on reindex (issue 112)
authorJames Moger <james.moger@gitblit.com>
Mon, 23 Jul 2012 18:04:23 +0000 (14:04 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 23 Jul 2012 18:04:23 +0000 (14:04 -0400)
docs/04_releases.mkd
src/com/gitblit/LuceneExecutor.java

index 1c74c0cd01b42f98a842a85b0209a64f325ee444..89671c72cc1aaae196f63a6c0dad2c0ce372d01e 100644 (file)
@@ -11,6 +11,7 @@ If you are updating from an 0.9.x release AND you have indexed branches with the
 \r
 #### fixes\r
 \r
+- Fixed Lucene charset encoding bug when reindexing a repository (issue 112)\r
 - Fixed null pointer in LdapUserSerivce if account has a null email address (issue 110)\r
 \r
 #### changes\r
index f7a739056066e47df1b627bcf07e29902d277af8..2e099303af694f5e965a47290b8960c28810ff75 100644 (file)
@@ -412,7 +412,8 @@ public class LuceneExecutor implements Runnable {
                if (!deleteIndex(model.name)) {\r
                        return result;\r
                }\r
-               try {                   \r
+               try {\r
+                       String [] encodings = storedSettings.getStrings(Keys.web.blobEncodings).toArray(new String[0]);\r
                        FileBasedConfig config = getConfig(repository);\r
                        Set<String> indexedCommits = new TreeSet<String>();\r
                        IndexWriter writer = getIndexWriter(model.name);\r
@@ -562,7 +563,7 @@ public class LuceneExecutor implements Runnable {
                                                        }\r
                                                        in.close();\r
                                                        byte[] content = os.toByteArray();\r
-                                                       String str = new String(content, Constants.CHARACTER_ENCODING);\r
+                                                       String str = StringUtils.decodeString(content, encodings);                                                      \r
                                                        doc.add(new Field(FIELD_CONTENT, str, Store.YES, Index.ANALYZED));\r
                                                        os.reset();\r
                                                }                                                       \r