Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–233 unchanged (233 lines)
234 signatureLength = in.read(tarheader);
235 in.reset();
236 if (TarArchiveInputStream.matches(tarheader, signatureLength)) {
237 return new TarArchiveInputStream(in);
238 }
239 // COMPRESS-117 - improve auto-recognition
240 try {
241 TarArchiveInputStream tais = new TarArchiveInputStream(new ByteArrayInputStream(tarheader));
242 tais.getNextEntry();
243 return new TarArchiveInputStream(in);
244 } catch (Exception e) { // NOPMD
245 // can generate IllegalArgumentException as well as IOException
246 // autodetection, simply not a TAR
247 // ignored
248 }
249 } catch (IOException e) {
250 throw new ArchiveException("Could not use reset and mark operations.", e);
251 }
252
253 throw new ArchiveException("No Archiver found for the stream signature");
254 }
255}
256

After

…lines 1–233 unchanged (233 lines)
234 signatureLength = in.read(tarheader);
235 in.reset();
236 if (TarArchiveInputStream.matches(tarheader, signatureLength)) {
237 return new TarArchiveInputStream(in);
238 }
239 // COMPRESS-117 - improve auto-recognition
240 if (signatureLength >= 512) {
241 try {
242 TarArchiveInputStream tais = new TarArchiveInputStream(new ByteArrayInputStream(tarheader));
243 tais.getNextEntry();
244 return new TarArchiveInputStream(in);
245 } catch (Exception e) { // NOPMD
246 // can generate IllegalArgumentException as well as IOException
247 // autodetection, simply not a TAR
248 // ignored
249 }
250 }
251 } catch (IOException e) {
252 throw new ArchiveException("Could not use reset and mark operations.", e);
253 }
254
255 throw new ArchiveException("No Archiver found for the stream signature");
256 }
257}
258

Before

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "compress"
. "."
identifier "archivers"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "ByteArrayInputStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "InputStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "OutputStream"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
block_comment "/**\n * <p>Factory to create Archive[In|Out]putStreams from n"...
class_declaration
modifiers
public "public"
class "class"
identifier "ArchiveStreamFactory"
class_body
{ "{"
block_comment "/**\n * Constant used to identify the AR archive format.\n"...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "AR"
= "="
string_literal
" "\""
string_fragment "ar"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the CPIO archive format"...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "CPIO"
= "="
string_literal
" "\""
string_fragment "cpio"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the Unix DUMP archive f"...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "DUMP"
= "="
string_literal
" "\""
string_fragment "dump"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the JAR archive format."...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "JAR"
= "="
string_literal
" "\""
string_fragment "jar"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the TAR archive format."...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "TAR"
= "="
string_literal
" "\""
string_fragment "tar"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the ZIP archive format."...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "ZIP"
= "="
string_literal
" "\""
string_fragment "zip"
" "\""
; ";"
block_comment "/**\n * Create an archive input stream from an archiver n"...
method_declaration (+253 nodes collapsed)
block_comment "/**\n * Create an archive output stream from an archiver "...
method_declaration (+227 nodes collapsed)
block_comment "/**\n * Create an archive input stream from an input stre"...
method_declaration
modifiers
public "public"
type_identifier "ArchiveInputStream"
identifier "createArchiveInputStream"
formal_parameters
( "("
formal_parameter
modifiers
final "final"
type_identifier "InputStream"
identifier "in"
) ")"
throws
throws "throws"
type_identifier "ArchiveException"
block
{ "{"
if_statement (+25 nodes collapsed)
if_statement (+30 nodes collapsed)
local_variable_declaration (+21 nodes collapsed)
expression_statement
method_invocation
identifier "in"
. "."
identifier "mark"
argument_list
( "("
field_access
identifier "signature"
. "."
identifier "length"
) ")"
; ";"
try_statement
try "try"
block
{ "{"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "signatureLength"
= "="
method_invocation
identifier "in"
. "."
identifier "read"
argument_list
( "("
identifier "signature"
) ")"
; ";"
expression_statement
method_invocation
identifier "in"
. "."
identifier "reset"
argument_list
( "("
) ")"
; ";"
if_statement (+115 nodes collapsed)
line_comment "// Dump needs a bigger buffer to check the signature;"
local_variable_declaration (+21 nodes collapsed)
expression_statement
method_invocation
identifier "in"
. "."
identifier "mark"
argument_list
( "("
field_access
identifier "dumpsig"
. "."
identifier "length"
) ")"
; ";"
expression_statement
assignment_expression
identifier "signatureLength"
= "="
method_invocation
identifier "in"
. "."
identifier "read"
argument_list
( "("
identifier "dumpsig"
) ")"
; ";"
expression_statement
method_invocation
identifier "in"
. "."
identifier "reset"
argument_list
( "("
) ")"
; ";"
if_statement (+28 nodes collapsed)
line_comment "// Tar needs an even bigger buffer to check the signature; r"...
local_variable_declaration (+21 nodes collapsed)
expression_statement
method_invocation
identifier "in"
. "."
identifier "mark"
argument_list
( "("
field_access
identifier "tarheader"
. "."
identifier "length"
) ")"
; ";"
expression_statement
assignment_expression
identifier "signatureLength"
= "="
method_invocation
identifier "in"
. "."
identifier "read"
argument_list
( "("
identifier "tarheader"
) ")"
; ";"
expression_statement
method_invocation
identifier "in"
. "."
identifier "reset"
argument_list
( "("
) ")"
; ";"
if_statement (+28 nodes collapsed)
line_comment "// COMPRESS-117 - improve auto-recognition"
try_statement (+58 nodes collapsed)
} "}"
catch_clause (+26 nodes collapsed)
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "ArchiveException"
argument_list
( "("
string_literal
" "\""
string_fragment "No Archiver found for the stream signature"
" "\""
) ")"
; ";"
} "}"
} "}"

