diff --git a/modules/core/src/com/haulmont/cuba/core/app/cache/ObjectsCache.java b/modules/core/src/com/haulmont/cuba/core/app/cache/ObjectsCache.java index 1938aaabf9..2552def4e5 100644 --- a/modules/core/src/com/haulmont/cuba/core/app/cache/ObjectsCache.java +++ b/modules/core/src/com/haulmont/cuba/core/app/cache/ObjectsCache.java @@ -44,13 +44,13 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; */ public class ObjectsCache implements ObjectsCacheInstance, ObjectsCacheController { + private final Logger log = LoggerFactory.getLogger(ObjectsCache.class); + protected String name; protected CacheSet cacheSet; protected CacheLoader loader; protected boolean logUpdateEvent = false; - protected static Logger log = LoggerFactory.getLogger(ObjectsCache.class); - protected ReentrantReadWriteLock cacheLock = new ReentrantReadWriteLock(); protected ReentrantLock updateDataLock = new ReentrantLock(); diff --git a/modules/core/src/com/haulmont/cuba/core/app/filestorage/amazon/auth/AWS4SignerForAuthorizationHeader.java b/modules/core/src/com/haulmont/cuba/core/app/filestorage/amazon/auth/AWS4SignerForAuthorizationHeader.java index 1d3d309340..aa6b1c165b 100644 --- a/modules/core/src/com/haulmont/cuba/core/app/filestorage/amazon/auth/AWS4SignerForAuthorizationHeader.java +++ b/modules/core/src/com/haulmont/cuba/core/app/filestorage/amazon/auth/AWS4SignerForAuthorizationHeader.java @@ -20,6 +20,7 @@ package com.haulmont.cuba.core.app.filestorage.amazon.auth; import com.haulmont.cuba.core.app.filestorage.amazon.util.BinaryUtils; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.Map; @@ -102,7 +103,7 @@ public class AWS4SignerForAuthorizationHeader extends AWS4SignerBase { System.out.println("------------------------------------"); // compute the signing key - byte[] kSecret = (SCHEME + awsSecretKey).getBytes(); + byte[] kSecret = (SCHEME + awsSecretKey).getBytes(StandardCharsets.UTF_8); byte[] kDate = sign(dateStamp, kSecret, "HmacSHA256"); byte[] kRegion = sign(regionName, kDate, "HmacSHA256"); byte[] kService = sign(serviceName, kRegion, "HmacSHA256"); diff --git a/modules/core/src/com/haulmont/cuba/core/app/filestorage/amazon/auth/AWS4SignerForChunkedUpload.java b/modules/core/src/com/haulmont/cuba/core/app/filestorage/amazon/auth/AWS4SignerForChunkedUpload.java index 6cffccfad2..20b519d126 100644 --- a/modules/core/src/com/haulmont/cuba/core/app/filestorage/amazon/auth/AWS4SignerForChunkedUpload.java +++ b/modules/core/src/com/haulmont/cuba/core/app/filestorage/amazon/auth/AWS4SignerForChunkedUpload.java @@ -20,6 +20,7 @@ package com.haulmont.cuba.core.app.filestorage.amazon.auth; import com.haulmont.cuba.core.app.filestorage.amazon.util.BinaryUtils; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.Map; @@ -137,7 +138,7 @@ public class AWS4SignerForChunkedUpload extends AWS4SignerBase { System.out.println("------------------------------------"); // compute the signing key - byte[] kSecret = (SCHEME + awsSecretKey).getBytes(); + byte[] kSecret = (SCHEME + awsSecretKey).getBytes(StandardCharsets.UTF_8); byte[] kDate = sign(dateStamp, kSecret, "HmacSHA256"); byte[] kRegion = sign(regionName, kDate, "HmacSHA256"); byte[] kService = sign(serviceName, kRegion, "HmacSHA256"); diff --git a/modules/core/src/com/haulmont/cuba/core/app/importexport/EntityImportExport.java b/modules/core/src/com/haulmont/cuba/core/app/importexport/EntityImportExport.java index 5237adaa48..8a444ad21e 100644 --- a/modules/core/src/com/haulmont/cuba/core/app/importexport/EntityImportExport.java +++ b/modules/core/src/com/haulmont/cuba/core/app/importexport/EntityImportExport.java @@ -88,7 +88,7 @@ public class EntityImportExport implements EntityImportExportAPI { @Override public byte[] exportEntitiesToZIP(Collection entities) { String json = entitySerialization.toJson(entities, null, EntitySerializationOption.COMPACT_REPEATED_ENTITIES); - byte[] jsonBytes = json.getBytes(); + byte[] jsonBytes = json.getBytes(StandardCharsets.UTF_8); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(byteArrayOutputStream); @@ -156,13 +156,13 @@ public class EntityImportExport implements EntityImportExportAPI { @Override public Collection importEntitiesFromZIP(byte[] zipBytes, EntityImportView view) { Collection result = new ArrayList<>(); - Collection entities = null; + Collection entities; ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(zipBytes); ZipArchiveInputStream archiveReader = new ZipArchiveInputStream(byteArrayInputStream); try { try { while (archiveReader.getNextZipEntry() != null) { - String json = new String(readBytesFromEntry(archiveReader)); + String json = new String(readBytesFromEntry(archiveReader), StandardCharsets.UTF_8); entities = entitySerialization.entitiesCollectionFromJson(json, null, EntitySerializationOption.COMPACT_REPEATED_ENTITIES); diff --git a/modules/core/src/com/haulmont/cuba/core/jmx/Scheduling.java b/modules/core/src/com/haulmont/cuba/core/jmx/Scheduling.java index 8521ba7801..ca06f2d9fe 100644 --- a/modules/core/src/com/haulmont/cuba/core/jmx/Scheduling.java +++ b/modules/core/src/com/haulmont/cuba/core/jmx/Scheduling.java @@ -108,7 +108,7 @@ public class Scheduling implements SchedulingMBean { Query query = em.createQuery(jpql); - Date startDate = DateUtils.addHours(timeSource.currentTimestamp(), -Integer.valueOf(age)); + Date startDate = DateUtils.addHours(timeSource.currentTimestamp(), -Integer.parseInt(age)); query.setParameter(1, startDate); if (maxPeriod != null) { query.setParameter(2, Integer.parseInt(maxPeriod) * 3600); diff --git a/modules/core/src/com/haulmont/cuba/core/sys/CorePersistentAttributesLoadChecker.java b/modules/core/src/com/haulmont/cuba/core/sys/CorePersistentAttributesLoadChecker.java index d23f4c2a18..2a37c85421 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/CorePersistentAttributesLoadChecker.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/CorePersistentAttributesLoadChecker.java @@ -23,7 +23,6 @@ import com.haulmont.cuba.core.Persistence; import com.haulmont.cuba.core.entity.BaseEntityInternalAccess; import com.haulmont.cuba.core.entity.BaseGenericIdEntity; import com.haulmont.cuba.core.global.GlobalPersistentAttributesLoadChecker; -import com.haulmont.cuba.core.global.MetadataTools; import javax.inject.Inject; import javax.persistence.EntityManagerFactory; @@ -33,9 +32,6 @@ public class CorePersistentAttributesLoadChecker extends GlobalPersistentAttribu @Inject protected Persistence persistence; - @Inject - protected MetadataTools metadataTools; - @Override protected boolean isLoadedSpecificCheck(Object entity, String property, MetaClass metaClass, MetaProperty metaProperty) { if (metadataTools.isEmbeddable(metaClass) diff --git a/modules/core/src/com/haulmont/cuba/core/sys/EntityManagerImpl.java b/modules/core/src/com/haulmont/cuba/core/sys/EntityManagerImpl.java index 50425238e9..56cec47593 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/EntityManagerImpl.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/EntityManagerImpl.java @@ -327,7 +327,7 @@ public class EntityManagerImpl implements EntityManager { continue; } - if (srcProperty.getRange().isClass() & !metadataTools.isEmbedded(srcProperty)) { + if (srcProperty.getRange().isClass() && !metadataTools.isEmbedded(srcProperty)) { if (!metadataTools.isOwningSide(srcProperty)) continue; diff --git a/modules/core/src/com/haulmont/cuba/core/sys/SecurityTokenManager.java b/modules/core/src/com/haulmont/cuba/core/sys/SecurityTokenManager.java index 9c7b252b36..9be9ada14e 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/SecurityTokenManager.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/SecurityTokenManager.java @@ -102,7 +102,9 @@ public class SecurityTokenManager { protected Cipher getCipher(int mode) { try { Cipher cipher = Cipher.getInstance("AES"); - byte[] encryptionKey = rightPad(substring(config.getKeyForSecurityTokenEncryption(), 0, 16), 16).getBytes(); + byte[] encryptionKey = rightPad(substring(config.getKeyForSecurityTokenEncryption(), 0, 16), 16) + .getBytes(StandardCharsets.UTF_8); + SecretKeySpec sKeySpec = new SecretKeySpec(encryptionKey, "AES"); cipher.init(mode, sKeySpec); return cipher; diff --git a/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateAfterMacroHandler.java b/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateAfterMacroHandler.java index f756f132e8..a074b04885 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateAfterMacroHandler.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateAfterMacroHandler.java @@ -27,9 +27,8 @@ import java.util.regex.Pattern; @Scope("prototype") public class DateAfterMacroHandler extends AbstractQueryMacroHandler { - protected static final Pattern MACRO_PATTERN = Pattern.compile("@dateAfter\\s*\\(([^\\)]+)\\)"); + protected static final Pattern MACRO_PATTERN = Pattern.compile("@dateAfter\\s*\\(([^)]+)\\)"); - protected int count; protected Map namedParameters; protected List paramNames = new ArrayList<>(); diff --git a/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateBeforeMacroHandler.java b/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateBeforeMacroHandler.java index 1a97a27925..6362830df4 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateBeforeMacroHandler.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateBeforeMacroHandler.java @@ -27,9 +27,8 @@ import java.util.regex.Pattern; @Scope("prototype") public class DateBeforeMacroHandler extends AbstractQueryMacroHandler { - protected static final Pattern MACRO_PATTERN = Pattern.compile("@dateBefore\\s*\\(([^\\)]+)\\)"); + protected static final Pattern MACRO_PATTERN = Pattern.compile("@dateBefore\\s*\\(([^)]+)\\)"); - protected int count; protected Map namedParameters; protected List paramNames = new ArrayList<>(); diff --git a/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateEqualsMacroHandler.java b/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateEqualsMacroHandler.java index d8937b9942..676361d6f0 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateEqualsMacroHandler.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/querymacro/DateEqualsMacroHandler.java @@ -28,9 +28,8 @@ import java.util.regex.Pattern; @Scope("prototype") public class DateEqualsMacroHandler extends AbstractQueryMacroHandler { - protected static final Pattern MACRO_PATTERN = Pattern.compile("@dateEquals\\s*\\(([^\\)]+)\\)"); + protected static final Pattern MACRO_PATTERN = Pattern.compile("@dateEquals\\s*\\(([^)]+)\\)"); - protected int count; protected Map namedParameters; protected List> paramNames = new ArrayList<>(); diff --git a/modules/core/src/com/haulmont/cuba/core/sys/querymacro/TimeBetweenQueryMacroHandler.java b/modules/core/src/com/haulmont/cuba/core/sys/querymacro/TimeBetweenQueryMacroHandler.java index c846aa7b8e..74411f1864 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/querymacro/TimeBetweenQueryMacroHandler.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/querymacro/TimeBetweenQueryMacroHandler.java @@ -36,7 +36,7 @@ import java.util.regex.Pattern; @Scope("prototype") public class TimeBetweenQueryMacroHandler extends AbstractQueryMacroHandler { - protected static final Pattern MACRO_PATTERN = Pattern.compile("@between\\s*\\(([^\\)]+)\\)"); + protected static final Pattern MACRO_PATTERN = Pattern.compile("@between\\s*\\(([^)]+)\\)"); protected static final Pattern PARAM_PATTERN = Pattern.compile("(now)\\s*([\\d\\s+-]*)"); protected static final Pattern QUERY_PARAM_PATTERN = Pattern.compile(":(\\w+)"); @@ -51,7 +51,6 @@ public class TimeBetweenQueryMacroHandler extends AbstractQueryMacroHandler { units.put("second", Calendar.SECOND); } - protected int count; protected Map params = new HashMap<>(); public TimeBetweenQueryMacroHandler() { diff --git a/modules/core/src/com/haulmont/cuba/core/sys/utils/DbUpdaterUtil.java b/modules/core/src/com/haulmont/cuba/core/sys/utils/DbUpdaterUtil.java index 7b4377c151..9c37bc982e 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/utils/DbUpdaterUtil.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/utils/DbUpdaterUtil.java @@ -267,6 +267,7 @@ public class DbUpdaterUtil extends DbUpdaterEngine { private String url; private String user; private String password; + private PrintWriter logWriter; private SingleConnectionDataSource(String url, String user, String password) throws SQLException { this.url = url; @@ -286,11 +287,12 @@ public class DbUpdaterUtil extends DbUpdaterEngine { @Override public PrintWriter getLogWriter() throws SQLException { - return new PrintWriter(System.out); + return logWriter; } @Override public void setLogWriter(PrintWriter out) throws SQLException { + this.logWriter = out; } @Override diff --git a/modules/core/src/com/haulmont/cuba/restapi/ServerTokenStoreImpl.java b/modules/core/src/com/haulmont/cuba/restapi/ServerTokenStoreImpl.java index ec4b2e44ff..89c323cac0 100644 --- a/modules/core/src/com/haulmont/cuba/restapi/ServerTokenStoreImpl.java +++ b/modules/core/src/com/haulmont/cuba/restapi/ServerTokenStoreImpl.java @@ -47,8 +47,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -/** - */ @Component(ServerTokenStore.NAME) public class ServerTokenStoreImpl implements ServerTokenStore { @@ -100,8 +98,8 @@ public class ServerTokenStoreImpl implements ServerTokenStore { @Override public byte[] getState() { - if (tokenValueToAccessTokenStore.isEmpty() && tokenValueToAccessTokenStore.isEmpty() & authenticationToAccessTokenStore.isEmpty() - & tokenValueToSessionIdStore.isEmpty() & tokenValueToAuthenticationKeyStore.isEmpty()) { + if (tokenValueToAccessTokenStore.isEmpty() && tokenValueToAuthenticationStore.isEmpty() && authenticationToAccessTokenStore.isEmpty() + && tokenValueToSessionIdStore.isEmpty() && tokenValueToAuthenticationKeyStore.isEmpty()) { return new byte[0]; } @@ -409,6 +407,7 @@ public class ServerTokenStoreImpl implements ServerTokenStore { this.expiry = date.getTime(); } + @Override public int compareTo(Delayed other) { if (this == other) { return 0; @@ -417,6 +416,7 @@ public class ServerTokenStoreImpl implements ServerTokenStore { return (diff == 0 ? 0 : ((diff < 0) ? -1 : 1)); } + @Override public long getDelay(TimeUnit unit) { return expiry - System.currentTimeMillis(); } @@ -425,4 +425,4 @@ public class ServerTokenStoreImpl implements ServerTokenStore { return value; } } -} +} \ No newline at end of file diff --git a/modules/global/src/com/haulmont/bali/db/DbUtils.java b/modules/global/src/com/haulmont/bali/db/DbUtils.java index a07e638dc7..65a2a66904 100644 --- a/modules/global/src/com/haulmont/bali/db/DbUtils.java +++ b/modules/global/src/com/haulmont/bali/db/DbUtils.java @@ -17,7 +17,9 @@ package com.haulmont.bali.db; import javax.annotation.concurrent.ThreadSafe; +import java.io.OutputStreamWriter; import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; @@ -198,7 +200,7 @@ public final class DbUtils { * @param e SQLException to print stack trace of */ public static void printStackTrace(SQLException e) { - printStackTrace(e, new PrintWriter(System.err)); + printStackTrace(e, new PrintWriter(new OutputStreamWriter(System.err, StandardCharsets.UTF_8))); } /** @@ -226,7 +228,7 @@ public final class DbUtils { * @param conn Connection to print warnings from */ public static void printWarnings(Connection conn) { - printWarnings(conn, new PrintWriter(System.err)); + printWarnings(conn, new PrintWriter(new OutputStreamWriter(System.err, StandardCharsets.UTF_8))); } /** diff --git a/modules/global/src/com/haulmont/chile/core/datatypes/impl/ByteArrayDatatype.java b/modules/global/src/com/haulmont/chile/core/datatypes/impl/ByteArrayDatatype.java index 2b72841946..34be787211 100644 --- a/modules/global/src/com/haulmont/chile/core/datatypes/impl/ByteArrayDatatype.java +++ b/modules/global/src/com/haulmont/chile/core/datatypes/impl/ByteArrayDatatype.java @@ -66,7 +66,7 @@ public class ByteArrayDatatype implements Datatype { if (value == null || value.length() == 0) return null; - return Base64.decodeBase64(value.getBytes()); + return Base64.decodeBase64(value.getBytes(StandardCharsets.UTF_8)); } @Override diff --git a/modules/global/src/com/haulmont/cuba/core/global/GlobalPersistentAttributesLoadChecker.java b/modules/global/src/com/haulmont/cuba/core/global/GlobalPersistentAttributesLoadChecker.java index f5e9ac0b67..22d4fc0591 100644 --- a/modules/global/src/com/haulmont/cuba/core/global/GlobalPersistentAttributesLoadChecker.java +++ b/modules/global/src/com/haulmont/cuba/core/global/GlobalPersistentAttributesLoadChecker.java @@ -39,6 +39,12 @@ public class GlobalPersistentAttributesLoadChecker implements PersistentAttribut @Inject protected Metadata metadata; + protected enum PropertyLoadedState { + YES, + NO, + UNKNOWN + } + @Override public boolean isLoaded(Object entity, String property) { MetaClass metaClass = metadata.getClassNN(entity.getClass()); @@ -57,15 +63,15 @@ public class GlobalPersistentAttributesLoadChecker implements PersistentAttribut } } - Boolean isLoaded = isLoadedCommonCheck(entity, property); - if (isLoaded != null) { - return isLoaded; + PropertyLoadedState isLoaded = isLoadedCommonCheck(entity, property); + if (isLoaded != PropertyLoadedState.UNKNOWN) { + return isLoaded == PropertyLoadedState.YES; } return isLoadedSpecificCheck(entity, property, metaClass, metaProperty); } - protected Boolean isLoadedCommonCheck(Object entity, String property) { + protected PropertyLoadedState isLoadedCommonCheck(Object entity, String property) { if (entity instanceof BaseGenericIdEntity) { BaseGenericIdEntity baseGenericIdEntity = (BaseGenericIdEntity) entity; @@ -73,7 +79,7 @@ public class GlobalPersistentAttributesLoadChecker implements PersistentAttribut if (inaccessibleAttributes != null) { for (String inaccessibleAttr : inaccessibleAttributes) { if (inaccessibleAttr.equals(property)) - return false; + return PropertyLoadedState.NO; } } @@ -83,16 +89,16 @@ public class GlobalPersistentAttributesLoadChecker implements PersistentAttribut boolean inFetchGroup = fetchGroup.getAttributeNames().contains(property); if (!inFetchGroup) { // definitely not loaded - return false; + return PropertyLoadedState.NO; } else { // requires additional check specific for the tier - return null; + return PropertyLoadedState.UNKNOWN; } } } } - return null; + return PropertyLoadedState.UNKNOWN; } protected boolean isLoadedSpecificCheck(Object entity, String property, MetaClass metaClass, MetaProperty metaProperty) { diff --git a/modules/global/src/com/haulmont/cuba/core/global/MetadataTools.java b/modules/global/src/com/haulmont/cuba/core/global/MetadataTools.java index 35d5a978fc..6c218e6fdc 100644 --- a/modules/global/src/com/haulmont/cuba/core/global/MetadataTools.java +++ b/modules/global/src/com/haulmont/cuba/core/global/MetadataTools.java @@ -17,6 +17,7 @@ package com.haulmont.cuba.core.global; +import com.google.common.collect.ImmutableList; import com.haulmont.bali.util.Preconditions; import com.haulmont.chile.core.annotations.NamePattern; import com.haulmont.chile.core.datatypes.Datatype; @@ -61,7 +62,7 @@ public class MetadataTools { public static final String SYSTEM_ANN_NAME = "cuba.system"; public static final String STORE_ANN_NAME = "cuba.storeName"; - public static final List SYSTEM_INTERFACES = Arrays.asList( + public static final List SYSTEM_INTERFACES = ImmutableList.of( Instance.class, Entity.class, BaseGenericIdEntity.class, diff --git a/modules/global/src/com/haulmont/cuba/core/sys/AbstractViewRepository.java b/modules/global/src/com/haulmont/cuba/core/sys/AbstractViewRepository.java index 33061f71fe..eaeac2353a 100644 --- a/modules/global/src/com/haulmont/cuba/core/sys/AbstractViewRepository.java +++ b/modules/global/src/com/haulmont/cuba/core/sys/AbstractViewRepository.java @@ -42,6 +42,7 @@ import javax.inject.Inject; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReadWriteLock; @@ -144,7 +145,7 @@ public class AbstractViewRepository implements ViewRepository { SAXReader reader = new SAXReader(); Document doc; try { - doc = reader.read(new InputStreamReader(stream)); + doc = reader.read(new InputStreamReader(stream, StandardCharsets.UTF_8)); } catch (DocumentException e) { throw new RuntimeException("Unable to parse view file " + fileName, e); } @@ -363,7 +364,7 @@ public class AbstractViewRepository implements ViewRepository { } public void deployViews(InputStream xml) { - deployViews(new InputStreamReader(xml)); + deployViews(new InputStreamReader(xml, StandardCharsets.UTF_8)); } public void deployViews(Reader xml) { @@ -379,7 +380,7 @@ public class AbstractViewRepository implements ViewRepository { try { doc = reader.read(xml); } catch (DocumentException e) { - throw new RuntimeException(e); + throw new RuntimeException("Unable to read views xml", e); } Element rootElem = doc.getRootElement(); diff --git a/modules/global/src/com/haulmont/cuba/core/sys/LogControlImpl.java b/modules/global/src/com/haulmont/cuba/core/sys/LogControlImpl.java index 465335781d..4cd387fd7a 100644 --- a/modules/global/src/com/haulmont/cuba/core/sys/LogControlImpl.java +++ b/modules/global/src/com/haulmont/cuba/core/sys/LogControlImpl.java @@ -90,13 +90,11 @@ public class LogControlImpl implements LogControl { randomAccessFile.seek(lengthFile - LOG_TAIL_AMOUNT_BYTES); skipFirstLine(randomAccessFile); } - String str; while (randomAccessFile.read() != -1) { randomAccessFile.seek(randomAccessFile.getFilePointer() - 1); String line = readUtf8Line(randomAccessFile); if (line != null) { - str = new String(line.getBytes(), StandardCharsets.UTF_8.name()); - sb.append(str).append("\n"); + sb.append(line).append("\n"); } } } catch (IOException e) { @@ -256,6 +254,6 @@ public class LogControlImpl implements LogControl { return null; } - return new String(input.toByteArray(), StandardCharsets.UTF_8.name()); + return new String(input.toByteArray(), StandardCharsets.UTF_8); } } \ No newline at end of file diff --git a/modules/global/src/com/haulmont/cuba/core/sys/QueryHolder.java b/modules/global/src/com/haulmont/cuba/core/sys/QueryHolder.java index 264ebee84b..6b81aaff67 100644 --- a/modules/global/src/com/haulmont/cuba/core/sys/QueryHolder.java +++ b/modules/global/src/com/haulmont/cuba/core/sys/QueryHolder.java @@ -19,6 +19,7 @@ package com.haulmont.cuba.core.sys; import com.haulmont.cuba.core.global.LoadContext; import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.builder.HashCodeBuilder; import java.io.Serializable; @@ -45,4 +46,12 @@ public class QueryHolder implements Serializable { return true; } + + @Override + public int hashCode() { + if (query != null) { + return query.hashCode(); + } + return super.hashCode(); + } } \ No newline at end of file diff --git a/modules/global/src/com/haulmont/cuba/core/sys/jmx/MBeanExporter.java b/modules/global/src/com/haulmont/cuba/core/sys/jmx/MBeanExporter.java index 69ea9f32db..bfaf5d915b 100644 --- a/modules/global/src/com/haulmont/cuba/core/sys/jmx/MBeanExporter.java +++ b/modules/global/src/com/haulmont/cuba/core/sys/jmx/MBeanExporter.java @@ -61,7 +61,7 @@ public class MBeanExporter extends org.springframework.jmx.export.MBeanExporter } catch (NoSuchFieldException | IllegalAccessException ignore) { } if (beans != null) { - log.info("Registering beans for JMX exposure: " + beans.keySet()); + log.info("Registering beans for JMX exposure: {}", beans.keySet()); } super.afterSingletonsInstantiated(); diff --git a/modules/global/src/com/haulmont/cuba/core/sys/logging/EclipseLinkLog.java b/modules/global/src/com/haulmont/cuba/core/sys/logging/EclipseLinkLog.java index a9d75fc51b..62dbfb1427 100644 --- a/modules/global/src/com/haulmont/cuba/core/sys/logging/EclipseLinkLog.java +++ b/modules/global/src/com/haulmont/cuba/core/sys/logging/EclipseLinkLog.java @@ -33,7 +33,7 @@ public class EclipseLinkLog extends AbstractSessionLog { protected Map logsCache = new ConcurrentHashMap<>(); - protected static Map levels = new HashMap<>(); + protected static final Map levels = new HashMap<>(); static { levels.put(SessionLog.OFF, Level.OFF); diff --git a/modules/gui/src/com/haulmont/cuba/gui/ComponentsHelper.java b/modules/gui/src/com/haulmont/cuba/gui/ComponentsHelper.java index 96d9d3d415..5d2fe32d76 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/ComponentsHelper.java +++ b/modules/gui/src/com/haulmont/cuba/gui/ComponentsHelper.java @@ -208,7 +208,7 @@ public abstract class ComponentsHelper { if (comp != null) { return comp; } else { - findComponent((Frame) c, id); + return findComponent((Frame) c, id); } } } diff --git a/modules/gui/src/com/haulmont/cuba/gui/app/core/entityinspector/EntityInspectorBrowse.java b/modules/gui/src/com/haulmont/cuba/gui/app/core/entityinspector/EntityInspectorBrowse.java index e0931c376c..e1b3ce661e 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/app/core/entityinspector/EntityInspectorBrowse.java +++ b/modules/gui/src/com/haulmont/cuba/gui/app/core/entityinspector/EntityInspectorBrowse.java @@ -59,6 +59,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.*; @@ -524,7 +525,9 @@ public class EntityInspectorBrowse extends AbstractLookup { exportDisplay.show(new ByteArrayDataProvider(entityImportExportService.exportEntitiesToZIP(selected)), selectedMeta.getJavaClass().getSimpleName() + ".zip", ZIP); } else if (exportFormat == JSON) { - exportDisplay.show(new ByteArrayDataProvider(entityImportExportService.exportEntitiesToJSON(selected).getBytes()), + byte[] data = entityImportExportService.exportEntitiesToJSON(selected) + .getBytes(StandardCharsets.UTF_8); + exportDisplay.show(new ByteArrayDataProvider(data), selectedMeta.getJavaClass().getSimpleName() + ".json", JSON); } } catch (Exception e) { diff --git a/modules/gui/src/com/haulmont/cuba/gui/app/security/group/browse/GroupBrowser.java b/modules/gui/src/com/haulmont/cuba/gui/app/security/group/browse/GroupBrowser.java index 292143a3e2..909597b44f 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/app/security/group/browse/GroupBrowser.java +++ b/modules/gui/src/com/haulmont/cuba/gui/app/security/group/browse/GroupBrowser.java @@ -52,6 +52,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.*; public class GroupBrowser extends AbstractWindow { @@ -410,9 +411,12 @@ public class GroupBrowser extends AbstractWindow { if (!selected.isEmpty()) { try { if (exportFormat == ExportFormat.ZIP) { - exportDisplay.show(new ByteArrayDataProvider(entityImportExportService.exportEntitiesToZIP(selected, view)), "Groups", ExportFormat.ZIP); + byte[] data = entityImportExportService.exportEntitiesToZIP(selected, view); + exportDisplay.show(new ByteArrayDataProvider(data), "Groups", ExportFormat.ZIP); } else if (exportFormat == ExportFormat.JSON) { - exportDisplay.show(new ByteArrayDataProvider(entityImportExportService.exportEntitiesToJSON(selected, view).getBytes()), "Groups", ExportFormat.JSON); + byte[] data = entityImportExportService.exportEntitiesToJSON(selected, view) + .getBytes(StandardCharsets.UTF_8); + exportDisplay.show(new ByteArrayDataProvider(data), "Groups", ExportFormat.JSON); } } catch (Exception e) { showNotification(getMessage("exportFailed"), e.getMessage(), NotificationType.ERROR); @@ -420,5 +424,4 @@ public class GroupBrowser extends AbstractWindow { } } } - } \ No newline at end of file diff --git a/modules/gui/src/com/haulmont/cuba/gui/app/security/role/browse/RoleBrowser.java b/modules/gui/src/com/haulmont/cuba/gui/app/security/role/browse/RoleBrowser.java index c757d5363b..832e20a234 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/app/security/role/browse/RoleBrowser.java +++ b/modules/gui/src/com/haulmont/cuba/gui/app/security/role/browse/RoleBrowser.java @@ -42,13 +42,14 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.*; public class RoleBrowser extends AbstractLookup { protected static final String DEFAULT_ROLE_PROPERTY = "defaultRole"; - protected static final Logger log = LoggerFactory.getLogger(RoleBrowser.class); + private final Logger log = LoggerFactory.getLogger(RoleBrowser.class); @Inject protected Table rolesTable; @@ -242,9 +243,12 @@ public class RoleBrowser extends AbstractLookup { if (!selected.isEmpty()) { try { if (exportFormat == ExportFormat.ZIP) { - exportDisplay.show(new ByteArrayDataProvider(entityImportExportService.exportEntitiesToZIP(selected, view)), "Roles", ExportFormat.ZIP); + byte[] data = entityImportExportService.exportEntitiesToZIP(selected, view); + exportDisplay.show(new ByteArrayDataProvider(data), "Roles", ExportFormat.ZIP); } else if (exportFormat == ExportFormat.JSON) { - exportDisplay.show(new ByteArrayDataProvider(entityImportExportService.exportEntitiesToJSON(selected, view).getBytes()), "Roles", ExportFormat.JSON); + byte[] data = entityImportExportService.exportEntitiesToJSON(selected, view) + .getBytes(StandardCharsets.UTF_8); + exportDisplay.show(new ByteArrayDataProvider(data), "Roles", ExportFormat.JSON); } } catch (Exception e) { showNotification(getMessage("exportFailed"), e.getMessage(), NotificationType.ERROR); diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/actions/RemoveAction.java b/modules/gui/src/com/haulmont/cuba/gui/components/actions/RemoveAction.java index b6fc78ec37..e744d0e67a 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/actions/RemoveAction.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/actions/RemoveAction.java @@ -23,7 +23,6 @@ import com.haulmont.cuba.client.ClientConfig; import com.haulmont.cuba.core.entity.Entity; import com.haulmont.cuba.core.global.AppBeans; import com.haulmont.cuba.core.global.Configuration; -import com.haulmont.cuba.core.global.Security; import com.haulmont.cuba.gui.components.*; import com.haulmont.cuba.gui.components.DialogAction.Type; import com.haulmont.cuba.gui.data.CollectionDatasource; @@ -61,8 +60,6 @@ public class RemoveAction extends ItemTrackingAction implements Action.HasBefore protected String confirmationMessage; protected String confirmationTitle; - protected Security security = AppBeans.get(Security.NAME); - protected AfterRemoveHandler afterRemoveHandler; protected BeforeActionPerformedHandler beforeActionPerformedHandler; diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/filter/FilterParserImpl.java b/modules/gui/src/com/haulmont/cuba/gui/components/filter/FilterParserImpl.java index ff908e6d5f..a46a493bf7 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/filter/FilterParserImpl.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/filter/FilterParserImpl.java @@ -34,7 +34,7 @@ import javax.annotation.Nullable; @Component(FilterParser.NAME) public class FilterParserImpl implements FilterParser { - protected static Logger log = LoggerFactory.getLogger(FilterParser.class); + private static final Logger log = LoggerFactory.getLogger(FilterParser.class); @Override public ConditionsTree getConditions(Filter filter, String xml) { diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/filter/edit/FilterEditor.java b/modules/gui/src/com/haulmont/cuba/gui/components/filter/edit/FilterEditor.java index b2801008d6..d59cf8d8dd 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/filter/edit/FilterEditor.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/filter/edit/FilterEditor.java @@ -45,6 +45,8 @@ import java.util.*; */ public class FilterEditor extends AbstractWindow { + private final Logger log = LoggerFactory.getLogger(FilterEditor.class); + protected static final String GLOBAL_FILTER_PERMISSION = "cuba.gui.filter.global"; protected FilterEntity filterEntity; @@ -113,8 +115,6 @@ public class FilterEditor extends AbstractWindow { protected boolean treeItemChangeListenerEnabled = true; - protected static Logger log = LoggerFactory.getLogger(FilterEditor.class); - @WindowParam(name = "useShortConditionForm") protected Boolean useShortConditionForm; diff --git a/modules/gui/src/com/haulmont/cuba/gui/export/ExcelExporter.java b/modules/gui/src/com/haulmont/cuba/gui/export/ExcelExporter.java index 7a5c0a1ca5..ad821440a2 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/export/ExcelExporter.java +++ b/modules/gui/src/com/haulmont/cuba/gui/export/ExcelExporter.java @@ -417,7 +417,7 @@ public class ExcelExporter { } i++; } - return rowNumber++; + return rowNumber; } protected int createGroupRow(GroupTable table, List columns, int rowNumber, GroupInfo groupInfo, int groupNumber) { diff --git a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/AbstractTableLoader.java b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/AbstractTableLoader.java index 17a9c7b60d..49420827f4 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/AbstractTableLoader.java +++ b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/AbstractTableLoader.java @@ -19,12 +19,10 @@ package com.haulmont.cuba.gui.xml.layout.loaders; import com.haulmont.chile.core.model.MetaClass; import com.haulmont.chile.core.model.MetaProperty; import com.haulmont.chile.core.model.MetaPropertyPath; -import com.haulmont.cuba.client.ClientConfig; import com.haulmont.cuba.core.app.dynamicattributes.DynamicAttributes; import com.haulmont.cuba.core.app.dynamicattributes.DynamicAttributesUtils; import com.haulmont.cuba.core.entity.CategoryAttribute; import com.haulmont.cuba.core.global.AppBeans; -import com.haulmont.cuba.core.global.Configuration; import com.haulmont.cuba.core.global.MetadataTools; import com.haulmont.cuba.gui.ComponentsHelper; import com.haulmont.cuba.gui.GuiDevelopmentException; @@ -51,7 +49,6 @@ public abstract class AbstractTableLoader extends ActionsHolder protected MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME); protected DynamicAttributesGuiTools dynamicAttributesGuiTools = AppBeans.get(DynamicAttributesGuiTools.NAME); protected DynamicAttributes dynamicAttributes = AppBeans.get(DynamicAttributes.NAME); - protected ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class); protected ComponentLoader buttonsPanelLoader; protected Element panelElement; diff --git a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/AbstractUploadFieldLoader.java b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/AbstractUploadFieldLoader.java index 399be80a19..8d47f04b70 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/AbstractUploadFieldLoader.java +++ b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/AbstractUploadFieldLoader.java @@ -55,7 +55,7 @@ public abstract class AbstractUploadFieldLoader extends A String fileSizeLimit = element.attributeValue("fileSizeLimit"); if (StringUtils.isNotEmpty(fileSizeLimit)) { - resultComponent.setFileSizeLimit(Long.valueOf(fileSizeLimit)); + resultComponent.setFileSizeLimit(Long.parseLong(fileSizeLimit)); } } diff --git a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/DataGridLoader.java b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/DataGridLoader.java index 35114e3607..4472e90a75 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/DataGridLoader.java +++ b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/DataGridLoader.java @@ -19,12 +19,10 @@ package com.haulmont.cuba.gui.xml.layout.loaders; import com.haulmont.chile.core.model.MetaClass; import com.haulmont.chile.core.model.MetaProperty; import com.haulmont.chile.core.model.MetaPropertyPath; -import com.haulmont.cuba.client.ClientConfig; import com.haulmont.cuba.core.app.dynamicattributes.DynamicAttributes; import com.haulmont.cuba.core.app.dynamicattributes.DynamicAttributesUtils; import com.haulmont.cuba.core.entity.CategoryAttribute; import com.haulmont.cuba.core.global.AppBeans; -import com.haulmont.cuba.core.global.Configuration; import com.haulmont.cuba.core.global.MetadataTools; import com.haulmont.cuba.gui.ComponentsHelper; import com.haulmont.cuba.gui.GuiDevelopmentException; @@ -53,7 +51,6 @@ public class DataGridLoader extends ActionsHolderLoader { protected MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME); protected DynamicAttributesGuiTools dynamicAttributesGuiTools = AppBeans.get(DynamicAttributesGuiTools.NAME); protected DynamicAttributes dynamicAttributes = AppBeans.get(DynamicAttributes.NAME); - protected ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class); protected ComponentLoader buttonsPanelLoader; protected Element panelElement; @@ -285,7 +282,7 @@ public class DataGridLoader extends ActionsHolderLoader { String expandRatio = element.attributeValue("expandRatio"); if (StringUtils.isNotEmpty(expandRatio)) { - column.setExpandRatio(Integer.valueOf(expandRatio)); + column.setExpandRatio(Integer.parseInt(expandRatio)); } String collapsed = element.attributeValue("collapsed"); @@ -441,7 +438,7 @@ public class DataGridLoader extends ActionsHolderLoader { protected void loadFrozenColumnCount(DataGrid component, Element element) { String frozenColumnCount = element.attributeValue("frozenColumnCount"); if (StringUtils.isNotEmpty(frozenColumnCount)) { - component.setFrozenColumnCount(Integer.valueOf(frozenColumnCount)); + component.setFrozenColumnCount(Integer.parseInt(frozenColumnCount)); } } -} +} \ No newline at end of file diff --git a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/FileUploadFieldLoader.java b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/FileUploadFieldLoader.java index 64394b7296..0f728e9148 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/FileUploadFieldLoader.java +++ b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/FileUploadFieldLoader.java @@ -67,7 +67,7 @@ public class FileUploadFieldLoader extends AbstractFieldLoader protected void loadFileSizeLimit() { String fileSizeLimit = element.attributeValue("fileSizeLimit"); if (StringUtils.isNotEmpty(fileSizeLimit)) { - resultComponent.setFileSizeLimit(Long.valueOf(fileSizeLimit)); + resultComponent.setFileSizeLimit(Long.parseLong(fileSizeLimit)); } } diff --git a/modules/web/src/com/haulmont/cuba/web/app/folders/CubaFoldersPane.java b/modules/web/src/com/haulmont/cuba/web/app/folders/CubaFoldersPane.java index 2ae80b76a2..74711c187e 100644 --- a/modules/web/src/com/haulmont/cuba/web/app/folders/CubaFoldersPane.java +++ b/modules/web/src/com/haulmont/cuba/web/app/folders/CubaFoldersPane.java @@ -712,13 +712,7 @@ public class CubaFoldersPane extends VerticalLayout { protected class SearchFolderActionsHandler extends AppFolderActionsHandler { - protected OpenAction openAction = new OpenAction(); - protected CopyAction copyAction = new CopyAction(); - protected CreateAction createAction = new CreateAction(false); - protected EditAction editAction = new EditAction(); - protected RemoveAction removeAction = new RemoveAction(); - protected ExportAction exportAction = new ExportAction(); - protected ImportAction importAction = new ImportAction(); + protected CreateAction searchFolderCreateAction = new CreateAction(false); @Override public Action[] getActions(Object target, Object sender) { @@ -774,26 +768,25 @@ public class CubaFoldersPane extends VerticalLayout { } protected Action[] createAllActions() { - return new Action[] {openAction, copyAction, createAction, + return new Action[] {openAction, copyAction, searchFolderCreateAction, editAction, removeAction, exportAction, importAction}; } protected Action[] createWithoutOpenActions() { - return new Action[] {createAction, editAction, removeAction}; + return new Action[] {searchFolderCreateAction, editAction, removeAction}; } protected Action[] createOnlyCreateAction() { - return new Action[] {createAction}; + return new Action[] {searchFolderCreateAction}; } protected Action[] createImportCreateAction() { - return new Action[] {createAction, importAction}; + return new Action[] {searchFolderCreateAction, importAction}; } protected Action[] createOpenCreateAction() { - return new Action[] {openAction, createAction, copyAction}; + return new Action[] {openAction, searchFolderCreateAction, copyAction}; } - } protected abstract class FolderAction extends Action { diff --git a/modules/web/src/com/haulmont/cuba/web/gui/components/WebComponentsHelper.java b/modules/web/src/com/haulmont/cuba/web/gui/components/WebComponentsHelper.java index f76d9af0a3..0b1c0c0e45 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/components/WebComponentsHelper.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/components/WebComponentsHelper.java @@ -54,7 +54,7 @@ import java.lang.reflect.Field; public class WebComponentsHelper { - protected static Map> fontIcons = new ConcurrentHashMap<>(); + protected static final Map> fontIcons = new ConcurrentHashMap<>(); static { registerFontIcon("font-icon", FontAwesome.class); diff --git a/modules/web/src/com/haulmont/cuba/web/gui/components/WebDataGrid.java b/modules/web/src/com/haulmont/cuba/web/gui/components/WebDataGrid.java index 04a74600a4..859abe0f29 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/components/WebDataGrid.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/components/WebDataGrid.java @@ -138,7 +138,7 @@ public class WebDataGrid extends WebAbstractComponent headerRows = new ArrayList<>(); protected final List footerRows = new ArrayList<>(); - protected static Map, Class> rendererClasses; + protected static final Map, Class> rendererClasses; protected boolean showIconsForPopupMenuActions; diff --git a/modules/web/src/com/haulmont/cuba/web/gui/components/WebSplitPanel.java b/modules/web/src/com/haulmont/cuba/web/gui/components/WebSplitPanel.java index 279d076b8b..1d133895db 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/components/WebSplitPanel.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/components/WebSplitPanel.java @@ -87,8 +87,8 @@ public class WebSplitPanel extends WebAbstractComponent impl component = new CubaHorizontalSplitPanel() { @Override public void setSplitPosition(float pos, Unit unit, boolean reverse) { - currentPosition = getSplitPosition(); - inverse = isSplitPositionReversed(); + currentPosition = this.getSplitPosition(); + inverse = this.isSplitPositionReversed(); super.setSplitPosition(pos, unit, reverse); } @@ -97,19 +97,16 @@ public class WebSplitPanel extends WebAbstractComponent impl component = new VerticalSplitPanel() { @Override public void setSplitPosition(float pos, Unit unit, boolean reverse) { - currentPosition = getSplitPosition(); + currentPosition = this.getSplitPosition(); super.setSplitPosition(pos, unit, reverse); } }; } - component.addSplitPositionChangeListener(new AbstractSplitPanel.SplitPositionChangeListener() { - @Override - public void onSplitPositionChanged(AbstractSplitPanel.SplitPositionChangeEvent event) { - firePositionUpdateListener(currentPosition, event.getSplitPosition()); - } - }); + component.addSplitPositionChangeListener(event -> + firePositionUpdateListener(currentPosition, event.getSplitPosition()) + ); } protected void firePositionUpdateListener(float previousPosition, float newPosition) { diff --git a/modules/web/src/com/haulmont/cuba/web/gui/components/WebTimeField.java b/modules/web/src/com/haulmont/cuba/web/gui/components/WebTimeField.java index 68bfdc92b0..7780c81001 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/components/WebTimeField.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/components/WebTimeField.java @@ -281,9 +281,10 @@ public class WebTimeField extends WebAbstractField implemen @Override public String getFormattedValue() { - Object value = getValue(); - if (value instanceof Date) + Object value = this.getValue(); + if (value instanceof Date) { return new SimpleDateFormat(timeFormat).format(value); + } return super.getFormattedValue(); } diff --git a/modules/web/src/com/haulmont/cuba/web/toolkit/ui/CubaManagedTabSheet.java b/modules/web/src/com/haulmont/cuba/web/toolkit/ui/CubaManagedTabSheet.java index 0de6eaf253..3fb626c76f 100644 --- a/modules/web/src/com/haulmont/cuba/web/toolkit/ui/CubaManagedTabSheet.java +++ b/modules/web/src/com/haulmont/cuba/web/toolkit/ui/CubaManagedTabSheet.java @@ -501,7 +501,7 @@ public class CubaManagedTabSheet extends CssLayout } protected void setComponent(Component component) { - removeComponent(this.component); + this.removeComponent(this.component); this.component = component;