Fixing (again) the build on windows

This commit is contained in:
Francesco Chicchiriccò 2014-04-24 11:36:07 +02:00
parent 4f1072a6e0
commit fac8c0ae6f
12 changed files with 95 additions and 88 deletions

View File

@ -413,10 +413,10 @@ public abstract class AbstractServices {
throw new UnsupportedMediaTypeException("Unsupported media type");
} else if (contentTypeValue == Accept.ATOM) {
entryChanges = atomDeserializer.<AtomEntryImpl, AtomEntryImpl>read(
IOUtils.toInputStream(changes), AtomEntryImpl.class).getObject();
IOUtils.toInputStream(changes, Constants.ENCODING), AtomEntryImpl.class).getObject();
} else {
final Container<JSONEntryImpl> jcont =
mapper.readValue(IOUtils.toInputStream(changes), new TypeReference<JSONEntryImpl>() {
final Container<JSONEntryImpl> jcont = mapper.readValue(IOUtils.toInputStream(changes, Constants.ENCODING),
new TypeReference<JSONEntryImpl>() {
});
entryChanges = dataBinder.toAtomEntry(jcont.getObject());
@ -495,11 +495,11 @@ public abstract class AbstractServices {
InputStream res;
if (acceptType == Accept.ATOM) {
res = xml.addOrReplaceEntity(entityId, entitySetName, IOUtils.toInputStream(entity),
getUtilities(acceptType).readEntry(acceptType, IOUtils.toInputStream(entity)));
res = xml.addOrReplaceEntity(entityId, entitySetName, IOUtils.toInputStream(entity, Constants.ENCODING),
getUtilities(acceptType).readEntry(acceptType, IOUtils.toInputStream(entity, Constants.ENCODING)));
} else {
res = json.addOrReplaceEntity(entityId, entitySetName, IOUtils.toInputStream(entity),
getUtilities(acceptType).readEntry(acceptType, IOUtils.toInputStream(entity)));
res = json.addOrReplaceEntity(entityId, entitySetName, IOUtils.toInputStream(entity, Constants.ENCODING),
getUtilities(acceptType).readEntry(acceptType, IOUtils.toInputStream(entity, Constants.ENCODING)));
}
final Container<AtomEntryImpl> cres;
@ -579,7 +579,7 @@ public abstract class AbstractServices {
entityKey = xml.getDefaultEntryKey(entitySetName, entry);
utils.addMediaEntityValue(entitySetName, entityKey, IOUtils.toInputStream(entity));
utils.addMediaEntityValue(entitySetName, entityKey, IOUtils.toInputStream(entity, Constants.ENCODING));
final String id = Commons.getMediaContent().get(entitySetName);
if (StringUtils.isNotBlank(id)) {
@ -602,11 +602,12 @@ public abstract class AbstractServices {
} else {
final Accept contentTypeValue = Accept.parse(contentType, version);
if (Accept.ATOM == contentTypeValue) {
container = atomDeserializer.read(IOUtils.toInputStream(entity), AtomEntryImpl.class);
container = atomDeserializer.read(IOUtils.toInputStream(entity, Constants.ENCODING), AtomEntryImpl.class);
entry = container.getObject();
} else {
final Container<JSONEntryImpl> jcontainer =
mapper.readValue(IOUtils.toInputStream(entity), new TypeReference<JSONEntryImpl>() {
mapper.readValue(IOUtils.toInputStream(entity, Constants.ENCODING),
new TypeReference<JSONEntryImpl>() {
});
entry = dataBinder.toAtomEntry(jcontainer.getObject());
@ -700,7 +701,7 @@ public abstract class AbstractServices {
replaceAll("\\<d:Title\\>.*\\</d:Title\\>", "<d:Title>[Sacked]</d:Title>");
final FSManager fsManager = FSManager.instance(version);
fsManager.putInMemory(IOUtils.toInputStream(newContent, "UTF-8"),
fsManager.putInMemory(IOUtils.toInputStream(newContent, Constants.ENCODING),
fsManager.getAbsolutePath(Commons.getEntityBasePath("Person", entityId) + Constants.get(version,
ConstantKey.ENTITY), utils.getKey()));
@ -759,7 +760,7 @@ public abstract class AbstractServices {
"<d:Salary m:type=\"Edm.Int32\">" + newSalary + "</d:Salary>");
}
FSManager.instance(version).putInMemory(IOUtils.toInputStream(newContent, "UTF-8"),
FSManager.instance(version).putInMemory(IOUtils.toInputStream(newContent, Constants.ENCODING),
FSManager.instance(version).getAbsolutePath(path.toString(), acceptType));
return xml.createResponse(null, null, null, acceptType, Response.Status.NO_CONTENT);
@ -1150,7 +1151,7 @@ public abstract class AbstractServices {
final InputStream changed = utils.replaceProperty(
entitySetName,
entityId,
IOUtils.toInputStream(changes),
IOUtils.toInputStream(changes, Constants.ENCODING),
Arrays.asList(path.split("/")),
acceptType,
justValue);
@ -1306,7 +1307,8 @@ public abstract class AbstractServices {
final AbstractUtilities utils = getUtilities(null);
final InputStream res = utils.putMediaInMemory(entitySetName, entityId, IOUtils.toInputStream(value));
final InputStream res = utils.putMediaInMemory(
entitySetName, entityId, IOUtils.toInputStream(value, Constants.ENCODING));
final String location = uriInfo.getRequestUri().toASCIIString().replace("/$value", "");
@ -1367,7 +1369,8 @@ public abstract class AbstractServices {
try {
final AbstractUtilities utils = getUtilities(null);
InputStream res = utils.putMediaInMemory(entitySetName, entityId, path, IOUtils.toInputStream(value));
InputStream res = utils.putMediaInMemory(
entitySetName, entityId, path, IOUtils.toInputStream(value, Constants.ENCODING));
final Response response;
if ("return-content".equalsIgnoreCase(prefer)) {

View File

@ -61,7 +61,7 @@ public class V3ActionOverloading extends AbstractServices {
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), "UTF-8").
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
replaceAll("Static\\.svc", "ActionOverloading.svc");
final Response.ResponseBuilder builder = status(response.getStatus());
@ -71,7 +71,7 @@ public class V3ActionOverloading extends AbstractServices {
}
}
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, "UTF-8");
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(toBeStreamedBack, baos);
IOUtils.closeQuietly(toBeStreamedBack);

View File

@ -40,6 +40,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.fit.methods.MERGE;
import org.apache.olingo.fit.methods.PATCH;
import org.apache.olingo.fit.utils.Constants;
import org.springframework.stereotype.Service;
@Service
@ -54,7 +55,7 @@ public class V3KeyAsSegment {
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), "UTF-8").
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
replaceAll("Static\\.svc", "KeyAsSegment.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
@ -64,7 +65,7 @@ public class V3KeyAsSegment {
}
}
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, "UTF-8");
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(toBeStreamedBack, baos);
IOUtils.closeQuietly(toBeStreamedBack);

View File

@ -72,7 +72,7 @@ public class V3OpenType {
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), "UTF-8").
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
replaceAll("Static\\.svc", "OpenType.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
@ -82,7 +82,7 @@ public class V3OpenType {
}
}
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, "UTF-8");
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(toBeStreamedBack, baos);
IOUtils.closeQuietly(toBeStreamedBack);

View File

@ -275,9 +275,9 @@ public class V3Services extends AbstractServices {
final List<String> links;
if (content == Accept.XML || content == Accept.TEXT || content == Accept.ATOM) {
links = xml.extractLinkURIs(IOUtils.toInputStream(link)).getValue();
links = xml.extractLinkURIs(IOUtils.toInputStream(link, Constants.ENCODING)).getValue();
} else {
links = json.extractLinkURIs(IOUtils.toInputStream(link)).getValue();
links = json.extractLinkURIs(IOUtils.toInputStream(link, Constants.ENCODING)).getValue();
}
utils.putLinksInMemory(
@ -352,9 +352,9 @@ public class V3Services extends AbstractServices {
final List<String> links;
if (content == Accept.XML || content == Accept.TEXT || content == Accept.ATOM) {
links = xml.extractLinkURIs(IOUtils.toInputStream(link)).getValue();
links = xml.extractLinkURIs(IOUtils.toInputStream(link, Constants.ENCODING)).getValue();
} else {
links = json.extractLinkURIs(IOUtils.toInputStream(link)).getValue();
links = json.extractLinkURIs(IOUtils.toInputStream(link, Constants.ENCODING)).getValue();
}
utils.putLinksInMemory(

View File

@ -39,6 +39,7 @@ import javax.ws.rs.core.UriInfo;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.fit.methods.PATCH;
import org.apache.olingo.fit.utils.Constants;
import org.springframework.stereotype.Service;
@Service
@ -53,7 +54,7 @@ public class V4KeyAsSegment {
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), "UTF-8").
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
replaceAll("Static\\.svc", "KeyAsSegment.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
@ -63,7 +64,7 @@ public class V4KeyAsSegment {
}
}
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, "UTF-8");
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(toBeStreamedBack, baos);
IOUtils.closeQuietly(toBeStreamedBack);

View File

@ -67,7 +67,7 @@ public class V4OpenType {
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), "UTF-8").
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
replaceAll("Static\\.svc", "OpenType.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
@ -77,7 +77,7 @@ public class V4OpenType {
}
}
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, "UTF-8");
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(toBeStreamedBack, baos);
IOUtils.closeQuietly(toBeStreamedBack);

View File

@ -106,7 +106,7 @@ public class V4Services extends AbstractServices {
if (!providedAsync.containsKey(name)) {
throw new NotFoundException();
}
final InputStream res = IOUtils.toInputStream(providedAsync.get(name));
final InputStream res = IOUtils.toInputStream(providedAsync.get(name), Constants.ENCODING);
providedAsync.remove(name);
return xml.createMonitorResponse(res);
} catch (Exception e) {
@ -645,11 +645,12 @@ public class V4Services extends AbstractServices {
final AtomEntryImpl entry;
final Accept contentTypeValue = Accept.parse(contentType, version);
if (Accept.ATOM == contentTypeValue) {
entryContainer = atomDeserializer.read(IOUtils.toInputStream(entity), AtomEntryImpl.class);
entryContainer = atomDeserializer.read(IOUtils.toInputStream(entity, Constants.ENCODING), AtomEntryImpl.class);
entry = entryContainer.getObject();
} else {
final Container<JSONEntryImpl> jcontainer =
mapper.readValue(IOUtils.toInputStream(entity), new TypeReference<JSONEntryImpl>() {
mapper.readValue(IOUtils.toInputStream(entity, Constants.ENCODING),
new TypeReference<JSONEntryImpl>() {
});
entry = dataBinder.toAtomEntry(jcontainer.getObject());
@ -738,7 +739,7 @@ public class V4Services extends AbstractServices {
final AtomEntryImpl entryChanges;
if (Accept.ATOM == contentTypeValue) {
container = atomDeserializer.read(IOUtils.toInputStream(changes), AtomEntryImpl.class);
container = atomDeserializer.read(IOUtils.toInputStream(changes, Constants.ENCODING), AtomEntryImpl.class);
entryChanges = container.getObject();
} else {
final String entityType = getMetadataObj().getEntitySet(entitySetName).getType();
@ -746,8 +747,8 @@ public class V4Services extends AbstractServices {
getNavigationProperty(containedEntitySetName).getType();
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(containedType).build();
final Container<JSONEntryImpl> jsonContainer = mapper.readValue(IOUtils.toInputStream(changes),
new TypeReference<JSONEntryImpl>() {
final Container<JSONEntryImpl> jsonContainer = mapper.readValue(
IOUtils.toInputStream(changes, Constants.ENCODING), new TypeReference<JSONEntryImpl>() {
});
jsonContainer.getObject().setType(typeInfo.getFullQualifiedName().toString());
entryChanges = dataBinder.toAtomEntry(jsonContainer.getObject());

View File

@ -57,7 +57,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
protected InputStream addLinks(
final String entitySetName, final String entitykey, final InputStream is, final Set<String> links)
throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
IOUtils.closeQuietly(is);
@ -71,7 +71,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
@Override
protected Set<String> retrieveAllLinkNames(InputStream is) throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
IOUtils.closeQuietly(is);
@ -101,7 +101,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
protected NavigationLinks retrieveNavigationInfo(final String entitySetName, final InputStream is)
throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
IOUtils.closeQuietly(is);
@ -144,7 +144,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final String entitySetName, final String entityKey, final InputStream is, final NavigationLinks links)
throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
if (links != null) {
@ -175,16 +175,16 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(
Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")"));
return IOUtils.toInputStream(srcNode.toString(), "UTF-8");
return IOUtils.toInputStream(srcNode.toString(), Constants.ENCODING);
}
@Override
public InputStream getPropertyValue(final InputStream src, final List<String> path)
throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final JsonNode srcNode = mapper.readTree(src);
final JsonNode node = getProperty(srcNode, path);
return IOUtils.toInputStream(node.asText());
return IOUtils.toInputStream(node.asText(), Constants.ENCODING);
}
@Override
@ -196,7 +196,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
Commons.getEntityBasePath(entitySetName, entityId) + Constants.get(version, ConstantKey.ENTITY),
Accept.JSON_FULLMETA);
final ObjectMapper mapper = new ObjectMapper();
final JsonNode srcNode = mapper.readTree(src);
final ObjectNode propertyNode = new ObjectNode(JsonNodeFactory.instance);
@ -243,7 +243,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
public InputStream addJsonInlinecount(
final InputStream src, final int count, final Accept accept)
throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final JsonNode srcNode = mapper.readTree(src);
((ObjectNode) srcNode).put(Constants.get(version, ConstantKey.ODATA_COUNT_NAME), count);
@ -258,7 +258,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
}
public InputStream wrapJsonEntities(final InputStream entities) throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final JsonNode node = mapper.readTree(entities);
final ObjectNode res;
@ -287,7 +287,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
@Override
public InputStream selectEntity(final InputStream src, final String[] propertyNames) throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
final Set<String> retain = new HashSet<String>();
@ -319,7 +319,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
throw new NotFoundException();
}
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode node = mapper.createObjectNode();
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
@ -363,7 +363,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
protected InputStream replaceLink(
final InputStream toBeChanged, final String linkName, final InputStream replacement)
throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode toBeChangedNode = (ObjectNode) mapper.readTree(toBeChanged);
final ObjectNode replacementNode = (ObjectNode) mapper.readTree(replacement);
@ -386,7 +386,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
protected Map<String, InputStream> getChanges(final InputStream src) throws Exception {
final Map<String, InputStream> res = new HashMap<String, InputStream>();
final ObjectMapper mapper = new ObjectMapper();
final JsonNode srcObject = mapper.readTree(src);
final Iterator<Map.Entry<String, JsonNode>> fields = srcObject.fields();
@ -409,7 +409,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
@Override
public Map.Entry<String, List<String>> extractLinkURIs(final InputStream is)
throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
IOUtils.closeQuietly(is);
@ -436,7 +436,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
@Override
public InputStream addEditLink(
final InputStream content, final String title, final String href) throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(content);
IOUtils.closeQuietly(content);
@ -448,7 +448,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
public InputStream addOperation(final InputStream content, final String name, final String metaAnchor,
final String href) throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(content);
IOUtils.closeQuietly(content);
@ -464,7 +464,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
public InputStream replaceProperty(
final InputStream src, final InputStream replacement, final List<String> path, final boolean justValue)
throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
IOUtils.closeQuietly(src);
@ -491,7 +491,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
@Override
public InputStream deleteProperty(final InputStream src, final List<String> path) throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
IOUtils.closeQuietly(src);

View File

@ -386,7 +386,7 @@ public abstract class AbstractUtilities {
+ "</entry>";
fsManager.putInMemory(
IOUtils.toInputStream(entity),
IOUtils.toInputStream(entity, Constants.ENCODING),
fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY), Accept.ATOM));
// -----------------------------------------
@ -406,7 +406,8 @@ public abstract class AbstractUtilities {
+ "\"Description\": null" + "}";
fsManager.putInMemory(
IOUtils.toInputStream(entity), fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY),
IOUtils.toInputStream(entity, Constants.ENCODING),
fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY),
Accept.JSON_FULLMETA));
// -----------------------------------------

View File

@ -334,7 +334,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
title,
link.getStart().getAttributeByName(new QName("type")).getValue());
addAtomElement(IOUtils.toInputStream(normalizedLink), writer);
addAtomElement(IOUtils.toInputStream(normalizedLink, Constants.ENCODING), writer);
}
}
} catch (Exception ignore) {
@ -453,7 +453,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
Collections.<Map.Entry<String, String>>singletonList(
new AbstractMap.SimpleEntry<String, String>("rel", "edit")), false, 0, -1, -1);
addAtomElement(IOUtils.toInputStream(editLinkElement), writer);
addAtomElement(IOUtils.toInputStream(editLinkElement, Constants.ENCODING), writer);
writer.add(reader);
} catch (Exception e) {
@ -468,7 +468,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
writer.add(entryElement.getStart());
addAtomElement(IOUtils.toInputStream(editLinkElement), writer);
addAtomElement(IOUtils.toInputStream(editLinkElement, Constants.ENCODING), writer);
writer.add(entryElement.getContentReader());
writer.add(entryElement.getEnd());
@ -741,7 +741,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
extractElement(reader, writer, Collections.<String>singletonList("feed"), 0, 1, 1).getValue();
writer.add(feedElement.getStart());
addAtomElement(IOUtils.toInputStream(String.format("<m:count>%d</m:count>", count)), writer);
addAtomElement(IOUtils.toInputStream(String.format("<m:count>%d</m:count>", count), Constants.ENCODING), writer);
writer.add(feedElement.getContentReader());
writer.add(feedElement.getEnd());
@ -1211,8 +1211,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final Map.Entry<Integer, XmlElement> element = extractElement(reader, writer, pathElements, 0, 3, 4);
final XMLEventReader changesReader = new XMLEventReaderWrapper(
IOUtils.toInputStream(String.format("<%s m:null=\"true\" />", path.get(path.size() - 1))));
final XMLEventReader changesReader = new XMLEventReaderWrapper(IOUtils.toInputStream(
String.format("<%s m:null=\"true\" />", path.get(path.size() - 1)), Constants.ENCODING));
writer.add(changesReader);
changesReader.close();

View File

@ -222,7 +222,7 @@ public abstract class Commons {
builder.append("</links>");
return IOUtils.toInputStream(builder.toString());
return IOUtils.toInputStream(builder.toString(), Constants.ENCODING);
}
public static InputStream getLinksAsJSON(final ODataServiceVersion version,
@ -252,7 +252,7 @@ public abstract class Commons {
links.set("value", uris);
}
return IOUtils.toInputStream(links.toString(), "UTF-8");
return IOUtils.toInputStream(links.toString(), Constants.ENCODING);
}
public static InputStream changeFormat(final InputStream is, final ODataServiceVersion version, final Accept target) {
@ -266,7 +266,7 @@ public abstract class Commons {
final JsonNode node =
changeFormat((ObjectNode) mapper.readTree(new ByteArrayInputStream(bos.toByteArray())), version, target);
return IOUtils.toInputStream(node.toString(), "UTF-8");
return IOUtils.toInputStream(node.toString(), Constants.ENCODING);
} catch (Exception e) {
LOG.error("Error changing format", e);
return new ByteArrayInputStream(bos.toByteArray());