Skip to content

Commit

Permalink
Issue #2080: Fix typos in code
Browse files Browse the repository at this point in the history
  • Loading branch information
mkordas committed Sep 21, 2015
1 parent 03f2be4 commit 0c2a64d
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java
Expand Up @@ -20,7 +20,7 @@
package com.puppycrawl.tools.checkstyle.api; package com.puppycrawl.tools.checkstyle.api;


/** /**
* A block of text from an inputfile that does not necessarily * A block of text from an input file that does not necessarily
* have any grammatical structure. * have any grammatical structure.
* *
* @author lkuehne * @author lkuehne
Expand All @@ -36,28 +36,28 @@ public interface TextBlock {
String[] getText(); String[] getText();


/** /**
* The line in the inputfile where the text block starts. * The line in the input file where the text block starts.
* Counting starts from 1. * Counting starts from 1.
* @return first line of the text block * @return first line of the text block
*/ */
int getStartLineNo(); int getStartLineNo();


/** /**
* The last line of the text block in the inputfile. * The last line of the text block in the input file.
* Counting starts from 1. * Counting starts from 1.
* @return last line of the text block * @return last line of the text block
*/ */
int getEndLineNo(); int getEndLineNo();


/** /**
* The column in the inputfile where the text block starts. * The column in the input file where the text block starts.
* Counting starts from 0. * Counting starts from 0.
* @return first line of the text block * @return first line of the text block
*/ */
int getStartColNo(); int getStartColNo();


