[IMAGING] Pull request

2018-11-30 Thread Sukant Kumar
Hello Everyone,

I am Shukant Pal, look at my PR for Commons Imaging 
https://github.com/apache/commons-imaging/pull/38. I want to get it 
merged, how to do that?

Regards,

ShukantPal



Re: [IMAGING] Pull request

2018-11-30 Thread Gilles

Hi.

On Fri, 30 Nov 2018 14:00:52 +, Sukant Kumar wrote:

Hello Everyone,

I am Shukant Pal, look at my PR for Commons Imaging
https://github.com/apache/commons-imaging/pull/38. I want to get it
merged, how to do that?


A committer has to do it.
IIRC the main committer of [Imaging] (Bruno) is busy elsewhere
at the moment, so some patience will be necessary until someone
can review your contribution.

Best regards,
Gilles



Regards,

ShukantPal



-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #34: IMAGING-188

2018-07-21 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/34#discussion_r204226800
  
--- Diff: pom.xml ---
@@ -209,6 +209,12 @@
   2.6
   test
 
+
+
+  com.github.jai-imageio
+  jai-imageio-jpeg2000
+  1.3.0
+
--- End diff --

Adding a dependency to `jai-imageio-jpeg2000` brings `jai-imageio-core` too 
I believe. ImageIO and Commons Imaging share a lot of features. But, IMO, 
adding a dependency from one to another, would be like adding TestNG as a 
dependency in JUnit to get the TestNG groups feature.

A better approach, IMO, would be to build up the required code for JPEG2000 
either within Commons Imaging or as a module. And then implement the rest of 
the code as you have it here.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-07-31 Thread TheRealHaui
GitHub user TheRealHaui opened a pull request:

https://github.com/apache/commons-imaging/pull/30

add-tests

Added new Unit Tests.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/TheRealHaui/commons-imaging add-tests

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/30.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #30


commit d58de6e4e60f6f61ff8e8b37887b62914f8e19c3
Author: Michael Hausegger 
Date:   2017-07-31T23:03:41Z

add-tests Added new Unit Tests.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-06 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r131538871
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpParserTest.java
 ---
