James Moger
2012-07-23 fa0afc0f2d7fa3cc6dc5de5dec006c4ecf4c6272
Properly decode blobs on reindex (issue-112)
2 files modified
6 ■■■■■ changed files
docs/04_releases.mkd 1 ●●●● patch | view | raw | blame | history
src/com/gitblit/LuceneExecutor.java 5 ●●●●● patch | view | raw | blame | history
docs/04_releases.mkd
@@ -11,6 +11,7 @@
#### fixes
- Fixed Lucene charset encoding bug when reindexing a repository (issue 112)
- Fixed null pointer in LdapUserSerivce if account has a null email address (issue 110)
#### changes
src/com/gitblit/LuceneExecutor.java
@@ -412,7 +412,8 @@
        if (!deleteIndex(model.name)) {
            return result;
        }
        try {
        try {
            String [] encodings = storedSettings.getStrings(Keys.web.blobEncodings).toArray(new String[0]);
            FileBasedConfig config = getConfig(repository);
            Set<String> indexedCommits = new TreeSet<String>();
            IndexWriter writer = getIndexWriter(model.name);
@@ -562,7 +563,7 @@
                            }
                            in.close();
                            byte[] content = os.toByteArray();
                            String str = new String(content, Constants.CHARACTER_ENCODING);
                            String str = StringUtils.decodeString(content, encodings);
                            doc.add(new Field(FIELD_CONTENT, str, Store.YES, Index.ANALYZED));
                            os.reset();
                        }