Updated libraries to latest versions and code compatibility fixes;

This commit is contained in:
Oleg Agafonov 2019-02-17 16:12:57 +04:00
parent 971a98061d
commit 8cf681dff2
13 changed files with 106 additions and 83 deletions

View file

@ -51,7 +51,7 @@
<dependency>
<groupId>com.mortennobel</groupId>
<artifactId>java-image-scaling</artifactId>
<version>0.8.5</version>
<version>0.8.6</version>
</dependency>
<dependency>
<groupId>com.google.collections</groupId>
@ -66,12 +66,12 @@
<dependency>
<groupId>org.jetlang</groupId>
<artifactId>jetlang</artifactId>
<version>0.2.9</version>
<version>0.2.23</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.286</version>
<version>1.11.498</version>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
@ -114,7 +114,7 @@
<artifactId>truevfs-profile-base</artifactId>
<groupId>net.java.truevfs</groupId>
<type>jar</type>
<version>0.10.8</version>
<version>0.11.1</version>
<exclusions>
<exclusion>
<artifactId>truevfs-access-swing</artifactId>
@ -129,7 +129,7 @@
<dependency>
<groupId>com.googlecode.soundlibs</groupId>
<artifactId>mp3spi</artifactId>
<version>1.9.5-1</version>
<version>1.9.5.4</version>
</dependency>
<dependency>
<groupId>javazoom</groupId>
@ -154,13 +154,13 @@
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-transcoder</artifactId>
<version>1.7</version>
<version>1.11</version>
</dependency>
<!-- svg support end -->
<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime</artifactId>
<version>3.2.7.Final</version>
<version>4.0.2.Final</version>
</dependency>
</dependencies>

View file

