Skip to content

Commit 3c823ff

Browse files
committed
Merge branch 'master' into release-2.12 and bump version to 2.12.2.
2 parents c429254 + bbb996d commit 3c823ff

File tree

32 files changed

+160
-125
lines changed

32 files changed

+160
-125
lines changed

.github/workflows/docker-image.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

1616
- name: Log in to Docker Hub
17-
uses: docker/login-action@v1
17+
uses: docker/login-action@v2
1818
with:
1919
username: ${{ secrets.DOCKER_USERNAME }}
2020
password: ${{ secrets.DOCKER_PASSWORD }}
2121
- name: Log in to the Github registry
22-
uses: docker/login-action@v1
22+
uses: docker/login-action@v2
2323
with:
2424
registry: ghcr.io
2525
username: ${{ github.actor }}
2626
password: ${{ secrets.GITHUB_TOKEN }}
2727

2828
- name: Build and push master branch snapshot
2929
if: ${{ github.ref == 'refs/heads/master' }}
30-
uses: docker/build-push-action@v2
30+
uses: docker/build-push-action@v3
3131
with:
3232
file: build/docker/Dockerfile
3333
push: true
@@ -38,15 +38,15 @@ jobs:
3838
- name: Extract metadata (tags, labels) for Docker
3939
id: meta
4040
if: ${{ startsWith(github.ref, 'refs/tags/') }}
41-
uses: docker/metadata-action@v3
41+
uses: docker/metadata-action@v4
4242
with:
4343
images: |
4444
robcast/digilib
4545
ghcr.io/robcast/digilib
4646
4747
- name: Build and push tagged version
4848
if: ${{ startsWith(github.ref, 'refs/tags/') }}
49-
uses: docker/build-push-action@v2
49+
uses: docker/build-push-action@v3
5050
with:
5151
file: build/docker/Dockerfile
5252
push: true

.github/workflows/maven.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,42 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
- name: Set up JDK 11
16-
uses: actions/setup-java@v2
16+
uses: actions/setup-java@v3
1717
with:
1818
java-version: '11'
1919
distribution: 'adopt'
2020
- name: Cache Maven packages
21-
uses: actions/cache@v2
21+
uses: actions/cache@v3
2222
with:
2323
path: ~/.m2
2424
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
2525
restore-keys: ${{ runner.os }}-m2
2626

