Skip to content

Commit

Permalink
Merge pull request #280 from bl-dpt/review
Browse files Browse the repository at this point in the history
Code cleanup and PDF parser fix
  • Loading branch information
carlwilson authored Oct 27, 2017
2 parents 4a4b6bb + 119c599 commit f0e9222
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 102 deletions.
12 changes: 2 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# Ignore Eclipse files
.project
.classpath
.settings

# Ignore IntelliJ files
.idea
**/*.iml

# Ignore Maven artefacts
target/
pom.xml.tag
Expand All @@ -19,4 +10,5 @@ release.properties
Gemfile.lock

# Ignore Test Root
test-root
/test-root/

Original file line number Diff line number Diff line change
Expand Up @@ -716,14 +716,7 @@ else if ("ANNO".equals (id)) {
("Chunk type '" + id + "' ignored", _nByte));
}
if (chunk != null) {
try {
if (!chunk.readChunk (info)) {
return false;
}
}
catch (JhoveException e) {
info.setMessage(new ErrorMessage (e.getMessage()));
info.setWellFormed (false);
if (!chunk.readChunk (info)) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,13 +735,7 @@ protected boolean readChunk(RepInfo info) throws IOException {
}

if (chunk != null) {
try {
if (!chunk.readChunk(info)) {
return false;
}
} catch (JhoveException je) {
info.setMessage(new ErrorMessage(je.getMessage()));
info.setWellFormed(false);
if (!chunk.readChunk(info)) {
return false;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package edu.harvard.hul.ois.jhove.module.iff;

import edu.harvard.hul.ois.jhove.JhoveException;
import edu.harvard.hul.ois.jhove.ModuleBase;
import edu.harvard.hul.ois.jhove.RepInfo;

Expand Down Expand Up @@ -46,8 +45,7 @@ public Chunk(ModuleBase module, ChunkHeader hdr, DataInputStream dstrm)
* @return <code>false</code> if the chunk is structurally
* invalid, otherwise <code>true</code>
*/
public abstract boolean readChunk(RepInfo info)
throws IOException, JhoveException;
public abstract boolean readChunk(RepInfo info) throws IOException;

/**
* Converts a byte buffer cleanly into an ASCII string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,9 @@ else if (_state == (State.NAME)) {
int ch1 = readChar ();
int ch2 = readChar ();
// Will throw a PDFException if not hexadecimal:
_ch = (hexValue(ch1) << 8) + hexValue(ch2);
_ch = (hexValue(ch1) << 4) + hexValue(ch2);
}
if (isDelimiter (_ch) || isWhitespace (_ch)) {
else if (isDelimiter (_ch) || isWhitespace (_ch)) {
_state = State.WHITESPACE;
((StringValuedToken) token).setValue(buffer.toString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,9 @@ else if (id.equals ("ltxt")) {
("Chunk type '" + id + "' in Associated Data Chunk ignored"));
}
else {
try {
if (!chunk.readChunk (info)) {
return false;
}
}
catch (JhoveException e) {
info.setMessage(new ErrorMessage (e.getMessage()));
info.setWellFormed (false);
if (!chunk.readChunk (info)) {
return false;
}

}
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public FormatChunk(
* @return <code>false</code> if the chunk is structurally
* invalid, otherwise <code>true</code>
*/
public boolean readChunk(RepInfo info) throws IOException, JhoveException {
public boolean readChunk(RepInfo info) throws IOException {
WaveModule module = (WaveModule) _module;
int validBitsPerSample = -1;
byte[] subformat = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,7 @@ private boolean readInfoChunk (RepInfo info) throws IOException
("Chunk type '" + id + "' in List Info Chunk ignored"));
}
else {
try {
if (!chunk.readChunk (info)) {
return false;
}
}
catch (JhoveException e) {
info.setMessage(new ErrorMessage (e.getMessage()));
info.setWellFormed (false);
if (!chunk.readChunk (info)) {
return false;
}
}
Expand Down Expand Up @@ -157,14 +150,7 @@ else if ("eucm".equals (id)) {
("Chunk type '" + id + "' in Associated Data Chunk ignored"));
}
else {
try {
if (!chunk.readChunk (info)) {
return false;
}
}
catch (JhoveException e) {
info.setMessage(new ErrorMessage (e.getMessage()));
info.setWellFormed (false);
if (!chunk.readChunk (info)) {
return false;
}
}
Expand Down Expand Up @@ -210,14 +196,7 @@ else if (id.equals ("ltxt")) {
"' in Associated Data Chunk ignored"));
}
else {
try {
if (!chunk.readChunk (info)) {
return false;
}
}
catch (JhoveException e) {
info.setMessage(new ErrorMessage (e.getMessage()));
info.setWellFormed (false);
if (!chunk.readChunk (info)) {
return false;
}
}
Expand Down
14 changes: 0 additions & 14 deletions md5.pl

This file was deleted.

24 changes: 0 additions & 24 deletions userhome

This file was deleted.

0 comments on commit f0e9222

Please sign in to comment.