Fix to have consistent whitespace

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1496671 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2013-06-25 23:30:37 +00:00
parent 666841c1e7
commit 9d87fb9caa

View File

@ -62,9 +62,9 @@ public class HPSFPropertiesExtractor extends POITextExtractor {
// Now custom ones // Now custom ones
CustomProperties cps = dsi == null ? null : dsi.getCustomProperties(); CustomProperties cps = dsi == null ? null : dsi.getCustomProperties();
if(cps != null) { if (cps != null) {
Iterator<String> keys = cps.nameSet().iterator(); Iterator<String> keys = cps.nameSet().iterator();
while(keys.hasNext()) { while (keys.hasNext()) {
String key = keys.next(); String key = keys.next();
String val = getPropertyValueText( cps.get(key) ); String val = getPropertyValueText( cps.get(key) );
text.append(key + " = " + val + "\n"); text.append(key + " = " + val + "\n");
@ -82,7 +82,7 @@ public class HPSFPropertiesExtractor extends POITextExtractor {
} }
private static String getPropertiesText(SpecialPropertySet ps) { private static String getPropertiesText(SpecialPropertySet ps) {
if(ps == null) { if (ps == null) {
// Not defined, oh well // Not defined, oh well
return ""; return "";
} }
@ -91,7 +91,7 @@ public class HPSFPropertiesExtractor extends POITextExtractor {
PropertyIDMap idMap = ps.getPropertySetIDMap(); PropertyIDMap idMap = ps.getPropertySetIDMap();
Property[] props = ps.getProperties(); Property[] props = ps.getProperties();
for(int i=0; i<props.length; i++) { for (int i=0; i<props.length; i++) {
String type = Long.toString( props[i].getID() ); String type = Long.toString( props[i].getID() );
Object typeObj = idMap.get(props[i].getID()); Object typeObj = idMap.get(props[i].getID());
if(typeObj != null) { if(typeObj != null) {
@ -105,21 +105,21 @@ public class HPSFPropertiesExtractor extends POITextExtractor {
return text.toString(); return text.toString();
} }
private static String getPropertyValueText(Object val) { private static String getPropertyValueText(Object val) {
if(val == null) { if (val == null) {
return "(not set)"; return "(not set)";
} }
if(val instanceof byte[]) { if (val instanceof byte[]) {
byte[] b = (byte[])val; byte[] b = (byte[])val;
if(b.length == 0) { if (b.length == 0) {
return ""; return "";
} }
if(b.length == 1) { if (b.length == 1) {
return Byte.toString(b[0]); return Byte.toString(b[0]);
} }
if(b.length == 2) { if (b.length == 2) {
return Integer.toString( LittleEndian.getUShort(b) ); return Integer.toString( LittleEndian.getUShort(b) );
} }
if(b.length == 4) { if (b.length == 4) {
return Long.toString( LittleEndian.getUInt(b) ); return Long.toString( LittleEndian.getUInt(b) );
} }
// Maybe it's a string? who knows! // Maybe it's a string? who knows!
@ -161,10 +161,9 @@ public class HPSFPropertiesExtractor extends POITextExtractor {
} }
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
for(String file : args) { for (String file : args) {
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor( HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
new NPOIFSFileSystem(new File(file)) new NPOIFSFileSystem(new File(file)));
);
System.out.println(ext.getText()); System.out.println(ext.getText());
} }
} }