Skip to content

Commit

Permalink
Configuring check style for this project
Browse files Browse the repository at this point in the history
  • Loading branch information
ropalka committed Jun 13, 2016
1 parent c7d7c1f commit a2a013f
Show file tree
Hide file tree
Showing 19 changed files with 112 additions and 83 deletions.
30 changes: 30 additions & 0 deletions pom.xml
Expand Up @@ -40,6 +40,7 @@
<properties>
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
<version.org.wildfly.checkstyle-config>1.0.4.Final</version.org.wildfly.checkstyle-config>
</properties>

<dependencies>
Expand All @@ -65,6 +66,35 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${version.checkstyle.plugin}</version>
<configuration>
<configLocation>wildfly-checkstyle/checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<excludes>**/*$logger.java,**/*$bundle.java</excludes>
<useFile/>
</configuration>
<dependencies>
<dependency>
<groupId>org.wildfly.checkstyle</groupId>
<artifactId>wildfly-checkstyle-config</artifactId>
<version>${version.org.wildfly.checkstyle-config}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>check-style</id>
<phase>compile</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>${version.antrun.plugin}</version>
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/org/jboss/dmr/Base64.java
Expand Up @@ -65,37 +65,37 @@ class Base64 {

/* ******** P U B L I C F I E L D S ******** */
/** No options specified. Value is zero. */
public final static int NO_OPTIONS = 0;
public static final int NO_OPTIONS = 0;

/** Specify encoding. */
public final static int ENCODE = 1;
public static final int ENCODE = 1;

/** Specify decoding. */
public final static int DECODE = 0;
public static final int DECODE = 0;

/** Specify that data should be gzip-compressed. */
public final static int GZIP = 2;
public static final int GZIP = 2;

/** Don't break lines when encoding (violates strict Base64 specification) */
public final static int DONT_BREAK_LINES = 8;
public static final int DONT_BREAK_LINES = 8;

/* ******** P R I V A T E F I E L D S ******** */

/** Maximum line length (76) of Base64 output. */
private final static int MAX_LINE_LENGTH = 76;
private static final int MAX_LINE_LENGTH = 76;

/** The equals sign (=) as a byte. */
private final static byte EQUALS_SIGN = (byte) '=';
private static final byte EQUALS_SIGN = (byte) '=';

/** The new line character (\n) as a byte. */
private final static byte NEW_LINE = (byte) '\n';
private static final byte NEW_LINE = (byte) '\n';

/** Preferred encoding. */
private final static String PREFERRED_ENCODING = "UTF-8";
private static final String PREFERRED_ENCODING = "UTF-8";

/** The 64 valid Base64 values. */
private final static byte[] ALPHABET;
private final static byte[] _NATIVE_ALPHABET = /* May be something funny like EBCDIC */
private static final byte[] ALPHABET;
private static final byte[] _NATIVE_ALPHABET = /* May be something funny like EBCDIC */
{ (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J',
(byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S',
(byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b',
Expand All @@ -118,7 +118,7 @@ class Base64 {
/**
* Translates a Base64 value to either its 6-bit reconstruction value or a negative number indicating some other meaning.
**/
private final static byte[] DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8
private static final byte[] DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8
-5, -5, // Whitespace: Tab and Linefeed
-9, -9, // Decimal 11 - 12
-5, // Whitespace: Carriage Return
Expand Down Expand Up @@ -150,8 +150,8 @@ class Base64 {

// I think I end up not using the BAD_ENCODING indicator.
// private final static byte BAD_ENCODING = -9; // Indicates error in encoding
private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
private static final byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
private static final byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding

/** Defeats instantiation. */
private Base64() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jboss/dmr/BigDecimalModelValue.java
Expand Up @@ -121,7 +121,7 @@ void format(final PrintWriter writer, final int indent, final boolean ignored) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand All @@ -132,7 +132,7 @@ public boolean equals(final Object other) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jboss/dmr/BigIntegerModelValue.java
Expand Up @@ -124,7 +124,7 @@ void format(final PrintWriter writer, final int indent, final boolean ignored) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand All @@ -135,7 +135,7 @@ public boolean equals(final Object other) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jboss/dmr/BytesModelValue.java
Expand Up @@ -189,7 +189,7 @@ void formatMultiLine(final PrintWriter writer, final int indent) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand All @@ -200,7 +200,7 @@ public boolean equals(final Object other) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jboss/dmr/ListModelValue.java
Expand Up @@ -277,7 +277,7 @@ void formatAsJSON(final PrintWriter writer, final int indent, final boolean mult

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand All @@ -288,7 +288,7 @@ public boolean equals(final Object other) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jboss/dmr/LongModelValue.java
Expand Up @@ -128,7 +128,7 @@ void format(final PrintWriter writer, final int indent, final boolean multiLine)

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand All @@ -139,7 +139,7 @@ public boolean equals(final Object other) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jboss/dmr/ModelNode.java
Expand Up @@ -1425,7 +1425,7 @@ public void writeString(final PrintWriter writer, final boolean compact) {
/**
* Get a JSON string representation of this model node, formatted nicely, if requested.
* @param compact Flag that indicates whether or not the string should be all on
* one line (i.e. {@code true}) or should be printed on multiple lines ({@code false}).
* one line (i.e. {@code true}) or should be printed on multiple lines ({@code false}).
* @return The JSON string.
*/
public String toJSONString(final boolean compact) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/jboss/dmr/ModelValue.java
Expand Up @@ -285,7 +285,7 @@ public int hashCode() {

/**
* Adds the number of indentations (4 spaces each) specified to the writer's output.
*
*
* @param writer The PrintWriter instance containing the current output.
* @param count The number of indentations to be written.
*/
Expand All @@ -297,7 +297,7 @@ protected static void indent(final PrintWriter writer, final int count) {

/**
* Formats the current value object as part of a DMR string.
*
*
* @param writer A PrintWriter instance containing the generated DMR string representation.
* @param indent The number of tabs to indent the current generated string.
* @param multiLine Flag indicating whether or not the string should begin on a new line.
Expand All @@ -308,11 +308,11 @@ void format(final PrintWriter writer, final int indent, final boolean multiLine)

/**
* Formats the current value object as part of a JSON string.
*
*
* @param writer A PrintWriter instance containing the JSON string.
* @param indent The number of tabs to indent the current generated string.
* @param multiLine Flag that indicates whether or not the string should
* begin on a new line.
* begin on a new line.
*/
void formatAsJSON(final PrintWriter writer, final int indent, final boolean multiLine) {
writer.append(asString());
Expand All @@ -328,7 +328,7 @@ public String toString() {

/**
* Outputs the DMR representation of this value to the supplied PrintWriter instance.
*
*
* @param writer A PrintWriter instance use to output the DMR string.
* @param compact Flag indicating whether or not to include new lines in the generated string representation.
*/
Expand All @@ -338,7 +338,7 @@ public void writeString(final PrintWriter writer, final boolean compact) {

/**
* Converts this value to a JSON string representation.
*
*
* @param compact Flag indicating whether or not to include new lines in the generated string representation.
* @return The JSON formatted string representation of this value.
*/
Expand All @@ -351,7 +351,7 @@ public String toJSONString(final boolean compact) {

/**
* Outputs this value as a JSON string representation to the supplied PrintWriter instance.
*
*
* @param writer A PrintWriter instance use to output the JSON string.
* @param compact Flag indicating whether or not to include new lines in the generated string representation.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jboss/dmr/ObjectModelValue.java
Expand Up @@ -261,7 +261,7 @@ void formatAsJSON(final PrintWriter writer, final int indent, final boolean mult

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand All @@ -272,7 +272,7 @@ public boolean equals(final Object other) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jboss/dmr/StringModelValue.java
Expand Up @@ -216,7 +216,7 @@ void formatAsJSON(final PrintWriter writer, final int indent, final boolean mult

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand All @@ -227,7 +227,7 @@ public boolean equals(final Object other) {

/**
* Determine whether this object is equal to another.
*
*
* @param other the other object
* @return {@code true} if they are equal, {@code false} otherwise
*/
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/jboss/dmr/BigDecimalModelValueTest.java
Expand Up @@ -28,13 +28,13 @@ public void testWriteExternal() {
@Test
public void testAsLong() {
final BigDecimalModelValue value = new BigDecimalModelValue(new BigDecimal(5));
assertEquals(5l, value.asLong());
assertEquals(5L, value.asLong());
}

@Test
public void testAsLongWithDefault() {
final BigDecimalModelValue value = new BigDecimalModelValue(new BigDecimal(5));
assertEquals(5l, value.asLong(10l));
assertEquals(5L, value.asLong(10L));
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/jboss/dmr/BigIntegerModelValueTest.java
Expand Up @@ -28,13 +28,13 @@ public void testWriteExternal() {
@Test
public void testAsLong() {
final BigIntegerModelValue value = new BigIntegerModelValue(new BigInteger("5"));
assertEquals(5l, value.asLong());
assertEquals(5L, value.asLong());
}

@Test
public void testAsLongWithDefault() {
final BigIntegerModelValue value = new BigIntegerModelValue(new BigInteger("5"));
assertEquals(5l, value.asLong(10l));
assertEquals(5L, value.asLong(10L));
}

@Test
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/org/jboss/dmr/BooleanModelValueTest.java
Expand Up @@ -16,14 +16,14 @@ public void TestWriteExternal() {

@Test
public void testAsLong() {
assertEquals(0l, BooleanModelValue.FALSE.asLong());
assertEquals(1l, BooleanModelValue.TRUE.asLong());
assertEquals(0L, BooleanModelValue.FALSE.asLong());
assertEquals(1L, BooleanModelValue.TRUE.asLong());
}

@Test
public void testAsLongWithDefault() {
assertEquals(0l, BooleanModelValue.FALSE.asLong(5l));
assertEquals(1l, BooleanModelValue.TRUE.asLong(5l));
assertEquals(0L, BooleanModelValue.FALSE.asLong(5L));
assertEquals(1L, BooleanModelValue.TRUE.asLong(5L));
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/jboss/dmr/BytesModelValueTest.java
Expand Up @@ -28,13 +28,13 @@ public void testWriteExternal() {
@Test
public void testAsLong() {
final BytesModelValue value = new BytesModelValue(new byte[] { (byte) 0 });
assertEquals(0l, value.asLong());
assertEquals(0L, value.asLong());
}

@Test
public void testAsLongWithDefault() {
final BytesModelValue value = new BytesModelValue(new byte[] { (byte) 0 });
assertEquals(0l, value.asLong(5l));
assertEquals(0L, value.asLong(5L));
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/jboss/dmr/DoubleModelValueTest.java
Expand Up @@ -28,13 +28,13 @@ public void testWriteExternal() {
@Test
public void testAsLong() {
final DoubleModelValue value = new DoubleModelValue(5.0);
assertEquals(5l, value.asLong());
assertEquals(5L, value.asLong());
}

@Test
public void testAsLongWithDefault() {
final DoubleModelValue value = new DoubleModelValue(5.0);
assertEquals(5l, value.asLong(10l));
assertEquals(5L, value.asLong(10L));
}

@Test
Expand Down

0 comments on commit a2a013f

Please sign in to comment.