Source:
static void executeScriptFiles(List<FileInfo> filesInfo, SQLCommandLineReader parentLineReader, DDLParserCallback callback) throws IOException { LineReaderAdapter adapter = null; SQLCommandLineReader reader = null; StringBuilder statements = new StringBuilder(); if ( ! m_interactive && callback == null) { System.out.println(); StringBuilder commandString = new StringBuilder(); commandString.append(filesInfo.get(0).toString()); for (int ii = 1; ii < filesInfo.size(); ii++) { commandString.append(" " + filesInfo.get(ii).getFile().toString()); } System.out.println(commandString.toString()); } for (int ii = 0; ii < filesInfo.size(); ii++) { FileInfo fileInfo = filesInfo.get(ii); adapter = null; reader = null; if (fileInfo.getOption() == FileOption.INLINEBATCH) { reader = parentLineReader; } else { try { reader = adapter = new LineReaderAdapter(new FileReader(fileInfo.getFile())); } catch (FileNotFoundException e) { System.err.println("Script file '" + fileInfo.getFile() + "' could not be found."); stopOrContinue(e); return; } if(fileInfo.getOption() == FileOption.BATCH) { String line; while ((line = reader.readBatchLine()) != null) { statements.append(line).append("\n"); } if( ii == filesInfo.size()-1 ) { String allStatements = statements.toString(); byte[] bytes = allStatements.getBytes("UTF-8"); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); reader = adapter = new LineReaderAdapter(new InputStreamReader( bais ) ); } } } try { executeScriptFromReader(fileInfo, reader, callback); } catch (SQLCmdEarlyExitException e) { throw e; } catch (Exception x) { stopOrContinue(x); } finally { if (adapter != null) { adapter.close(); } } } }

Target:
static void executeScriptFiles(List<FileInfo> filesInfo, SQLCommandLineReader parentLineReader, DDLParserCallback callback) throws IOException { LineReaderAdapter adapter = null; SQLCommandLineReader reader = null; StringBuilder statements = new StringBuilder(); if ( ! m_interactive && callback == null) { System.out.println(); StringBuilder commandString = new StringBuilder(); commandString.append(filesInfo.get(0).toString()); for (int ii = 1; ii < filesInfo.size(); ii++) { commandString.append(" " + filesInfo.get(ii).getFile().toString()); } System.out.println(commandString.toString()); } for (int ii = 0; ii < filesInfo.size(); ii++) { FileInfo fileInfo = filesInfo.get(ii); adapter = null; reader = null; if (fileInfo.getOption() == FileOption.INLINEBATCH) { reader = parentLineReader; } else { try { reader = adapter = new LineReaderAdapter(new FileReader(fileInfo.getFile())); } catch (FileNotFoundException e) { System.err.println("Script file '" + fileInfo.getFile() + "' could not be found."); stopOrContinue(e); return; } if (fileInfo.getOption() == FileOption.BATCH) { String line; while ((line = reader.readBatchLine()) != null) { statements.append(line).append("\n"); } reader = null; if ( ii == filesInfo.size() - 1 ) { String allStatements = statements.toString(); byte[] bytes = allStatements.getBytes("UTF-8"); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); reader = adapter = new LineReaderAdapter(new InputStreamReader( bais ) ); } } } try { executeScriptFromReader(fileInfo, reader, callback); } catch (SQLCmdEarlyExitException e) { throw e; } catch (Exception x) { stopOrContinue(x); } finally { if (adapter != null) { adapter.close(); } } } }