Misc: fixing the critical errors reported by Apache Analysis tool
This commit is contained in:
parent
e981aaad79
commit
93992f9135
|
@ -714,7 +714,7 @@ public class DataRequest extends ServiceRequest {
|
|||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
new DeserializerException("Error reading raw value",
|
||||
throw new DeserializerException("Error reading raw value",
|
||||
SerializerException.MessageKeys.IO_EXCEPTION);
|
||||
}
|
||||
} while (true);
|
||||
|
|
|
@ -164,25 +164,26 @@ public class EntityResponse extends ServiceResponse {
|
|||
}
|
||||
|
||||
public static String buildLocation(String baseURL, Entity entity, String enitySetName, EdmEntityType type) {
|
||||
String location = baseURL + "/" + enitySetName + "(";
|
||||
StringBuilder location = new StringBuilder();
|
||||
location.append(baseURL).append("/").append(enitySetName).append("(");
|
||||
int i = 0;
|
||||
boolean usename = type.getKeyPredicateNames().size() > 1;
|
||||
|
||||
for (String key : type.getKeyPredicateNames()) {
|
||||
if (i > 0) {
|
||||
location += ",";
|
||||
location.append(",");
|
||||
}
|
||||
i++;
|
||||
if (usename) {
|
||||
location += (key + "=");
|
||||
location.append(key).append("=");
|
||||
}
|
||||
if (entity.getProperty(key).getType().equals("Edm.String")) {
|
||||
location = location + "'" + entity.getProperty(key).getValue().toString() + "'";
|
||||
location.append("'").append(entity.getProperty(key).getValue().toString()).append("'");
|
||||
} else {
|
||||
location = location + entity.getProperty(key).getValue().toString();
|
||||
location.append(entity.getProperty(key).getValue().toString());
|
||||
}
|
||||
}
|
||||
location += ")";
|
||||
return location;
|
||||
location.append(")");
|
||||
return location.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,9 +159,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
|
|||
values.add(complex(reader, event.asStartElement(), (EdmComplexType) edmType));
|
||||
} else if (edmType instanceof EdmEnumType) {
|
||||
values.add(readEnum(reader, event.asStartElement()));
|
||||
} else {
|
||||
// do not add null or empty values
|
||||
}
|
||||
// do not add null or empty values
|
||||
}
|
||||
|
||||
if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
|
||||
|
@ -247,9 +246,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
|
|||
} else if (edmType instanceof EdmEnumType) {
|
||||
valuable.setValue(ValueType.ENUM, readEnum(reader, start));
|
||||
valuable.setType(edmType.getFullQualifiedName().getFullQualifiedNameAsString());
|
||||
} else {
|
||||
// do not add null or empty values
|
||||
}
|
||||
// do not add null or empty values
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -588,18 +588,14 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
|
|||
final ExpandOption innerExpand, final SelectOption innerSelect, final XMLStreamWriter writer)
|
||||
throws XMLStreamException, SerializerException {
|
||||
if (property.isCollection()) {
|
||||
if (navigationLink == null || navigationLink.getInlineEntitySet() == null) {
|
||||
// nothing to write.
|
||||
} else {
|
||||
if (navigationLink != null && navigationLink.getInlineEntitySet() != null) {
|
||||
writer.writeStartElement(ATOM, "feed", NS_ATOM);
|
||||
writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
|
||||
innerSelect, writer);
|
||||
writer.writeEndElement();
|
||||
}
|
||||
} else {
|
||||
if (navigationLink == null || navigationLink.getInlineEntity() == null) {
|
||||
// nothing to write
|
||||
} else {
|
||||
if (navigationLink != null && navigationLink.getInlineEntity() != null) {
|
||||
writeEntity(metadata, property.getType(), navigationLink.getInlineEntity(), null,
|
||||
innerExpand, innerSelect, writer, false);
|
||||
}
|
||||
|
@ -756,9 +752,8 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
|
|||
isNullable, maxLength, precision, scale, isUnicode);
|
||||
if (value == null) {
|
||||
writer.writeAttribute(DATA, NS_DATA, "null", "true");
|
||||
} else if (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean)) {
|
||||
writer.writeCharacters(value);
|
||||
} else if (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)
|
||||
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean)
|
||||
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)
|
||||
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double)
|
||||
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)
|
||||
|
|
Loading…
Reference in New Issue