Skip to content

Commit 6086e32

Browse files
RocMarshaltillrohrmann
authored andcommitted
[FLINK-23909][connector-jdbc][scala-shell][yarn] Remove redundant variables and improve some style format in coding.
This closes apache#16931.
1 parent b82acf9 commit 6086e32

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/JdbcDataTypeTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public static List<TestItem> testData() {
149149

150150
private static TestItem createTestItem(Object... args) {
151151
assert args.length >= 2;
152-
TestItem item = TestItem.fromDialetAndType((String) args[0], (String) args[1]);
152+
TestItem item = TestItem.fromDialectAndType((String) args[0], (String) args[1]);
153153
if (args.length == 3) {
154154
item.withExpectError((String) args[2]);
155155
}
@@ -193,7 +193,7 @@ private TestItem(String dialect, String dataTypeExpr) {
193193
this.dataTypeExpr = dataTypeExpr;
194194
}
195195

196-
static TestItem fromDialetAndType(String dialect, String dataTypeExpr) {
196+
static TestItem fromDialectAndType(String dialect, String dataTypeExpr) {
197197
return new TestItem(dialect, dataTypeExpr);
198198
}
199199

flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/catalog/PostgresCatalogTestBase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static TestTable getPrimitiveTable() {
189189
}
190190

191191
// TODO: add back timestamptz and time types.
192-
// Flink currently doens't support converting time's precision, with the following error
192+
// Flink currently doesn't support converting time's precision, with the following error
193193
// TableException: Unsupported conversion from data type 'TIME(6)' (conversion class:
194194
// java.sql.Time)
195195
// to type information. Only data types that originated from type information fully support a

flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcExactlyOnceSinkE2eTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ public void testInsert() throws Exception {
234234
insertedIds.toString(),
235235
insertedIds.size() == expectedIds.size() && expectedIds.containsAll(insertedIds));
236236
LOG.info(
237-
"Test insert for {} finished in {}ms", dbEnv, System.currentTimeMillis() - started);
237+
"Test insert for {} finished in {} ms.",
238+
dbEnv,
239+
System.currentTimeMillis() - started);
238240
}
239241

240242
@Override

flink-scala-shell/src/main/java/org/apache/flink/api/java/JarHelper.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,12 @@ public void jarDir(File dirOrFile2Jar, File destJar) throws IOException {
8686

8787
/** Unjars a given jar file into a given directory. */
8888
public void unjarDir(File jarFile, File destDir) throws IOException {
89-
BufferedOutputStream dest = null;
9089
FileInputStream fis = new FileInputStream(jarFile);
9190
unjar(fis, destDir);
9291
}
9392

9493
/** Given an InputStream on a jar file, unjars the contents into the given directory. */
9594
public void unjar(InputStream in, File destDir) throws IOException {
96-
BufferedOutputStream dest = null;
9795
JarInputStream jis = new JarInputStream(in);
9896
JarEntry entry;
9997
while ((entry = jis.getNextJarEntry()) != null) {
@@ -112,7 +110,7 @@ public void unjar(InputStream in, File destDir) throws IOException {
112110
System.out.println("unjarring " + destFile + " from " + entry.getName());
113111
}
114112
FileOutputStream fos = new FileOutputStream(destFile);
115-
dest = new BufferedOutputStream(fos, BUFFER_SIZE);
113+
BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE);
116114
try {
117115
while ((count = jis.read(data, 0, BUFFER_SIZE)) != -1) {
118116
dest.write(data, 0, count);

flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ public int run(String[] args) throws CliArgsException, FlinkException {
685685
}
686686

687687
private void shutdownCluster(
688-
ClusterClient clusterClient,
688+
ClusterClient<ApplicationId> clusterClient,
689689
ScheduledExecutorService scheduledExecutorService,
690690
YarnApplicationStatusMonitor yarnApplicationStatusMonitor) {
691691
try {
@@ -827,7 +827,7 @@ public static Map<String, String> getDynamicProperties(String dynamicPropertiesE
827827

828828
if (firstEquals >= 0) {
829829
String key = propLine.substring(0, firstEquals).trim();
830-
String value = propLine.substring(firstEquals + 1, propLine.length()).trim();
830+
String value = propLine.substring(firstEquals + 1).trim();
831831

832832
if (!key.isEmpty()) {
833833
properties.put(key, value);

0 commit comments

Comments
 (0)