Skip to content

Commit d618df2

Browse files
committed
Reformat all files.
1 parent 977c454 commit d618df2

File tree

173 files changed

+11302
-10139
lines changed

Some content is hidden

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

173 files changed

+11302
-10139
lines changed

buildSrc/src/main/groovy/dwh-migration-dumper.java-common-conventions.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ spotless {
181181

182182
java {
183183
googleJavaFormat()
184-
ratchetFrom("v1.0.20")
185184
licenseHeaderFile rootProject.file("gradle/codequality/HEADER.java");
186185
trimTrailingWhitespace();
187186
FileCollection files = files();

dumper/app/src/main/java/com/google/edwmigration/dumper/application/dumper/DefaultArguments.java

Lines changed: 107 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -39,131 +39,125 @@
3939
import org.slf4j.Logger;
4040
import org.slf4j.LoggerFactory;
4141

42-
/**
43-
*
44-
* @author shevek
45-
*/
42+
/** @author shevek */
4643
public class DefaultArguments {
4744

48-
@SuppressWarnings("UnusedVariable")
49-
private static final Logger LOG = LoggerFactory.getLogger(DefaultArguments.class);
50-
51-
public static class BooleanValueConverter implements ValueConverter<Boolean> {
52-
53-
private final String[] V_TRUE = {"true", "t", "yes", "y", "1"};
54-
private final String[] V_FALSE = {"false", "f", "no", "n", "0"};
55-
56-
public static BooleanValueConverter INSTANCE = new BooleanValueConverter();
57-
58-
private BooleanValueConverter() {
59-
}
60-
61-
@Override
62-
public Boolean convert(String value) {
63-
for (String s : V_TRUE)
64-
if (value.equalsIgnoreCase(s))
65-
return Boolean.TRUE;
66-
for (String s : V_FALSE)
67-
if (value.equalsIgnoreCase(s))
68-
return Boolean.FALSE;
69-
throw new ValueConversionException("Not a valid boolean value: " + value);
70-
}
71-
72-
@Override
73-
public Class<? extends Boolean> valueType() {
74-
return Boolean.class;
75-
}
76-
77-
@Override
78-
public String valuePattern() {
79-
StringBuilder buf = new StringBuilder();
80-
Joiner joiner = Joiner.on('/');
81-
joiner.appendTo(buf, V_TRUE);
82-
buf.append('/');
83-
joiner.appendTo(buf, V_FALSE);
84-
return buf.toString();
85-
}
86-
}
45+
@SuppressWarnings("UnusedVariable")
46+
private static final Logger LOG = LoggerFactory.getLogger(DefaultArguments.class);
8747

88-
private static final String PRODUCT_GROUP = "com.google.edwmigration.dumper";
89-
private static final String PRODUCT_CORE_MODULE = "app";
48+
public static class BooleanValueConverter implements ValueConverter<Boolean> {
9049

91-
protected final OptionParser parser = new OptionParser();
92-
private final OptionSpec<?> helpOption = parser.accepts("help", "Displays command-line help.").forHelp();
93-
private final OptionSpec<?> versionOption = parser.accepts("version", "Displays the product version and exits.").forHelp();
94-
private final String[] args;
95-
private OptionSet options;
50+
private final String[] V_TRUE = {"true", "t", "yes", "y", "1"};
51+
private final String[] V_FALSE = {"false", "f", "no", "n", "0"};
9652

97-
@SuppressWarnings("EI_EXPOSE_REP2")
98-
public DefaultArguments(@Nonnull String[] args) {
99-
this.args = args;
100-
}
53+
public static BooleanValueConverter INSTANCE = new BooleanValueConverter();
10154

102-
@Nonnull
103-
@SuppressWarnings("EI_EXPOSE_REP")
104-
public String[] getArgs() {
105-
return args;
106-
}
55+
private BooleanValueConverter() {}
10756

108-
// Any description starting with UNDOCUMENTED: is ... undocumented
109-
protected void printHelpOn(@Nonnull PrintStream out, OptionSet o) throws IOException {
110-
111-
BuiltinHelpFormatter helpFormatter = new BuiltinHelpFormatter(120, 4) {
112-
@Override
113-
public String format(Map<String, ? extends OptionDescriptor> options) {
114-
115-
//https://github.com/jopt-simple/jopt-simple/blob/master/src/main/java/joptsimple/BuiltinHelpFormatter.java#L91
116-
Comparator<OptionDescriptor> comparator
117-
= (first, second)
118-
-> first.options().iterator().next().compareTo(second.options().iterator().next());
119-
Set<OptionDescriptor> sorted = new TreeSet<>(comparator);
57+
@Override
58+
public Boolean convert(String value) {
59+
for (String s : V_TRUE) if (value.equalsIgnoreCase(s)) return Boolean.TRUE;
60+
for (String s : V_FALSE) if (value.equalsIgnoreCase(s)) return Boolean.FALSE;
61+
throw new ValueConversionException("Not a valid boolean value: " + value);
62+
}
12063

121-
sorted.addAll(options.values()
122-
.stream()
123-
.filter((val) -> !val.description().startsWith("UNDOCUMENTED:"))
124-
.collect(Collectors.toList()));
64+
@Override
65+
public Class<? extends Boolean> valueType() {
66+
return Boolean.class;
67+
}
12568

126-
this.addRows(sorted);
127-
return this.formattedHelpOutput();
128-
}
69+
@Override
70+
public String valuePattern() {
71+
StringBuilder buf = new StringBuilder();
72+
Joiner joiner = Joiner.on('/');
73+
joiner.appendTo(buf, V_TRUE);
74+
buf.append('/');
75+
joiner.appendTo(buf, V_FALSE);
76+
return buf.toString();
77+
}
78+
}
79+
80+
private static final String PRODUCT_GROUP = "com.google.edwmigration.dumper";
81+
private static final String PRODUCT_CORE_MODULE = "app";
82+
83+
protected final OptionParser parser = new OptionParser();
84+
private final OptionSpec<?> helpOption =
85+
parser.accepts("help", "Displays command-line help.").forHelp();
86+
private final OptionSpec<?> versionOption =
87+
parser.accepts("version", "Displays the product version and exits.").forHelp();
88+
private final String[] args;
89+
private OptionSet options;
90+
91+
@SuppressWarnings("EI_EXPOSE_REP2")
92+
public DefaultArguments(@Nonnull String[] args) {
93+
this.args = args;
94+
}
95+
96+
@Nonnull
97+
@SuppressWarnings("EI_EXPOSE_REP")
98+
public String[] getArgs() {
99+
return args;
100+
}
101+
102+
// Any description starting with UNDOCUMENTED: is ... undocumented
103+
protected void printHelpOn(@Nonnull PrintStream out, OptionSet o) throws IOException {
104+
105+
BuiltinHelpFormatter helpFormatter =
106+
new BuiltinHelpFormatter(120, 4) {
107+
@Override
108+
public String format(Map<String, ? extends OptionDescriptor> options) {
109+
110+
// https://github.com/jopt-simple/jopt-simple/blob/master/src/main/java/joptsimple/BuiltinHelpFormatter.java#L91
111+
Comparator<OptionDescriptor> comparator =
112+
(first, second) ->
113+
first.options().iterator().next().compareTo(second.options().iterator().next());
114+
Set<OptionDescriptor> sorted = new TreeSet<>(comparator);
115+
116+
sorted.addAll(
117+
options.values().stream()
118+
.filter((val) -> !val.description().startsWith("UNDOCUMENTED:"))
119+
.collect(Collectors.toList()));
120+
121+
this.addRows(sorted);
122+
return this.formattedHelpOutput();
123+
}
129124
};
130-
parser.formatHelpWith(helpFormatter);
131-
132-
parser.printHelpOn(out);
125+
parser.formatHelpWith(helpFormatter);
126+
127+
parser.printHelpOn(out);
128+
}
129+
130+
@Nonnull
131+
@SuppressWarnings("DM_EXIT")
132+
protected OptionSet parseOptions() throws Exception {
133+
OptionSet o = parser.parse(args);
134+
if (o.has(helpOption)) {
135+
printHelpOn(System.err, o);
136+
System.exit(1);
133137
}
134-
135-
@Nonnull
136-
@SuppressWarnings("DM_EXIT")
137-
protected OptionSet parseOptions() throws Exception {
138-
OptionSet o = parser.parse(args);
139-
if (o.has(helpOption)) {
140-
printHelpOn(System.err, o);
141-
System.exit(1);
142-
}
143-
if (o.has(versionOption)) {
144-
System.err.println(new ProductMetadata().getModule(PRODUCT_GROUP + ":" + PRODUCT_CORE_MODULE));
145-
System.exit(1);
146-
}
147-
return o;
138+
if (o.has(versionOption)) {
139+
System.err.println(
140+
new ProductMetadata().getModule(PRODUCT_GROUP + ":" + PRODUCT_CORE_MODULE));
141+
System.exit(1);
148142
}
149-
150-
@Nonnull
151-
public OptionSet getOptions() {
152-
if (options == null) {
153-
try {
154-
options = parseOptions();
155-
} catch (Exception e) {
156-
Throwables.throwIfUnchecked(e);
157-
throw new RuntimeException(e);
158-
}
159-
}
160-
return options;
143+
return o;
144+
}
145+
146+
@Nonnull
147+
public OptionSet getOptions() {
148+
if (options == null) {
149+
try {
150+
options = parseOptions();
151+
} catch (Exception e) {
152+
Throwables.throwIfUnchecked(e);
153+
throw new RuntimeException(e);
154+
}
161155
}
156+
return options;
157+
}
162158

163-
@Override
164-
public String toString() {
165-
return MoreObjects.toStringHelper(this)
166-
.add("args", Arrays.toString(args))
167-
.toString();
168-
}
159+
@Override
160+
public String toString() {
161+
return MoreObjects.toStringHelper(this).add("args", Arrays.toString(args)).toString();
162+
}
169163
}

dumper/app/src/main/java/com/google/edwmigration/dumper/application/dumper/DumperDiagnosticQuery.java

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,27 @@
3030
import org.anarres.jdiagnostics.XalanQuery;
3131
import org.anarres.jdiagnostics.XercesQuery;
3232

33-
/**
34-
*
35-
* @author shevek
36-
*/
33+
/** @author shevek */
3734
public class DumperDiagnosticQuery extends CompositeQuery {
3835

39-
public DumperDiagnosticQuery(Throwable t) {
40-
add(new SystemPropertiesQuery());
41-
add(new SAXQuery());
42-
add(new DOMQuery());
43-
add(new JAXPQuery());
44-
add(new ClassPathQuery());
45-
// add(new XSLTQuery());
46-
add(new EnvironmentQuery());
47-
// add(new AntQuery());
48-
add(new XalanQuery());
49-
add(new XercesQuery());
50-
add(new TmpDirQuery());
51-
// add(new ProcessEnvironmentQuery());
52-
add(new ProductMetadataQuery());
53-
add(new ThrowableQuery(t));
54-
55-
add(new ClassLoaderQuery("system", String.class.getClassLoader()));
56-
add(new ClassLoaderQuery("threadcontext", Thread.currentThread().getContextClassLoader()));
57-
add(new ClassLoaderQuery("jdiagnostics", getClass().getClassLoader()));
58-
}
36+
public DumperDiagnosticQuery(Throwable t) {
37+
add(new SystemPropertiesQuery());
38+
add(new SAXQuery());
39+
add(new DOMQuery());
40+
add(new JAXPQuery());
41+
add(new ClassPathQuery());
42+
// add(new XSLTQuery());
43+
add(new EnvironmentQuery());
44+
// add(new AntQuery());
45+
add(new XalanQuery());
46+
add(new XercesQuery());
47+
add(new TmpDirQuery());
48+
// add(new ProcessEnvironmentQuery());
49+
add(new ProductMetadataQuery());
50+
add(new ThrowableQuery(t));
5951

52+
add(new ClassLoaderQuery("system", String.class.getClassLoader()));
53+
add(new ClassLoaderQuery("threadcontext", Thread.currentThread().getContextClassLoader()));
54+
add(new ClassLoaderQuery("jdiagnostics", getClass().getClassLoader()));
55+
}
6056
}

dumper/app/src/main/java/com/google/edwmigration/dumper/application/dumper/MetadataDumperUsageException.java

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,32 @@
2121
import javax.annotation.Nonnull;
2222

2323
/**
24-
* For exceptions that should halt the dumper, but for which
25-
* we do not need to show the user a stack trace (i.e.,
26-
* invalid arguments to the dumper). Do not use this for
27-
* JDBC/filesystem/etc issues; if a customer experiences any of those,
28-
* we want to know all of the gory details.
24+
* For exceptions that should halt the dumper, but for which we do not need to show the user a stack
25+
* trace (i.e., invalid arguments to the dumper). Do not use this for JDBC/filesystem/etc issues; if
26+
* a customer experiences any of those, we want to know all of the gory details.
2927
*
3028
* @author matt
3129
*/
3230
public class MetadataDumperUsageException extends Exception {
3331

34-
private final List<String> msgs;
32+
private final List<String> msgs;
3533

36-
@SuppressWarnings("unchecked")
37-
public MetadataDumperUsageException(@Nonnull String msg) {
38-
this(msg, Collections.emptyList());
39-
}
34+
@SuppressWarnings("unchecked")
35+
public MetadataDumperUsageException(@Nonnull String msg) {
36+
this(msg, Collections.emptyList());
37+
}
4038

41-
public MetadataDumperUsageException(@Nonnull String msg, @Nonnull List<String> msgs) {
42-
super(msg);
43-
this.msgs = msgs;
44-
}
39+
public MetadataDumperUsageException(@Nonnull String msg, @Nonnull List<String> msgs) {
40+
super(msg);
41+
this.msgs = msgs;
42+
}
4543

46-
public List<String> getMessages() {
47-
return msgs;
48-
}
49-
50-
@Override
51-
public String toString() {
52-
return this.getMessage() + "\n" + String.join("\n", msgs);
53-
}
44+
public List<String> getMessages() {
45+
return msgs;
46+
}
5447

48+
@Override
49+
public String toString() {
50+
return this.getMessage() + "\n" + String.join("\n", msgs);
51+
}
5552
}

dumper/app/src/main/java/com/google/edwmigration/dumper/application/dumper/annotations/RespectsArgumentAssessment.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,27 @@
1616
*/
1717
package com.google.edwmigration.dumper.application.dumper.annotations;
1818

19+
import com.google.edwmigration.dumper.application.dumper.ConnectorArguments;
1920
import java.lang.annotation.Documented;
2021
import java.lang.annotation.ElementType;
2122
import java.lang.annotation.Inherited;
2223
import java.lang.annotation.Retention;
2324
import java.lang.annotation.RetentionPolicy;
2425
import java.lang.annotation.Target;
25-
import com.google.edwmigration.dumper.application.dumper.ConnectorArguments;
2626

27-
/**
28-
*
29-
* @author frsv
30-
*/
27+
/** @author frsv */
3128
@Target(ElementType.TYPE)
3229
@Retention(RetentionPolicy.RUNTIME)
3330
@Documented
3431
@Inherited
35-
@RespectsInput(order = 2000, arg = ConnectorArguments.OPT_ASSESSMENT, description = RespectsArgumentAssessment.DESCRIPTION, required = RespectsArgumentAssessment.REQUIRED)
32+
@RespectsInput(
33+
order = 2000,
34+
arg = ConnectorArguments.OPT_ASSESSMENT,
35+
description = RespectsArgumentAssessment.DESCRIPTION,
36+
required = RespectsArgumentAssessment.REQUIRED)
3637
public @interface RespectsArgumentAssessment {
3738

38-
String DESCRIPTION = "Whether to dump additional data for Migration Assessment in the service compatible format.";
39-
String REQUIRED = "when dumping for BigQuery Migration Assessment service";
39+
String DESCRIPTION =
40+
"Whether to dump additional data for Migration Assessment in the service compatible format.";
41+
String REQUIRED = "when dumping for BigQuery Migration Assessment service";
4042
}

0 commit comments

Comments
 (0)