Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jun 22, 2016
2 parents e1c2409 + 097bea8 commit 57d57f3
Show file tree
Hide file tree
Showing 43 changed files with 200 additions and 227 deletions.
36 changes: 0 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,42 +341,6 @@
<excludes combine.children="append">
<exclude>checkstyle:/src/site/resources/.*</exclude>
<!--
@todo #678:30min After upgrade to qulice 0.16.4 we have to fix
AbbreviationAsWordInNameCheck checkstyle warings in next classes.
Fix issues and remove all excludes of PMD here.
-->
<exclude>checkstyle:/src/main/java/org/takes/facets/auth/codecs/CcAES.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/facets/auth/codecs/CcXOR.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/misc/Href.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rs/xe/XeSLA.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rs/RsJSON.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rs/RsPrettyJSON.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rs/RsWithType.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rs/RsXSLT.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rs/RsHTML.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rs/Body.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rs/RsPrettyXML.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/tk/TkHTML.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/tk/TkCORS.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/rq/ChunkedInputStream.java</exclude>
<exclude>checkstyle:/src/main/java/org/takes/http/FtCLI.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/facets/hamcrest/HmRsStatusTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/facets/auth/codecs/CcAESTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/facets/auth/codecs/CcXORTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/misc/HrefTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/rs/xe/XeSLATest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/rs/BodyTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/rs/RsXSLTTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/rs/RsJSONTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/rs/RsPrettyJSONTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/rs/RsPrettyXMLTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/tk/TkHTMLTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/tk/TkRedirectTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/tk/TkCORSTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/rq/RqMethodTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/http/FtBasicTest.java</exclude>
<exclude>checkstyle:/src/test/java/org/takes/http/FtCLITest.java</exclude>
<!--
@todo #678:30min After upgrade to qulice 0.16.4 we have to fix
AvoidDuplicateLiterals PMD warings in next classes. Fix issues and
remove all excludes of PMD here.
Expand Down
8 changes: 4 additions & 4 deletions src/it/file-manager/src/main/java/org/takes/it/fm/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import org.takes.facets.fork.FkRegex;
import org.takes.facets.fork.TkFork;
import org.takes.http.Exit;
import org.takes.http.FtCLI;
import org.takes.tk.TkHTML;
import org.takes.http.FtCli;
import org.takes.tk.TkHtml;
import org.takes.tk.TkRedirect;

