diff --git a/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/SVGImageRenderer.java b/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/SVGImageRenderer.java index ac357759fc..b355e34dd6 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/SVGImageRenderer.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/SVGImageRenderer.java @@ -99,7 +99,7 @@ public class SVGImageRenderer implements ImageRenderer { g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); - g2d.setRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE, new WeakReference(bi)); + g2d.setRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE, new WeakReference<>(bi)); Dimension2D dimSVG = getDimension(); double scaleX = dim.getWidth() / dimSVG.getWidth(); diff --git a/poi/src/main/java/org/apache/poi/hpsf/CustomProperties.java b/poi/src/main/java/org/apache/poi/hpsf/CustomProperties.java index fa49246e80..64891fbf19 100644 --- a/poi/src/main/java/org/apache/poi/hpsf/CustomProperties.java +++ b/poi/src/main/java/org/apache/poi/hpsf/CustomProperties.java @@ -73,7 +73,7 @@ public class CustomProperties implements Map { * The custom properties */ private final HashMap props = new HashMap<>(); - + /** * Maps property IDs to property names and vice versa. */ @@ -90,10 +90,10 @@ public class CustomProperties implements Map { * Puts a {@link CustomProperty} into this map. It is assumed that the * {@link CustomProperty} already has a valid ID. Otherwise use * {@link #put(CustomProperty)}. - * + * * @param name the property name * @param cp the property - * + * * @return the previous property stored under this name */ public CustomProperty put(final String name, final CustomProperty cp) { @@ -102,7 +102,7 @@ public class CustomProperties implements Map { isPure = false; return null; } - + if (!name.equals(cp.getName())) { throw new IllegalArgumentException("Parameter \"name\" (" + name + ") and custom property's name (" + cp.getName() + @@ -110,7 +110,7 @@ public class CustomProperties implements Map { } checkCodePage(name); - + /* Register name and ID in the dictionary. Mapping in both directions is possible. If there is already a */ props.remove(dictionary.getKey(name)); dictionary.put(cp.getID(), name); @@ -156,7 +156,7 @@ public class CustomProperties implements Map { final Property p = new Property(-1, variantType, value); return put(new CustomProperty(p, key)); } - + /** * Gets a named value from the custom properties - only works for keys of type String * @@ -196,7 +196,7 @@ public class CustomProperties implements Map { public void clear() { props.clear(); } - + @Override public int hashCode() { return props.hashCode(); @@ -222,9 +222,9 @@ public class CustomProperties implements Map { list.addAll(props.values()); return Collections.unmodifiableList(list); } - + /** - * @return the list of property values - use {@link #properties()} for the wrapped values + * @return the list of property values - use {@link #properties()} for the wrapped values */ @Override public Collection values() { @@ -247,18 +247,17 @@ public class CustomProperties implements Map { /** * Returns a set of all the names of our custom properties. * Equivalent to {@link #nameSet()} - * + * * @return a set of all the names of our custom properties */ @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) - public Set keySet() { + public Set keySet() { return Collections.unmodifiableSet(dictionary.values()); } /** * Returns a set of all the names of our custom properties - * + * * @return a set of all the names of our custom properties */ public Set nameSet() { @@ -267,7 +266,7 @@ public class CustomProperties implements Map { /** * Returns a set of all the IDs of our custom properties - * + * * @return a set of all the IDs of our custom properties */ public Set idSet() { @@ -313,14 +312,14 @@ public class CustomProperties implements Map { } /** - * Checks against both the property, and its values. + * Checks against both the property, and its values. */ @Override public boolean containsValue(Object value) { if(value instanceof CustomProperty) { return props.containsValue(value); } - + for(CustomProperty cp : props.values()) { if(cp.getValue() == value) { return true;