diff --git a/src/main/java/com/avaje/ebeaninternal/server/text/csv/CsvUtilReader.java b/src/main/java/com/avaje/ebeaninternal/server/text/csv/CsvUtilReader.java index 4a7fc27e1..161df976e 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/text/csv/CsvUtilReader.java +++ b/src/main/java/com/avaje/ebeaninternal/server/text/csv/CsvUtilReader.java @@ -4,19 +4,19 @@ package com.avaje.ebeaninternal.server.text.csv; // rbygrave: Made some Java Generics tweaks to remove warnings /** - Copyright 2005 Bytecode Pty Ltd. - - 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 - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + * Copyright 2005 Bytecode Pty Ltd. + *

+ * 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 + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import java.io.BufferedReader; @@ -27,223 +27,222 @@ import java.util.List; /** * Glen Smith's CSV reader released under Apache License version 2. - * + * * @author Glen Smith - * + * */ public class CsvUtilReader { - private final BufferedReader br; + private final BufferedReader br; - private boolean hasNext = true; + private boolean hasNext = true; - private final char separator; + private final char separator; - private final char quotechar; - - private final int skipLines; + private final char quotechar; - private boolean linesSkiped; + private final int skipLines; - /** The default separator to use if none is supplied to the constructor. */ - public static final char DEFAULT_SEPARATOR = ','; + private boolean linesSkiped; - /** - * The default quote character to use if none is supplied to the - * constructor. - */ - public static final char DEFAULT_QUOTE_CHARACTER = '"'; - - /** - * The default line to start reading. - */ - public static final int DEFAULT_SKIP_LINES = 0; + /** The default separator to use if none is supplied to the constructor. */ + public static final char DEFAULT_SEPARATOR = ','; - /** - * Constructs CSVReader using a comma for the separator. - * - * @param reader - * the reader to an underlying CSV source. - */ - public CsvUtilReader(Reader reader) { - this(reader, DEFAULT_SEPARATOR); + /** + * The default quote character to use if none is supplied to the + * constructor. + */ + public static final char DEFAULT_QUOTE_CHARACTER = '"'; + + /** + * The default line to start reading. + */ + public static final int DEFAULT_SKIP_LINES = 0; + + /** + * Constructs CSVReader using a comma for the separator. + * + * @param reader + * the reader to an underlying CSV source. + */ + public CsvUtilReader(Reader reader) { + this(reader, DEFAULT_SEPARATOR); + } + + /** + * Constructs CSVReader with supplied separator. + * + * @param reader + * the reader to an underlying CSV source. + * @param separator + * the delimiter to use for separating entries. + */ + public CsvUtilReader(Reader reader, char separator) { + this(reader, separator, DEFAULT_QUOTE_CHARACTER); + } + + + /** + * Constructs CSVReader with supplied separator and quote char. + * + * @param reader + * the reader to an underlying CSV source. + * @param separator + * the delimiter to use for separating entries + * @param quotechar + * the character to use for quoted elements + */ + public CsvUtilReader(Reader reader, char separator, char quotechar) { + this(reader, separator, quotechar, DEFAULT_SKIP_LINES); + } + + /** + * Constructs CSVReader with supplied separator and quote char. + * + * @param reader + * the reader to an underlying CSV source. + * @param separator + * the delimiter to use for separating entries + * @param quotechar + * the character to use for quoted elements + * @param line + * the line number to skip for start reading + */ + public CsvUtilReader(Reader reader, char separator, char quotechar, int line) { + this.br = new BufferedReader(reader); + this.separator = separator; + this.quotechar = quotechar; + this.skipLines = line; + } + + /** + * Reads the entire file into a List with each element being a String[] of + * tokens. + * + * @return a List of String[], with each String[] representing a line of the + * file. + * + * @throws IOException + * if bad things happen during the read + */ + public List readAll() throws IOException { + + List allElements = new ArrayList<>(); + while (hasNext) { + String[] nextLineAsTokens = readNext(); + if (nextLineAsTokens != null) + allElements.add(nextLineAsTokens); + } + return allElements; + + } + + /** + * Reads the next line from the buffer and converts to a string array. + * + * @return a string array with each comma-separated element as a separate + * entry. + * + * @throws IOException + * if bad things happen during the read + */ + public String[] readNext() throws IOException { + + String nextLine = getNextLine(); + return hasNext ? parseLine(nextLine) : null; + } + + /** + * Reads the next line from the file. + * + * @return the next line from the file without trailing newline + * @throws IOException + * if bad things happen during the read + */ + private String getNextLine() throws IOException { + if (!this.linesSkiped) { + for (int i = 0; i < skipLines; i++) { + br.readLine(); + } + this.linesSkiped = true; + } + String nextLine = br.readLine(); + if (nextLine == null) { + hasNext = false; + } + return hasNext ? nextLine : null; + } + + /** + * Parses an incoming String and returns an array of elements. + * + * @param nextLine + * the string to parse + * @return the comma-tokenized list of elements, or null if nextLine is null + * @throws IOException if bad things happen during the read + */ + private String[] parseLine(String nextLine) throws IOException { + + if (nextLine == null) { + return null; } - /** - * Constructs CSVReader with supplied separator. - * - * @param reader - * the reader to an underlying CSV source. - * @param separator - * the delimiter to use for separating entries. - */ - public CsvUtilReader(Reader reader, char separator) { - this(reader, separator, DEFAULT_QUOTE_CHARACTER); - } - - + List tokensOnThisLine = new ArrayList<>(); - /** - * Constructs CSVReader with supplied separator and quote char. - * - * @param reader - * the reader to an underlying CSV source. - * @param separator - * the delimiter to use for separating entries - * @param quotechar - * the character to use for quoted elements - */ - public CsvUtilReader(Reader reader, char separator, char quotechar) { - this(reader, separator, quotechar, DEFAULT_SKIP_LINES); - } - - /** - * Constructs CSVReader with supplied separator and quote char. - * - * @param reader - * the reader to an underlying CSV source. - * @param separator - * the delimiter to use for separating entries - * @param quotechar - * the character to use for quoted elements - * @param line - * the line number to skip for start reading - */ - public CsvUtilReader(Reader reader, char separator, char quotechar, int line) { - this.br = new BufferedReader(reader); - this.separator = separator; - this.quotechar = quotechar; - this.skipLines = line; - } + StringBuilder sb = new StringBuilder(); + boolean inQuotes = false; + do { + if (inQuotes) { + // continuing a quoted section, reappend newline + sb.append("\n"); + nextLine = getNextLine(); + if (nextLine == null) + break; + } + for (int i = 0; i < nextLine.length(); i++) { - /** - * Reads the entire file into a List with each element being a String[] of - * tokens. - * - * @return a List of String[], with each String[] representing a line of the - * file. - * - * @throws IOException - * if bad things happen during the read - */ - public List readAll() throws IOException { - - List allElements = new ArrayList<>(); - while (hasNext) { - String[] nextLineAsTokens = readNext(); - if (nextLineAsTokens != null) - allElements.add(nextLineAsTokens); - } - return allElements; - - } - - /** - * Reads the next line from the buffer and converts to a string array. - * - * @return a string array with each comma-separated element as a separate - * entry. - * - * @throws IOException - * if bad things happen during the read - */ - public String[] readNext() throws IOException { - - String nextLine = getNextLine(); - return hasNext ? parseLine(nextLine) : null; - } - - /** - * Reads the next line from the file. - * - * @return the next line from the file without trailing newline - * @throws IOException - * if bad things happen during the read - */ - private String getNextLine() throws IOException { - if (!this.linesSkiped) { - for (int i = 0; i < skipLines; i++) { - br.readLine(); + char c = nextLine.charAt(i); + if (c == quotechar) { + // this gets complex... the quote may end a quoted block, or escape another quote. + // do a 1-char lookahead: + if (inQuotes // we are in quotes, therefore there can be escaped quotes in here. + && nextLine.length() > (i + 1) // there is indeed another character to check. + && nextLine.charAt(i + 1) == quotechar) { // ..and that char. is a quote also. + // we have two quote chars in a row == one quote char, so consume them both and + // put one on the token. we do *not* exit the quoted text. + sb.append(nextLine.charAt(i + 1)); + i++; + } else { + inQuotes = !inQuotes; + // the tricky case of an embedded quote in the middle: a,bc"d"ef,g + if (i > 2 //not on the begining of the line + && nextLine.charAt(i - 1) != this.separator //not at the begining of an escape sequence + && nextLine.length() > (i + 1) && + nextLine.charAt(i + 1) != this.separator //not at the end of an escape sequence + ) { + sb.append(c); } - this.linesSkiped = true; + } + } else if (c == separator && !inQuotes) { + tokensOnThisLine.add(sb.toString().trim()); + sb = new StringBuilder(); // start work on next token + } else { + sb.append(c); } - String nextLine = br.readLine(); - if (nextLine == null) { - hasNext = false; - } - return hasNext ? nextLine : null; - } + } + } while (inQuotes); + tokensOnThisLine.add(sb.toString().trim()); + return tokensOnThisLine.toArray(new String[tokensOnThisLine.size()]); + } - /** - * Parses an incoming String and returns an array of elements. - * - * @param nextLine - * the string to parse - * @return the comma-tokenized list of elements, or null if nextLine is null - * @throws IOException if bad things happen during the read - */ - private String[] parseLine(String nextLine) throws IOException { + /** + * Closes the underlying reader. + * + * @throws IOException if the close fails + */ + public void close() throws IOException { + br.close(); + } - if (nextLine == null) { - return null; - } - - List tokensOnThisLine = new ArrayList<>(); - - StringBuilder sb = new StringBuilder(); - boolean inQuotes = false; - do { - if (inQuotes) { - // continuing a quoted section, reappend newline - sb.append("\n"); - nextLine = getNextLine(); - if (nextLine == null) - break; - } - for (int i = 0; i < nextLine.length(); i++) { - - char c = nextLine.charAt(i); - if (c == quotechar) { - // this gets complex... the quote may end a quoted block, or escape another quote. - // do a 1-char lookahead: - if( inQuotes // we are in quotes, therefore there can be escaped quotes in here. - && nextLine.length() > (i+1) // there is indeed another character to check. - && nextLine.charAt(i+1) == quotechar ){ // ..and that char. is a quote also. - // we have two quote chars in a row == one quote char, so consume them both and - // put one on the token. we do *not* exit the quoted text. - sb.append(nextLine.charAt(i+1)); - i++; - }else{ - inQuotes = !inQuotes; - // the tricky case of an embedded quote in the middle: a,bc"d"ef,g - if(i>2 //not on the begining of the line - && nextLine.charAt(i-1) != this.separator //not at the begining of an escape sequence - && nextLine.length()>(i+1) && - nextLine.charAt(i+1) != this.separator //not at the end of an escape sequence - ){ - sb.append(c); - } - } - } else if (c == separator && !inQuotes) { - tokensOnThisLine.add(sb.toString().trim()); - sb = new StringBuilder(); // start work on next token - } else { - sb.append(c); - } - } - } while (inQuotes); - tokensOnThisLine.add(sb.toString().trim()); - return tokensOnThisLine.toArray(new String[tokensOnThisLine.size()]); - } - - /** - * Closes the underlying reader. - * - * @throws IOException if the close fails - */ - public void close() throws IOException{ - br.close(); - } - } diff --git a/src/main/java/com/avaje/ebeaninternal/server/text/csv/TCsvReader.java b/src/main/java/com/avaje/ebeaninternal/server/text/csv/TCsvReader.java index a99acfec4..fffcff5b6 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/text/csv/TCsvReader.java +++ b/src/main/java/com/avaje/ebeaninternal/server/text/csv/TCsvReader.java @@ -1,16 +1,5 @@ package com.avaje.ebeaninternal.server.text.csv; -import java.io.Reader; -import java.sql.Types; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Locale; - import com.avaje.ebean.EbeanServer; import com.avaje.ebean.bean.EntityBean; import com.avaje.ebean.plugin.ExpressionPath; @@ -24,200 +13,211 @@ import com.avaje.ebeaninternal.server.deploy.BeanDescriptor; import com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocOne; import com.avaje.ebeaninternal.server.el.ElPropertyValue; +import java.io.Reader; +import java.sql.Types; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Locale; + /** * Implementation of the CsvReader */ public class TCsvReader implements CsvReader { - private static final TimeStringParser TIME_PARSER = new TimeStringParser(); + private static final TimeStringParser TIME_PARSER = new TimeStringParser(); - private final EbeanServer server; + private final EbeanServer server; - private final BeanDescriptor descriptor; + private final BeanDescriptor descriptor; - private final List columnList = new ArrayList<>(); + private final List columnList = new ArrayList<>(); - private final CsvColumn ignoreColumn = new CsvColumn(); + private final CsvColumn ignoreColumn = new CsvColumn(); - private boolean hasHeader; + private boolean hasHeader; - private int logInfoFrequency = 1000; + private int logInfoFrequency = 1000; - private String defaultTimeFormat = "HH:mm:ss"; - private String defaultDateFormat = "yyyy-MM-dd"; - private String defaultTimestampFormat = "yyyy-MM-dd hh:mm:ss.fffffffff"; - private Locale defaultLocale = Locale.getDefault(); + private String defaultTimeFormat = "HH:mm:ss"; + private String defaultDateFormat = "yyyy-MM-dd"; + private String defaultTimestampFormat = "yyyy-MM-dd hh:mm:ss.fffffffff"; + private Locale defaultLocale = Locale.getDefault(); - /** - * The batch size used for JDBC statement batching. - */ - protected int persistBatchSize = 30; + /** + * The batch size used for JDBC statement batching. + */ + protected int persistBatchSize = 30; - private boolean addPropertiesFromHeader; + private boolean addPropertiesFromHeader; - public TCsvReader(EbeanServer server, BeanDescriptor descriptor) { - this.server = server; - this.descriptor = descriptor; - } + public TCsvReader(EbeanServer server, BeanDescriptor descriptor) { + this.server = server; + this.descriptor = descriptor; + } - public void setDefaultLocale(Locale defaultLocale) { - this.defaultLocale = defaultLocale; - } + public void setDefaultLocale(Locale defaultLocale) { + this.defaultLocale = defaultLocale; + } - public void setDefaultTimeFormat(String defaultTimeFormat) { - this.defaultTimeFormat = defaultTimeFormat; - } + public void setDefaultTimeFormat(String defaultTimeFormat) { + this.defaultTimeFormat = defaultTimeFormat; + } - public void setDefaultDateFormat(String defaultDateFormat) { - this.defaultDateFormat = defaultDateFormat; - } + public void setDefaultDateFormat(String defaultDateFormat) { + this.defaultDateFormat = defaultDateFormat; + } - public void setDefaultTimestampFormat(String defaultTimestampFormat) { - this.defaultTimestampFormat = defaultTimestampFormat; - } + public void setDefaultTimestampFormat(String defaultTimestampFormat) { + this.defaultTimestampFormat = defaultTimestampFormat; + } - public void setPersistBatchSize(int persistBatchSize) { - this.persistBatchSize = persistBatchSize; - } + public void setPersistBatchSize(int persistBatchSize) { + this.persistBatchSize = persistBatchSize; + } - public void setIgnoreHeader() { - setHasHeader(true, false); - } + public void setIgnoreHeader() { + setHasHeader(true, false); + } - public void setAddPropertiesFromHeader() { - setHasHeader(true, true); - } + public void setAddPropertiesFromHeader() { + setHasHeader(true, true); + } - public void setHasHeader(boolean hasHeader, boolean addPropertiesFromHeader) { - this.hasHeader = hasHeader; - this.addPropertiesFromHeader = addPropertiesFromHeader; - } + public void setHasHeader(boolean hasHeader, boolean addPropertiesFromHeader) { + this.hasHeader = hasHeader; + this.addPropertiesFromHeader = addPropertiesFromHeader; + } - public void setLogInfoFrequency(int logInfoFrequency) { - this.logInfoFrequency = logInfoFrequency; - } + public void setLogInfoFrequency(int logInfoFrequency) { + this.logInfoFrequency = logInfoFrequency; + } - public void addIgnore() { - columnList.add(ignoreColumn); - } + public void addIgnore() { + columnList.add(ignoreColumn); + } - public void addProperty(String propertyName) { - addProperty(propertyName, null); - } + public void addProperty(String propertyName) { + addProperty(propertyName, null); + } - public void addDateTime(String propertyName, String dateTimeFormat) { - addDateTime(propertyName, dateTimeFormat, Locale.getDefault()); - } + public void addDateTime(String propertyName, String dateTimeFormat) { + addDateTime(propertyName, dateTimeFormat, Locale.getDefault()); + } - public void addDateTime(String propertyName, String dateTimeFormat, Locale locale) { + public void addDateTime(String propertyName, String dateTimeFormat, Locale locale) { - ExpressionPath elProp = descriptor.getExpressionPath(propertyName); - if (!elProp.isDateTimeCapable()) { - throw new TextException("Property " + propertyName + " is not DateTime capable"); - } - if (dateTimeFormat == null) { - dateTimeFormat = getDefaultDateTimeFormat(elProp.getJdbcType()); - } + ExpressionPath elProp = descriptor.getExpressionPath(propertyName); + if (!elProp.isDateTimeCapable()) { + throw new TextException("Property " + propertyName + " is not DateTime capable"); + } + if (dateTimeFormat == null) { + dateTimeFormat = getDefaultDateTimeFormat(elProp.getJdbcType()); + } - if (locale == null) { - locale = defaultLocale; - } + if (locale == null) { + locale = defaultLocale; + } - SimpleDateFormat sdf = new SimpleDateFormat(dateTimeFormat, locale); - DateTimeParser parser = new DateTimeParser(sdf, dateTimeFormat, elProp); + SimpleDateFormat sdf = new SimpleDateFormat(dateTimeFormat, locale); + DateTimeParser parser = new DateTimeParser(sdf, dateTimeFormat, elProp); - CsvColumn column = new CsvColumn(elProp, parser); - columnList.add(column); - } + CsvColumn column = new CsvColumn(elProp, parser); + columnList.add(column); + } - private String getDefaultDateTimeFormat(int jdbcType) { - switch (jdbcType) { - case Types.TIME: - return defaultTimeFormat; - case Types.DATE: - return defaultDateFormat; - case Types.TIMESTAMP: - return defaultTimestampFormat; + private String getDefaultDateTimeFormat(int jdbcType) { + switch (jdbcType) { + case Types.TIME: + return defaultTimeFormat; + case Types.DATE: + return defaultDateFormat; + case Types.TIMESTAMP: + return defaultTimestampFormat; - default: - throw new RuntimeException("Expected java.sql.Types TIME,DATE or TIMESTAMP but got [" + jdbcType + "]"); - } - } + default: + throw new RuntimeException("Expected java.sql.Types TIME,DATE or TIMESTAMP but got [" + jdbcType + "]"); + } + } - public void addProperty(String propertyName, StringParser parser) { + public void addProperty(String propertyName, StringParser parser) { - ExpressionPath elProp = descriptor.getExpressionPath(propertyName); - if (parser == null) { - parser = elProp.getStringParser(); - } - CsvColumn column = new CsvColumn(elProp, parser); - columnList.add(column); - } + ExpressionPath elProp = descriptor.getExpressionPath(propertyName); + if (parser == null) { + parser = elProp.getStringParser(); + } + CsvColumn column = new CsvColumn(elProp, parser); + columnList.add(column); + } - public void process(Reader reader) throws Exception { - DefaultCsvCallback callback = new DefaultCsvCallback<>(persistBatchSize, logInfoFrequency); - process(reader, callback); - } + public void process(Reader reader) throws Exception { + DefaultCsvCallback callback = new DefaultCsvCallback<>(persistBatchSize, logInfoFrequency); + process(reader, callback); + } - public void process(Reader reader, CsvCallback callback) throws Exception { + public void process(Reader reader, CsvCallback callback) throws Exception { - if (reader == null) { - throw new NullPointerException("reader is null?"); - } - if (callback == null) { - throw new NullPointerException("callback is null?"); - } + if (reader == null) { + throw new NullPointerException("reader is null?"); + } + if (callback == null) { + throw new NullPointerException("callback is null?"); + } - CsvUtilReader utilReader = new CsvUtilReader(reader); + CsvUtilReader utilReader = new CsvUtilReader(reader); - callback.begin(server); + callback.begin(server); - int row = 0; + int row = 0; - if (hasHeader) { - String[] line = utilReader.readNext(); - if (addPropertiesFromHeader) { - addPropertiesFromHeader(line); - } - callback.readHeader(line); - } + if (hasHeader) { + String[] line = utilReader.readNext(); + if (addPropertiesFromHeader) { + addPropertiesFromHeader(line); + } + callback.readHeader(line); + } - try { - do { - ++row; - String[] line = utilReader.readNext(); - if (line == null) { - --row; - break; - } + try { + do { + ++row; + String[] line = utilReader.readNext(); + if (line == null) { + --row; + break; + } - if (callback.processLine(row, line)) { - // the line content is expected to be ok for processing - if (line.length != columnList.size()) { - // we have not got the expected number of columns - String msg = "Error at line " + row + ". Expected [" + columnList.size() + "] columns " - + "but instead we have [" + line.length + "]. Line[" + Arrays.toString(line) + "]"; - throw new TextException(msg); - } + if (callback.processLine(row, line)) { + // the line content is expected to be ok for processing + if (line.length != columnList.size()) { + // we have not got the expected number of columns + String msg = "Error at line " + row + ". Expected [" + columnList.size() + "] columns " + + "but instead we have [" + line.length + "]. Line[" + Arrays.toString(line) + "]"; + throw new TextException(msg); + } - T bean = buildBeanFromLineContent(row, line); + T bean = buildBeanFromLineContent(row, line); - callback.processBean(row, line, bean); + callback.processBean(row, line, bean); - } - } while (true); + } + } while (true); - callback.end(row); + callback.end(row); - } catch (Exception e) { - // notify that an error occurred so that any - // transaction can be rolled back if required - callback.endWithError(row, e); - throw e; - } - } + } catch (Exception e) { + // notify that an error occurred so that any + // transaction can be rolled back if required + callback.endWithError(row, e); + throw e; + } + } - private void addPropertiesFromHeader(String[] line) { + private void addPropertiesFromHeader(String[] line) { for (String aLine : line) { ElPropertyValue elProp = descriptor.getElGetValue(aLine); if (elProp == null) { @@ -238,106 +238,106 @@ public class TCsvReader implements CsvReader { addProperty(aLine); } } - } + } - private boolean isDateTimeType(int t) { + private boolean isDateTimeType(int t) { return t == Types.TIMESTAMP || t == Types.DATE || t == Types.TIME; } - @SuppressWarnings("unchecked") - protected T buildBeanFromLineContent(int row, String[] line) { + @SuppressWarnings("unchecked") + protected T buildBeanFromLineContent(int row, String[] line) { - try { - EntityBean entityBean = descriptor.createEntityBean(); - T bean = (T) entityBean; + try { + EntityBean entityBean = descriptor.createEntityBean(); + T bean = (T) entityBean; - int columnPos = 0; - for (; columnPos < line.length; columnPos++) { - convertAndSetColumn(columnPos, line[columnPos], entityBean); - } + int columnPos = 0; + for (; columnPos < line.length; columnPos++) { + convertAndSetColumn(columnPos, line[columnPos], entityBean); + } - return bean; + return bean; - } catch (RuntimeException e) { - String msg = "Error at line: " + row + " line[" + Arrays.toString(line) + "]"; - throw new RuntimeException(msg, e); - } - } + } catch (RuntimeException e) { + String msg = "Error at line: " + row + " line[" + Arrays.toString(line) + "]"; + throw new RuntimeException(msg, e); + } + } - protected void convertAndSetColumn(int columnPos, String strValue, EntityBean bean) { + protected void convertAndSetColumn(int columnPos, String strValue, EntityBean bean) { - strValue = strValue.trim(); + strValue = strValue.trim(); - if (strValue.isEmpty()) { - return; - } + if (strValue.isEmpty()) { + return; + } - CsvColumn c = columnList.get(columnPos); - c.convertAndSet(strValue, bean); - } + CsvColumn c = columnList.get(columnPos); + c.convertAndSet(strValue, bean); + } - /** - * Processes a column in the csv content. - */ - public static class CsvColumn { + /** + * Processes a column in the csv content. + */ + public static class CsvColumn { - private final ExpressionPath path; - private final StringParser parser; + private final ExpressionPath path; + private final StringParser parser; - /** - * Constructor for the IGNORE column. - */ - private CsvColumn() { - this.path = null; - this.parser = null; - } + /** + * Constructor for the IGNORE column. + */ + private CsvColumn() { + this.path = null; + this.parser = null; + } - /** - * Construct with a property and parser. - */ - public CsvColumn(ExpressionPath path, StringParser parser) { - this.path = path; - this.parser = parser; - } + /** + * Construct with a property and parser. + */ + public CsvColumn(ExpressionPath path, StringParser parser) { + this.path = path; + this.parser = parser; + } - /** - * Convert the string to the appropriate value and set it to the bean. - */ - public void convertAndSet(String strValue, EntityBean bean) { + /** + * Convert the string to the appropriate value and set it to the bean. + */ + public void convertAndSet(String strValue, EntityBean bean) { - if (parser != null && path != null) { - Object value = parser.parse(strValue); - path.pathSet(bean, value); - } - } - } + if (parser != null && path != null) { + Object value = parser.parse(strValue); + path.pathSet(bean, value); + } + } + } - /** - * A StringParser for converting custom date/time/datetime strings into - * appropriate java types (Date, Calendar, SQL Date, Time, Timestamp, JODA - * etc). - */ - private static class DateTimeParser implements StringParser { + /** + * A StringParser for converting custom date/time/datetime strings into + * appropriate java types (Date, Calendar, SQL Date, Time, Timestamp, JODA + * etc). + */ + private static class DateTimeParser implements StringParser { - private final DateFormat dateFormat; - private final ExpressionPath path; - private final String format; + private final DateFormat dateFormat; + private final ExpressionPath path; + private final String format; - DateTimeParser(DateFormat dateFormat, String format, ExpressionPath path) { - this.dateFormat = dateFormat; - this.path = path; - this.format = format; - } + DateTimeParser(DateFormat dateFormat, String format, ExpressionPath path) { + this.dateFormat = dateFormat; + this.path = path; + this.format = format; + } - public Object parse(String value) { - try { - Date dt = dateFormat.parse(value); - return path.parseDateTime(dt.getTime()); + public Object parse(String value) { + try { + Date dt = dateFormat.parse(value); + return path.parseDateTime(dt.getTime()); - } catch (ParseException e) { - throw new TextException("Error parsing [" + value + "] using format[" + format + "]", e); - } - } + } catch (ParseException e) { + throw new TextException("Error parsing [" + value + "] using format[" + format + "]", e); + } + } - } + } } diff --git a/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonBeanReader.java b/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonBeanReader.java index 0497146e9..e6e2e720a 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonBeanReader.java +++ b/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonBeanReader.java @@ -11,7 +11,7 @@ import java.io.IOException; /** * A 'context' for reading entity beans from JSON. *

- * This is used such that a load context and persistence context can be used to span multiple marshalling requests. + * This is used such that a load context and persistence context can be used to span multiple marshalling requests. *

*/ public class DJsonBeanReader implements JsonBeanReader { diff --git a/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonContext.java b/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonContext.java index 92a4603ae..eef1f1d8f 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonContext.java +++ b/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonContext.java @@ -129,7 +129,7 @@ public class DJsonContext implements JsonContext { @Override public DJsonBeanReader createBeanReader(BeanType beanType, JsonParser parser, JsonReadOptions options) throws JsonIOException { - BeanDescriptor desc = (BeanDescriptor)beanType; + BeanDescriptor desc = (BeanDescriptor) beanType; ReadJson readJson = new ReadJson(desc, parser, options, determineObjectMapper(options)); return new DJsonBeanReader<>(desc, readJson); } diff --git a/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonScalar.java b/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonScalar.java index c55c9be34..ed63ca3aa 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonScalar.java +++ b/src/main/java/com/avaje/ebeaninternal/server/text/json/DJsonScalar.java @@ -21,7 +21,7 @@ public class DJsonScalar { public void write(JsonGenerator gen, Object value) throws IOException { if (value instanceof String) { - gen.writeString((String)value); + gen.writeString((String) value); } else { ScalarType scalarType = typeManager.getScalarType(value.getClass()); diff --git a/src/main/java/com/avaje/ebeaninternal/server/text/json/ReadJson.java b/src/main/java/com/avaje/ebeaninternal/server/text/json/ReadJson.java index e815de642..782ddd7e5 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/text/json/ReadJson.java +++ b/src/main/java/com/avaje/ebeaninternal/server/text/json/ReadJson.java @@ -116,7 +116,7 @@ public class ReadJson { */ public void persistenceContextPut(Object beanId, T currentBean) { - persistenceContextPutIfAbsent(beanId, (EntityBean)currentBean, rootDesc); + persistenceContextPutIfAbsent(beanId, (EntityBean) currentBean, rootDesc); } /** @@ -132,7 +132,7 @@ public class ReadJson { Object existing = beanDesc.contextPutIfAbsent(persistenceContext, id, bean); if (existing != null) { - beanDesc.merge(bean, (EntityBean)existing); + beanDesc.merge(bean, (EntityBean) existing); } else { if (loadContext != null) { @@ -156,10 +156,10 @@ public class ReadJson { public ObjectMapper getObjectMapper() { if (objectMapper == null) { throw new IllegalStateException( - "Jackson ObjectMapper required but has not set. The ObjectMapper can be set on" - +" either the ServerConfig or on JsonReadOptions."); + "Jackson ObjectMapper required but has not set. The ObjectMapper can be set on" + + " either the ServerConfig or on JsonReadOptions."); } - return (ObjectMapper)objectMapper; + return (ObjectMapper) objectMapper; } /** @@ -214,7 +214,7 @@ public class ReadJson { * Typically this is used to read Transient properties where the type is unknown to Ebean. */ public Object readValueUsingObjectMapper(Class propertyType) throws IOException { - return getObjectMapper().readValue(parser, propertyType); + return getObjectMapper().readValue(parser, propertyType); } } diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/AutoCommitTransactionManager.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/AutoCommitTransactionManager.java index c2c40ebe4..934d5fabc 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/AutoCommitTransactionManager.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/AutoCommitTransactionManager.java @@ -17,8 +17,8 @@ import java.sql.Connection; public class AutoCommitTransactionManager extends TransactionManager { public AutoCommitTransactionManager(boolean localL2Caching, ServerConfig serverConfig, ClusterManager clusterManager, BackgroundExecutor backgroundExecutor, - DocStoreUpdateProcessor indexUpdateProcessor, BeanDescriptorManager descMgr) { - + DocStoreUpdateProcessor indexUpdateProcessor, BeanDescriptorManager descMgr) { + super(localL2Caching, serverConfig, clusterManager, backgroundExecutor, indexUpdateProcessor, descMgr); } diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/DeleteByIdMap.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/DeleteByIdMap.java index 20ed290a9..72ce09be7 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/DeleteByIdMap.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/DeleteByIdMap.java @@ -1,8 +1,11 @@ package com.avaje.ebeaninternal.server.transaction; +import com.avaje.ebean.annotation.DocStoreMode; import com.avaje.ebeaninternal.server.cache.CacheChangeSet; import com.avaje.ebeaninternal.server.core.PersistRequest; import com.avaje.ebeaninternal.server.deploy.BeanDescriptor; +import com.avaje.ebeanservice.docstore.api.DocStoreUpdates; +import com.avaje.ebeanservice.docstore.api.support.DocStoreDeleteEvent; import java.io.Serializable; import java.util.Collection; @@ -10,10 +13,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import com.avaje.ebean.annotation.DocStoreMode; -import com.avaje.ebeanservice.docstore.api.support.DocStoreDeleteEvent; -import com.avaje.ebeanservice.docstore.api.DocStoreUpdates; - /** * Beans deleted by Id used for updating L2 Cache. */ diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/ExplicitJdbcTransaction.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/ExplicitJdbcTransaction.java index b8fc830da..fd33ea3ee 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/ExplicitJdbcTransaction.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/ExplicitJdbcTransaction.java @@ -6,7 +6,7 @@ import java.sql.SQLException; /** * This only works for Postgres and H2 (and doesn't work for Oracle). - * + *

* Uses explicit begin statement to start the transactions. */ public class ExplicitJdbcTransaction extends JdbcTransaction { diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/ExplicitTransactionManager.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/ExplicitTransactionManager.java index 70b4ee7b1..3875f5a8c 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/ExplicitTransactionManager.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/ExplicitTransactionManager.java @@ -17,7 +17,7 @@ import java.sql.Connection; public class ExplicitTransactionManager extends TransactionManager { public ExplicitTransactionManager(boolean localL2Caching, ServerConfig serverConfig, ClusterManager clusterManager, BackgroundExecutor backgroundExecutor, - DocStoreUpdateProcessor indexUpdateProcessor, BeanDescriptorManager descMgr) { + DocStoreUpdateProcessor indexUpdateProcessor, BeanDescriptorManager descMgr) { super(localL2Caching, serverConfig, clusterManager, backgroundExecutor, indexUpdateProcessor, descMgr); } diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/JdbcTransaction.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/JdbcTransaction.java index 256cbf68b..9a13bbe8e 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/JdbcTransaction.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/JdbcTransaction.java @@ -15,6 +15,9 @@ import com.avaje.ebeaninternal.server.core.PersistRequest; import com.avaje.ebeaninternal.server.core.PersistRequestBean; import com.avaje.ebeaninternal.server.lib.util.Str; import com.avaje.ebeaninternal.server.persist.BatchControl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import javax.persistence.PersistenceException; import javax.persistence.RollbackException; import java.io.IOException; @@ -26,8 +29,6 @@ import java.util.HashSet; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * JDBC Connection based transaction. diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/JtaTransactionManager.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/JtaTransactionManager.java index 8162164fa..0917a56d3 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/JtaTransactionManager.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/JtaTransactionManager.java @@ -151,7 +151,7 @@ public class JtaTransactionManager implements ExternalTransactionManager { } public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, - SecurityException, IllegalStateException, SystemException { + SecurityException, IllegalStateException, SystemException { } public int getStatus() throws SystemException { diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/PostCommitProcessing.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/PostCommitProcessing.java index 8c52986c2..2ecb1a2bf 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/PostCommitProcessing.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/PostCommitProcessing.java @@ -6,10 +6,10 @@ import com.avaje.ebeaninternal.api.TransactionEvent; import com.avaje.ebeaninternal.api.TransactionEventTable; import com.avaje.ebeaninternal.api.TransactionEventTable.TableIUD; import com.avaje.ebeaninternal.server.cache.CacheChangeSet; -import com.avaje.ebeanservice.docstore.api.DocStoreUpdates; import com.avaje.ebeaninternal.server.cluster.ClusterManager; import com.avaje.ebeaninternal.server.core.PersistRequestBean; import com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager; +import com.avaje.ebeanservice.docstore.api.DocStoreUpdates; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/RemoteTransactionEvent.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/RemoteTransactionEvent.java index 1983c3cd5..3d2735bce 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/RemoteTransactionEvent.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/RemoteTransactionEvent.java @@ -67,8 +67,8 @@ public class RemoteTransactionEvent implements Runnable { public boolean isEmpty() { return beanPersistList.isEmpty() - && (tableList == null || tableList.isEmpty()) - && (deleteByIdMap == null || deleteByIdMap.isEmpty()); + && (tableList == null || tableList.isEmpty()) + && (deleteByIdMap == null || deleteByIdMap.isEmpty()); } public void addBeanPersistIds(BeanPersistIds beanPersist) { diff --git a/src/main/java/com/avaje/ebeaninternal/server/type/ConvertInetAddresses.java b/src/main/java/com/avaje/ebeaninternal/server/type/ConvertInetAddresses.java index 2473e140a..b576e7ebb 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/type/ConvertInetAddresses.java +++ b/src/main/java/com/avaje/ebeaninternal/server/type/ConvertInetAddresses.java @@ -140,7 +140,7 @@ public final class ConvertInetAddresses { // The argument was malformed, i.e. not an IP string literal. if (addr == null) { throw new IllegalArgumentException( - String.format("'%s' is not an IP string literal.", ipString)); + String.format("'%s' is not an IP string literal.", ipString)); } try { @@ -159,8 +159,7 @@ public final class ConvertInetAddresses { * {@link IPAddressUtil#textToNumericFormatV4} or * {@link IPAddressUtil#textToNumericFormatV6}. */ - throw new IllegalArgumentException( - String.format("'%s' is extremely broken.", ipString), e); + throw new IllegalArgumentException(String.format("'%s' is extremely broken.", ipString), e); } } diff --git a/src/main/java/com/avaje/ebeaninternal/server/type/DefaultTypeManager.java b/src/main/java/com/avaje/ebeaninternal/server/type/DefaultTypeManager.java index 3aed66650..867a6c0c9 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/type/DefaultTypeManager.java +++ b/src/main/java/com/avaje/ebeaninternal/server/type/DefaultTypeManager.java @@ -62,7 +62,21 @@ import java.time.YearMonth; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Currency; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.Set; +import java.util.TimeZone; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; /** @@ -330,7 +344,7 @@ public final class DefaultTypeManager implements TypeManager, KnownImmutable { for (Object value : EnumSet.allOf(enumClass).toArray()) { mappedClasses.add(value.getClass()); } - for (Class cls: mappedClasses) { + for (Class cls : mappedClasses) { typeMap.put(cls, scalarType); } logAdd(scalarType); @@ -363,8 +377,8 @@ public final class DefaultTypeManager implements TypeManager, KnownImmutable { if (found == null) { if (type.getName().equals("org.joda.time.LocalTime")) { throw new IllegalStateException( - "ScalarType of Joda LocalTime not defined. You need to set ServerConfig.jodaLocalTimeMode to" - + " either 'normal' or 'utc'. UTC is the old mode using UTC timezone but local time zone is now preferred as 'normal' mode."); + "ScalarType of Joda LocalTime not defined. You need to set ServerConfig.jodaLocalTimeMode to" + + " either 'normal' or 'utc'. UTC is the old mode using UTC timezone but local time zone is now preferred as 'normal' mode."); } found = checkInterfaceTypes(type); } @@ -882,8 +896,7 @@ public final class DefaultTypeManager implements TypeManager, KnownImmutable { // determine the types from generic parameter types using reflection Class[] propParamTypes = TypeReflectHelper.getParams(prop.getClass(), CompoundTypeProperty.class); if (propParamTypes.length != 2) { - throw new RuntimeException("Expecting 2 generic paramter types but got " + Arrays.toString(propParamTypes) + " for " - + prop.getClass()); + throw new RuntimeException("Expecting 2 generic paramter types but got " + Arrays.toString(propParamTypes) + " for " + prop.getClass()); } return propParamTypes[1]; diff --git a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ImmutableMetaFactory.java b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ImmutableMetaFactory.java index 0be11f55f..6f2f04c3f 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ImmutableMetaFactory.java +++ b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ImmutableMetaFactory.java @@ -40,7 +40,7 @@ public class ImmutableMetaFactory { } String msg = "Was unable to use reflection to find a constructor and appropriate getters for" + - "immutable type " + cls + ". The errors while looking for the getter methods follow:"; + "immutable type " + cls + ". The errors while looking for the getter methods follow:"; logger.error(msg); for (RuntimeException runtimeException : errors) { @@ -48,7 +48,7 @@ public class ImmutableMetaFactory { } msg = "Unable to use reflection to build ImmutableMeta for " + cls - + ". Associated Errors trying to find a constructor and getter methods have been logged"; + + ". Associated Errors trying to find a constructor and getter methods have been logged"; throw new RuntimeException(msg); } diff --git a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedCompoundType.java b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedCompoundType.java index 5815e850d..fdab64005 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedCompoundType.java +++ b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedCompoundType.java @@ -1,11 +1,11 @@ package com.avaje.ebeaninternal.server.type.reflect; -import java.lang.reflect.Constructor; -import java.util.Arrays; - import com.avaje.ebean.config.CompoundType; import com.avaje.ebean.config.CompoundTypeProperty; +import java.lang.reflect.Constructor; +import java.util.Arrays; + @SuppressWarnings({"rawtypes"}) public class ReflectionBasedCompoundType implements CompoundType { diff --git a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedCompoundTypeProperty.java b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedCompoundTypeProperty.java index 57b81ecd6..b4a76776f 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedCompoundTypeProperty.java +++ b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedCompoundTypeProperty.java @@ -1,9 +1,9 @@ package com.avaje.ebeaninternal.server.type.reflect; -import java.lang.reflect.Method; - import com.avaje.ebean.config.CompoundTypeProperty; +import java.lang.reflect.Method; + @SuppressWarnings({"rawtypes"}) public class ReflectionBasedCompoundTypeProperty implements CompoundTypeProperty { diff --git a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedScalarTypeConverter.java b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedScalarTypeConverter.java index 27074f9b2..25f8d8c86 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedScalarTypeConverter.java +++ b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedScalarTypeConverter.java @@ -1,10 +1,10 @@ package com.avaje.ebeaninternal.server.type.reflect; +import com.avaje.ebean.config.ScalarTypeConverter; + import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import com.avaje.ebean.config.ScalarTypeConverter; - @SuppressWarnings({"rawtypes"}) public class ReflectionBasedScalarTypeConverter implements ScalarTypeConverter { @@ -31,7 +31,7 @@ public class ReflectionBasedScalarTypeConverter implements ScalarTypeConverter { return reader.invoke(beanType, NO_ARGS); } catch (Exception e) { String msg = "Error invoking read method " + reader.getName() - + " on " + beanType.getClass().getName(); + + " on " + beanType.getClass().getName(); throw new RuntimeException(msg); } } diff --git a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedTypeBuilder.java b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedTypeBuilder.java index de9c7c203..b7edee132 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedTypeBuilder.java +++ b/src/main/java/com/avaje/ebeaninternal/server/type/reflect/ReflectionBasedTypeBuilder.java @@ -1,12 +1,12 @@ package com.avaje.ebeaninternal.server.type.reflect; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; - import com.avaje.ebeaninternal.server.type.ScalarType; import com.avaje.ebeaninternal.server.type.ScalarTypeWrapper; import com.avaje.ebeaninternal.server.type.TypeManager; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; + public class ReflectionBasedTypeBuilder { private final TypeManager typeManager; @@ -68,7 +68,7 @@ public class ReflectionBasedTypeBuilder { return lowerFirstChar(name.substring(3)); } String msg = "Expecting method " + name + " to start with is or get " - + " so as to follow bean specification?"; + + " so as to follow bean specification?"; throw new RuntimeException(msg); } diff --git a/src/main/java/com/avaje/ebeaninternal/server/util/BindParamsParser.java b/src/main/java/com/avaje/ebeaninternal/server/util/BindParamsParser.java index 6c7113605..933e3f81b 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/util/BindParamsParser.java +++ b/src/main/java/com/avaje/ebeaninternal/server/util/BindParamsParser.java @@ -1,15 +1,14 @@ package com.avaje.ebeaninternal.server.util; -import java.util.Collection; - -import javax.persistence.PersistenceException; - import com.avaje.ebean.config.EncryptKey; import com.avaje.ebeaninternal.api.BindParams; import com.avaje.ebeaninternal.api.BindParams.OrderedList; import com.avaje.ebeaninternal.api.BindParams.Param; import com.avaje.ebeaninternal.server.deploy.BeanDescriptor; +import javax.persistence.PersistenceException; +import java.util.Collection; + /** * Parses the BindParams if they are using named parameters. *

diff --git a/src/main/java/com/avaje/ebeaninternal/server/util/package.html b/src/main/java/com/avaje/ebeaninternal/server/util/package.html index 84ed601cc..1bc4da98e 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/util/package.html +++ b/src/main/java/com/avaje/ebeaninternal/server/util/package.html @@ -1,12 +1,11 @@ - - Server side Utility objects + + Server side Utility objects Server side Utility objects - - \ No newline at end of file +