@@ -1,3 +1,19 @@
+/*
--- End diff --

Great catch on the missing licence headers! As I'm adding comments to this 
PR, and I'm just passing by the component to see if it supports something that 
I need for a project - and am not really familiar with the code base. It may 
take a bit longer to merge this PR. But if you submit another one just for the 
headers, we can merge it pretty much immediately ;-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-06 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r131538915
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByteOrShortTest.java
 ---
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import java.nio.ByteOrder;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+
+/**
+ * Unit tests for class {@link TagInfoByteOrShort}.
+ *
+ * @date 2017-08-01
+ * @see TagInfoByteOrShort
+ *
+ **/
+public class TagInfoByteOrShortTest{
+
+  @Test
+  public void 
testEncodeValueTaking1And1AndEncodeValueTaking1And1AndEncodeValueTaking1And1ReturningNonEmptyArrayOne()
 {
+  TiffDirectoryType tiffDirectoryType = 
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTES;
+  TagInfoByteOrShort tagInfoByteOrShort = new TagInfoByteOrShort("r", 
500, 500, tiffDirectoryType);
+  ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+  short[] shortArray = new short[2];
+  byte[] byteArray = tagInfoByteOrShort.encodeValue(byteOrder, 
shortArray);
+
+  assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, 
byteArray);
+  }
+
+  @Test
+  public void 
testEncodeValueTaking1And1AndEncodeValueTaking1And1AndEncodeValueTaking1And1ReturningNonEmptyArrayTwo()
 {
--- End diff --

Never had problems with really long test method names, but **if** it's 
possible to simplify the method name, I'd be +1 for that. Not thoroughly 
reading the tests yet.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-06 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r131538887
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PgmFileInfoTest.java ---
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.pnm;
+
+import org.apache.commons.imaging.ImageReadException;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Unit tests for class {@link PgmFileInfo}.
+ *
+ * @date 2017-08-01
--- End diff --

Not necessary I think... 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-06 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r131538792
  
--- Diff: pom.xml ---
@@ -209,6 +209,12 @@
   2.5
   test
 
+
--- End diff --

-0 Looks like it reduces the code that needs to be written a little bit. 
But I'd still be keen to keep the code lengthier, but using just vanilla JUnit.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-06 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r131538892
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PgmFileInfoTest.java ---
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.pnm;
+
+import org.apache.commons.imaging.ImageReadException;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Unit tests for class {@link PgmFileInfo}.
+ *
+ * @date 2017-08-01
+ * @see PgmFileInfo
+ *
+ **/
+public class PgmFileInfoTest{
+
+  @Test(expected = ImageReadException.class)
--- End diff --

I think the IDE got confused here. Better to keep consistent with number of 
spaces.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-09 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r132306138
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PgmFileInfoTest.java ---
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.pnm;
+
+import org.apache.commons.imaging.ImageReadException;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Unit tests for class {@link PgmFileInfo}.
+ *
+ * @date 2017-08-01
--- End diff --

Removed the class comment.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-09 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r132306981
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PgmFileInfoTest.java ---
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.pnm;
+
+import org.apache.commons.imaging.ImageReadException;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Unit tests for class {@link PgmFileInfo}.
+ *
+ * @date 2017-08-01
+ * @see PgmFileInfo
+ *
+ **/
+public class PgmFileInfoTest{
+
+  @Test(expected = ImageReadException.class)
--- End diff --

Reformatted code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-09 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r132307800
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByteOrShortTest.java
 ---
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import java.nio.ByteOrder;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+
+/**
+ * Unit tests for class {@link TagInfoByteOrShort}.
+ *
+ * @date 2017-08-01
+ * @see TagInfoByteOrShort
+ *
+ **/
+public class TagInfoByteOrShortTest{
+
+  @Test
+  public void 
testEncodeValueTaking1And1AndEncodeValueTaking1And1AndEncodeValueTaking1And1ReturningNonEmptyArrayOne()
 {
+  TiffDirectoryType tiffDirectoryType = 
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTES;
+  TagInfoByteOrShort tagInfoByteOrShort = new TagInfoByteOrShort("r", 
500, 500, tiffDirectoryType);
+  ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+  short[] shortArray = new short[2];
+  byte[] byteArray = tagInfoByteOrShort.encodeValue(byteOrder, 
shortArray);
+
+  assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, 
byteArray);
+  }
+
+  @Test
+  public void 
testEncodeValueTaking1And1AndEncodeValueTaking1And1AndEncodeValueTaking1And1ReturningNonEmptyArrayTwo()
 {
--- End diff --

Renamed test methods.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-09 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r132308184
  
--- Diff: pom.xml ---
@@ -209,6 +209,12 @@
   2.5
   test
 
+
--- End diff --

Well, Equalsverifier checks equals and hashCode methods soroly.
Therefore I considered to use it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-09 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r132310660
  
--- Diff: pom.xml ---
@@ -209,6 +209,12 @@
   2.5
   test
 
+
--- End diff --

Indeed, and I may even use it in some projects at work. However, other 
commons components use - as far as I can remember - JUnit with some local 
helper classes for tests. So my line of thinking, is that even though it looks 
useful, others would have to learn and remember to use it, or eventually we 
would end up with calls to Equalsverifier methods, and in some other places the 
old way. But again, -0 is not a blocker, if others prefer to have it, I'm fine 
with it :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-08-09 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r132311416
  
--- Diff: pom.xml ---
@@ -209,6 +209,12 @@
   2.5
   test
 
+
--- End diff --

Understand your point.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #30: add-tests

2017-09-19 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/30#discussion_r139785201
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpParserTest.java
 ---
@@ -1,3 +1,19 @@
+/*
--- End diff --

Created #31 which contains only license header corrections.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #34: IMAGING-188

2017-12-07 Thread DasBueroAmDraht
GitHub user DasBueroAmDraht opened a pull request:

https://github.com/apache/commons-imaging/pull/34

IMAGING-188

https://issues.apache.org/jira/browse/IMAGING-188

commits: 
- support for all icns types listed on wikipedia: 
https://en.wikipedia.org/wiki/Apple_Icon_Image_format
- support for JPEG 2000 via modified ImageIO Library, look at the new entry 
in the pom

- test for the enhanced IcnsDecoder, plus test files (extracts images of 
all icns-types from several icns files)


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/DasBueroAmDraht/commons-imaging IMAGING-188

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/34.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #34


commit 1e3f0ebd28aa7736facd3dfc079db6a25d884c13
Author: Marco Wagner 
Date:   2017-12-07T13:33:50Z

IMAGING-188: ICNS Image Parser: Support for large Icons (ic07, ic08, ic09, 
ic10 [128px, 256px, 512px, 1024px]) and JPEG 2000
- support for all icns types listed on wikipedia: 
https://en.wikipedia.org/wiki/Apple_Icon_Image_format
- support for JPEG 2000 via modified ImageIO Library, look at the new entry 
in the pom

commit 121ea21f16120842a91aacc0678becedbd9e67ee
Author: Marco Wagner 
Date:   2017-12-07T13:36:57Z

IMAGING-188: ICNS Image Parser: Support for large Icons (ic07, ic08, ic09, 
ic10 [128px, 256px, 512px, 1024px]) and JPEG 2000
- test for the enhanced IcnsDecoder, plus test files (extracts images of 
all icns-types from several icns files)




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #15: Imaging-136

2017-12-31 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/15#discussion_r159147410
  
--- Diff: src/test/data/specificTests/info.txt ---
@@ -0,0 +1 @@
+Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.





jpg/10/1402522741337.jpg
Contributed by Tilman Hausherr.
This is image file was uploaded to
https://issues.apache.org/jira/browse/IMAGING-136.
--- End diff --

Thanks for adding this file like in the other directory!!! :clap: 


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #15: Imaging-136

2017-12-31 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/15#discussion_r159147413
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/specific/JpegImageParserTest.java
 ---
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.imaging.formats.jpeg.specific;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.ImagingTestConstants;
+import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
+import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Basic tests for JpegImageParser.
+ */
+public final class JpegImageParserTest {
+/**
+ * Image created with The Gimp 2.8
+ * @throws ImageReadException
+ * @throws IOException 
+ */
+@Test
+public void testGetBufferedImage10() throws ImageReadException, 
IOException {
+final File imageFile = new 
File(ImagingTestConstants.TEST_SPECIFIC_FOLDER, "jpg/10/1402522741337.jpg");
--- End diff --

I'd use a different directory structure, but this can be done later after 
this gets merged.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #15: Imaging-136

2017-12-31 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/15#discussion_r159147395
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java ---
@@ -125,7 +136,9 @@
 SOF5_MARKER, SOF6_MARKER, SOF7_MARKER, SOF8_MARKER, 
SOF9_MARKER,
 SOF10_MARKER, SOF11_MARKER, DAC_MARKER, SOF13_MARKER,
 SOF14_MARKER, SOF15_MARKER, EOI_MARKER, SOS_MARKER, 
DQT_MARKER,
-DNL_MARKER, COM_MARKER));
+DNL_MARKER, COM_MARKER,
--- End diff --

There will be a minor conflict here when rebase/merging it, but can be 
easily resolved by whoever merges it.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #15: Imaging-136

2017-12-31 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/15#discussion_r159147397
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java 
---
@@ -38,7 +41,7 @@
 
 import static org.apache.commons.imaging.common.BinaryFunctions.*;
 
-public class JpegDecoder extends BinaryFileParser implements 
JpegUtils.Visitor {
+public final class JpegDecoder extends BinaryFileParser implements 
JpegUtils.Visitor {
--- End diff --

Not necessary to address this here. We can discuss and add the final later 
if necessary :-)


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #15: Imaging-136

2017-12-31 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/15#discussion_r159147391
  
--- Diff: 
src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java ---
@@ -317,4 +317,23 @@ public static void copyStreamToStream(final 
InputStream is, final OutputStream o
 copyStreamToStream(is, os);
 return os.toByteArray();
 }
+
+/**
+ * This method shall behave exactly the same as int[] 
java.util.Arrays.copyOfRange(int[], int, int)
+ * which is not available for Java 1.5.
+ * 
+ * Please use int[] java.util.Arrays.copyOfRange(int[], int, int) 
after shift to Java 1.6 or better!
+ * @param originalArray
+ * @param fromPosition
+ * @param toPosition
+ * @return 
+ */
+public static int[] copyArray(int[] originalArray, int fromPosition, 
int toPosition) {
--- End diff --

We can replace it now as Commons Imaging is building with Java 7.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #38: Cleaned up PNG component.

2018-11-29 Thread SukantPal
GitHub user SukantPal opened a pull request:

https://github.com/apache/commons-imaging/pull/38

Cleaned up PNG component.

Following changes were made (overview): PngWriter.ImageHeader removed 
(replaced  by making PngChunkIhdr mutable); divided PngWriter.writeImage (by 
creating pixel data writing method).

Introduced ChunkLoader. Instead of embedding the chunk loading process in 
the PngImageParser, I have separated it into ChunkLoader.

I hope these changes will make the code more modular and readable.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/SukantPal/commons-imaging master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/38.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #38


commit 9c5b06220b66b2c26baf5ebc8e84f56fe07b4b34
Author: shukant 
Date:   2018-11-30T03:56:55Z

Cleaned up PNG component.


Following changes were made (overview): PngWriter.ImageHeader removed 
(replaced  by making PngChunkIhdr mutable); divided PngWriter.writeImage (by 
creating pixel data writing method).

Introduced ChunkLoader. Instead of embedding the chunk loading process in 
the PngImageParser, I have separated it into ChunkLoader.




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-13 Thread TheRealHaui
GitHub user TheRealHaui opened a pull request:

https://github.com/apache/commons-imaging/pull/27

Increase code coverage one

I have created Unit Tests to increase code coverage which I want to 
contribute.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/TheRealHaui/commons-imaging 
increase-code-coverage-one

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/27.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #27


commit 127469460ab0ae0d12d35b4e0b5056af6debdea2
Author: Michael Hausegger 
Date:   2017-07-13T20:12:46Z

increase-code-coverage-one Added Unit Tests to increase code coverage.

commit 8e48087803a12106f1d8b88803a94557f031ec62
Author: Michael Hausegger 
Date:   2017-07-13T21:00:31Z

increase-code-coverage-one Added Unit Tests to increase code coverage.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-imaging/pull/27


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632387
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 13.07.2017
+ * @see BmpWriterRgb
+ *
+ **/
+public class BmpWriterRgbTest{
+
+
+@Test
+public void testGetImageData() {
+
+BmpWriterRgb bmpWriterRgb = new BmpWriterRgb();
+BufferedImage bufferedImage = new BufferedImage(2, 2, 5);
+byte[] byteArray = bmpWriterRgb.getImageData(bufferedImage);
+
+assertEquals( 24, bmpWriterRgb.getBitsPerPixel() );
+assertEquals( 0, bmpWriterRgb.getPaletteSize() );
+assertEquals( 16, byteArray.length );
+assertEquals( "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", 
Arrays.toString(byteArray) );
--- End diff --

I'd use `assertArrayEquals( new byte[] { 0,0,0, ... }, byteArray ); ` to 
avoid string serialization issues with some locales.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632531
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -66,6 +64,22 @@ protected File createTempFile(final byte src[]) throws 
IOException {
 }
 final byte longArray[] = (baos.toByteArray());
 
-return new byte[][] { emptyArray, single, simple, zeroes, 
longArray, };
+return new byte[][]{emptyArray, single, simple, zeroes, 
longArray,};
+}
+
+@Test
--- End diff --

@Test(expected=NullPointerException.class)
Would be another way of writing this without the try/catch code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632941
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PbmFileInfoTest.java ---
@@ -0,0 +1,41 @@
+package org.apache.commons.imaging.formats.pnm;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link PbmFileInfo}.
+ *
+ * @date 13.07.2017
+ * @see PbmFileInfo
+ *
+ **/
+public class PbmFileInfoTest{
+
+
+  @Test
+  public void testGetRGBThrowsIOException() throws IOException {
+
+  PbmFileInfo pbmFileInfo = new PbmFileInfo(2764, 354, true);
+  byte[] byteArray = new byte[2];
+  ByteArrayInputStream byteArrayInputStream = new 
ByteArrayInputStream(byteArray);
+  byteArrayInputStream.read(byteArray);
+
+  try { 
+pbmFileInfo.getRGB((InputStream) byteArrayInputStream);
--- End diff --

No need to cast


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632776
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegmentTest.java
 ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.jpeg.segments;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link JfifSegment}.
+ *
+ * @date 13.07.2017
+ * @see JfifSegment
+ *
+ **/
+public class JfifSegmentTest{
+
+
+  @Test
+  public void testCreatesJfifSegment() {
+
+  byte[] byteArray = new byte[25];
+  JfifSegment jfifSegment = null;
+
+  try {
+jfifSegment = new JfifSegment((-2275), byteArray);
+fail("Expecting exception: Exception");
+  } catch(Throwable e) {
--- End diff --

Any reason why you want to catch all Throwables (Errors and Exceptions) 
instead of the usual Exceptions?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127633319
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByteTest.java
 ---
@@ -0,0 +1,37 @@
+package org.apache.commons.imaging.formats.tiff.fieldtypes;
+
+import org.junit.Test;
+
+import java.nio.ByteOrder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link FieldTypeByte}.
+ *
+ * @date 13.07.2017
+ * @see FieldTypeByte
+ *
+ **/
+public class FieldTypeByteTest{
+
+
+  @Test
+  public void testWriteDataWithNull() {
+
+  FieldTypeByte fieldTypeByte = FieldType.UNDEFINED;
+  ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+
+  try { 
+fieldTypeByte.writeData( null, byteOrder);
+fail("Expecting exception: Exception");
+  } catch(Exception e) {
+ assertEquals("Invalid data: null (null)",e.getMessage());
+ assertEquals(FieldTypeByte.class.getName(), 
e.getStackTrace()[0].getClassName());
--- End diff --

It may be worth adding a helper method for this..

assertExceptionClassName(FieldTypeByte.class, e);

Why are you needing to look at the stack trace? Can't you look at the 
exception class itself?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127633025
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PbmFileInfoTest.java ---
@@ -0,0 +1,41 @@
+package org.apache.commons.imaging.formats.pnm;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link PbmFileInfo}.
+ *
+ * @date 13.07.2017
+ * @see PbmFileInfo
+ *
+ **/
+public class PbmFileInfoTest{
+
+
+  @Test
+  public void testGetRGBThrowsIOException() throws IOException {
+
+  PbmFileInfo pbmFileInfo = new PbmFileInfo(2764, 354, true);
+  byte[] byteArray = new byte[2];
+  ByteArrayInputStream byteArrayInputStream = new 
ByteArrayInputStream(byteArray);
--- End diff --

InputStream is = new ByteArrayInputStream(new byte[2]);

The rest of this method doesn't care what the InputStream implementation is.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-16 Thread onealj
Github user onealj commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127632145
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 13.07.2017
--- End diff --

Use ISO 8601 date format (-MM-DD) to avoid ambiguity between countries 
that use MM-DD- and DD-MM-.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127761190
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 13.07.2017
--- End diff --

Good idea.
Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127768274
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 13.07.2017
+ * @see BmpWriterRgb
+ *
+ **/
+public class BmpWriterRgbTest{
+
+
+@Test
+public void testGetImageData() {
+
+BmpWriterRgb bmpWriterRgb = new BmpWriterRgb();
+BufferedImage bufferedImage = new BufferedImage(2, 2, 5);
+byte[] byteArray = bmpWriterRgb.getImageData(bufferedImage);
+
+assertEquals( 24, bmpWriterRgb.getBitsPerPixel() );
+assertEquals( 0, bmpWriterRgb.getPaletteSize() );
+assertEquals( 16, byteArray.length );
+assertEquals( "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", 
Arrays.toString(byteArray) );
--- End diff --

Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127768831
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -66,6 +64,22 @@ protected File createTempFile(final byte src[]) throws 
IOException {
 }
 final byte longArray[] = (baos.toByteArray());
 
-return new byte[][] { emptyArray, single, simple, zeroes, 
longArray, };
+return new byte[][]{emptyArray, single, simple, zeroes, 
longArray,};
+}
+
+@Test
--- End diff --

Yes, I know.
However, for what reason ever I experienced a lot of people preferring the 
try/catch notation over the annotation approach.
That's why I write/wrote it this way.
In the hope to have to rewrite as less code in the end as possible.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127769590
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegmentTest.java
 ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.jpeg.segments;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link JfifSegment}.
+ *
+ * @date 13.07.2017
+ * @see JfifSegment
+ *
+ **/
+public class JfifSegmentTest{
+
+
+  @Test
+  public void testCreatesJfifSegment() {
+
+  byte[] byteArray = new byte[25];
+  JfifSegment jfifSegment = null;
+
+  try {
+jfifSegment = new JfifSegment((-2275), byteArray);
+fail("Expecting exception: Exception");
+  } catch(Throwable e) {
--- End diff --

Had to do with the fact that at the beginning the test class resided in a 
different hierarchical folder structure than the original class ...
Corrected.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127770520
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PbmFileInfoTest.java ---
@@ -0,0 +1,41 @@
+package org.apache.commons.imaging.formats.pnm;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link PbmFileInfo}.
+ *
+ * @date 13.07.2017
+ * @see PbmFileInfo
+ *
+ **/
+public class PbmFileInfoTest{
+
+
+  @Test
+  public void testGetRGBThrowsIOException() throws IOException {
+
+  PbmFileInfo pbmFileInfo = new PbmFileInfo(2764, 354, true);
+  byte[] byteArray = new byte[2];
+  ByteArrayInputStream byteArrayInputStream = new 
ByteArrayInputStream(byteArray);
--- End diff --

Changed to interface.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127770670
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/pnm/PbmFileInfoTest.java ---
@@ -0,0 +1,41 @@
+package org.apache.commons.imaging.formats.pnm;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link PbmFileInfo}.
+ *
+ * @date 13.07.2017
+ * @see PbmFileInfo
+ *
+ **/
+public class PbmFileInfoTest{
+
+
+  @Test
+  public void testGetRGBThrowsIOException() throws IOException {
+
+  PbmFileInfo pbmFileInfo = new PbmFileInfo(2764, 354, true);
+  byte[] byteArray = new byte[2];
+  ByteArrayInputStream byteArrayInputStream = new 
ByteArrayInputStream(byteArray);
+  byteArrayInputStream.read(byteArray);
+
+  try { 
+pbmFileInfo.getRGB((InputStream) byteArrayInputStream);
--- End diff --

Changed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127775941
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByteTest.java
 ---
@@ -0,0 +1,37 @@
+package org.apache.commons.imaging.formats.tiff.fieldtypes;
+
+import org.junit.Test;
+
+import java.nio.ByteOrder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link FieldTypeByte}.
+ *
+ * @date 13.07.2017
+ * @see FieldTypeByte
+ *
+ **/
+public class FieldTypeByteTest{
+
+
+  @Test
+  public void testWriteDataWithNull() {
+
+  FieldTypeByte fieldTypeByte = FieldType.UNDEFINED;
+  ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+
+  try { 
+fieldTypeByte.writeData( null, byteOrder);
+fail("Expecting exception: Exception");
+  } catch(Exception e) {
+ assertEquals("Invalid data: null (null)",e.getMessage());
+ assertEquals(FieldTypeByte.class.getName(), 
e.getStackTrace()[0].getClassName());
--- End diff --

You're right.
Omitting the stack trace is definitely shorter and more intuitive.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread TheRealHaui
GitHub user TheRealHaui opened a pull request:

https://github.com/apache/commons-imaging/pull/28

Increase code coverage one

Added various improvements to selected Unit Tests.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/TheRealHaui/commons-imaging 
increase-code-coverage-one

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/28.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #28


commit 127469460ab0ae0d12d35b4e0b5056af6debdea2
Author: Michael Hausegger 
Date:   2017-07-13T20:12:46Z

increase-code-coverage-one Added Unit Tests to increase code coverage.

commit 8e48087803a12106f1d8b88803a94557f031ec62
Author: Michael Hausegger 
Date:   2017-07-13T21:00:31Z

increase-code-coverage-one Added Unit Tests to increase code coverage.

commit 66b929d15a0f03441b58c7cadd42e58da831d5bb
Author: Michael Hausegger 
Date:   2017-07-13T21:14:08Z

increase-code-coverage-one Fixed failing test.

commit 10c8babeff6d0115d4fa440f226e716eaa3bbf79
Author: Michael Hausegger 
Date:   2017-07-15T21:39:54Z

increase-code-coverage-one Fix directory hierarchy problem.

commit 48a365d24fecf2a29213f16468d3c165f9f34d1e
Author: Michael Hausegger 
Date:   2017-07-17T16:51:29Z

increase-code-coverage-one Changed date format in comments.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127778422
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -66,6 +64,22 @@ protected File createTempFile(final byte src[]) throws 
IOException {
 }
 final byte longArray[] = (baos.toByteArray());
 
-return new byte[][] { emptyArray, single, simple, zeroes, 
longArray, };
+return new byte[][]{emptyArray, single, simple, zeroes, 
longArray,};
+}
+
+@Test
--- End diff --

@onealj @TheRealHaui If I were maintaining this code, I'd be happy with 
either pattern.

`@Test(expected=NullPointerException.class)` would be a little shorter and 
equivalent to the `try..catch` construct used here in this case.

However, the reason people tend to prefer `try..catch` is because in a lot 
of cases it is not granular enough. Take this (admittedly contrived) example:

```java
@Test(expected=NullPointerException.class)
public void doSomething() {
  String s = null;
  assertTrue(s.isEmpty());
  try {
somethingWhichThrowsNullPointerException():
  } catch (NullPointerException e) {
assertNull(s);
  }
}
```

In this case, rather than `somethingWhichThrowsNullPointerException(s1)` 
throwing `NullPointerException` (which we expect), it will be `s.isEmpty()` 
that throws it instead, which isn't what we intended, since it means the test 
will always "pass".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127781676
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/RgbBufferedImageFactoryTest.java
 ---
@@ -0,0 +1,36 @@
+package org.apache.commons.imaging.common;
+
+import org.junit.Test;
+
+import java.awt.image.DirectColorModel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link RgbBufferedImageFactory}.
+ *
+ * @date 2017-07-13
+ * @see RgbBufferedImageFactory
+ *
+ **/
--- End diff --

Ditto regarding javadoc.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127782199
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/RgbBufferedImageFactoryTest.java
 ---
@@ -0,0 +1,36 @@
+package org.apache.commons.imaging.common;
+
+import org.junit.Test;
+
+import java.awt.image.DirectColorModel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link RgbBufferedImageFactory}.
+ *
+ * @date 2017-07-13
+ * @see RgbBufferedImageFactory
+ *
+ **/
+public class RgbBufferedImageFactoryTest{
+
+
+@Test
+public void testGetColorBufferedImageThrowsIllegalArgumentException() {
+
+RgbBufferedImageFactory rgbBufferedImageFactory = new 
RgbBufferedImageFactory();
+
+try {
+rgbBufferedImageFactory.getColorBufferedImage(0, 0, true);
+fail("Expecting exception: IllegalArgumentException");
+} catch(IllegalArgumentException e) {
+assertEquals("Width (0) and height (0) cannot be <= 
0",e.getMessage());
+assertEquals(DirectColorModel.class.getName(), 
e.getStackTrace()[0].getClassName());
+}
+
+}
+
+
--- End diff --

Ditto regarding blank lines. Please shorten them for all other classes as 
well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127781398
  
--- Diff: src/test/java/org/apache/commons/imaging/ImageDumpTest.java ---
@@ -0,0 +1,44 @@
+package org.apache.commons.imaging;
+
+import org.junit.Test;
+
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link ImageDump}.
+ *
+ * @date 2017-07-13
+ * @see ImageDump
+ *
+ **/
+public class ImageDumpTest{
+
+
--- End diff --

Having two blank lines here seems to be inconsistent with the other test 
classes in commons-imaging. I suggest shortening it to one blank line.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127782141
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/RgbBufferedImageFactoryTest.java
 ---
@@ -0,0 +1,36 @@
+package org.apache.commons.imaging.common;
+
+import org.junit.Test;
+
+import java.awt.image.DirectColorModel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link RgbBufferedImageFactory}.
+ *
+ * @date 2017-07-13
+ * @see RgbBufferedImageFactory
+ *
+ **/
+public class RgbBufferedImageFactoryTest{
+
+
+@Test
+public void testGetColorBufferedImageThrowsIllegalArgumentException() {
+
--- End diff --

Ditto regarding blank lines. Please shorten them for all other classes as 
well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127782622
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -17,24 +17,22 @@
 
 package org.apache.commons.imaging.common.bytesource;
 
-import static org.junit.Assert.assertTrue;
+import org.apache.commons.imaging.ImagingTest;
+import org.junit.Test;
 
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
+import java.io.*;
 
-import org.apache.commons.imaging.ImagingTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
--- End diff --

I'd keep the ordering and style of the imports as before; no need to 
rearrange them just to import `assertEquals` and `fail`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127781095
  
--- Diff: src/test/java/org/apache/commons/imaging/ImageDumpTest.java ---
@@ -0,0 +1,44 @@
+package org.apache.commons.imaging;
+
+import org.junit.Test;
+
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link ImageDump}.
+ *
+ * @date 2017-07-13
+ * @see ImageDump
+ *
+ **/
+public class ImageDumpTest{
+
+
+@Test
+public void testDumpColorSpace() {
+
+ImageDump imageDump = new ImageDump();
+ColorSpace colorSpace = ColorSpace.getInstance(1004);
+imageDump.dumpColorSpace("Ku&]N>!4'C#Jzn+", colorSpace);
+
+assertEquals(3, colorSpace.getNumComponents());
+
+}
+
+
+@Test
+public void testDump() {
+
+ImageDump imageDump = new ImageDump();
+BufferedImage bufferedImage = new BufferedImage(10, 10, 10);
+imageDump.dump(bufferedImage);
+
+assertEquals(10, bufferedImage.getHeight());
+
+}
--- End diff --

Ditto regarding blank lines.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127781035
  
--- Diff: src/test/java/org/apache/commons/imaging/ImageDumpTest.java ---
@@ -0,0 +1,44 @@
+package org.apache.commons.imaging;
+
+import org.junit.Test;
+
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link ImageDump}.
+ *
+ * @date 2017-07-13
+ * @see ImageDump
+ *
+ **/
+public class ImageDumpTest{
+
+
+@Test
+public void testDumpColorSpace() {
+
+ImageDump imageDump = new ImageDump();
+ColorSpace colorSpace = ColorSpace.getInstance(1004);
+imageDump.dumpColorSpace("Ku&]N>!4'C#Jzn+", colorSpace);
+
+assertEquals(3, colorSpace.getNumComponents());
+
+}
--- End diff --

Most test methods I've seen in commons-imaging prefer to have no blank 
lines at the start and end of the test method body. I suggest removing the 
blank lines at the start and end of `testDumpColorSpace`'s body here for 
consistency, so like this:

```java
@Test 
public void testDumpColorSpace() {
ImageDump imageDump = new ImageDump();
ColorSpace colorSpace = ColorSpace.getInstance(1004);
imageDump.dumpColorSpace("Ku&]N>!4'C#Jzn+", colorSpace);

assertEquals(3, colorSpace.getNumComponents());
}


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127781871
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/RgbBufferedImageFactoryTest.java
 ---
@@ -0,0 +1,36 @@
+package org.apache.commons.imaging.common;
+
+import org.junit.Test;
+
+import java.awt.image.DirectColorModel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link RgbBufferedImageFactory}.
+ *
+ * @date 2017-07-13
+ * @see RgbBufferedImageFactory
+ *
+ **/
+public class RgbBufferedImageFactoryTest{
+
+
--- End diff --

Ditto regarding blank lines. Please shorten them for all other classes as 
well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127783226
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgbTest.java ---
@@ -0,0 +1,35 @@
+package org.apache.commons.imaging.formats.bmp;
+
+import org.junit.Test;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link BmpWriterRgb}.
+ *
+ * @date 2017-07-13
+ * @see BmpWriterRgb
+ *
+ **/
+public class BmpWriterRgbTest{
+
+
+@Test
+public void testGetImageData() {
+
+BmpWriterRgb bmpWriterRgb = new BmpWriterRgb();
+BufferedImage bufferedImage = new BufferedImage(2, 2, 5);
+byte[] byteArray = bmpWriterRgb.getImageData(bufferedImage);
+
+assertEquals( 24, bmpWriterRgb.getBitsPerPixel() );
+assertEquals( 0, bmpWriterRgb.getPaletteSize() );
+assertEquals( 16, byteArray.length );
+assertEquals( "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", 
Arrays.toString(byteArray) );
--- End diff --

Spaces at start and end of parameter lists seem unnecessary here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127782170
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/RgbBufferedImageFactoryTest.java
 ---
@@ -0,0 +1,36 @@
+package org.apache.commons.imaging.common;
+
+import org.junit.Test;
+
+import java.awt.image.DirectColorModel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link RgbBufferedImageFactory}.
+ *
+ * @date 2017-07-13
+ * @see RgbBufferedImageFactory
+ *
+ **/
+public class RgbBufferedImageFactoryTest{
+
+
+@Test
+public void testGetColorBufferedImageThrowsIllegalArgumentException() {
+
+RgbBufferedImageFactory rgbBufferedImageFactory = new 
RgbBufferedImageFactory();
+
+try {
+rgbBufferedImageFactory.getColorBufferedImage(0, 0, true);
+fail("Expecting exception: IllegalArgumentException");
+} catch(IllegalArgumentException e) {
+assertEquals("Width (0) and height (0) cannot be <= 
0",e.getMessage());
+assertEquals(DirectColorModel.class.getName(), 
e.getStackTrace()[0].getClassName());
+}
+
--- End diff --

Ditto regarding blank lines. Please shorten them for all other classes as 
well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127783301
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookupTest.java
 ---
@@ -0,0 +1,28 @@
+package org.apache.commons.imaging.formats.jpeg.iptc;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link IptcTypeLookup}.
+ *
+ * @date 2017-07-13
+ * @see IptcTypeLookup
+ *
+ **/
+public class IptcTypeLookupTest{
+
+
+@Test
+public void testGetIptcTypeWithPositive() {
+
+IptcType iptcType = IptcTypeLookup.getIptcType(1117);
+
+assertEquals( 1117, iptcType.getType() );
+assertEquals( "Unknown", iptcType.getName() );
--- End diff --

Ditto regarding spaces at start and end of parameter lists.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127782716
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -17,24 +17,22 @@
 
 package org.apache.commons.imaging.common.bytesource;
 
-import static org.junit.Assert.assertTrue;
+import org.apache.commons.imaging.ImagingTest;
+import org.junit.Test;
 
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
+import java.io.*;
 
-import org.apache.commons.imaging.ImagingTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 public abstract class ByteSourceTest extends ImagingTest {
 protected File createTempFile(final byte src[]) throws IOException {
 final File file = createTempFile("raw_", ".bin");
 
 // write test bytes to file.
 try (FileOutputStream fos = new FileOutputStream(file);
-OutputStream os = new BufferedOutputStream(fos)) {
+ OutputStream os = new BufferedOutputStream(fos)) {
--- End diff --

No need to un-tab this line AFAICT.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127781644
  
--- Diff: src/test/java/org/apache/commons/imaging/ImageDumpTest.java ---
@@ -0,0 +1,44 @@
+package org.apache.commons.imaging;
+
+import org.junit.Test;
+
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link ImageDump}.
+ *
+ * @date 2017-07-13
+ * @see ImageDump
+ *
+ **/
+public class ImageDumpTest{
+
+
+@Test
+public void testDumpColorSpace() {
+
+ImageDump imageDump = new ImageDump();
+ColorSpace colorSpace = ColorSpace.getInstance(1004);
+imageDump.dumpColorSpace("Ku&]N>!4'C#Jzn+", colorSpace);
+
+assertEquals(3, colorSpace.getNumComponents());
+
+}
+
+
+@Test
+public void testDump() {
+
+ImageDump imageDump = new ImageDump();
+BufferedImage bufferedImage = new BufferedImage(10, 10, 10);
+imageDump.dump(bufferedImage);
+
+assertEquals(10, bufferedImage.getHeight());
+
+}
+
+
--- End diff --

Having two blank lines here seems to be inconsistent with the other test 
classes in commons-imaging. I suggest shortening it to one or zero blank lines.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127780455
  
--- Diff: src/test/java/org/apache/commons/imaging/ImageDumpTest.java ---
@@ -0,0 +1,44 @@
+package org.apache.commons.imaging;
+
+import org.junit.Test;
+
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link ImageDump}.
+ *
+ * @date 2017-07-13
+ * @see ImageDump
+ *
+ **/
+public class ImageDumpTest{
--- End diff --

The `{` seems to be joined directly with the class name to its left. This 
is inconsistent with all the other test classes AFAICT.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127782811
  
--- Diff: 
src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceTest.java 
---
@@ -66,6 +64,22 @@ protected File createTempFile(final byte src[]) throws 
IOException {
 }
 final byte longArray[] = (baos.toByteArray());
 
-return new byte[][] { emptyArray, single, simple, zeroes, 
longArray, };
+return new byte[][]{emptyArray, single, simple, zeroes, 
longArray,};
--- End diff --

No need to remove spaces here AFAICT.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-17 Thread jbduncan
Github user jbduncan commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/28#discussion_r127780127
  
--- Diff: src/test/java/org/apache/commons/imaging/ImageDumpTest.java ---
@@ -0,0 +1,44 @@
+package org.apache.commons.imaging;
+
+import org.junit.Test;
+
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for class {@link ImageDump}.
+ *
+ * @date 2017-07-13
+ * @see ImageDump
+ *
+ **/
--- End diff --

I question the presence of Javadoc in this class and all the other classes 
affected by this PR. AFAICT not all the tests (if any) even have Javadocs, so 
why should javadocs be added for this class and the others?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #27: Increase code coverage one

2017-07-17 Thread TheRealHaui
Github user TheRealHaui commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/27#discussion_r127843760
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByteTest.java
 ---
@@ -0,0 +1,37 @@
+package org.apache.commons.imaging.formats.tiff.fieldtypes;
+
+import org.junit.Test;
+
+import java.nio.ByteOrder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for class {@link FieldTypeByte}.
+ *
+ * @date 13.07.2017
+ * @see FieldTypeByte
+ *
+ **/
+public class FieldTypeByteTest{
+
+
+  @Test
+  public void testWriteDataWithNull() {
+
+  FieldTypeByte fieldTypeByte = FieldType.UNDEFINED;
+  ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+
+  try { 
+fieldTypeByte.writeData( null, byteOrder);
+fail("Expecting exception: Exception");
+  } catch(Exception e) {
+ assertEquals("Invalid data: null (null)",e.getMessage());
+ assertEquals(FieldTypeByte.class.getName(), 
e.getStackTrace()[0].getClassName());
--- End diff --

No, you're not right!
Obviously, became already dizzy ...

The difference is that the approach with the stack trace - of course - 
verifies which class the exception originated from.
The verification which exception was thrown and before more over if an 
exception was thrown gets already verified in the catch clause.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #28: Increase code coverage one

2017-07-19 Thread TheRealHaui
Github user TheRealHaui closed the pull request at:

https://github.com/apache/commons-imaging/pull/28


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #31: add-missing-license-headers

2017-09-19 Thread TheRealHaui
GitHub user TheRealHaui opened a pull request:

https://github.com/apache/commons-imaging/pull/31

add-missing-license-headers

Added missing license headers.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/TheRealHaui/commons-imaging 
add-missing-license-headers

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/31.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #31


commit 4468e18c5b4b1241477e5a023f22c616d42749fe
Author: Michael Hausegger 
Date:   2017-09-19T18:54:53Z

add-missing-license-headers Added missing license headers.




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #31: add-missing-license-headers

2017-12-07 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-imaging/pull/31


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-15 Thread garydgregory
Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210286324
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java ---
@@ -327,7 +331,7 @@ private BmpImageContents readImageContents(final 
InputStream is,
 switch (bhi.compression) {
 case BI_RGB:
 if (verbose) {
--- End diff --

Seeing "if verbose" and then "log at the info level" is slightly confusing 
here. If we want to keep the 'verbose' setting then maybe the code should 
rename this to 'logInfo', or, should we provide a setting that contains the log 
level to use when 'verbose' is enabled?


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-15 Thread garydgregory
Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210286764
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkText.java 
---
@@ -42,9 +47,9 @@ public PngChunkText(final int length, final int 
chunkType, final int crc, final
 final int textLength = bytes.length - (index + 1);
 text = new String(bytes, index + 1, textLength, 
StandardCharsets.ISO_8859_1);
 
-if (getDebug()) {
-System.out.println("Keyword: " + keyword);
-System.out.println("Text: " + text);
+if (LOGGER.isLoggable(Level.FINE)) {
--- End diff --

Uhg, the JUL level names are AWFUL :=(


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-15 Thread garydgregory
Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210287038
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java ---
@@ -45,9 +50,14 @@ public PsdHeaderInfo(final int version, final byte[] 
reserved, final int channel
 }
 
 public void dump() {
-final PrintWriter pw = new PrintWriter(new 
OutputStreamWriter(System.out, Charset.defaultCharset()));
-dump(pw);
-pw.flush();
+try (StringWriter sw = new StringWriter(); PrintWriter pw = new 
PrintWriter(sw)) {
--- End diff --

This seems like duplicate code from a similar block I saw above. Should it 
be refactored?


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-15 Thread garydgregory
Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210287176
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java ---
@@ -40,9 +45,14 @@ public PsdImageContents(final PsdHeaderInfo header,
 }
 
 public void dump() {
-final PrintWriter pw = new PrintWriter(new 
OutputStreamWriter(System.out, Charset.defaultCharset()));
-dump(pw);
-pw.flush();
+try (StringWriter sw = new StringWriter(); PrintWriter pw = new 
PrintWriter(sw)) {
--- End diff --

Same comment as above.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-15 Thread garydgregory
Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210287298
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java ---
@@ -355,9 +360,14 @@ private String getValueDescription(final Object o) {
 }
 
 public void dump() {
-final PrintWriter pw = new PrintWriter(new 
OutputStreamWriter(System.out, Charset.defaultCharset()));
-dump(pw);
-pw.flush();
+try (StringWriter sw = new StringWriter(); PrintWriter pw = new 
PrintWriter(sw)) {
--- End diff --

Same comment as above.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-15 Thread garydgregory
Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210287591
  
--- Diff: src/main/java/org/apache/commons/imaging/icc/IccTag.java ---
@@ -73,11 +76,12 @@ private IccTagDataType getIccTagDataType(final int 
quad) {
 }
 
 public void dump(final String prefix) throws ImageReadException, 
IOException {
-final PrintWriter pw = new PrintWriter(new 
OutputStreamWriter(System.out, Charset.defaultCharset()));
-
-dump(pw, prefix);
-
-pw.flush();
+try (StringWriter sw = new StringWriter(); PrintWriter pw = new 
PrintWriter(sw)) {
--- End diff --

Same comment as above even though this code is slightly different - no 
catch clause.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-15 Thread garydgregory
Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210287763
  
--- Diff: 
src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
 ---
@@ -27,7 +27,7 @@
 import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
 import org.apache.commons.imaging.formats.tiff.TiffField;
 import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
-import org.apache.commons.imaging.util.Debug;
+import org.apache.commons.imaging.internal.Debug;
--- End diff --

I like the package name :-)


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-15 Thread sebbASF
Github user sebbASF commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210327438
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java ---
@@ -327,7 +331,7 @@ private BmpImageContents readImageContents(final 
InputStream is,
 switch (bhi.compression) {
 case BI_RGB:
 if (verbose) {
--- End diff --

Seems to me it would be better to use the log-level alone to control what 
is being logged.

So the verbose flag would become a log-level instead.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-16 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210519489
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkText.java 
---
@@ -42,9 +47,9 @@ public PngChunkText(final int length, final int 
chunkType, final int crc, final
 final int textLength = bytes.length - (index + 1);
 text = new String(bytes, index + 1, textLength, 
StandardCharsets.ISO_8859_1);
 
-if (getDebug()) {
-System.out.println("Keyword: " + keyword);
-System.out.println("Text: " + text);
+if (LOGGER.isLoggable(Level.FINE)) {
--- End diff --

I went straight for `LOGGER.isDebugEnabled()` and the IDE remembered me 
what it actually looked like :=/


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-16 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210521304
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java ---
@@ -327,7 +331,7 @@ private BmpImageContents readImageContents(final 
InputStream is,
 switch (bhi.compression) {
 case BI_RGB:
 if (verbose) {
--- End diff --

You are both correct @garydgregory , @sebbASF .

I tried to remove the flags `DEBUG` or `isDebug()` or `getDebug()` by 
`LOGGER.isLoggable(Level.FINE)`, but forgot to do the same for `verbose` using 
the `INFO` level (wonder if we should use FINEST for debug, and FINE for the 
verbose messages...)
Will just log to info. I believe we can assume that 


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-16 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210523866
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java ---
@@ -45,9 +50,14 @@ public PsdHeaderInfo(final int version, final byte[] 
reserved, final int channel
 }
 
 public void dump() {
-final PrintWriter pw = new PrintWriter(new 
OutputStreamWriter(System.out, Charset.defaultCharset()));
-dump(pw);
-pw.flush();
+try (StringWriter sw = new StringWriter(); PrintWriter pw = new 
PrintWriter(sw)) {
--- End diff --

@garydgregory I'm not sure how to refactor it. If you look at the `dump` 
methods, you will see they are scattered all over the place, but there's no 
`@Override` tags, as they are not defined in any parent class.

I am ignoring this for now, as we could have users coming from Sanselan 
using these methods. But for 2.x I would like to tackle this problem and either 
remove the `dump` methods, or have a design with a base class defining the 
signature of these methods.

That would give us a place to implement a method that could remove this 
duplication.

The alternative that I see here, is to add a `Util` class to the project, 
and add a method to remove the duplication. But I am not very fond of `Util` 
classes for a case like this one (where a proper design would remove the need 
for it).

I hope this makes sense. Do you think we could ignore this duplication for 
now, and fix in the upcoming (hopefully soon) next releases?


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-16 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210524716
  
--- Diff: src/main/java/org/apache/commons/imaging/icc/IccTag.java ---
@@ -73,11 +76,12 @@ private IccTagDataType getIccTagDataType(final int 
quad) {
 }
 
 public void dump(final String prefix) throws ImageReadException, 
IOException {
-final PrintWriter pw = new PrintWriter(new 
OutputStreamWriter(System.out, Charset.defaultCharset()));
-
-dump(pw, prefix);
-
-pw.flush();
+try (StringWriter sw = new StringWriter(); PrintWriter pw = new 
PrintWriter(sw)) {
--- End diff --

This was intentional.

The previous code contains the `throws IOException` (while the other 
methods don't) -> 
https://github.com/apache/commons-imaging/blob/d2ec76bd10f30c39ae5180ede1254908e76045f0/src/main/java/org/apache/commons/imaging/icc/IccTag.java#L75

Should we make them all the same, catching and logging, instead of throwing 
the IOException? As this is a `dump` method, not used by another method such as 
`toString()`, I think the impact on end users should be minimal.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-16 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210546814
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java ---
@@ -327,7 +331,7 @@ private BmpImageContents readImageContents(final 
InputStream is,
 switch (bhi.compression) {
 case BI_RGB:
 if (verbose) {
--- End diff --

Done in 
https://github.com/apache/commons-imaging/pull/35/commits/96b0a18e3c0ac435da85a3cf361975e2e77aa7f0

Also removed the `PARAM_KEY_VERBOSE` constant, used to include a param in a 
map to enable verbose. I initially put a `@deprecated` annotation, then 
realized this will be 1.0 of imaging, not sanselan, so removing it should be OK.


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-16 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/35#discussion_r210549560
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java ---
@@ -327,7 +331,7 @@ private BmpImageContents readImageContents(final 
InputStream is,
 switch (bhi.compression) {
 case BI_RGB:
 if (verbose) {
--- End diff --

And on

>(wonder if we should use FINEST for debug, and FINE for the verbose 
messages...)

If you have the chance to run the tests, you will notice the huge amount of 
verbose messages being printed now. I believe some users could be inundated 
with log lines (as the INFO is enabled by default? and verbose was disabled by 
default)


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-08-25 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-imaging/pull/35


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #29: Improve various unit tests style

2017-07-19 Thread TheRealHaui
GitHub user TheRealHaui opened a pull request:

https://github.com/apache/commons-imaging/pull/29

Improve various unit tests style

Code formatting changed as desired in #27 and #28.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/TheRealHaui/commons-imaging 
improve-various-unit-tests-style

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/29.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #29


commit 5c8b1fcf92fdab412818b20175c617e3690fc060
Author: Michael Hausegger 
Date:   2017-07-13T20:12:46Z

increase-code-coverage-one Added Unit Tests to increase code coverage.

commit 471ac19d179a3eb167930f163117703cf7851aa8
Author: Michael Hausegger 
Date:   2017-07-13T21:00:31Z

increase-code-coverage-one Added Unit Tests to increase code coverage.

commit ff9adf8a87c3963dcc5a0f0be9668f1690f8fd45
Author: Michael Hausegger 
Date:   2017-07-13T21:14:08Z

increase-code-coverage-one Fixed failing test.

commit 489c8c33ad03e9f22762e0520670694f08659c57
Author: Michael Hausegger 
Date:   2017-07-15T21:39:54Z

increase-code-coverage-one Fix directory hierarchy problem.

commit d0c70bddfbeff23970702b339de938d6d2876d33
Author: Michael Hausegger 
Date:   2017-07-19T14:18:07Z

improve-various-unit-tests-style Improved code formatting.

commit 2e962d12698711f3614fe16ff75036c139d4d1fb
Author: Michael Hausegger 
Date:   2017-07-19T14:40:55Z

improve-various-unit-tests-style Changed various blank lines and blanks as 
requested.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #29: Improve various unit tests style

2017-07-20 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-imaging/pull/29


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #32: add test for DataReaderStripsTest::applyPr...

2017-10-14 Thread testingsavvy
GitHub user testingsavvy opened a pull request:

https://github.com/apache/commons-imaging/pull/32

add test for DataReaderStripsTest::applyPredictor

This PR adds a new test for `DataReaderStripsTest::applyPredictor`, so that 
it can be tested in isolation.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/testingsavvy/commons-imaging add-test

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/32.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #32


commit ddf9f2f655f8296a858eb90fa868d94dfc9a79f6
Author: testingsavvy 
Date:   2017-10-15T02:59:52Z

add test for DataReaderStripsTest::applyPredictor




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #33: Imaging-209 PnmImageParser throws ImageWri...

2017-12-04 Thread aesy
GitHub user aesy opened a pull request:

https://github.com/apache/commons-imaging/pull/33

Imaging-209 PnmImageParser throws ImageWriteException when writing

if PnmImageParser.PARAM_KEY_PNM_RAWBITS is provided.

I fixed the issue and added a test to cover it.

Issue can be found here: https://issues.apache.org/jira/browse/IMAGING-209

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/aesy/commons-imaging master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/33.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #33


commit 9ab1fb1615c97aa635d660d1b41ee0776ab7e401
Author: Isak W 
Date:   2017-12-04T14:38:24Z

Fix issue where PnmImageParser would throw ImageWriteException
when writing if PnmImageParser.PARAM_KEY_PNM_RAWBITS is provided.




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #33: Imaging-209 PnmImageParser throws ImageWri...

2017-12-23 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-imaging/pull/33


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #32: add test for DataReaderStripsTest::applyPr...

2017-12-23 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-imaging/pull/32


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #35: IMAGING-154 Removed Debug class

2018-02-05 Thread kinow
GitHub user kinow opened a pull request:

https://github.com/apache/commons-imaging/pull/35

IMAGING-154 Removed Debug class

Removed the `Debug` and `ImageDump` classes. Also removed methods with the 
`verbose` parameter, as well as any `System.out.println`'s. Tried to keep the 
change to a minimum, but given the extent of its use, I believe the pull 
request diff will be a bit long.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/kinow/commons-imaging IMAGING-154

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/35.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #35


commit 0e218c63086ce0e0ee9270d6099cc9466a0cda4c
Author: Bruno P. Kinoshita 
Date:   2018-02-05T11:10:25Z

IMAGING-154 Removed Debug class




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #18: IMAGING-168 installing package with Swedis...

2017-08-06 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/18#discussion_r131540224
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java ---
@@ -248,6 +258,35 @@ public PhotoshopApp13Data parsePhotoshopSegment(final 
byte[] bytes,
 return elements;
 }
 
+private String getEncodingCharsetName(byte[] codedCharacterSet){
+final Character WHITESPACE = ' ';
+String codedCharacterSetString = new String(codedCharacterSet);
+try {
+if (Charset.isSupported(codedCharacterSetString)) {
+return codedCharacterSetString;
+}
+}catch (IllegalCharsetNameException e){
+
--- End diff --

Might be worth to add at least one comment saying why these exceptions are 
not important, and that can be safely ignored.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #18: IMAGING-168 installing package with Swedis...

2017-08-06 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/18#discussion_r131540245
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java ---
@@ -50,6 +50,10 @@ public IptcRecord(final IptcType iptcType, final String 
value) {
 this.value = value;
 }
 
+public IptcRecord(final IptcType iptcType, final String value) {
+this(iptcType, value, "ISO-8859-1");
--- End diff --

+1 there is a constant defined in another class, but I wonder if we could 
use `StandardCharsets` as `commons-imaging` is using Java1.7+.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #26: (doc) Update sample usage example links fr...

2017-07-10 Thread deroneriksson
GitHub user deroneriksson opened a pull request:

https://github.com/apache/commons-imaging/pull/26

(doc) Update sample usage example links from svn to git

This updates the broken example links at src/site/xdoc/sampleusage.xml so 
that the generated page at target/site/sampleusage.html links to the examples 
on GitHub.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/deroneriksson/commons-imaging 
MINOR-update_sample_usage_links_from_svn_to_git

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/26.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #26


commit 221a3522e878d7360feba7e243dc9747a0fe291a
Author: Deron Eriksson 
Date:   2017-07-10T22:07:41Z

(doc) Update sample usage example links from svn to git




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #26: (doc) Update sample usage example links fr...

2017-07-12 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-imaging/pull/26


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #37: add size guard against corrupted icns file...

2018-04-20 Thread gregsh
GitHub user gregsh opened a pull request:

https://github.com/apache/commons-imaging/pull/37

add size guard against corrupted icns files

The problematic  incs file: groovy-1.7.5/bin/groovy.icns

From https://bintray.com/groovy/maven/groovy/1.7.5#files



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/JetBrains/intellij-deps-commons-imaging 
upstream

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/37.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #37


commit 05fedb1413d66c3356fec3f453b50cba5702d3f0
Author: Gregory.Shrago 
Date:   2018-04-20T15:15:13Z

add size guard against corrupted icns files

(cherry picked from commit 6ee36f1c6d72522537ac7f77fa0cb957bed05be7)




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #36: Avoid jpeg parse fail due to jfxx and exif

2018-07-21 Thread kinow
Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-imaging/pull/36#discussion_r204226858
  
--- Diff: 
src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java ---
@@ -312,7 +312,12 @@ private void dumpSegments(final List v) {
 @Override
 public ImageMetadata getMetadata(final ByteSource byteSource, final 
Map params)
 throws ImageReadException, IOException {
-final TiffImageMetadata exif = getExifMetadata(byteSource, params);
+TiffImageMetadata exif = null;
+try {
+exif = getExifMetadata(byteSource, params);
+} catch (Exception e) {
+// exif parse failed.
+}
--- End diff --

I think we should still fail here. Other parsers such as the 
`TiffImageParser` fail, so `JpegImageParser` not throwing an exception would be 
wrong.

Also, not even logging the exception can cause problems to users of the API 
that would have to debug the code to understand why they were not seeing the 
EXIF metadata, just to find an exception that was not propagated.

The rest of the code looks good. Would you be able to provide at least one 
unit tests for your code @hyunuck, please?

Thanks
Bruno


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-imaging pull request #36: Avoid jpeg parse fail due to jfxx and exif

2018-03-28 Thread hyunuck
GitHub user hyunuck opened a pull request:

https://github.com/apache/commons-imaging/pull/36

Avoid jpeg parse fail due to jfxx and exif

- add jfxx signature when parsing jpeg
- Avoid jpeg parse fail due to exif

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/hyunuck/commons-imaging master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-imaging/pull/36.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #36


commit e337c954847bf3a5ff17b64ec17c45916280fe31
Author: Justin 
Date:   2018-03-28T14:41:52Z

add jfxx signature when parsing jpeg

commit 8ad11248834e21154a09fdeb9c130bd800ea8250
Author: Justin 
Date:   2018-03-28T14:44:45Z

Avoid jpeg parse fail due to exif




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org