@ -24,6 +24,7 @@ import org.apache.log4j.Logger;
import org.mage.card.arcane.CardRendererUtils;
import org.ocpsoft.prettytime.Duration;
import org.ocpsoft.prettytime.PrettyTime;
import org.ocpsoft.prettytime.TimeFormat;
import org.ocpsoft.prettytime.units.JustNow;
import javax.swing.*;
@ -82,7 +83,7 @@ public class TablesPanel extends javax.swing.JPanel {
final JToggleButton[] filterButtons;
// time formater
private PrettyTime timeFormater = new PrettyTime();
private PrettyTime timeFormater = new PrettyTime(Locale.ENGLISH);
// time ago renderer
TableCellRenderer timeAgoCellRenderer = new DefaultTableCellRenderer() {
@ -219,9 +220,12 @@ public class TablesPanel extends javax.swing.JPanel {
// tableModel.setSession(session);
// formater
timeFormater.setLocale(Locale.ENGLISH);
JustNow jn = timeFormater.getUnit(JustNow.class);
jn.setMaxQuantity(1000L * 30L); // 30 seconds gap (show "just now" from 0 to 30 secs)
// change default just now from 60 to 30 secs
// see workaround for 4.0 versions: https://github.com/ocpsoft/prettytime/issues/152
TimeFormat timeFormat = timeFormater.removeUnit(JustNow.class);
JustNow newJustNow = new JustNow();
newJustNow.setMaxQuantity(1000L * 30L); // 30 seconds gap (show "just now" from 0 to 30 secs)
timeFormater.registerUnit(newJustNow, timeFormat);
// 1. TABLE CURRENT
tableTables.createDefaultColumnsFromModel();
@ -1377,35 +1381,35 @@ public class TablesPanel extends javax.swing.JPanel {
javax.swing.GroupLayout jPanelTopLayout = new javax.swing.GroupLayout(jPanelTop);
jPanelTop.setLayout(jPanelTopLayout);
jPanelTopLayout.setHorizontalGroup(
jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopLayout.createSequentialGroup()
.addContainerGap()
.addComponent(btnNewTable)
.addGap(6, 6, 6)
.addComponent(btnNewTournament)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(filterBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(filterBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnQuickStart)
.addContainerGap(792, Short.MAX_VALUE))
jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopLayout.createSequentialGroup()
.addContainerGap()
.addComponent(btnNewTable)
.addGap(6, 6, 6)
.addComponent(btnNewTournament)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(filterBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(filterBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnQuickStart)
.addContainerGap(792, Short.MAX_VALUE))
);
jPanelTopLayout.setVerticalGroup(
jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnNewTable)
.addComponent(btnNewTournament))
.addGroup(jPanelTopLayout.createSequentialGroup()
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(filterBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnQuickStart))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(filterBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnNewTable)
.addComponent(btnNewTournament))
.addGroup(jPanelTopLayout.createSequentialGroup()
.addGroup(jPanelTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(filterBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnQuickStart))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(filterBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
);
gridBagConstraints = new java.awt.GridBagConstraints();
@ -1442,12 +1446,12 @@ public class TablesPanel extends javax.swing.JPanel {
javax.swing.GroupLayout jPanelTablesLayout = new javax.swing.GroupLayout(jPanelTables);
jPanelTables.setLayout(jPanelTablesLayout);
jPanelTablesLayout.setHorizontalGroup(
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
);
jPanelTablesLayout.setVerticalGroup(
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 672, Short.MAX_VALUE)
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 672, Short.MAX_VALUE)
);
jSplitPane1.setLeftComponent(jPanelTables);

View file

@ -12,7 +12,7 @@ import mage.client.util.gui.BufferedImageBuilder;
import mage.client.util.gui.GuiDisplayUtil;
import mage.constants.Rarity;
import mage.utils.StreamUtils;
import org.apache.batik.dom.svg.SVGDOMImplementation;
import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;

View file

@ -34,12 +34,12 @@
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
<version>2.2.22.GA</version>
<version>2.5.0.Final</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-serialization</artifactId>
<version>1.0.3.GA</version>
<version>4.2.2.GA</version>
</dependency>
<dependency>
<groupId>concurrent</groupId>
@ -54,7 +54,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
<version>2.8.5</version>
</dependency>
</dependencies>
<!-- to get the reference to local repository with com\googlecode\jspf\jspf-core\0.9.1\ -->

View file

@ -42,7 +42,13 @@
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.17</version>
<version>2.3.2</version>
</dependency>
<dependency>
<!-- server xml config needs optional dependency for jaxb-impl -->
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
@ -200,31 +206,31 @@
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.25.0</version>
<version>1.28.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-gmail</artifactId>
<version>v1-rev82-1.23.0</version>
<version>v1-rev20190120-1.28.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-java6</artifactId>
<version>1.25.0</version>
<version>1.28.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.25.0</version>
<version>1.28.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
<version>1.5.0-b01</version>
<type>jar</type>
</dependency>
<dependency>

View file

@ -9,9 +9,6 @@ import com.j256.ormlite.stmt.SelectArg;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.support.DatabaseConnection;
import com.j256.ormlite.table.TableUtils;
import java.io.File;
import java.sql.SQLException;
import java.util.List;
import mage.cards.repository.CardRepository;
import mage.cards.repository.RepositoryUtil;
import org.apache.log4j.Logger;
@ -21,6 +18,10 @@ import org.apache.shiro.crypto.hash.Hash;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.apache.shiro.crypto.hash.SimpleHash;
import java.io.File;
import java.sql.SQLException;
import java.util.List;
public enum AuthorizedUserRepository {
instance;
@ -108,7 +109,7 @@ public enum AuthorizedUserRepository {
public void closeDB() {
try {
if (dao != null && dao.getConnectionSource() != null) {
DatabaseConnection conn = dao.getConnectionSource().getReadWriteConnection();
DatabaseConnection conn = dao.getConnectionSource().getReadWriteConnection(dao.getTableName());
conn.executeStatement("shutdown compact", 0);
}
} catch (SQLException ex) {

View file

@ -8,11 +8,12 @@ import com.j256.ormlite.stmt.SelectArg;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.support.DatabaseConnection;
import com.j256.ormlite.table.TableUtils;
import mage.cards.repository.RepositoryUtil;
import org.apache.log4j.Logger;
import java.io.File;
import java.sql.SQLException;
import java.util.List;
import mage.cards.repository.RepositoryUtil;
import org.apache.log4j.Logger;
public enum TableRecordRepository {
@ -68,7 +69,7 @@ public enum TableRecordRepository {
public void closeDB() {
try {
if (dao != null && dao.getConnectionSource() != null) {
DatabaseConnection conn = dao.getConnectionSource().getReadWriteConnection();
DatabaseConnection conn = dao.getConnectionSource().getReadWriteConnection(dao.getTableName());
conn.executeStatement("shutdown compact", 0);
}
} catch (SQLException ex) {

View file

@ -94,12 +94,12 @@ public enum UserStatsRepository {
public long getLatestEndTimeMs() {
try {
QueryBuilder<UserStats, Object> qb = dao.queryBuilder();
QueryBuilder<UserStats, Object> qb = dao.queryBuilder();
qb.orderBy("endTimeMs", false).limit(1L);
List<UserStats> users = dao.query(qb.prepare());
List<UserStats> users = dao.query(qb.prepare());
if (!users.isEmpty()) {
return users.get(0).getEndTimeMs();
}
return users.get(0).getEndTimeMs();
}
} catch (SQLException ex) {
Logger.getLogger(UserStatsRepository.class).error("Error getting the latest end time from DB - ", ex);
}
@ -111,7 +111,7 @@ public enum UserStatsRepository {
public List<String> updateUserStats() {
Set<String> updatedUsers = new HashSet<>();
// Lock the DB so that no other updateUserStats runs at the same time.
synchronized(this) {
synchronized (this) {
long latestEndTimeMs = this.getLatestEndTimeMs();
List<TableRecord> records = TableRecordRepository.instance.getAfter(latestEndTimeMs);
for (TableRecord record : records) {
@ -126,9 +126,9 @@ public enum UserStatsRepository {
for (ResultProtos.MatchPlayerProto player : match.getPlayersList()) {
UserStats userStats = this.getUser(player.getName());
ResultProtos.UserStatsProto proto =
userStats != null
? userStats.getProto()
: ResultProtos.UserStatsProto.newBuilder().setName(player.getName()).build();
userStats != null
? userStats.getProto()
: ResultProtos.UserStatsProto.newBuilder().setName(player.getName()).build();
ResultProtos.UserStatsProto.Builder builder = ResultProtos.UserStatsProto.newBuilder(proto)
.setMatches(proto.getMatches() + 1);
switch (player.getQuit()) {
@ -370,7 +370,7 @@ public enum UserStatsRepository {
public void closeDB() {
try {
if (dao != null && dao.getConnectionSource() != null) {
DatabaseConnection conn = dao.getConnectionSource().getReadWriteConnection();
DatabaseConnection conn = dao.getConnectionSource().getReadWriteConnection(dao.getTableName());
conn.executeStatement("shutdown compact", 0);
}
} catch (SQLException ex) {

View file

@ -43,13 +43,13 @@
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.1.1</version>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.2</version>
<version>1.9.2</version>
</dependency>
<dependency>
@ -62,26 +62,26 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.7.Final</version>
<version>4.0.0.Beta5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<version>1.3.0-alpha4</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.json</artifactId>
<version>2.0.10</version>
<version>2.0.20</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
<version>2.3.1.GA</version>
<version>4.0.0.Beta8</version>
</dependency>
<dependency>
@ -93,19 +93,19 @@
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<version>3.1-jbossorg-1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<version>3.0-alpha-1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.7</version>
<version>2.10.1</version>
</dependency>
</dependencies>

View file

@ -64,6 +64,17 @@
<artifactId>mage-game-freeforall</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<!-- server xml config needs optional dependency for jaxb-impl -->
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
</dependencies>
<build>

View file

@ -23,13 +23,13 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.187</version>
<version>1.4.197</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-jdbc</artifactId>
<version>4.48</version>
<version>5.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@ -38,7 +38,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.6.0</version>
<version>3.7.0-rc1</version>
</dependency>
</dependencies>

View file

@ -506,7 +506,7 @@ public enum CardRepository {
public void closeDB() {
try {
if (cardDao != null && cardDao.getConnectionSource() != null) {
DatabaseConnection conn = cardDao.getConnectionSource().getReadWriteConnection();
DatabaseConnection conn = cardDao.getConnectionSource().getReadWriteConnection(cardDao.getTableName());
conn.executeStatement("shutdown compact", 0);
}
} catch (SQLException ex) {

View file

@ -98,7 +98,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13-beta-2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
@ -108,7 +108,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<version>1.8.0-beta2</version>
</dependency>
</dependencies>
</dependencyManagement>