Skip to content

Commit

Permalink
squid:UselessParenthesesCheck - Useless parentheses around expression…
Browse files Browse the repository at this point in the history
…s should be removed to prevent any misunderstanding
  • Loading branch information
georgekankava committed Feb 5, 2016
1 parent 604b3bd commit e0fa181
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public DateWritable getPrimitiveWritableObject(Object o) {
if(o instanceof String) {
return new DateWritable(parse((String)o));
} else {
return new DateWritable(((Date) o));
return new DateWritable((Date) o);
}
}

Expand All @@ -53,7 +53,7 @@ public Date getPrimitiveJavaObject(Object o) {
if(o instanceof String) {
parse((String)o);
} else {
if (o instanceof Date) return ((Date) o);
if (o instanceof Date) return (Date) o;
}
return null;
}
Expand Down
26 changes: 13 additions & 13 deletions json-serde/src/main/java/org/openx/data/jsonserde/JsonSerDe.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void initialize(Configuration conf, Properties tbl) throws SerDeException
} else {
columnTypes = TypeInfoUtils.getTypeInfosFromTypeString(columnTypeProperty);
}
assert (columnNames.size() == columnTypes.size());
assert columnNames.size() == columnTypes.size();

stats = new SerDeStats();

Expand All @@ -128,8 +128,8 @@ public void initialize(Configuration conf, Properties tbl) throws SerDeException
String columnSortOrder = tbl.getProperty(Constants.SERIALIZATION_SORT_ORDER);
columnSortOrderIsDesc = new boolean[columnNames.size()];
for (int i = 0; i < columnSortOrderIsDesc.length; i++) {
columnSortOrderIsDesc[i] = (columnSortOrder != null &&
columnSortOrder.charAt(i) == '-');
columnSortOrderIsDesc[i] = columnSortOrder != null &&
columnSortOrder.charAt(i) == '-';
}


Expand Down Expand Up @@ -222,7 +222,7 @@ public Writable serialize(Object obj, ObjectInspector objInspector) throws SerDe
}

