Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup and PDF parser fix #280

Merged
merged 5 commits into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.