/**
Expand Down Expand Up @@ -64,7 +64,7 @@ public App(final File dir) {
* @throws IOException If fails
*/
public static void main(final String... args) throws IOException {
new FtCLI(
new FtCli(
new App(new File(System.getProperty("user.dir"))),
args
).start(Exit.NEVER);
Expand All @@ -76,7 +76,7 @@ public Response act(final Request request) throws IOException {
new FkRegex("/", new TkRedirect("/f")),
new FkRegex(
"/about",
new TkHTML(App.class.getResource("about.html"))
new TkHtml(App.class.getResource("about.html"))
),
new FkRegex("/robots.txt", ""),
new FkRegex("/f(.*)", new TkDir(this.home))
Expand Down
4 changes: 2 additions & 2 deletions src/it/file-manager/src/main/java/org/takes/it/fm/RsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.io.IOException;
import java.io.InputStream;
import org.takes.Response;
import org.takes.rs.RsXSLT;
import org.takes.rs.RsXslt;
import org.takes.rs.xe.RsXembly;
import org.takes.rs.xe.XeAppend;
import org.takes.rs.xe.XeMillis;
Expand All @@ -53,7 +53,7 @@ final class RsPage implements Response {
* @param source Xembly source
*/
RsPage(final String xsl, final XeSource source) {
this.origin = new RsXSLT(
this.origin = new RsXslt(
new RsXembly(
new XeStylesheet(xsl),
new XeAppend(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* @since 0.13.8
*/
@EqualsAndHashCode(of = {"origin", "key", "spec"})
public final class CcAES implements Codec {
public final class CcAes implements Codec {
/**
* The block size constant.
*/
Expand Down Expand Up @@ -76,7 +76,7 @@ public final class CcAES implements Codec {
* @param key The encryption key
* @since 0.22
*/
public CcAES(final Codec codec, final String key) {
public CcAes(final Codec codec, final String key) {
this(codec, key.getBytes(Charset.defaultCharset()));
}

Expand All @@ -86,10 +86,10 @@ public CcAES(final Codec codec, final String key) {
* @param codec Original codec
* @param key The encryption key
*/
public CcAES(final Codec codec, final byte[] key) {
public CcAes(final Codec codec, final byte[] key) {
this.origin = codec;
this.key = key.clone();
this.spec = CcAES.algorithmParameterSpec();
this.spec = CcAes.algorithmParameterSpec();
}

@Override
Expand Down Expand Up @@ -126,7 +126,7 @@ private byte[] encrypt(final byte[] bytes) throws IOException {
*/
private static AlgorithmParameterSpec algorithmParameterSpec() {
final SecureRandom random = new SecureRandom();
final byte[] bytes = new byte[CcAES.BLOCK];
final byte[] bytes = new byte[CcAes.BLOCK];
random.nextBytes(bytes);
return new IvParameterSpec(bytes);
}
Expand All @@ -138,11 +138,11 @@ private static AlgorithmParameterSpec algorithmParameterSpec() {
* @return The verified encryption key
*/
private static byte[] withCorrectBlockSize(final byte[] key) {
if (key.length != CcAES.BLOCK) {
if (key.length != CcAes.BLOCK) {
throw new IllegalArgumentException(
String.format(
"the length of the AES key must be exactly %d bytes",
CcAES.BLOCK
CcAes.BLOCK
)
);
}
Expand Down Expand Up @@ -177,7 +177,7 @@ private Cipher create(final int mode)
throws IOException {
try {
final SecretKeySpec secret = new SecretKeySpec(
CcAES.withCorrectBlockSize(this.key), "AES"
CcAes.withCorrectBlockSize(this.key), "AES"
);
final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(mode, secret, this.spec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @since 0.1
*/
@EqualsAndHashCode(of = { "origin", "secret" })
public final class CcXOR implements Codec {
public final class CcXor implements Codec {

/**
* Original codec.
Expand All @@ -56,7 +56,7 @@ public final class CcXOR implements Codec {
* @param codec Original codec
* @param key Secret key for encoding
*/
public CcXOR(final Codec codec, final String key) {
public CcXor(final Codec codec, final String key) {
this(codec, new Utf8String(key).bytes());
}

Expand All @@ -65,7 +65,7 @@ public CcXOR(final Codec codec, final String key) {
* @param codec Original codec
* @param key Secret key for encoding
*/
public CcXOR(final Codec codec, final byte[] key) {
public CcXor(final Codec codec, final byte[] key) {
this.origin = codec;
this.secret = Arrays.copyOf(key, key.length);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* @since 0.1
*/
@EqualsAndHashCode(of = { "take", "options" })
public final class FtCLI implements Front {
public final class FtCli implements Front {

/**
* Take.
Expand All @@ -75,7 +75,7 @@ public final class FtCLI implements Front {
* @param tks Take
* @param args Arguments
*/
public FtCLI(final Take tks, final String... args) {
public FtCli(final Take tks, final String... args) {
this(tks, Arrays.asList(args));
}

Expand All @@ -84,7 +84,7 @@ public FtCLI(final Take tks, final String... args) {
* @param tks Take
* @param args Arguments
*/
public FtCLI(final Take tks, final Iterable<String> args) {
public FtCli(final Take tks, final Iterable<String> args) {
this.take = tks;
this.options = new Options(args);
}
Expand All @@ -96,7 +96,7 @@ public void start(final Exit exit) throws IOException {
tks = new Take() {
@Override
public Response act(final Request request) throws IOException {
return FtCLI.this.take.act(
return FtCli.this.take.act(
new RqWithHeader(
request, "X-Takes-HitRefresh: yes"
)
Expand Down Expand Up @@ -125,7 +125,7 @@ public Response act(final Request request) throws IOException {
@Override
public void run() {
try {
front.start(FtCLI.this.exit(exit));
front.start(FtCli.this.exit(exit));
} catch (final IOException ex) {
throw new IllegalStateException(ex);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/takes/misc/Href.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Href() {
* @param txt Text of the link
*/
public Href(final CharSequence txt) {
this(Href.createURI(txt.toString()));
this(Href.createUri(txt.toString()));
}

/**
Expand Down Expand Up @@ -282,7 +282,7 @@ private static String decode(final String txt) {
* @throws IllegalStateException in case an invalid character could not be
* encoded properly.
*/
private static URI createURI(final String txt) {
private static URI createUri(final String txt) {
URI result;
try {
result = new URI(txt);
Expand All @@ -297,7 +297,7 @@ private static URI createURI(final String txt) {
index + 1,
Href.encode(value.substring(index, index + 1))
);
result = Href.createURI(value.toString());
result = Href.createUri(value.toString());
}
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/rq/ChunkedInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public int read(final byte[] buf) throws IOException {
* Read the CRLF terminator.
* @throws IOException If an IO error occurs.
*/
private void readCRLF() throws IOException {
private void readCrlf() throws IOException {
final int crsymbol = this.origin.read();
final int lfsymbol = this.origin.read();
if (crsymbol != '\r' || lfsymbol != '\n') {
Expand All @@ -142,7 +142,7 @@ private void readCRLF() throws IOException {
*/
private void nextChunk() throws IOException {
if (!this.bof) {
this.readCRLF();
this.readCrlf();
}
this.size = ChunkedInputStream.chunkSize(this.origin);
this.bof = false;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/rs/Body.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ interface Body {
/**
* Content of a body based on an {@link java.net.URL}.
*/
final class URL implements Body {
final class Url implements Body {

/**
* The {@link java.net.URL} of the content.
Expand All @@ -74,7 +74,7 @@ final class URL implements Body {
* Constructs an {@code URL} with the specified {@link java.net.URL}.
* @param content The {@link java.net.URL} of the content.
*/
URL(final java.net.URL content) {
Url(final java.net.URL content) {
this.url = content;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,29 @@
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsHTML extends RsWrap {
public final class RsHtml extends RsWrap {

/**
* Ctor.
* @since 0.10
*/
public RsHTML() {
public RsHtml() {
this("<html/>");
}

/**
* Ctor.
* @param body HTML body
*/
public RsHTML(final CharSequence body) {
public RsHtml(final CharSequence body) {
this(new RsEmpty(), body);
}

/**
* Ctor.
* @param body HTML body
*/
public RsHTML(final byte[] body) {
public RsHtml(final byte[] body) {
this(new RsEmpty(), body);
}

Expand All @@ -72,15 +72,15 @@ public RsHTML(final byte[] body) {
* @param url URL with body
* @since 0.10
*/
public RsHTML(final URL url) {
public RsHtml(final URL url) {
this(new RsEmpty(), url);
}

/**
* Ctor.
* @param body HTML body
*/
public RsHTML(final InputStream body) {
public RsHtml(final InputStream body) {
this(new RsEmpty(), body);
}

Expand All @@ -89,7 +89,7 @@ public RsHTML(final InputStream body) {
* @param res Original response
* @param body HTML body
*/
public RsHTML(final Response res, final CharSequence body) {
public RsHtml(final Response res, final CharSequence body) {
this(new RsWithBody(res, body));
}

Expand All @@ -98,7 +98,7 @@ public RsHTML(final Response res, final CharSequence body) {
* @param res Original response
* @param body HTML body
*/
public RsHTML(final Response res, final byte[] body) {
public RsHtml(final Response res, final byte[] body) {
this(new RsWithBody(res, body));
}

Expand All @@ -107,7 +107,7 @@ public RsHTML(final Response res, final byte[] body) {
* @param res Original response
* @param body HTML body
*/
public RsHTML(final Response res, final InputStream body) {
public RsHtml(final Response res, final InputStream body) {
this(new RsWithBody(res, new Body.TempFile(new Body.Stream(body))));
}

Expand All @@ -116,7 +116,7 @@ public RsHTML(final Response res, final InputStream body) {
* @param res Original response
* @param url URL with body
*/
public RsHTML(final Response res, final URL url) {
public RsHtml(final Response res, final URL url) {
this(new RsWithBody(res, url));
}

Expand All @@ -125,7 +125,7 @@ public RsHTML(final Response res, final URL url) {
* @param res Original response
* @since 0.10
*/
public RsHTML(final Response res) {
public RsHtml(final Response res) {
super(
new RsWithType(
new RsWithStatus(res, HttpURLConnection.HTTP_OK),
Expand Down
Loading

0 comments on commit 57d57f3

Please sign in to comment.