private String getSerializedFieldName( List<String> columnNames, int pos, StructField sf) {
String n = (columnNames==null? sf.getFieldName(): columnNames.get(pos));
String n = columnNames==null? sf.getFieldName(): columnNames.get(pos);

if(options.getMappings().containsKey(n)) {
return options.getMappings().get(n);
Expand Down Expand Up @@ -291,30 +291,30 @@ public Object serializeField(Object obj,
result = null;
break;
case BOOLEAN:
result = (((BooleanObjectInspector)poi).get(obj)?
result = ((BooleanObjectInspector)poi).get(obj)?
Boolean.TRUE:
Boolean.FALSE);
Boolean.FALSE;
break;
case BYTE:
result = (((ByteObjectInspector)poi).get(obj));
result = ((ByteObjectInspector)poi).get(obj);
break;
case DOUBLE:
result = (((DoubleObjectInspector)poi).get(obj));
result = ((DoubleObjectInspector)poi).get(obj);
break;
case FLOAT:
result = (((FloatObjectInspector)poi).get(obj));
result = ((FloatObjectInspector)poi).get(obj);
break;
case INT:
result = (((IntObjectInspector)poi).get(obj));
result = ((IntObjectInspector)poi).get(obj);
break;
case LONG:
result = (((LongObjectInspector)poi).get(obj));
result = ((LongObjectInspector)poi).get(obj);
break;
case SHORT:
result = (((ShortObjectInspector)poi).get(obj));
result = ((ShortObjectInspector)poi).get(obj);
break;
case STRING:
result = (((StringObjectInspector)poi).getPrimitiveJavaObject(obj));
result = ((StringObjectInspector)poi).getPrimitiveJavaObject(obj);
break;
case UNKNOWN:
throw new RuntimeException("Unknown primitive");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static Object checkObject(Object data) {

if(data instanceof String ||
data instanceof Text) {
String str = (data instanceof String ? (String)data : ((Text)data).toString() );
String str = data instanceof String ? (String)data : ((Text)data).toString();
if(str.trim().isEmpty())
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public Object getStructFieldDataFromJsonObject(JSONObject data, StructField fiel
MyField f = (MyField) fieldRef;

int fieldID = f.getFieldID();
assert (fieldID >= 0 && fieldID < fields.size());
assert fieldID >= 0 && fieldID < fields.size();

Object fieldData = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Object getPrimitiveWritableObject(Object o) {
if(o instanceof String) {
return new BooleanWritable(Boolean.parseBoolean((String) o));
} else {
return new BooleanWritable(((Boolean) o));
return new BooleanWritable((Boolean) o);
}
}

Expand All @@ -45,7 +45,7 @@ public boolean get(Object o) {
if(o instanceof String) {
return Boolean.parseBoolean((String) o);
} else {
return (((Boolean) o));
return (Boolean) o;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public byte get(Object o) {
if(o instanceof String) {
return ParsePrimitiveUtils.parseByte((String)o);
} else {
return ((Byte) o);
return (Byte) o;
}
}

Expand All @@ -56,7 +56,7 @@ public Object getPrimitiveJavaObject(Object o)

@Override
public Object create(byte value) {
return (value);
return value;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Object getPrimitiveWritableObject(Object o) {
if(o instanceof String) {
return new DoubleWritable(Double.parseDouble((String)o));
} else {
return new DoubleWritable(((Double) o));
return new DoubleWritable((Double) o);
}
}

Expand All @@ -44,7 +44,7 @@ public double get(Object o) {
if(o instanceof String) {
return Double.parseDouble((String)o);
} else {
return (((Double) o));
return (Double) o;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public float get(Object o) {
if(o instanceof String) {
return Float.parseFloat((String)o);
} else {
return ((Float) o);
return (Float) o;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public int get(Object o) {
if(o instanceof String) {
return ParsePrimitiveUtils.parseInt((String)o);
} else {
return ((Integer) o);
return (Integer) o;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public long get(Object o) {
if(o instanceof String) {
return ParsePrimitiveUtils.parseLong((String)o);
} else {
return ((Long) o);
return (Long) o;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public short get(Object o) {
if(o instanceof String) {
return ParsePrimitiveUtils.parseShort((String)o);
} else {
return ((Short) o);
return (Short) o;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public TimestampWritable getPrimitiveWritableObject(Object o) {
if(o instanceof String) {
return new TimestampWritable(ParsePrimitiveUtils.parseTimestamp((String)o));
} else {
return new TimestampWritable(((Timestamp) o));
return new TimestampWritable((Timestamp) o);
}
}

Expand All @@ -70,7 +70,7 @@ public Timestamp getPrimitiveJavaObject(Object o) {
if(o instanceof String) {
return ParsePrimitiveUtils.parseTimestamp((String)o);
} else {
return ((Timestamp) o);
return (Timestamp) o;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class JsonStringJavaObjectInspector extends

@Override
public Text getPrimitiveWritableObject(Object o) {
return o == null ? null : new Text(((String) o.toString()));
return o == null ? null : new Text((String) o.toString());
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion json-udf/src/main/java/org/openx/data/udf/JsonUDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public Object evaluate(DeferredObject[] arguments) throws HiveException {

@Override
public String getDisplayString(String[] children) {
assert (children.length > 0);
assert children.length > 0;

StringBuilder sb = new StringBuilder();
sb.append("JsonUDF(");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ private void populateMap(Object bean) {

boolean includeSuperClass = klass.getClassLoader() != null;

Method[] methods = (includeSuperClass) ?
Method[] methods = includeSuperClass ?
klass.getMethods() : klass.getDeclaredMethods();
for (int i = 0; i < methods.length; i += 1) {
try {
Expand Down
2 changes: 1 addition & 1 deletion json/src/main/java/org/openx/data/jsonserde/json/XML.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public static Object stringToValue(String string) {
if (initial == '0' && string.charAt(negative ? 2 : 1) == '0') {
return string;
}
if ((initial >= '0' && initial <= '9')) {
if (initial >= '0' && initial <= '9') {
if (string.indexOf('.') >= 0) {
return Double.valueOf(string);
} else if (string.indexOf('e') < 0 && string.indexOf('E') < 0) {
Expand Down

0 comments on commit e0fa181

Please sign in to comment.