Skip to content

Instantly share code, notes, and snippets.

View dustinschultz's full-sized avatar
😃

Dustin Schultz dustinschultz

😃
View GitHub Profile
@dustinschultz
dustinschultz / gist:5786101
Created June 14, 2013 23:42
On JDK 1.7_21 results in NPE - JDK 1.6_45 does not throw exception
import java.io.FileReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stax.StAXSource;
@dustinschultz
dustinschultz / gist:5731418
Created June 7, 2013 18:40
" throws SAXParseException, other special entities are parsed correctly.
/**
* Copyright (C) [2013] [The FURTHeR Project]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@dustinschultz
dustinschultz / gist:5718281
Created June 5, 2013 23:52
Comments after XML declaration cause XQQueryException
/**
* Copyright (C) [2013] [The FURTHeR Project]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
xquery version "1.0";
let $message := 'Hello World!'
return
<results>
<message>{fn:trace($message, '$message is: ')}</message>
</results>
Happens on a fresh startup (empty data dir) with local bundles installed that depend on Spring AOP and are a part of features include in the featuresBoot. If I restart, everything works fine.
Happens more often than not but does not happen on every startup.
ghost:~ dustin$ java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Apache ServiceMix (4.4.2)
@dustinschultz
dustinschultz / gist:6d731fd880c8c0ac226e
Last active August 29, 2015 14:20
Lucene Fuzzy Query Edit Distance
import java.io.IOException;
import java.io.StringReader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.en.EnglishAnalyzer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.TextField;