After

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "compress"
. "."
identifier "archivers"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "ByteArrayInputStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "InputStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "OutputStream"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
block_comment "/**\n * <p>Factory to create Archive[In|Out]putStreams from n"...
class_declaration
modifiers
public "public"
class "class"
identifier "ArchiveStreamFactory"
class_body
{ "{"
block_comment "/**\n * Constant used to identify the AR archive format.\n"...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "AR"
= "="
string_literal
" "\""
string_fragment "ar"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the CPIO archive format"...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "CPIO"
= "="
string_literal
" "\""
string_fragment "cpio"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the Unix DUMP archive f"...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "DUMP"
= "="
string_literal
" "\""
string_fragment "dump"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the JAR archive format."...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "JAR"
= "="
string_literal
" "\""
string_fragment "jar"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the TAR archive format."...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "TAR"
= "="
string_literal
" "\""
string_fragment "tar"
" "\""
; ";"
block_comment "/**\n * Constant used to identify the ZIP archive format."...
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "ZIP"
= "="
string_literal
" "\""
string_fragment "zip"
" "\""
; ";"
block_comment "/**\n * Create an archive input stream from an archiver n"...
method_declaration (+253 nodes collapsed)
block_comment "/**\n * Create an archive output stream from an archiver "...
method_declaration (+227 nodes collapsed)
block_comment "/**\n * Create an archive input stream from an input stre"...
method_declaration
modifiers
public "public"
type_identifier "ArchiveInputStream"
identifier "createArchiveInputStream"
formal_parameters
( "("
formal_parameter
modifiers
final "final"
type_identifier "InputStream"
identifier "in"
) ")"
throws
throws "throws"
type_identifier "ArchiveException"
block
{ "{"
if_statement (+25 nodes collapsed)
if_statement (+30 nodes collapsed)
local_variable_declaration (+21 nodes collapsed)
expression_statement
method_invocation
identifier "in"
. "."
identifier "mark"
argument_list
( "("
field_access
identifier "signature"
. "."
identifier "length"
) ")"
; ";"
try_statement
try "try"
block
{ "{"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "signatureLength"
= "="
method_invocation
identifier "in"
. "."
identifier "read"
argument_list
( "("
identifier "signature"
) ")"
; ";"
expression_statement
method_invocation
identifier "in"
. "."
identifier "reset"
argument_list
( "("
) ")"
; ";"
if_statement (+115 nodes collapsed)
line_comment "// Dump needs a bigger buffer to check the signature;"
local_variable_declaration (+21 nodes collapsed)
expression_statement
method_invocation
identifier "in"
. "."
identifier "mark"
argument_list
( "("
field_access
identifier "dumpsig"
. "."
identifier "length"
) ")"
; ";"
expression_statement
assignment_expression
identifier "signatureLength"
= "="
method_invocation
identifier "in"
. "."
identifier "read"
argument_list
( "("
identifier "dumpsig"
) ")"
; ";"
expression_statement
method_invocation
identifier "in"
. "."
identifier "reset"
argument_list
( "("
) ")"
; ";"
if_statement (+28 nodes collapsed)
line_comment "// Tar needs an even bigger buffer to check the signature; r"...
local_variable_declaration (+21 nodes collapsed)
expression_statement
method_invocation
identifier "in"
. "."
identifier "mark"
argument_list
( "("
field_access
identifier "tarheader"
. "."
identifier "length"
) ")"
; ";"
expression_statement
assignment_expression
identifier "signatureLength"
= "="
method_invocation
identifier "in"
. "."
identifier "read"
argument_list
( "("
identifier "tarheader"
) ")"
; ";"
expression_statement
method_invocation
identifier "in"
. "."
identifier "reset"
argument_list
( "("
) ")"
; ";"
if_statement (+28 nodes collapsed)
line_comment "// COMPRESS-117 - improve auto-recognition"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "signatureLength"
>= ">="
decimal_integer_literal "512"
) ")"
block
{ "{"
try_statement (+58 nodes collapsed)
} "}"
} "}"
catch_clause (+26 nodes collapsed)
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "ArchiveException"
argument_list
( "("
string_literal
" "\""
string_fragment "No Archiver found for the stream signature"
" "\""
) ")"
; ";"
} "}"
} "}"