-
Notifications
You must be signed in to change notification settings - Fork 26
Add getL and getstreamLength methods to GFPDInlineImage #738
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
base: integration
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -160,4 +160,14 @@ | |
| public Boolean getisMask() { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
|
Check failure on line 164 in validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDInlineImage.java
|
||
| public Long getL() { | ||
| return ((org.verapdf.pd.images.PDInlineImage) this.simplePDObject).getL(); | ||
|
Check failure on line 166 in validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDInlineImage.java
|
||
| } | ||
|
|
||
| @Override | ||
|
Check failure on line 169 in validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDInlineImage.java
|
||
| public Long getstreamLength() { | ||
| return ((org.verapdf.pd.images.PDInlineImage) this.simplePDObject).getStreamLength(); | ||
|
Check failure on line 171 in validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDInlineImage.java
|
||
|
Comment on lines
+164
to
+171
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
rg -nP --glob '*.java' '\b(getL|getStreamLength|getstreamLength)\s*\(' .
rg -n --glob 'pom.xml' --glob '*.gradle*' 'pdf-model|validation-model' .Repository: veraPDF/veraPDF-validation Length of output: 1300 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)PDFModel\.java$|(^|/)GFPDInlineImage\.java$'
echo
echo "== PDFModel outline =="
if [ -f src/main/java/org/verapdf/model/impl/pd/PDFModel.java ] || [ -f src/main/java/org/verapdf/model/pdf/PDFModel.java ]; then
ast-grep outline $(git ls-files | rg '(^|/)PDFModel\.java$') --view expanded || true
fi
echo
echo "== PDFModel relevant PDInlineImage section =="
rg -n --glob '*.java' 'interface PDInlineImage|class PDInlineImage|PDInlineImage' . | head -80
echo
echo "== GFPDInlineImage full relevant file =="
cat -n validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDInlineImage.java | sed -n '1,240p'
echo
echo "== pom dependency refs =="
cat -n pom.xml | sed -n '1,140p'
cat -n validation-model/pom.xml | sed -n '1,90p'
echo
echo "== current git status/stat =="
git diff --stat HEAD~1..HEAD 2>/dev/null || git status --shortRepository: veraPDF/veraPDF-validation Length of output: 19723 🌐 Web query:
💡 Result: In the veraPDF model (specifically within the org.verapdf.model.pdlayer package), PDInlineImage is a model interface representing inline images, rather than a direct implementation of the Apache PDFBox PDInlineImage class [1][2]. Based on the veraPDF model definition files (.mdl) and API structure, PDInlineImage does not possess methods named getL or getStreamLength [1]. These specific method names do not exist within the veraPDF PDInlineImage interface [1][2]. The veraPDF PDInlineImage interface is designed to map PDF model features for validation purposes [2]. While Apache PDFBox's PDInlineImage class (org.apache.pdfbox.pdmodel.graphics.image.PDInlineImage) provides methods to access image data—such as getData or createInputStream—the veraPDF model abstraction layer for inline images is distinct and primarily focused on exposing properties required for PDF/A validation, rather than providing direct stream manipulation methods like getStreamLength [1][3]. If you are encountering references to getL or getStreamLength, they are likely not standard members of the veraPDF 1.31.0 PDInlineImage interface [1]. You may be confusing the veraPDF model abstraction with the underlying Apache PDFBox library methods or a custom extension [3]. Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== pdf-model dependency declarations across repository =="
rg -n --glob 'pom.xml' 'artifactId>pdf-model|verapdf\.pdfmodel\.version|groupId>org\.verapdf|artifactId>parser|verapdf\.parser\.version' .
echo
echo "== local maven cache pdf-model files if present =="
find $HOME/.m2/repository/org/verapdf -path '*pdf-model*' 2>/dev/null | sort | tail -50 || true
if [ -d "$HOME/.m2/repository/org/verapdf/pdf-model" ]; then
find "$HOME/.m2/repository/org/verapdf/pdf-model" -maxdepth 4 -type f \( -name 'pdf-model-*.jar' -o -name 'PDInlineImage.java' -o -name '*.mdl' \) | sort
fi
echo
echo "== resolve pdf-model version and search inside jars (if cached) =="
python3 - <<'PY'
import os, json, re
root = os.path.expanduser('~/.m2/repository/org/verapdf/pdf-model')
versions = sorted(os.listdir(root)) if os.path.isdir(root) else []
print(json.dumps({"versions": versions, "count": len(versions)}))
PY
echo
echo "== inspect changed files context =="
git diff -- validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDInlineImage.java | sed -n '1,220p'Repository: veraPDF/veraPDF-validation Length of output: 2885 🌐 Web query:
💡 Result: As of July 24, 2026, the veraPDF project maintains the veraPDF-model repository, which defines the validation model using a domain-specific language (DSL) [1]. The specific class PDInlineImage.java is not a manually written source file but is generated from the model definition (typically defined in files like PDLayer.mdl) via Xtext [1][2]. Regarding version 1.31.0: - The veraPDF consortium has been working on version 1.31, as evidenced by development release directories (e.g., /dev/1.31) [3]. - Artifacts for version 1.31.1 exist in the developer repository [4], indicating that 1.31.0 was a preceding development or release version in that cycle. - The project documentation and source code are primarily managed through the GitHub organization veraPDF [1][5]. Developers wishing to inspect the generated code or the underlying model DSL can clone the veraPDF-model repository from GitHub and perform a Maven build to generate the source files [1]. Because PDInlineImage.java is a generated artifact, you will not find it directly in the repository's main file tree; instead, you must generate it locally from the DSL definition [1][2]. Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== git tags/ref state =="
git rev-parse HEAD
git branch --show-current 2>/dev/null || true
git tag --points-at HEAD 2>/dev/null | sort
git tag | rg '^(v?1\.31|1\.31\.0|1\.31\.1)' | sort | tail -20 || true
echo
echo "== local PDFLayer model definitions =="
find . -type f \( -name 'PDLayer.mdl' -o -path '*/pdf-model/*' -o -path '*/PDFLayer/*' \) | sort | head -100
rg -n --glob '*.mdl' --glob '*.xml' --glob '*.java' 'PDInlineImage|PDXImage' .
echo
echo "== direct URL artifact listing for 1.31.1 artifact =="
python3 - <<'PY'
import urllib.request
url = 'https://artifactory.openpreservation.org/artifactory/vera-dev/org/verapdf/pdf-model/'
for prefix in ['1.31.0/', '1.31.1/', '1.32.0-RC/']:
try:
lines = urllib.request.urlopen(url + prefix, timeout=20).read().decode()
print(f'\n--- {prefix} ---')
for line in lines.splitlines()[:40]:
print(line.rstrip())
except Exception as e:
print(f'\n--- {prefix} --- ERROR: {e}')
PY
echo
echo "== download and inspect pdf-model API for relevant methods if 1.31.1 is available =="
python3 - <<'PY'
import urllib.request, zipfile, io, re
bases = [
'https://artifactory.openpreservation.org/artifactory/vera-dev/org/verapdf/pdf-model/1.31.1/pdf-model-1.31.1.jar',
'https://artifactory.openpreservation.org/artifactory/vera-dev/org/verapdf/parser/1.31.1/parser-1.31.1.jar',
]
for href in bases:
try:
jar_path = '/tmp/' + href.split('/')[-1]
with urllib.request.urlopen(href, timeout=40) as r, open(jar_path, 'wb') as f:
f.write(r.read())
print(f'\n--- {jar_path} ---')
with zipfile.ZipFile(jar_path, 'r') as z:
names = z.namelist()
hits = [n for n in names if re.search(r'(/\b|\.)(PDInlineImage|PDXImage|PDFModel|PDFLayer|parser).*java|/getL|/getStreamLength', n, re.I)]
print('candidate hits:')
for n in hits[:100]:
print(n)
target = 'org/verapdf/model/pdlayer/PDInlineImage.java'
if target in z.namelist():
source = z.read(target).decode()
for line_no, line in enumerate(source.splitlines(), 1):
if re.search(r'getL|getStreamLength|getImage\s?\(|getL(Length)?\s?\(', line):
print(f'{target}:{line_no}: {line}')
except Exception as e:
print(f'ERROR for {href}: {e}')
PYRepository: veraPDF/veraPDF-validation Length of output: 14092 Restore API alignment before merging. The current build cannot resolve 🧰 Tools🪛 GitHub Check: Checkout and Build (17)[failure] 171-171: [failure] 169-169: [failure] 166-166: [failure] 164-164: [failure] 171-171: [failure] 169-169: [failure] 166-166: [failure] 164-164: 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Do not convert a length-read failure into a valid zero length.
When
getStreamLength()throws, the parser still createsGFOp_EIwith0, so downstream validation receives concrete but incorrect stream-length metadata. Propagate the parse failure or preserve an explicit “unknown” state handled by consumers; do not silently use zero.🤖 Prompt for AI Agents