do not throw exception if present operation returns diagnostics, clean up (mostly underscore style issues)
This commit is contained in:
parent
00412e7577
commit
d0c91568a8
142 changed files with 2794 additions and 4632 deletions
|
@ -1,323 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
|
||||
<!-- This is a checkstyle configuration file. For descriptions of
|
||||
what the following rules do, please see the checkstyle configuration
|
||||
page at http://checkstyle.sourceforge.net/config.html -->
|
||||
|
||||
<module name="Checker">
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<!-- Checks that there are no tab characters in the file.
|
||||
-->
|
||||
</module>
|
||||
|
||||
<module name="NewlineAtEndOfFile">
|
||||
<property name="lineSeparator" value="lf"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<!-- Checks that FIXME is not used in comments. TODO is preferred.
|
||||
-->
|
||||
<property name="format" value="((//.*)|(\*.*))FIXME" />
|
||||
<property name="message" value='TODO is preferred to FIXME. e.g. "TODO(johndoe): Refactor when v2 is released."' />
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<!-- Checks that TODOs are named. (Actually, just that they are followed
|
||||
by an open paren.)
|
||||
-->
|
||||
<property name="format" value="((//.*)|(\*.*))TODO[^(]" />
|
||||
<property name="message" value='All TODOs should be named. e.g. "TODO(johndoe): Refactor when v2 is released."' />
|
||||
</module>
|
||||
|
||||
<module name="JavadocPackage">
|
||||
<!-- Checks that each Java package has a Javadoc file used for commenting.
|
||||
Only allows a package-info.java, not package.html. -->
|
||||
</module>
|
||||
|
||||
<!-- All Java AST specific tests live under TreeWalker module. -->
|
||||
<module name="TreeWalker">
|
||||
|
||||
<!--
|
||||
|
||||
IMPORT CHECKS
|
||||
|
||||
-->
|
||||
|
||||
<module name="RedundantImport">
|
||||
<!-- Checks for redundant import statements. -->
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="ImportOrder">
|
||||
<!-- Checks for out of order import statements. -->
|
||||
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="groups" value="com.google,android,junit,net,org,java,javax"/>
|
||||
<!-- This ensures that static imports go first. -->
|
||||
<property name="option" value="top"/>
|
||||
<property name="tokens" value="STATIC_IMPORT, IMPORT"/>
|
||||
</module>
|
||||
|
||||
<!--
|
||||
|
||||
JAVADOC CHECKS
|
||||
|
||||
-->
|
||||
|
||||
<!-- Checks for Javadoc comments. -->
|
||||
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope" value="protected"/>
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="allowMissingJavadoc" value="true"/>
|
||||
<property name="allowMissingParamTags" value="true"/>
|
||||
<property name="allowMissingReturnTag" value="true"/>
|
||||
<property name="allowMissingThrowsTags" value="true"/>
|
||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
||||
<property name="allowUndeclaredRTE" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="JavadocType">
|
||||
<property name="scope" value="protected"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="JavadocStyle">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<!--
|
||||
|
||||
NAMING CHECKS
|
||||
|
||||
-->
|
||||
|
||||
<!-- Item 38 - Adhere to generally accepted naming conventions -->
|
||||
|
||||
<module name="PackageName">
|
||||
<!-- Validates identifiers for package names against the
|
||||
supplied expression. -->
|
||||
<!-- Here the default checkstyle rule restricts package name parts to
|
||||
seven characters, this is not in line with common practice at Google.
|
||||
-->
|
||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="TypeNameCheck">
|
||||
<!-- Validates static, final fields against the
|
||||
expression "^[A-Z][a-zA-Z0-9]*$". -->
|
||||
<metadata name="altname" value="TypeName"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="ConstantNameCheck">
|
||||
<!-- Validates non-private, static, final fields against the supplied
|
||||
public/package final fields "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$". -->
|
||||
<metadata name="altname" value="ConstantName"/>
|
||||
<property name="applyToPublic" value="true"/>
|
||||
<property name="applyToProtected" value="true"/>
|
||||
<property name="applyToPackage" value="true"/>
|
||||
<property name="applyToPrivate" value="false"/>
|
||||
<property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|FLAG_.*)$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Variable ''{0}'' should be in ALL_CAPS (if it is a constant) or be private (otherwise)."/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="StaticVariableNameCheck">
|
||||
<!-- Validates static, non-final fields against the supplied
|
||||
expression "^[a-z][a-zA-Z0-9]*_?$". -->
|
||||
<metadata name="altname" value="StaticVariableName"/>
|
||||
<property name="applyToPublic" value="true"/>
|
||||
<property name="applyToProtected" value="true"/>
|
||||
<property name="applyToPackage" value="true"/>
|
||||
<property name="applyToPrivate" value="true"/>
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="MemberNameCheck">
|
||||
<!-- Validates non-static members against the supplied expression. -->
|
||||
<metadata name="altname" value="MemberName"/>
|
||||
<property name="applyToPublic" value="true"/>
|
||||
<property name="applyToProtected" value="true"/>
|
||||
<property name="applyToPackage" value="true"/>
|
||||
<property name="applyToPrivate" value="true"/>
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="MethodNameCheck">
|
||||
<!-- Validates identifiers for method names. -->
|
||||
<metadata name="altname" value="MethodName"/>
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="ParameterName">
|
||||
<!-- Validates identifiers for method parameters against the
|
||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="LocalFinalVariableName">
|
||||
<!-- Validates identifiers for local final variables against the
|
||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="LocalVariableName">
|
||||
<!-- Validates identifiers for local variables against the
|
||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
LENGTH and CODING CHECKS
|
||||
|
||||
-->
|
||||
|
||||
<module name="LineLength">
|
||||
<!-- Checks if a line is too long. -->
|
||||
<property name="max" value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.max}" default="128"/>
|
||||
<property name="severity" value="error"/>
|
||||
|
||||
<!--
|
||||
The default ignore pattern exempts the following elements:
|
||||
- import statements
|
||||
- long URLs inside comments
|
||||
-->
|
||||
|
||||
<property name="ignorePattern"
|
||||
value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.ignorePattern}"
|
||||
default="^(package .*;\s*)|(import .*;\s*)|( *(\*|//).*https?://.*)$"/>
|
||||
</module>
|
||||
|
||||
<module name="LeftCurly">
|
||||
<!-- Checks for placement of the left curly brace ('{'). -->
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="RightCurly">
|
||||
<!-- Checks right curlies on CATCH, ELSE, and TRY blocks are on
|
||||
the same line. e.g., the following example is fine:
|
||||
<pre>
|
||||
if {
|
||||
...
|
||||
} else
|
||||
</pre>
|
||||
-->
|
||||
<!-- This next example is not fine:
|
||||
<pre>
|
||||
if {
|
||||
...
|
||||
}
|
||||
else
|
||||
</pre>
|
||||
-->
|
||||
<property name="option" value="same"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<!-- Checks for braces around if and else blocks -->
|
||||
<module name="NeedBraces">
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
|
||||
</module>
|
||||
|
||||
<module name="UpperEll">
|
||||
<!-- Checks that long constants are defined with an upper ell.-->
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="FallThrough">
|
||||
<!-- Warn about falling through to the next case statement. Similar to
|
||||
javac -Xlint:fallthrough, but the check is suppressed if a single-line comment
|
||||
on the last non-blank line preceding the fallen-into case contains 'fall through' (or
|
||||
some other variants which we don't publicized to promote consistency).
|
||||
-->
|
||||
<property name="reliefPattern"
|
||||
value="fall through|Fall through|fallthru|Fallthru|falls through|Falls through|fallthrough|Fallthrough|No break|NO break|no break|continue on"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
MODIFIERS CHECKS
|
||||
|
||||
-->
|
||||
|
||||
<module name="ModifierOrder">
|
||||
<!-- Warn if modifier order is inconsistent with JLS3 8.1.1, 8.3.1, and
|
||||
8.4.3. The prescribed order is:
|
||||
public, protected, private, abstract, static, final, transient, volatile,
|
||||
synchronized, native, strictfp
|
||||
-->
|
||||
</module>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
WHITESPACE CHECKS
|
||||
|
||||
-->
|
||||
|
||||
<module name="WhitespaceAround">
|
||||
<!-- Checks that various tokens are surrounded by whitespace.
|
||||
This includes most binary operators and keywords followed
|
||||
by regular or curly braces.
|
||||
-->
|
||||
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
|
||||
BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
|
||||
EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
|
||||
LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
|
||||
LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
|
||||
MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION,
|
||||
SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="WhitespaceAfter">
|
||||
<!-- Checks that commas, semicolons and typecasts are followed by
|
||||
whitespace.
|
||||
-->
|
||||
<property name="tokens" value="COMMA, SEMI, TYPECAST"/>
|
||||
</module>
|
||||
|
||||
<module name="NoWhitespaceAfter">
|
||||
<!-- Checks that there is no whitespace after various unary operators.
|
||||
Linebreaks are allowed.
|
||||
-->
|
||||
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS,
|
||||
UNARY_PLUS"/>
|
||||
<property name="allowLineBreaks" value="true"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="NoWhitespaceBefore">
|
||||
<!-- Checks that there is no whitespace before various unary operators.
|
||||
Linebreaks are allowed.
|
||||
-->
|
||||
<property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
|
||||
<property name="allowLineBreaks" value="true"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="ParenPad">
|
||||
<!-- Checks that there is no whitespace before close parens or after
|
||||
open parens.
|
||||
-->
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
</module>
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<localRepository>~/.m2/repository</localRepository>
|
||||
<activeProfiles>
|
||||
<activeProfile>xbib</activeProfile>
|
||||
</activeProfiles>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>xbib</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>xbib</id>
|
||||
<url>http://xbib.org/repository</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
</settings>
|
|
@ -51,8 +51,8 @@ public final class ASN1BitString extends ASN1Any {
|
|||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1EncodingException {
|
||||
if (checkTag && (berEncoding.tagGet() != BIT_STRING_TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("ASN.1 BIT STRING: bad BER: tag=" + berEncoding.tagGet() +
|
||||
if (checkTag && (berEncoding.getTag() != BIT_STRING_TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("ASN.1 BIT STRING: bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + BIT_STRING_TAG + "\n");
|
||||
}
|
||||
if (berEncoding instanceof BERPrimitive) {
|
||||
|
|
|
@ -48,9 +48,9 @@ public final class ASN1Boolean extends ASN1Any {
|
|||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1EncodingException {
|
||||
if (checkTag && (berEncoding.tagGet() != TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
if (checkTag && (berEncoding.getTag() != TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException
|
||||
("ASN.1 BOOLEAN: bad BER: tag=" + berEncoding.tagGet() +
|
||||
("ASN.1 BOOLEAN: bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + "TAG\n");
|
||||
}
|
||||
if (berEncoding instanceof BERPrimitive) {
|
||||
|
|
|
@ -13,8 +13,8 @@ public class ASN1Decoder {
|
|||
}
|
||||
|
||||
public static ASN1Any toASN1(BEREncoding ber) throws ASN1Exception {
|
||||
if (ber.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) {
|
||||
switch (ber.tagGet()) {
|
||||
if (ber.getTagType() == BEREncoding.UNIVERSAL_TAG) {
|
||||
switch (ber.getTag()) {
|
||||
case ASN1Boolean.TAG:
|
||||
return new ASN1Boolean(ber, true);
|
||||
case ASN1Integer.INTEGER_TAG:
|
||||
|
|
|
@ -52,9 +52,9 @@ public final class ASN1Enumerated extends ASN1Any {
|
|||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1EncodingException {
|
||||
if (checkTag && (berEncoding.tagGet() != ENUMERATED_TAG ||
|
||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
||||
if (checkTag && (berEncoding.getTag() != ENUMERATED_TAG ||
|
||||
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + ENUMERATED_TAG + "\n");
|
||||
}
|
||||
if (!(berEncoding instanceof BERPrimitive)) {
|
||||
|
|
|
@ -76,8 +76,8 @@ public final class ASN1External extends ASN1Any {
|
|||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
if (checkTag && (berEncoding.tagGet() != EXTERNAL_TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
||||
if (checkTag && (berEncoding.getTag() != EXTERNAL_TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + EXTERNAL_TAG + "\n");
|
||||
}
|
||||
if (berEncoding instanceof BERPrimitive) {
|
||||
|
@ -96,31 +96,31 @@ public final class ASN1External extends ASN1Any {
|
|||
}
|
||||
int part = 0;
|
||||
BEREncoding p = ber.elementAt(part);
|
||||
if (p.tagGet() == ASN1ObjectIdentifier.OBJECT_IDENTIFIER_TAG &&
|
||||
p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) {
|
||||
if (p.getTag() == ASN1ObjectIdentifier.OBJECT_IDENTIFIER_TAG &&
|
||||
p.getTagType() == BEREncoding.UNIVERSAL_TAG) {
|
||||
sDirectReference = new ASN1ObjectIdentifier(p, true);
|
||||
if (numParts <= ++part) {
|
||||
throw new ASN1EncodingException("incomplete");
|
||||
}
|
||||
p = ber.elementAt(part);
|
||||
}
|
||||
if (p.tagGet() == ASN1Integer.INTEGER_TAG &&
|
||||
p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) {
|
||||
if (p.getTag() == ASN1Integer.INTEGER_TAG &&
|
||||
p.getTagType() == BEREncoding.UNIVERSAL_TAG) {
|
||||
sIndirectReference = new ASN1Integer(p, true);
|
||||
if (numParts <= ++part) {
|
||||
throw new ASN1EncodingException("incomplete");
|
||||
}
|
||||
p = ber.elementAt(part);
|
||||
}
|
||||
if (p.tagGet() == ASN1ObjectDescriptor.OBJECT_DESCRIPTOR_TAG &&
|
||||
p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) {
|
||||
if (p.getTag() == ASN1ObjectDescriptor.OBJECT_DESCRIPTOR_TAG &&
|
||||
p.getTagType() == BEREncoding.UNIVERSAL_TAG) {
|
||||
sDataValueDescriptor = new ASN1ObjectDescriptor(p, true);
|
||||
if (numParts <= ++part) {
|
||||
throw new ASN1EncodingException("incomplete");
|
||||
}
|
||||
p = ber.elementAt(part);
|
||||
}
|
||||
switch (p.tagGet()) {
|
||||
switch (p.getTag()) {
|
||||
case 0:
|
||||
if (!(p instanceof BERConstructed)) {
|
||||
throw new ASN1EncodingException("singleASN1type: bad form, primitive");
|
||||
|
@ -132,20 +132,20 @@ public final class ASN1External extends ASN1Any {
|
|||
break;
|
||||
case 1:
|
||||
// octetAligned [1] IMPLICIT OCTET STRING
|
||||
if (p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||
if (p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||
throw new ASN1EncodingException("encoding: bad tag type " + p);
|
||||
}
|
||||
cOctetAligned = new ASN1OctetString(p, false);
|
||||
break;
|
||||
case 2:
|
||||
// arbitrary [2] IMPLICIT BIT STRING
|
||||
if (p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||
if (p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||
throw new ASN1EncodingException("encoding: bad tag type " + p);
|
||||
}
|
||||
cArbitrary = new ASN1BitString(p, false);
|
||||
break;
|
||||
default:
|
||||
throw new ASN1EncodingException("encoding: tag = " + p.tagGet());
|
||||
throw new ASN1EncodingException("encoding: tag = " + p.getTag());
|
||||
}
|
||||
if (part != (numParts - 1)) {
|
||||
throw new ASN1Exception("extra element(s)");
|
||||
|
|
|
@ -31,8 +31,8 @@ public class ASN1GeneralString extends ASN1OctetString {
|
|||
public ASN1GeneralString(BEREncoding ber, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != GENERAL_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
||||
if (checkTag && (ber.getTag() != GENERAL_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||
" expected " + GENERAL_STRING_TAG + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ public final class ASN1GeneralizedTime extends ASN1VisibleString {
|
|||
public ASN1GeneralizedTime(BEREncoding ber, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != GENERALIZED_TIME_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
||||
if (checkTag && (ber.getTag() != GENERALIZED_TIME_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||
" expected " + GENERALIZED_TIME_TAG + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ public class ASN1GraphicString extends ASN1OctetString {
|
|||
*/
|
||||
public ASN1GraphicString(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != GRAPHIC_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
||||
if (checkTag && (ber.getTag() != GRAPHIC_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||
" expected " + GRAPHIC_STRING_TAG + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ public final class ASN1IA5String extends ASN1OctetString {
|
|||
*/
|
||||
public ASN1IA5String(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != IA5_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
||||
if (checkTag && (ber.getTag() != IA5_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||
" expected " + IA5_STRING_TAG + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ public final class ASN1Integer extends ASN1Any {
|
|||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1EncodingException {
|
||||
if (checkTag && (berEncoding.tagGet() != INTEGER_TAG ||
|
||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
||||
if (checkTag && (berEncoding.getTag() != INTEGER_TAG ||
|
||||
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + INTEGER_TAG + "\n");
|
||||
}
|
||||
if (!(berEncoding instanceof BERPrimitive)) {
|
||||
|
|
|
@ -40,9 +40,9 @@ public final class ASN1Null extends ASN1Any {
|
|||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1EncodingException {
|
||||
if (checkTag && (berEncoding.tagGet() != NULL_TAG ||
|
||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
||||
if (checkTag && (berEncoding.getTag() != NULL_TAG ||
|
||||
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + NULL_TAG + "\n");
|
||||
}
|
||||
if (!(berEncoding instanceof BERPrimitive)) {
|
||||
|
|
|
@ -31,8 +31,8 @@ public class ASN1NumericString extends ASN1OctetString {
|
|||
public ASN1NumericString(BEREncoding ber, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != NUMERIC_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
||||
if (checkTag && (ber.getTag() != NUMERIC_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||
" expected " + NUMERIC_STRING_TAG + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ public final class ASN1ObjectDescriptor extends ASN1GraphicString {
|
|||
public ASN1ObjectDescriptor(BEREncoding ber, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != OBJECT_DESCRIPTOR_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
if (checkTag && (ber.getTag() != OBJECT_DESCRIPTOR_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException
|
||||
("ASN.1 ObjectDescriptor: bad BER: tag=" + ber.tagGet() +
|
||||
("ASN.1 ObjectDescriptor: bad BER: tag=" + ber.getTag() +
|
||||
" expected " + OBJECT_DESCRIPTOR_TAG + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ public final class ASN1ObjectIdentifier extends ASN1Any {
|
|||
*/
|
||||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException {
|
||||
if (checkTag && (berEncoding.tagGet() != OBJECT_IDENTIFIER_TAG ||
|
||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
||||
if (checkTag && (berEncoding.getTag() != OBJECT_IDENTIFIER_TAG ||
|
||||
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + OBJECT_IDENTIFIER_TAG + "\n");
|
||||
}
|
||||
if (!(berEncoding instanceof BERPrimitive)) {
|
||||
|
|
|
@ -68,9 +68,9 @@ public class ASN1OctetString extends ASN1Any {
|
|||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1EncodingException {
|
||||
if (checkTag && (berEncoding.tagGet() != OCTET_STRING_TAG ||
|
||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
||||
if (checkTag && (berEncoding.getTag() != OCTET_STRING_TAG ||
|
||||
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + OCTET_STRING_TAG + "\n");
|
||||
}
|
||||
if (berEncoding instanceof BERPrimitive) {
|
||||
|
|
|
@ -49,8 +49,8 @@ public final class ASN1PrintableString extends ASN1OctetString {
|
|||
public ASN1PrintableString(BEREncoding ber, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != PRINTABLE_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("ASN.1 PrintableString: bad BER: tag=" + ber.tagGet() +
|
||||
if (checkTag && (ber.getTag() != PRINTABLE_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("ASN.1 PrintableString: bad BER: tag=" + ber.getTag() +
|
||||
" expected " + PRINTABLE_STRING_TAG + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ public final class ASN1Sequence extends ASN1Any {
|
|||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
if (checkTag && (berEncoding.tagGet() != SEQUENCE_TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
if (checkTag && (berEncoding.getTag() != SEQUENCE_TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException
|
||||
("ASN.1 SEQUENCE: bad BER: tag=" + berEncoding.tagGet() +
|
||||
("ASN.1 SEQUENCE: bad BER: tag=" + berEncoding.getTag() +
|
||||
" expected " + SEQUENCE_TAG + "\n");
|
||||
}
|
||||
if (berEncoding instanceof BERPrimitive) {
|
||||
|
|
|
@ -53,12 +53,10 @@ public final class ASN1Set extends ASN1Any {
|
|||
* @throws ASN1Exception If the BER encoding is incorrect.
|
||||
*/
|
||||
@Override
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
if (checkTag && (berEncoding.tagGet() != SET_TAG ||
|
||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
||||
" expected " + SET_TAG + "\n");
|
||||
public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1Exception {
|
||||
if (checkTag && (berEncoding.getTag() != SET_TAG ||
|
||||
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + SET_TAG);
|
||||
}
|
||||
if (berEncoding instanceof BERPrimitive) {
|
||||
throw new ASN1EncodingException("bad form, primitive");
|
||||
|
|
|
@ -35,10 +35,8 @@ public final class ASN1T61String extends ASN1OctetString {
|
|||
public ASN1T61String(BEREncoding ber, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != T61_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException
|
||||
("ASN.1 T61String: bad BER: tag=" + ber.tagGet() +
|
||||
" expected " + T61_STRING_TAG + "\n");
|
||||
if (checkTag && (ber.getTag() != T61_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("ASN.1 T61String: bad BER: tag=" + ber.getTag() + " expected " + T61_STRING_TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,13 +39,10 @@ public final class ASN1UTCTime extends ASN1VisibleString {
|
|||
* @param checkTag If true, it checks the tag. Use false if is implicitly tagged.
|
||||
* @throws ASN1Exception If the BER encoding is incorrect.
|
||||
*/
|
||||
public ASN1UTCTime(BEREncoding ber, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
public ASN1UTCTime(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != UTC_TIME_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException
|
||||
("ASN.1 UTCTime: bad BER: tag=" + ber.tagGet() +
|
||||
" expected " + UTC_TIME_TAG + "\n");
|
||||
if (checkTag && (ber.getTag() != UTC_TIME_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + UTC_TIME_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,8 @@ public class ASN1VideotexString extends ASN1OctetString {
|
|||
*/
|
||||
public ASN1VideotexString(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != VIDEOTEX_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
||||
" expected " + VIDEOTEX_STRING_TAG + "\n");
|
||||
if (checkTag && (ber.getTag() != VIDEOTEX_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + VIDEOTEX_STRING_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,8 @@ public class ASN1VisibleString extends ASN1OctetString {
|
|||
public ASN1VisibleString(BEREncoding ber, boolean checkTag)
|
||||
throws ASN1Exception {
|
||||
super(ber, false);
|
||||
if (checkTag && (ber.tagGet() != TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
||||
" expected " + TAG + "\n");
|
||||
if (checkTag && (ber.getTag() != TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + TAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class BERConstructed extends BEREncoding {
|
|||
throws ASN1Exception {
|
||||
int contentLength = 0;
|
||||
for (BEREncoding element : elements) {
|
||||
contentLength += element.iTotalLength;
|
||||
contentLength += element.totalLength;
|
||||
}
|
||||
init(asn1Class, true, tag, contentLength);
|
||||
contentElements = elements;
|
||||
|
@ -65,7 +65,7 @@ public class BERConstructed extends BEREncoding {
|
|||
@Override
|
||||
public String toString() {
|
||||
StringBuilder str = new StringBuilder("[");
|
||||
switch (iTagType) {
|
||||
switch (tagType) {
|
||||
case BEREncoding.UNIVERSAL_TAG:
|
||||
str.append("UNIVERSAL ");
|
||||
break;
|
||||
|
@ -81,7 +81,7 @@ public class BERConstructed extends BEREncoding {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
str.append(String.valueOf(iTag)).append("]{");
|
||||
str.append(String.valueOf(tag)).append("]{");
|
||||
for (int x = 0; x < contentElements.length; x++) {
|
||||
if (x != 0) {
|
||||
str.append(',');
|
||||
|
@ -96,10 +96,10 @@ public class BERConstructed extends BEREncoding {
|
|||
* This protected method is used to implement the "get_encoding" method.
|
||||
*/
|
||||
@Override
|
||||
protected int iEncodingGet(int offset, byte[] data) {
|
||||
int i = iGetHead(offset, data);
|
||||
protected int getEncoding(int offset, byte[] data) {
|
||||
int i = getHead(offset, data);
|
||||
for (BEREncoding contentElement : contentElements) {
|
||||
i = contentElement.iEncodingGet(i, data);
|
||||
i = contentElement.getEncoding(i, data);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -50,20 +50,20 @@ public abstract class BEREncoding {
|
|||
* the same as that encoded in the identiferEncoding.
|
||||
* This is an internal member. You should not use this.
|
||||
*/
|
||||
protected int iTagType;
|
||||
protected int tagType;
|
||||
/**
|
||||
* The tag number of this BER encoded object. This value must be
|
||||
* the same as that encoded in the identiferEncoding.
|
||||
* This is an internal member. You should not use this.
|
||||
*/
|
||||
protected int iTag;
|
||||
protected int tag;
|
||||
/**
|
||||
* The total length of this BER object (the identifier octets, plus
|
||||
* length octets, plus content octects). This variable must be
|
||||
* set up before this object is used (using the init method).
|
||||
* This is an internal member. You should not use this.
|
||||
*/
|
||||
protected int iTotalLength;
|
||||
protected int totalLength;
|
||||
/**
|
||||
* Storage for the identifier octets. This variable is set up by
|
||||
* calling the make_identifer method.
|
||||
|
@ -85,53 +85,28 @@ public abstract class BEREncoding {
|
|||
return lengthEncoding;
|
||||
}
|
||||
|
||||
public int getITag() {
|
||||
return iTag;
|
||||
}
|
||||
|
||||
public int getITagType() {
|
||||
return iTagType;
|
||||
}
|
||||
|
||||
public int getITotalLength() {
|
||||
return iTotalLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the BER encoded object as an array of bytes. This routine
|
||||
* may be of use if you want to use the encoding rather than sending
|
||||
* it off. If you want to just output it, it is more efficient to
|
||||
* use the output method.
|
||||
* @return byte array
|
||||
*/
|
||||
public byte[] encodingGet() {
|
||||
byte[] result = new byte[iTotalLength];
|
||||
iEncodingGet(0, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to examine the tag type of the BER encoded ASN.1 object.
|
||||
* @return integer
|
||||
*/
|
||||
public int tagTypeGet() {
|
||||
return iTagType;
|
||||
public int getTagType() {
|
||||
return tagType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to examine the tag number of the BER encoded ASN.1 object.
|
||||
* @return integer
|
||||
*/
|
||||
public int tagGet() {
|
||||
return iTag;
|
||||
public int getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of bytes the encoding occupies.
|
||||
* @return integer
|
||||
*/
|
||||
public int totalLength() {
|
||||
return iTotalLength;
|
||||
public int getTotalLength() {
|
||||
return totalLength;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,7 +124,7 @@ public abstract class BEREncoding {
|
|||
throws ASN1Exception {
|
||||
makeIdentifier(tagType, isConstructed, tag);
|
||||
makeLength(length);
|
||||
iTotalLength = identifierEncoding.length + lengthEncoding.length + length;
|
||||
totalLength = identifierEncoding.length + lengthEncoding.length + length;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -158,7 +133,7 @@ public abstract class BEREncoding {
|
|||
* This is used by the superclasses to implement the "encodingGet"
|
||||
* method.
|
||||
*/
|
||||
protected int iGetHead(int offset, byte[] data) {
|
||||
protected int getHead(int offset, byte[] data) {
|
||||
for (int anIdentifierEncoding : identifierEncoding) {
|
||||
data[offset++] = (byte) anIdentifierEncoding;
|
||||
}
|
||||
|
@ -174,7 +149,7 @@ public abstract class BEREncoding {
|
|||
* array (as bytes), starting at offset into the array. The
|
||||
* offset of the last element used plus one is returned.
|
||||
*/
|
||||
protected abstract int iEncodingGet(int offset, byte[] data);
|
||||
protected abstract int getEncoding(int offset, byte[] data);
|
||||
|
||||
/**
|
||||
* This private method encodes the identifier octets. When a BER
|
||||
|
@ -201,12 +176,12 @@ public abstract class BEREncoding {
|
|||
if (tag < 0) {
|
||||
throw new ASN1Exception("ASN.1 tag value is negative");
|
||||
}
|
||||
iTagType = tagType & 0xC0;
|
||||
b = iTagType;
|
||||
this.tagType = tagType & 0xC0;
|
||||
b = this.tagType;
|
||||
if (isConstructed) {
|
||||
b |= 0x20;
|
||||
}
|
||||
iTag = tag;
|
||||
this.tag = tag;
|
||||
if (tag <= 30) {
|
||||
b |= (tag & 0x1F);
|
||||
identifierEncoding = new int[1];
|
||||
|
|
|
@ -31,10 +31,18 @@ public class BERPrimitive extends BEREncoding {
|
|||
* classes. It is not intended that higher level classes create
|
||||
* BERPrimitives directly.
|
||||
*
|
||||
* @param asn1Class ASN.1 class
|
||||
* @param tag tag
|
||||
* @param contents contents
|
||||
*
|
||||
* @throws ASN1Exception if BER primitive fails
|
||||
*
|
||||
* @see org.xbib.asn1.BEREncoding#UNIVERSAL_TAG
|
||||
* @see org.xbib.asn1.BEREncoding#APPLICATION_TAG
|
||||
* @see org.xbib.asn1.BEREncoding#CONTEXT_SPECIFIC_TAG
|
||||
* @see org.xbib.asn1.BEREncoding#PRIVATE_TAG
|
||||
*
|
||||
*
|
||||
*/
|
||||
public BERPrimitive(int asn1Class, int tag, int[] contents) throws ASN1Exception {
|
||||
init(asn1Class, false, tag, contents.length);
|
||||
|
@ -44,6 +52,7 @@ public class BERPrimitive extends BEREncoding {
|
|||
/**
|
||||
* This method allows the content octets to be examined.
|
||||
* Once again, only the ASN.1 standard objects should be using this.
|
||||
* @return content octets
|
||||
*/
|
||||
public int[] getContentOctets() {
|
||||
return contentsOctets;
|
||||
|
@ -52,11 +61,12 @@ public class BERPrimitive extends BEREncoding {
|
|||
/**
|
||||
* Returns a new String object representing this BER encoded
|
||||
* ASN.1 object's value.
|
||||
* @return string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder str = new StringBuilder("[");
|
||||
switch (iTagType) {
|
||||
switch (tagType) {
|
||||
case BEREncoding.UNIVERSAL_TAG:
|
||||
str.append("UNIVERSAL ");
|
||||
break;
|
||||
|
@ -72,7 +82,7 @@ public class BERPrimitive extends BEREncoding {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
str.append(String.valueOf(iTag)).append("] '");
|
||||
str.append(String.valueOf(tag)).append("] '");
|
||||
for (int octet : contentsOctets) {
|
||||
str.append(hex[(octet >> 4) & 0x0f]);
|
||||
str.append(hex[octet & 0x0f]);
|
||||
|
@ -83,10 +93,12 @@ public class BERPrimitive extends BEREncoding {
|
|||
|
||||
/**
|
||||
* This protected method is used to implement the "get_encoding" method.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
@Override
|
||||
protected int iEncodingGet(int offset, byte[] data) {
|
||||
int i = iGetHead(offset, data);
|
||||
protected int getEncoding(int offset, byte[] data) {
|
||||
int i = getHead(offset, data);
|
||||
for (int contentsOctet : contentsOctets) {
|
||||
data[i++] = (byte) contentsOctet;
|
||||
}
|
||||
|
|
|
@ -147,8 +147,8 @@ public class InputStreamBERReader implements BERReader {
|
|||
if (chunk == null) {
|
||||
throw new ASN1EncodingException(ERROR);
|
||||
}
|
||||
if (chunk.getITag() == 0 && chunk.getITagType() == BEREncoding.UNIVERSAL_TAG &&
|
||||
chunk.getITotalLength() == 2) {
|
||||
if (chunk.getTag() == 0 && chunk.getTagType() == BEREncoding.UNIVERSAL_TAG &&
|
||||
chunk.getTotalLength() == 2) {
|
||||
break;
|
||||
} else {
|
||||
chunks.add(chunk);
|
||||
|
|
25
build.gradle
25
build.gradle
|
@ -1,4 +1,5 @@
|
|||
plugins {
|
||||
id "com.github.spotbugs" version "1.6.2"
|
||||
id "org.sonarqube" version '2.6.1'
|
||||
id "io.codearte.nexus-staging" version "0.11.0"
|
||||
}
|
||||
|
@ -17,18 +18,22 @@ printf "Host: %s\nOS: %s %s %s\nJVM: %s %s %s %s\nGradle: %s Groovy: %s Java: %s
|
|||
GroovySystem.getVersion(),
|
||||
JavaVersion.current()
|
||||
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'pmd'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: "com.github.spotbugs"
|
||||
|
||||
|
||||
apply from: "${rootProject.projectDir}/gradle/ext.gradle"
|
||||
apply from: "${rootProject.projectDir}/gradle/sonarqube.gradle"
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
apply plugin: 'findbugs'
|
||||
apply plugin: 'pmd'
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
configurations {
|
||||
wagon
|
||||
|
@ -82,8 +87,6 @@ subprojects {
|
|||
sign configurations.archives
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "${rootProject.projectDir}/gradle/ext.gradle"
|
||||
apply from: "${rootProject.projectDir}/gradle/publish.gradle"
|
||||
apply from: "${rootProject.projectDir}/gradle/sonarqube.gradle"
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
group = org.xbib
|
||||
name = z3950
|
||||
version = 1.2.0
|
||||
version = 1.2.1
|
||||
|
||||
xbib-cql.version = 1.2.0
|
||||
netty.version = 4.1.29.Final
|
||||
|
||||
junit.version = 4.12
|
||||
wagon.version = 3.0.0
|
||||
wagon.version = 3.0.0
|
||||
|
||||
org.gradle.warning.mode = all
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
tasks.withType(FindBugs) {
|
||||
|
||||
|
||||
spotbugs {
|
||||
toolVersion = '3.1.3'
|
||||
sourceSets = [sourceSets.main]
|
||||
ignoreFailures = true
|
||||
reports {
|
||||
xml.enabled = false
|
||||
html.enabled = true
|
||||
}
|
||||
effort = "max"
|
||||
reportLevel = "high"
|
||||
}
|
||||
spotbugsMain.reports {
|
||||
xml.enabled = false
|
||||
html.enabled = true
|
||||
}
|
||||
spotbugsTest.reports {
|
||||
xml.enabled = false
|
||||
html.enabled = true
|
||||
}
|
||||
tasks.withType(Pmd) {
|
||||
ignoreFailures = true
|
||||
|
|
|
@ -1,323 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
|
||||
<!-- This is a checkstyle configuration file. For descriptions of
|
||||
what the following rules do, please see the checkstyle configuration
|
||||
page at http://checkstyle.sourceforge.net/config.html -->
|
||||
|
||||
<module name="Checker">
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<!-- Checks that there are no tab characters in the file.
|
||||
-->
|
||||
</module>
|
||||
|
||||
<module name="NewlineAtEndOfFile">
|
||||
<property name="lineSeparator" value="lf"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<!-- Checks that FIXME is not used in comments. TODO is preferred.
|
||||
-->
|
||||
<property name="format" value="((//.*)|(\*.*))FIXME" />
|
||||
<property name="message" value='TODO is preferred to FIXME. e.g. "TODO(johndoe): Refactor when v2 is released."' />
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<!-- Checks that TODOs are named. (Actually, just that they are followed
|
||||
by an open paren.)
|
||||
-->
|
||||
<property name="format" value="((//.*)|(\*.*))TODO[^(]" />
|
||||
<property name="message" value='All TODOs should be named. e.g. "TODO(johndoe): Refactor when v2 is released."' />
|
||||
</module>
|
||||
|
||||
<module name="JavadocPackage">
|
||||
<!-- Checks that each Java package has a Javadoc file used for commenting.
|
||||
Only allows a package-info.java, not package.html. -->
|
||||
</module>
|
||||
|
||||
<!-- All Java AST specific tests live under TreeWalker module. -->
|
||||
<module name="TreeWalker">
|
||||
|
||||
<!--
|
||||
|
||||
IMPORT CHECKS
|
||||
|
||||
-->
|
||||
|
||||
<module name="RedundantImport">
|
||||
<!-- Checks for redundant import statements. -->
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="ImportOrder">
|
||||
<!-- Checks for out of order import statements. -->
|
||||
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="groups" value="com.google,android,junit,net,org,java,javax"/>
|
||||