27-
- name: Checkout artifact repo
28-
uses: actions/checkout@v2
27+
- name: Checkout artifact repo (for release)
28+
if: startsWith(github.ref, 'refs/tags/')
29+
uses: actions/checkout@v3
2930
with:
3031
repository: robcast/digilib-repo
3132
ref: gh-pages
3233
path: digilib-repo
33-
- name: Copy existing maven-repo
34+
- name: Copy existing maven-repo (for release)
35+
if: startsWith(github.ref, 'refs/tags/')
3436
run: |
3537
mkdir -p target/site/maven-repo
3638
cp -rp digilib-repo/maven-repo/* target/site/maven-repo/
3739
38-
- name: Build with tests and javadoc using Maven
39-
run: mvn -Pbuild-all -DskipTests=false javadoc:aggregate deploy -DaltDeploymentRepository=repo::default::file:target/site/maven-repo -B
40+
- name: Build tests using Maven
41+
run: mvn -Pbuild-all -DskipTests=false test -B
4042

41-
- name: Deploy javadoc and maven-repo to digilib-repo
42-
uses: crazy-max/ghaction-github-pages@v2
43+
- name: Deploy javadoc and Maven artefacts (for release)
44+
if: startsWith(github.ref, 'refs/tags/')
45+
run: mvn -Pbuild-all javadoc:aggregate deploy -DaltDeploymentRepository=repo::default::file:target/site/maven-repo -B
46+
47+
- name: Deploy javadoc and maven-repo to digilib-repo (for release)
48+
if: startsWith(github.ref, 'refs/tags/')
49+
uses: crazy-max/ghaction-github-pages@v3
4350
with:
4451
repo: robcast/digilib-repo
4552
target_branch: gh-pages
@@ -53,14 +60,14 @@ jobs:
5360

5461
- name: Deploy html site to gh-pages
5562
if: ${{ github.ref == 'refs/heads/master' }}
56-
uses: crazy-max/ghaction-github-pages@v2
63+
uses: crazy-max/ghaction-github-pages@v3
5764
with:
5865
target_branch: gh-pages
5966
build_dir: doc/target/site
6067
env:
6168
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6269

63-
- name: add WAR to GH Release
70+
- name: add WAR to GH Release (for release)
6471
if: startsWith(github.ref, 'refs/tags/')
6572
uses: softprops/action-gh-release@v1
6673
with:

common-cdstar/pom.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>digilib</artifactId>
99
<groupId>digilib</groupId>
10-
<version>2.12.1</version>
10+
<version>2.12.2</version>
1111
</parent>
1212

1313
<artifactId>digilib-common-cdstar</artifactId>
@@ -31,14 +31,12 @@
3131
<version>4.5.13</version>
3232
</dependency>
3333
<dependency>
34-
<groupId>javax.json</groupId>
35-
<artifactId>javax.json-api</artifactId>
36-
<version>1.1</version><!--$NO-MVN-MAN-VER$--><!-- use 1.1 instead of global 1.0 -->
34+
<groupId>jakarta.json</groupId>
35+
<artifactId>jakarta.json-api</artifactId>
3736
</dependency>
3837
<dependency>
3938
<groupId>org.glassfish</groupId>
40-
<artifactId>javax.json</artifactId>
41-
<version>1.1.4</version><!-- use 1.1 instead of global 1.0 -->
39+
<artifactId>jakarta.json</artifactId>
4240
</dependency>
4341
</dependencies>
4442
</project>

common-cdstar/src/main/java/digilib/io/CdstarArchiveDocuDirectory.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
import java.util.Arrays;
3232
import java.util.List;
3333

34-
import javax.json.Json;
35-
import javax.json.JsonArray;
36-
import javax.json.JsonObject;
37-
import javax.json.JsonReader;
38-
import javax.json.JsonValue;
34+
import jakarta.json.Json;
35+
import jakarta.json.JsonArray;
36+
import jakarta.json.JsonObject;
37+
import jakarta.json.JsonReader;
38+
import jakarta.json.JsonValue;
3939

4040
import org.apache.http.HttpEntity;
4141
import org.apache.http.client.methods.CloseableHttpResponse;

common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>digilib</artifactId>
77
<groupId>digilib</groupId>
8-
<version>2.12.1</version>
8+
<version>2.12.2</version>
99
</parent>
1010

1111
<artifactId>digilib-common</artifactId>

common/src/main/java/digilib/conf/DigilibConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class DigilibConfiguration extends ParameterMap {
6464
* @return the version
6565
*/
6666
public static String getClassVersion() {
67-
return "2.12.1";
67+
return "2.12.2";
6868
}
6969

7070
/* non-static getVersion for Java inheritance */

common/src/main/java/digilib/image/ImageJobDescription.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ public ImageInput getInput() throws IOException {
566566
if (input == null || input.getMimetype() == null) {
567567
throw new FileOpException("Unable to load " + input);
568568
}
569-
logger.info("Planning to load: {}", input);
569+
logger.debug("Image input: {}", input);
570570
}
571571
return input;
572572
}

common/src/main/java/digilib/image/ImageLoaderDocuImage.java

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282

8383
import org.w3c.dom.NamedNodeMap;
8484
import org.w3c.dom.Node;
85+
import org.w3c.dom.NodeList;
8586

