Skip to content

Commit 10253fa

Browse files
committed
Consistently format all files
1 parent 3ff52b8 commit 10253fa

File tree

378 files changed

+33517
-33253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

378 files changed

+33517
-33253
lines changed

src/sqlancer/AbstractAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
public interface AbstractAction<G> {
66

7-
Query getQuery(G globalState) throws SQLException;
7+
Query getQuery(G globalState) throws SQLException;
88

99
}

src/sqlancer/CompositeTestOracle.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55

66
public class CompositeTestOracle implements TestOracle {
77

8-
private final TestOracle[] oracles;
9-
private int i;
8+
private final TestOracle[] oracles;
9+
private int i;
1010

11-
public CompositeTestOracle(List<TestOracle> oracles) {
12-
this.oracles = oracles.toArray(new TestOracle[oracles.size()]);
13-
}
11+
public CompositeTestOracle(List<TestOracle> oracles) {
12+
this.oracles = oracles.toArray(new TestOracle[oracles.size()]);
13+
}
1414

15-
@Override
16-
public void check() throws SQLException {
17-
try {
18-
oracles[i].check();
19-
} finally {
20-
i = (i + 1) % oracles.length;
21-
}
22-
}
15+
@Override
16+
public void check() throws SQLException {
17+
try {
18+
oracles[i].check();
19+
} finally {
20+
i = (i + 1) % oracles.length;
21+
}
22+
}
2323
}

src/sqlancer/DatabaseProvider.java

Lines changed: 78 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -11,94 +11,93 @@
1111

1212
public interface DatabaseProvider<G extends GlobalState<O>, O> {
1313

14-
void generateAndTestDatabase(G globalState) throws SQLException;
14+
void generateAndTestDatabase(G globalState) throws SQLException;
1515

16-
G generateGlobalState();
16+
G generateGlobalState();
1717

18-
// TODO: should be type G
19-
Connection createDatabase(GlobalState<?> globalState) throws SQLException;
18+
// TODO: should be type G
19+
Connection createDatabase(GlobalState<?> globalState) throws SQLException;
2020

21-
/**
22-
* The DBMS name is used to name the log directory and command to test the
23-
* respective DBMS.
24-
*/
25-
String getDBMSName();
21+
/**
22+
* The DBMS name is used to name the log directory and command to test the respective DBMS.
23+
*/
24+
String getDBMSName();
2625

27-
// TODO: remove this
28-
default void printDatabaseSpecificState(FileWriter writer, StateToReproduce state) {
26+
// TODO: remove this
27+
default void printDatabaseSpecificState(FileWriter writer, StateToReproduce state) {
2928

30-
}
29+
}
3130

32-
StateToReproduce getStateToReproduce(String databaseName);
31+
StateToReproduce getStateToReproduce(String databaseName);
3332

34-
O getCommand();
33+
O getCommand();
3534

36-
static boolean isEqualDouble(String first, String second) {
37-
try {
38-
double val = Double.parseDouble(first);
39-
double secVal = Double.parseDouble(second);
40-
return equals(val, secVal);
41-
} catch (Exception e) {
42-
return false;
43-
}
44-
}
35+
static boolean isEqualDouble(String first, String second) {
36+
try {
37+
double val = Double.parseDouble(first);
38+
double secVal = Double.parseDouble(second);
39+
return equals(val, secVal);
40+
} catch (Exception e) {
41+
return false;
42+
}
43+
}
4544

46-
static boolean equals(double a, double b) {
47-
if (a == b) {
48-
return true;
49-
}
50-
// If the difference is less than epsilon, treat as equal.
51-
return Math.abs(a - b) < 0.0001 * Math.max(Math.abs(a), Math.abs(b));
52-
}
45+
static boolean equals(double a, double b) {
46+
if (a == b) {
47+
return true;
48+
}
49+
// If the difference is less than epsilon, treat as equal.
50+
return Math.abs(a - b) < 0.0001 * Math.max(Math.abs(a), Math.abs(b));
51+
}
5352

54-
static List<String> getResultSetFirstColumnAsString(String queryString, Set<String> errors, Connection con,
55-
GlobalState<?> state) throws SQLException {
56-
if (state.getOptions().logEachSelect()) {
57-
// TODO: refactor me
58-
state.getLogger().writeCurrent(queryString);
59-
try {
60-
state.getLogger().getCurrentFileWriter().flush();
61-
} catch (IOException e) {
62-
// TODO Auto-generated catch block
63-
e.printStackTrace();
64-
}
65-
}
66-
QueryAdapter q = new QueryAdapter(queryString, errors);
67-
List<String> resultSet = new ArrayList<>();
68-
ResultSet result = null;
69-
try {
70-
result = q.executeAndGet(con);
71-
if (result == null) {
72-
throw new IgnoreMeException();
73-
}
74-
while (result.next()) {
75-
resultSet.add(result.getString(1));
76-
}
77-
result.getStatement().close();
78-
} catch (Exception e) {
79-
if (e instanceof IgnoreMeException) {
80-
throw e;
81-
}
82-
if (e instanceof NumberFormatException) {
83-
// https://github.com/tidb-challenge-program/bug-hunting-issue/issues/57
84-
throw new IgnoreMeException();
85-
}
86-
if (e.getMessage() == null) {
87-
throw new AssertionError(queryString, e);
88-
}
89-
for (String error : errors) {
90-
if (e.getMessage().contains(error)) {
91-
throw new IgnoreMeException();
92-
}
93-
}
94-
throw new AssertionError(queryString, e);
95-
} finally {
96-
if (result != null && !result.isClosed()) {
97-
result.getStatement().close();
98-
result.close();
99-
}
100-
}
101-
return resultSet;
102-
}
53+
static List<String> getResultSetFirstColumnAsString(String queryString, Set<String> errors, Connection con,
54+
GlobalState<?> state) throws SQLException {
55+
if (state.getOptions().logEachSelect()) {
56+
// TODO: refactor me
57+
state.getLogger().writeCurrent(queryString);
58+
try {
59+
state.getLogger().getCurrentFileWriter().flush();
60+
} catch (IOException e) {
61+
// TODO Auto-generated catch block
62+
e.printStackTrace();
63+
}
64+
}
65+
QueryAdapter q = new QueryAdapter(queryString, errors);
66+
List<String> resultSet = new ArrayList<>();
67+
ResultSet result = null;
68+
try {
69+
result = q.executeAndGet(con);
70+
if (result == null) {
71+
throw new IgnoreMeException();
72+
}
73+
while (result.next()) {
74+
resultSet.add(result.getString(1));
75+
}
76+
result.getStatement().close();
77+
} catch (Exception e) {
78+
if (e instanceof IgnoreMeException) {
79+
throw e;
80+
}
81+
if (e instanceof NumberFormatException) {
82+
// https://github.com/tidb-challenge-program/bug-hunting-issue/issues/57
83+
throw new IgnoreMeException();
84+
}
85+
if (e.getMessage() == null) {
86+
throw new AssertionError(queryString, e);
87+
}
88+
for (String error : errors) {
89+
if (e.getMessage().contains(error)) {
90+
throw new IgnoreMeException();
91+
}
92+
}
93+
throw new AssertionError(queryString, e);
94+
} finally {
95+
if (result != null && !result.isClosed()) {
96+
result.getStatement().close();
97+
result.close();
98+
}
99+
}
100+
return resultSet;
101+
}
103102

104103
}