/** /**
* The column in the inputfile where the text block ends. * The column in the input file where the text block ends.
* Counting starts from 0. * Counting starts from 0.
* @return last line of the text block * @return last line of the text block
*/ */
Expand Down
Expand Up @@ -2798,7 +2798,7 @@ public final class TokenTypes {
* <pre> * <pre>
* SOME_CONSTANT(1) * SOME_CONSTANT(1)
* { * {
* public void someMethodOverridenFromMainBody() * public void someMethodOverriddenFromMainBody()
* { * {
* } * }
* } * }
Expand Down Expand Up @@ -2828,7 +2828,7 @@ public final class TokenTypes {
* +--TYPE * +--TYPE
* | * |
* +--LITERAL_void (void) * +--LITERAL_void (void)
* +--IDENT (someMethodOverridenFromMainBody) * +--IDENT (someMethodOverriddenFromMainBody)
* +--LPAREN (() * +--LPAREN (()
* +--PARAMETERS * +--PARAMETERS
* +--RPAREN ()) * +--RPAREN ())
Expand Down Expand Up @@ -3323,10 +3323,10 @@ public final class TokenTypes {
public static final int LAMBDA = GeneratedJavaTokenTypes.LAMBDA; public static final int LAMBDA = GeneratedJavaTokenTypes.LAMBDA;


/** /**
* Begining of single line comment: '//'. * Beginning of single line comment: '//'.
* *
* <pre> * <pre>
* +--SINLE_LINE_COMMENT * +--SINGLE_LINE_COMMENT
* | * |
* +--COMMENT_CONTENT * +--COMMENT_CONTENT
* </pre> * </pre>
Expand All @@ -3335,7 +3335,7 @@ public final class TokenTypes {
GeneratedJavaTokenTypes.SINGLE_LINE_COMMENT; GeneratedJavaTokenTypes.SINGLE_LINE_COMMENT;


/** /**
* Begining of block comment: '/*'. * Beginning of block comment: '/*'.
* *
* <pre> * <pre>
* +--BLOCK_COMMENT_BEGIN * +--BLOCK_COMMENT_BEGIN
Expand Down Expand Up @@ -3364,7 +3364,7 @@ public final class TokenTypes {
* Text of single-line or block comment. * Text of single-line or block comment.
* *
*<pre> *<pre>
* +--SINLE_LINE_COMMENT * +--SINGLE_LINE_COMMENT
* | * |
* +--COMMENT_CONTENT * +--COMMENT_CONTENT
* </pre> * </pre>
Expand Down
Expand Up @@ -229,7 +229,7 @@ public void visitToken(DetailAST ast) {
for (String value : values) { for (String value : values) {
String checkName = value; String checkName = value;
// strip off the checkstyle-only prefix if present // strip off the checkstyle-only prefix if present
checkName = removeChecktylePrefixIfExests(checkName); checkName = removeCheckstylePrefixIfExists(checkName);
entries.add(new Entry(checkName, firstLine, firstColumn, entries.add(new Entry(checkName, firstLine, firstColumn,
lastLine, lastColumn)); lastLine, lastColumn));
} }
Expand All @@ -244,7 +244,7 @@ public void visitToken(DetailAST ast) {
* - name of the check * - name of the check
* @return check name without prefix * @return check name without prefix
*/ */
private static String removeChecktylePrefixIfExests(String checkName) { private static String removeCheckstylePrefixIfExists(String checkName) {
String result = checkName; String result = checkName;
if (checkName.startsWith(CHECKSTYLE_PREFIX)) { if (checkName.startsWith(CHECKSTYLE_PREFIX)) {
result = checkName.substring(CHECKSTYLE_PREFIX.length()); result = checkName.substring(CHECKSTYLE_PREFIX.length());
Expand Down
Expand Up @@ -213,7 +213,7 @@ private Set<Object> loadKeys(File file) {


/** /**
* Helper method to log an io exception. * Helper method to log an io exception.
* @param ex the exception that occured * @param ex the exception that occurred
* @param file the file that could not be processed * @param file the file that could not be processed
*/ */
private void logIOException(IOException ex, File file) { private void logIOException(IOException ex, File file) {
Expand All @@ -234,7 +234,7 @@ private void logIOException(IOException ex, File file) {
final SortedSet<LocalizedMessage> messages = Sets.newTreeSet(); final SortedSet<LocalizedMessage> messages = Sets.newTreeSet();
messages.add(message); messages.add(message);
getMessageDispatcher().fireErrors(file.getPath(), messages); getMessageDispatcher().fireErrors(file.getPath(), messages);
LOG.debug("IOException occured.", ex); LOG.debug("IOException occurred.", ex);
} }


/** /**
Expand Down
Expand Up @@ -222,8 +222,8 @@ private static boolean checkParams(DetailAST method) {
final DetailAST params = method.findFirstToken(TokenTypes.PARAMETERS); final DetailAST params = method.findFirstToken(TokenTypes.PARAMETERS);


if (params.getChildCount() == 1) { if (params.getChildCount() == 1) {
final DetailAST paratype = params.getFirstChild().findFirstToken(TokenTypes.TYPE); final DetailAST parameterType = params.getFirstChild().findFirstToken(TokenTypes.TYPE);
final DetailAST arrayDecl = paratype.findFirstToken(TokenTypes.ARRAY_DECLARATOR); final DetailAST arrayDecl = parameterType.findFirstToken(TokenTypes.ARRAY_DECLARATOR);


if (arrayDecl != null) { if (arrayDecl != null) {
final DetailAST arrayType = arrayDecl.getFirstChild(); final DetailAST arrayType = arrayDecl.getFirstChild();
Expand Down
Expand Up @@ -64,8 +64,8 @@ public void testMessageInEnglish() {


@Test @Test
public void testBundleReloadUrlNull() throws IOException { public void testBundleReloadUrlNull() throws IOException {
LocalizedMessage.UTF8Control cntrl = new LocalizedMessage.UTF8Control(); LocalizedMessage.UTF8Control control = new LocalizedMessage.UTF8Control();
cntrl.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", control.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages",
Locale.ENGLISH, "java.class", Locale.ENGLISH, "java.class",
Thread.currentThread().getContextClassLoader(), true); Thread.currentThread().getContextClassLoader(), true);
} }
Expand All @@ -82,8 +82,8 @@ public void testBundleReloadUrlNotNull() throws IOException {
String resource = "com/puppycrawl/tools/checkstyle/checks/coding/messages_en.properties"; String resource = "com/puppycrawl/tools/checkstyle/checks/coding/messages_en.properties";
when(classloader.getResource(resource)).thenReturn(url); when(classloader.getResource(resource)).thenReturn(url);


LocalizedMessage.UTF8Control cntrl = new LocalizedMessage.UTF8Control(); LocalizedMessage.UTF8Control control = new LocalizedMessage.UTF8Control();
cntrl.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", control.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages",
Locale.ENGLISH, "java.class", Locale.ENGLISH, "java.class",
classloader, true); classloader, true);
} }
Expand All @@ -97,8 +97,8 @@ public void testBundleReloadUrlNotNullStreamNull() throws IOException {
URL url = getMockUrl(null); URL url = getMockUrl(null);
when(classloader.getResource(resource)).thenReturn(url); when(classloader.getResource(resource)).thenReturn(url);


LocalizedMessage.UTF8Control cntrl = new LocalizedMessage.UTF8Control(); LocalizedMessage.UTF8Control control = new LocalizedMessage.UTF8Control();
cntrl.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", control.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages",
Locale.ENGLISH, "java.class", Locale.ENGLISH, "java.class",
classloader, true); classloader, true);
} }
Expand Down
Expand Up @@ -136,7 +136,7 @@ public void testResolveQualifiedNameFails() throws Exception {
ClassResolver classResolver = PowerMockito.spy(new ClassResolver(Thread ClassResolver classResolver = PowerMockito.spy(new ClassResolver(Thread
.currentThread().getContextClassLoader(), "", imports)); .currentThread().getContextClassLoader(), "", imports));


PowerMockito.doThrow(new ClassNotFoundException("excpected exception")) PowerMockito.doThrow(new ClassNotFoundException("expected exception"))
.when(classResolver, "safeLoad", anyObject()); .when(classResolver, "safeLoad", anyObject());
PowerMockito.doReturn(true).when(classResolver, "isLoadable", anyObject()); PowerMockito.doReturn(true).when(classResolver, "isLoadable", anyObject());


Expand All @@ -147,7 +147,7 @@ public void testResolveQualifiedNameFails() throws Exception {
catch (IllegalStateException e) { catch (IllegalStateException e) {
// expected // expected
assertTrue(e.getCause() instanceof ClassNotFoundException); assertTrue(e.getCause() instanceof ClassNotFoundException);
assertTrue(e.getMessage().endsWith("excpected exception")); assertTrue(e.getMessage().endsWith("expected exception"));
} }
} }
} }
Expand Up @@ -169,8 +169,8 @@ public void testWrongFile() throws Exception {
File impossibleFile = new File(""); File impossibleFile = new File("");
Set<LocalizedMessage> messages = check.process(impossibleFile, Lists.newArrayList("txt")); Set<LocalizedMessage> messages = check.process(impossibleFile, Lists.newArrayList("txt"));
assertEquals(1, messages.size()); assertEquals(1, messages.size());
Iterator<LocalizedMessage> iter = messages.iterator(); Iterator<LocalizedMessage> iterator = messages.iterator();
assertEquals("Unable to open ''.", iter.next().getMessage()); assertEquals("Unable to open ''.", iterator.next().getMessage());
} }


@Test @Test
Expand Down
Expand Up @@ -99,7 +99,7 @@ public void testNotFoundKey() throws Exception {
} }


/** /**
* Tests IO exception, that can orrur during reading of properties file. * Tests IO exception, that can occur during reading of properties file.
*/ */
@Test @Test
public void testIOException() throws Exception { public void testIOException() throws Exception {
Expand Down
Expand Up @@ -51,7 +51,7 @@ public void testWithChecker()
} }


@Test @Test
public void testAcceptableTockens() { public void testAcceptableTokens() {
int[] expected = {TokenTypes.NUM_LONG }; int[] expected = {TokenTypes.NUM_LONG };
UpperEllCheck check = new UpperEllCheck(); UpperEllCheck check = new UpperEllCheck();
int[] actual = check.getAcceptableTokens(); int[] actual = check.getAcceptableTokens();
Expand Down

0 comments on commit 0c2a64d

Please sign in to comment.