This commit is contained in:
Lukas Eder 2019-10-23 14:32:47 +02:00
parent e1efb1f082
commit e04da416dc

View File

@ -37,6 +37,8 @@
*/
package org.jooq.impl;
import static org.jooq.tools.jdbc.JDBCUtils.safeClose;
import java.io.IOException;
import java.io.Reader;
import java.io.StringWriter;
@ -67,9 +69,10 @@ final class SourceMetaProvider implements MetaProvider {
public final Meta provide() {
if (sources.length > 0) {
StringWriter w = new StringWriter();
Reader r = null;
try {
Reader r = sources[0].reader();
r = sources[0].reader();
char[] buffer = new char[8192];
int nRead;
while ((nRead = r.read(buffer, 0, 8192)) >= 0) {
@ -79,6 +82,9 @@ final class SourceMetaProvider implements MetaProvider {
catch (IOException e) {
throw new org.jooq.exception.IOException("Could not read source", e);
}
finally {
safeClose(r);
}
String s = w.toString();
sources[0] = Source.of(w.toString());