src/sqlancer/GlobalState.java

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -7,78 +7,78 @@
77

88
public class GlobalState<O> {
99

10-
private Connection con;
11-
private Randomly r;
12-
private MainOptions options;
13-
private O dmbsSpecificOptions;
14-
private StateLogger logger;
15-
private StateToReproduce state;
16-
private QueryManager manager;
17-
private String databaseName;
18-
19-
public void setConnection(Connection con) {
20-
this.con = con;
21-
}
22-
23-
@SuppressWarnings("unchecked")
24-
public void setDmbsSpecificOptions(Object dmbsSpecificOptions) {
25-
this.dmbsSpecificOptions = (O) dmbsSpecificOptions;
26-
}
27-
28-
public O getDmbsSpecificOptions() {
29-
return dmbsSpecificOptions;
30-
}
31-
32-
public Connection getConnection() {
33-
return con;
34-
}
35-
36-
public void setRandomly(Randomly r) {
37-
this.r = r;
38-
}
39-
40-
public Randomly getRandomly() {
41-
return r;
42-
}
43-
44-
public MainOptions getOptions() {
45-
return options;
46-
}
47-
48-
public void setMainOptions(MainOptions options) {
49-
this.options = options;
50-
}
51-
52-
public void setStateLogger(StateLogger logger) {
53-
this.logger = logger;
54-
}
55-
56-
public StateLogger getLogger() {
57-
return logger;
58-
}
59-
60-
public void setState(StateToReproduce state) {
61-
this.state = state;
62-
}
63-
64-
public StateToReproduce getState() {
65-
return state;
66-
}
67-
68-
public QueryManager getManager() {
69-
return manager;
70-
}
71-
72-
public void setManager(QueryManager manager) {
73-
this.manager = manager;
74-
}
75-
76-
public String getDatabaseName() {
77-
return databaseName;
78-
}
79-
80-
public void setDatabaseName(String databaseName) {
81-
this.databaseName = databaseName;
82-
}
10+
private Connection con;
11+
private Randomly r;
12+
private MainOptions options;
13+
private O dmbsSpecificOptions;
14+
private StateLogger logger;
15+
private StateToReproduce state;
16+
private QueryManager manager;
17+
private String databaseName;
18+
19+
public void setConnection(Connection con) {
20+
this.con = con;
21+
}
22+
23+
@SuppressWarnings("unchecked")
24+
public void setDmbsSpecificOptions(Object dmbsSpecificOptions) {
25+
this.dmbsSpecificOptions = (O) dmbsSpecificOptions;
26+
}
27+
28+
public O getDmbsSpecificOptions() {
29+
return dmbsSpecificOptions;
30+
}
31+
32+
public Connection getConnection() {
33+
return con;
34+
}
35+
36+
public void setRandomly(Randomly r) {
37+
this.r = r;
38+
}
39+
40+
public Randomly getRandomly() {
41+
return r;
42+
}
43+
44+
public MainOptions getOptions() {
45+
return options;
46+
}
47+
48+
public void setMainOptions(MainOptions options) {
49+
this.options = options;
50+
}
51+
52+
public void setStateLogger(StateLogger logger) {
53+
this.logger = logger;
54+
}
55+
56+
public StateLogger getLogger() {
57+
return logger;
58+
}
59+
60+
public void setState(StateToReproduce state) {
61+
this.state = state;
62+
}
63+
64+
public StateToReproduce getState() {
65+
return state;
66+
}
67+
68+
public QueryManager getManager() {
69+
return manager;
70+
}
71+
72+
public void setManager(QueryManager manager) {
73+
this.manager = manager;
74+
}
75+
76+
public String getDatabaseName() {
77+
return databaseName;
78+
}
79+
80+
public void setDatabaseName(String databaseName) {
81+
this.databaseName = databaseName;
82+
}
8383

8484
}

src/sqlancer/IgnoreMeException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
public class IgnoreMeException extends RuntimeException {
44

5-
private static final long serialVersionUID = 1L;
5+
private static final long serialVersionUID = 1L;
66

77
}

0 commit comments

Comments
 (0)