Skip to content

Commit

Permalink
AVRO-2117: Cleanup Java - Fix spelling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbasjes committed Dec 29, 2017
1 parent 2e25d2e commit 4b69cb2
Show file tree
Hide file tree
Showing 42 changed files with 66 additions and 64 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ Trunk (not yet released)

AVRO-2119: Run Apache Rat check on every java build (Niels Basjes)

AVRO-2117: Overall cleanup of java code (Niels Basjes)

BUG FIXES

AVRO-1741: Python3: Fix error when codec is not in the header.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ Map<String,JsonNode> jsonProps(Map<String,String> stringProps) {
}

/**
* Return the defined properties as an unmodifieable Map.
* Return the defined properties as an unmodifiable Map.
* @deprecated use {@link #getObjectProps()}
*/
@Deprecated
public Map<String,JsonNode> getJsonProps() {
return Collections.unmodifiableMap(props);
}

/** Return the defined properties as an unmodifieable Map. */
/** Return the defined properties as an unmodifiable Map. */
public Map<String,Object> getObjectProps() {
Map<String,Object> result = new LinkedHashMap<String,Object>();
for (Map.Entry<String,JsonNode> e : props.entrySet())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Logical types provides an opt-in way to extend Avro's types. Logical types
* specify a way of representing a high-level type as a base Avro type. For
* example, a date is specified as the number of days after the unix epoch (or
* before using a negative value). This enables extentions to Avro's type
* before using a negative value). This enables extensions to Avro's type
* system without breaking binary compatibility. Older versions see the base
* type and ignore the logical type.
*/
Expand Down
2 changes: 1 addition & 1 deletion lang/java/avro/src/main/java/org/apache/avro/Schema.java
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public void addAlias(String alias) {
this.aliases = new LinkedHashSet<String>();
aliases.add(alias);
}
/** Return the defined aliases as an unmodifieable Set. */
/** Return the defined aliases as an unmodifiable Set. */
public Set<String> aliases() {
if (aliases == null)
return Collections.emptySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ final <T extends JsonProperties> T addPropsTo(T jsonable) {
* <p/>
* All Avro named types and fields have 'doc', 'aliases', and 'name'
* components. 'name' is required, and provided to this builder. 'doc' and
* 'alises' are optional.
* 'aliases' are optional.
*/
public static abstract class NamedBuilder<S extends NamedBuilder<S>> extends
PropBuilder<S> {
Expand Down Expand Up @@ -2027,7 +2027,7 @@ private FieldAssembler<R> addField(Field field) {
* Usage is to first configure any of the optional parameters and then to call one
* of the type methods to complete the field. For example
* <pre>
* .namespace("org.apache.example").orderDecending().type()
* .namespace("org.apache.example").orderDescending().type()
* </pre>
* Optional parameters for a field are namespace, doc, order, and aliases.
*/
Expand All @@ -2047,7 +2047,7 @@ public FieldBuilder<R> orderAscending() {
return self();
}

/** Set this field to have decending order. Decending is the default **/
/** Set this field to have descending order. Descending is the default **/
public FieldBuilder<R> orderDescending() {
order = Schema.Field.Order.DESCENDING;
return self();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static SchemaPairCompatibility checkReaderWriterCompatibility(
final Schema writer
) {
final SchemaCompatibilityResult compatibility =
new ReaderWriterCompatiblityChecker()
new ReaderWriterCompatibilityChecker()
.getCompatibility(reader, writer);

final String message;
Expand Down Expand Up @@ -194,7 +194,7 @@ public String toString() {
*
* <p> Provides memoization to handle recursive schemas. </p>
*/
private static final class ReaderWriterCompatiblityChecker {
private static final class ReaderWriterCompatibilityChecker {
private static final String ROOT_REFERENCE_TOKEN = "";
private final Map<ReaderWriter, SchemaCompatibilityResult> mMemoizeMap =
new HashMap<ReaderWriter, SchemaCompatibilityResult>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/** Collection of static methods for generating the cannonical form of
* schemas (see {@link #toParsingForm}) -- and fingerprints of cannonical
/** Collection of static methods for generating the canonical form of
* schemas (see {@link #toParsingForm}) -- and fingerprints of canonical
* forms ({@link #fingerprint}).
*/
public class SchemaNormalization {
Expand Down Expand Up @@ -54,7 +54,7 @@ public static String toParsingForm(Schema s) {
* MessageDigest#getInstance(String)}, which will throw
* <code>NoSuchAlgorithmException</code> if it doesn't recognize
* the name.
* <p> Recommended Avro practice dictiates that
* <p> Recommended Avro practice dictates that
* <code>"CRC-64-AVRO"</code> is used for 64-bit fingerprints,
* <code>"MD5"</code> is used for 128-bit fingerprints, and
* <code>"SHA-256"</code> is used for 256-bit fingerprints. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface SchemaValidator {
* Validate one schema against others. The order of the schemas to validate
* against is chronological from most recent to oldest, if there is a natural
* chronological order. This allows some validators to identify which schemas
* are the most "recent" in order to validate only against the mosst recent
* are the most "recent" in order to validate only against the most recent
* schema(s).
*
* @param toValidate The schema to validate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class Codec {
/**
* Codecs must implement an equals() method. Two codecs, A and B are equal
* if: the result of A and B decompressing content compressed by A is the same
* AND the retult of A and B decompressing content compressed by B is the same
* AND the result of A and B decompressing content compressed by B is the same
**/
@Override
public abstract boolean equals(Object other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public DataFileStream(InputStream in, DatumReader<D> reader)
}

/**
* create an unitialized DataFileStream
* create an uninitialized DataFileStream
*/
protected DataFileStream(DatumReader<D> reader) throws IOException {
this.reader = reader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public boolean check(BlockedValue prev, int pos) {
type == Schema.Type.ARRAY || type == Schema.Type.MAP);

assert 0 <= items;
assert 0 != items || start == pos; // 0==itms ==> start==pos
assert 1 < items || start == lastFullItem; // 1<=itms ==> start==lFI
assert items <= 1 || start <= lastFullItem; // 1<itms ==> start<=lFI
assert 0 != items || start == pos; // 0==items ==> start==pos
assert 1 < items || start == lastFullItem; // 1<=items ==> start==lFI
assert items <= 1 || start <= lastFullItem; // 1<items ==> start<=lFI
assert lastFullItem <= pos;

switch (state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static Symbol getSymbol(Schema schema) {
* Otherwise, this JsonDecoder will reset its state and then
* reconfigure its input.
* @param in
* The IntputStream to read from. Cannot be null.
* The InputStream to read from. Cannot be null.
* @throws IOException
* @return this JsonDecoder
*/
Expand Down Expand Up @@ -475,7 +475,7 @@ public Symbol doAction(Symbol input, Symbol top) throws IOException {
if (currentReorderBuffer == null) {
currentReorderBuffer = new ReorderBuffer();
}
currentReorderBuffer.savedFields.put(fn, getVaueAsTree(in));
currentReorderBuffer.savedFields.put(fn, getValueAsTree(in));
}
} while (in.getCurrentToken() == JsonToken.FIELD_NAME);
throw new AvroTypeException("Expected field name not found: " + fa.fname);
Expand Down Expand Up @@ -524,7 +524,7 @@ public JsonElement(JsonToken t) {
}
}

private static List<JsonElement> getVaueAsTree(JsonParser in) throws IOException {
private static List<JsonElement> getValueAsTree(JsonParser in) throws IOException {
int level = 0;
List<JsonElement> result = new ArrayList<JsonElement>();
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private ResolvingDecoder(Object resolver, Decoder in)
*
* @param writer The writer's schema. Cannot be null.
* @param reader The reader's schema. Cannot be null.
* @return The opaque reolver.
* @return The opaque resolver.
* @throws IOException
*/
public static Object resolve(Schema writer, Schema reader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public final Symbol generate(Schema writer, Schema reader)
* <tt>reader</tt> and returns the start symbol for the grammar generated.
* If there is already a symbol in the map <tt>seen</tt> for resolving the
* two schemas, then that symbol is returned. Otherwise a new symbol is
* generated and returnd.
* generated and returned.
* @param writer The schema used by the writer
* @param reader The schema used by the reader
* @param seen The &lt;reader-schema, writer-schema&gt; to symbol
Expand Down Expand Up @@ -119,7 +119,7 @@ public Symbol generate(Schema writer, Schema reader,
case UNION:
return resolveUnion(writer, reader, seen);
default:
throw new AvroTypeException("Unkown type for schema: " + writerType);
throw new AvroTypeException("Unknown type for schema: " + writerType);
}
} else { // writer and reader are of different types
if (writerType == Schema.Type.UNION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public enum Kind {
ROOT,
/** non-terminal symbol which is a sequence of one or more other symbols */
SEQUENCE,
/** non-termial to represent the contents of an array or map */
/** non-terminal to represent the contents of an array or map */
REPEATER,
/** non-terminal to represent the union */
ALTERNATIVE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.io.IOException;
import java.io.ObjectInput;

/** Helper to permit Externalizeable implementations that write to an
/** Helper to permit Externalizable implementations that write to an
* InputStream. */
class ExternalizableInput extends InputStream {
private final ObjectInput in;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.io.IOException;
import java.io.ObjectOutput;

/** Helper to permit Externalizeable implementations that write to an
/** Helper to permit Externalizable implementations that write to an
* OutputStream. */
class ExternalizableOutput extends OutputStream {
private final ObjectOutput out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static BufferedReader data() throws IOException
/** Compute the fingerprint of <i>bytes[s,s+l)</i> using a slow
algorithm that's an alternative to that implemented in {@link
SchemaNormalization}. Algo from Broder93 ("Some applications of Rabin's
fingerpringint method"). */
fingerprinting method"). */
public static long altFingerprint(String s) {
// In our algorithm, we multiply all inputs by x^64 (which is
// equivalent to prepending it with a single "1" bit followed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public boolean equals(Object other) {
/**
* Codecs must implement an equals() method. Two codecs, A and B are equal
* if: the result of A and B decompressing content compressed by A is the same
* AND the retult of A and B decompressing content compressed by B is the same
* AND the result of A and B decompressing content compressed by B is the same
*/
private boolean compareDecompress(Codec other, ByteBuffer original) throws IOException {
ByteBuffer compressedA = this.compress(original);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public <T> byte[] testSerialization(String testType, T ... entityObjs) throws Ex

/**
* Test that non-string map-keys are readable through GenericDatumReader
* This methoud should read as array of {key, value} and not as a map
* This method should read as array of {key, value} and not as a map
*/
private <T> List<GenericRecord> testGenericDatumRead
(String testType, byte[] bytes, T ... entityObjs) throws IOException {
Expand All @@ -287,7 +287,7 @@ public <T> byte[] testSerialization(String testType, T ... entityObjs) throws Ex

/**
* Test that non-string map-keys are readable through ReflectDatumReader
* This methoud should form the original map and should not return any
* This method should form the original map and should not return any
* array of {key, value} as done by {@link #testGenericDatumRead()}
*/
private <T> List<T> testReflectDatumRead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static Protocol resolve(final Protocol protocol) {
}
result.setTypes(newSchemas); // replace types with resolved ones

// Resolve all schemas refferenced by protocol Messages.
// Resolve all schemas referenced by protocol Messages.
for (Map.Entry<String, Protocol.Message> entry : protocol.getMessages().entrySet()) {
Protocol.Message value = entry.getValue();
Protocol.Message nvalue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import static org.apache.avro.Schema.Type.RECORD;

/**
* this visitor will create a clone of the original Schema with docs and other nonesential fields stripped
* this visitor will create a clone of the original Schema with docs and other nonessential fields stripped
* by default. what attributes are copied is customizable.
*/
public final class CloningVisitor implements SchemaVisitor<Schema> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void writeTests() throws Exception {


/**
* An invididual comparison test
* An individual comparison test
*/
private static class GenTest {
private final File in, expectedOut;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static void assertCompilesWithJavaCompiler(Collection<SpecificCompiler.OutputFil
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
switch (diagnostic.getKind()) {
case ERROR:
// Do not add these to warnings becuase they will fail the compile, anyway.
// Do not add these to warnings because they will fail the compile, anyway.
LOG.error("{}", diagnostic);
break;
case WARNING:
Expand Down Expand Up @@ -325,7 +325,7 @@ public void testSettingOutputCharacterEncoding() throws Exception {
is.read(fileInDefaultEncoding);
is.close(); //close input stream otherwise delete might fail
if (!this.outputFile.delete()) {
throw new IllegalStateException("unable to delete " + this.outputFile); //delete otherwise compiler might not overwrite because src timestamp hasnt changed.
throw new IllegalStateException("unable to delete " + this.outputFile); //delete otherwise compiler might not overwrite because src timestamp hasn't changed.
}
// Generate file in another encoding (make sure it has different number of bytes per character)
String differentEncoding = Charset.defaultCharset().equals(Charset.forName("UTF-16")) ? "UTF-32" : "UTF-16";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type" : "record",
"name" : "UnionAndFixedFields",
"doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in genrated code",
"doc" : "Schema for UnionAndFixedFields designed to trigger fixed compiler warnings in generated code",
"namespace" : "org.apache.avro.specific",
"fields" : [ {
"name" : "u",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
e.getChannel().write(dataPack);
}
} catch (IOException ex) {
LOG.warn("unexpect error");
LOG.warn("unexpected error");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void setError(Exception error) {

/**
* The exception generated at the server,
* or null if no such exception has occured
* or null if no such exception has occurred
* @return the exception generated at the server, or
* null if no such exception
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public List<ByteBuffer> respond(List<ByteBuffer> buffers) throws IOException {
}

/** Called by a server to deserialize a request, compute and serialize a
* response or error. Transciever is used by connection-based servers to
* response or error. Transceiver is used by connection-based servers to
* track handshake status of connection. */
public List<ByteBuffer> respond(List<ByteBuffer> buffers,
Transceiver connection) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ protected DatumReader<Object> getDatumReader(Schema writer, Schema reader) {
}

/** Create a proxy instance whose methods invoke RPCs. */
public static <T> T getClient(Class<T> iface, Transceiver transciever)
public static <T> T getClient(Class<T> iface, Transceiver transceiver)
throws IOException {
return getClient(iface, transciever,
return getClient(iface, transceiver,
new ReflectData(iface.getClassLoader()));
}

/** Create a proxy instance whose methods invoke RPCs. */
@SuppressWarnings("unchecked")
public static <T> T getClient(Class<T> iface, Transceiver transciever,
public static <T> T getClient(Class<T> iface, Transceiver transceiver,
ReflectData reflectData) throws IOException {
Protocol protocol = reflectData.getProtocol(iface);
return (T)Proxy.newProxyInstance
(reflectData.getClassLoader(),
new Class[] { iface },
new ReflectRequestor(protocol, transciever, reflectData));
new ReflectRequestor(protocol, transceiver, reflectData));
}

/** Create a proxy instance whose methods invoke RPCs. */
Expand Down
Loading

0 comments on commit 4b69cb2

Please sign in to comment.