8687
import digilib.io.FileOpException;
8788
import digilib.io.FileOps;
@@ -94,7 +95,7 @@
9495
public class ImageLoaderDocuImage extends ImageInfoDocuImage {
9596

9697
/** DocuImage version */
97-
public static final String version = "ImageLoaderDocuImage 2.3.1";
98+
public static final String version = "ImageLoaderDocuImage 2.4.1";
9899

99100
/** image object */
100101
protected BufferedImage img;
@@ -132,8 +133,6 @@ protected static enum Hacks {
132133
needsRescaleRgba,
133134
/** destination image type for LookupOp(mapBgrByteTable) needs to be (A)BGR */
134135
needsMapBgr,
135-
/** set destination type for blur operation */
136-
forceDestForBlur,
137136
/** set destination type for scale operation */
138137
forceDestForScaleCustom,
139138
/** JPEG writer can't deal with RGBA */
@@ -146,7 +145,7 @@ protected static enum Hacks {
146145
force16BitTo8,
147146
/** convert images with 16 bit depth to sRGB (and 8 bit depth) */
148147
force16BitToSrgb8
149-
}
148+
}
150149

151150
/** active hacks */
152151
protected static EnumMap<Hacks, Boolean> imageHacks = new EnumMap<Hacks, Boolean>(Hacks.class);
@@ -431,6 +430,7 @@ protected void changeRasterToSrgb(BufferedImage img, ICC_Profile realProfile) {
431430
* @return
432431
*/
433432
protected BufferedImage changeTo8BitDepth(BufferedImage bi) {
433+
// method suggested by Harald K in https://stackoverflow.com/a/74995441/4912
434434
ColorModel cm = bi.getColorModel();
435435
ColorSpace cs = cm.getColorSpace();
436436
boolean hasAlpha = cm.hasAlpha();
@@ -487,17 +487,24 @@ public void setElem(int bank, int i, int val) {
487487
* @return
488488
*/
489489
protected BufferedImage changeTo8BitNoAlpha(BufferedImage bi) {
490+
BufferedImage newBi;
490491
ColorModel cm = bi.getColorModel();
491-
int transferType = DataBuffer.TYPE_BYTE;
492-
ColorSpace newCs = cm.getColorSpace();
493-
ColorModel newCm = new ComponentColorModel(newCs, false, false, Transparency.OPAQUE, transferType);
494-
WritableRaster newRaster = newCm.createCompatibleWritableRaster(bi.getWidth(), bi.getHeight());
495-
// use child Raster with only color components (bands 0,1,2)
496-
final int[] colorBands = new int[] { 0, 1, 2 };
497-
WritableRaster colorRaster = bi.getRaster().createWritableChild(0, 0, bi.getWidth(), bi.getHeight(), 0, 0,
498-
colorBands);
499-
BufferedImage newBi = new BufferedImage(newCm, newRaster, false, null);
500-
newBi.setData(colorRaster);
492+
if (cm instanceof ComponentColorModel || cm instanceof DirectColorModel) {
493+
ColorSpace newCs = cm.getColorSpace();
494+
ColorModel newCm = new ComponentColorModel(newCs, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
495+
WritableRaster newRaster = newCm.createCompatibleWritableRaster(bi.getWidth(), bi.getHeight());
496+
// use child Raster with only color components (bands 0,1,2)
497+
final int[] colorBands = new int[] { 0, 1, 2 };
498+
WritableRaster colorRaster = bi.getRaster().createWritableChild(0, 0, bi.getWidth(), bi.getHeight(), 0, 0,
499+
colorBands);
500+
newBi = new BufferedImage(newCm, newRaster, false, null);
501+
newBi.setData(colorRaster);
502+
} else {
503+
logger.debug("changeTo8BitNonAlpha: converting to sRGB");
504+
ColorConvertOp cco = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB), renderHint);
505+
BufferedImage dest = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_INT_RGB);
506+
newBi = cco.filter(bi, dest);
507+
}
501508
return newBi;
502509
}
503510

@@ -663,9 +670,10 @@ protected ICC_Profile getPngColorProfile(ImageReader reader) throws IOException
663670
ICC_Profile profile = null;
664671
IIOMetadata meta = reader.getImageMetadata(0);
665672
IIOMetadataNode dom = (IIOMetadataNode) meta.getAsTree(meta.getNativeMetadataFormatName());
666-
IIOMetadataNode iccpNode = (IIOMetadataNode) dom.getElementsByTagName("iCCP").item(0);
667-
if (iccpNode != null) {
673+
NodeList iccpNodes = dom.getElementsByTagName("iCCP");
674+
if (iccpNodes.getLength() > 0) {
668675
logger.debug("extracting iCCP profile from PNG.");
676+
IIOMetadataNode iccpNode = (IIOMetadataNode) iccpNodes.item(0);
669677
NamedNodeMap atts = iccpNode.getAttributes();
670678
//String name = atts.getNamedItem("profileName").getNodeValue();
671679
String compression = atts.getNamedItem("compressionMethod").getNodeValue();
@@ -740,7 +748,7 @@ public void loadSubimage(ImageInput ii, Rectangle region, int prescale) throws F
740748
cm = img.getColorModel();
741749
cs = cm.getColorSpace();
742750
} catch (Exception e) {
743-
logger.warn("Converting image to 8bit failed! Trying to convert to sRGB: {}", e);
751+
logger.warn("Converting image to 8bit failed! Trying to convert to sRGB: {}", e.toString());
744752
convertToSrgb = true;
745753
}
746754
}

doc/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>digilib</groupId>
55
<artifactId>digilib</artifactId>
6-
<version>2.12.1</version>
6+
<version>2.12.2</version>
77
</parent>
88
<artifactId>digilib-doc</artifactId>
99
<packaging>pom</packaging>

frontend-greyskin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>digilib</groupId>
77
<artifactId>digilib</artifactId>
8-
<version>2.12.1</version>
8+
<version>2.12.2</version>
99
</parent>
1010
<artifactId>digilib-frontend-greyskin</artifactId>
1111
<packaging>war</packaging>

0 commit comments

Comments
 (0)