Author: andrew.plotnikov
Date: 2011-12-23 08:18:15 -0500 (Fri, 23 Dec 2011)
New Revision: 5345
Modified:
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/util/HierarchicalProperty.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonWriterImpl.java
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/ObjectBuilder.java
ws/trunk/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AliasedURLRequestRedirector.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/DependencySupplier.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/OutputHeadersMap.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ResourceBinder.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RuntimeDelegateImpl.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/method/ParameterHelper.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/JsonEntityProvider.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/ResourceDescriptorValidator.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/uri/UriComponent.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/uri/UriTemplateParser.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/util/MediaTypeMap.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/wadl/BaseWadlGeneratorImpl.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ExtendedGroovyClassLoader.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyJaxrsPublisher.java
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpSession.java
Log:
EXOJCR-1687: Fixed new sonar violations in project
Modified:
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java
===================================================================
---
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -180,8 +180,10 @@
else
// update thread
{
- if (t_state == INDET && methodHasSideEffects(m_history[idx]))
+ if (t_state == INDET && methodHasSideEffects(m_history[idx]))
//NOSONAR
+ {
threads.put(r_history[idx], Boolean.FALSE);
+ }
}
}
Modified:
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java
===================================================================
---
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/Response.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -382,12 +382,15 @@
public Date getHeaderAsDate(String hdr) throws IOException, IllegalArgumentException
{
String raw_date = getHeader(hdr);
+
if (raw_date == null)
return null;
// asctime() format is missing an explicit GMT specifier
if (raw_date.toUpperCase().indexOf("GMT") == -1 &&
raw_date.indexOf(' ') > 0)
- raw_date += " GMT";
+ {
+ raw_date += " GMT"; //NOSONAR
+ }
Date date;
@@ -492,7 +495,9 @@
// asctime() format is missing an explicit GMT specifier
if (raw_date.toUpperCase().indexOf("GMT") == -1 &&
raw_date.indexOf(' ') > 0)
- raw_date += " GMT";
+ {
+ raw_date += " GMT"; //NOSONAR
+ }
Date date;
Modified:
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java
===================================================================
---
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/StreamDemultiplexor.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -213,7 +213,7 @@
// read the headers and data for all responses preceding us.
ResponseHandler head;
- while ((head = (ResponseHandler)RespHandlerList.getFirst()) != null && head
!= resph)
+ while ((head = (ResponseHandler)RespHandlerList.getFirst()) != null && head
!= resph) //NOSONAR
{
try
{
@@ -553,10 +553,14 @@
RespHandlerList.remove(resph);
}
- if (resph == MarkedForClose)
+ if (resph == MarkedForClose) //NOSONAR
+ {
close(new IOException("Premature end of Keep-Alive"), false);
+ }
else
+ {
closeSocketIfAllStreamsClosed();
+ }
}
/**
@@ -587,7 +591,7 @@
while (resph != null && resph.stream.closed)
{
- if (resph == MarkedForClose)
+ if (resph == MarkedForClose) //NOSONAR
{
// remove all response handlers first
ResponseHandler tmp;
@@ -596,7 +600,7 @@
tmp = (ResponseHandler)RespHandlerList.getFirst();
RespHandlerList.remove(tmp);
}
- while (tmp != resph);
+ while (tmp != resph); //NOSONAR
// close the socket
close(new IOException("Premature end of Keep-Alive"), false);
@@ -658,7 +662,7 @@
return;
}
- if (MarkedForClose == resph)
+ if (MarkedForClose == resph) //NOSONAR
return; // already marked for closing after an earlier resp
lasth = resph;
Modified:
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/util/HierarchicalProperty.java
===================================================================
---
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/util/HierarchicalProperty.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/util/HierarchicalProperty.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -240,9 +240,14 @@
private String makeStringFromQName(QName qname)
{
- String str = "";
+ StringBuffer str = new StringBuffer();
+
if (qname.getPrefix() != null && qname.getPrefix().length() > 0)
- str += qname.getPrefix() + ":";
- return str + qname.getLocalPart();
+ {
+ str.append(qname.getPrefix());
+ str.append(":");
+ }
+
+ return str.append(qname.getLocalPart()).toString();
}
}
Modified:
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonWriterImpl.java
===================================================================
---
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonWriterImpl.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/JsonWriterImpl.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
import java.io.Writer;
/**
@@ -34,252 +33,6 @@
public class JsonWriterImpl implements JsonWriter
{
-// /**
-// * Stack for control position in document.
-// */
-// private final Stack<JsonToken> jsonTokens = new Stack<JsonToken>();
-//
-// /**
-// * Writer.
-// */
-// private final Writer writer;
-//
-// /**
-// * Indicate is current value is the first, if not before value must be written
-// * comma.
-// */
-// private boolean commaFirst = false;
-//
-// /**
-// * Constructs JsonWriter.
-// *
-// * @param writer Writer.
-// */
-// public JsonWriterImpl(Writer writer)
-// {
-// this.writer = writer;
-// }
-//
-// /**
-// * Constructs JsonWriter.
-// *
-// * @param out OutputStream.
-// * @throws UnsupportedEncodingException
-// */
-// public JsonWriterImpl(OutputStream out)
-// {
-// this(new OutputStreamWriter(out, JsonUtils.DEFAULT_CHARSET));
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeStartObject() throws JsonException
-// {
-// if (!jsonTokens.isEmpty())
-// {
-// // Object can be stated after key with followed ':' or as array item.
-// if (jsonTokens.peek() != JsonToken.key && jsonTokens.peek() !=
JsonToken.array)
-// throw new JsonException("Syntax error. Unexpected element
'{'.");
-// }
-// try
-// {
-// if (commaFirst) // needed ',' before
-// writer.write(',');
-// writer.write('{');
-// // if at the top of stack is 'key' then remove it.
-// if (!jsonTokens.isEmpty() && jsonTokens.peek() == JsonToken.key)
-// jsonTokens.pop();
-// jsonTokens.push(JsonToken.object); // remember new object opened
-// commaFirst = false;
-// }
-// catch (IOException e)
-// {
-// throw new JsonException(e);
-// }
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeEndObject() throws JsonException
-// {
-// try
-// {
-// if (jsonTokens.pop() != JsonToken.object) // wrong JSON structure.
-// throw new JsonException("Sysntax error. Unexpected element
'}'.");
-// writer.write('}');
-// commaFirst = true;
-// }
-// catch (IOException e)
-// {
-// throw new JsonException(e);
-// }
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeStartArray() throws JsonException
-// {
-// if (jsonTokens.isEmpty() || (jsonTokens.peek() != JsonToken.key &&
jsonTokens.peek() != JsonToken.array))
-// throw new JsonException("Sysntax error. Unexpected element
'['..");
-// try
-// {
-// if (commaFirst) // needed ',' before
-// writer.write(',');
-// writer.write('[');
-// if (jsonTokens.peek() == JsonToken.key)
-// // if at the top of stack is 'key' then remove it.
-// jsonTokens.pop();
-// jsonTokens.push(JsonToken.array); // remember new array opened
-// commaFirst = false;
-// }
-// catch (IOException e)
-// {
-// throw new JsonException(e);
-// }
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeEndArray() throws JsonException
-// {
-// try
-// {
-// if (jsonTokens.pop() != JsonToken.array) // wrong JSON structure
-// throw new JsonException("Sysntax error. Unexpected element
']'.");
-// writer.write(']');
-// commaFirst = true;
-// }
-// catch (IOException e)
-// {
-// throw new JsonException(e);
-// }
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeKey(String key) throws JsonException
-// {
-// if (key == null)
-// throw new JsonException("Key is null.");
-// if (jsonTokens.isEmpty() || jsonTokens.peek() != JsonToken.object)
-// throw new JsonException("Sysntax error. Unexpected characters '"
+ key + "'." + jsonTokens);
-// try
-// {
-// if (commaFirst)
-// writer.write(',');
-// // create JSON representation for given string.
-// writer.write(JsonUtils.getJsonString(key));
-// writer.write(':');
-// commaFirst = false;
-// jsonTokens.push(JsonToken.key);
-// }
-// catch (IOException e)
-// {
-// throw new JsonException(e);
-// }
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeString(String value) throws JsonException
-// {
-// write(JsonUtils.getJsonString(value));
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeValue(long value) throws JsonException
-// {
-// write(Long.toString(value));
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeValue(double value) throws JsonException
-// {
-// write(Double.toString(value));
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeValue(boolean value) throws JsonException
-// {
-// write(Boolean.toString(value));
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void writeNull() throws JsonException
-// {
-// write("null");
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void flush() throws JsonException
-// {
-// try
-// {
-// writer.flush();
-// }
-// catch (IOException e)
-// {
-// new JsonException(e);
-// }
-// }
-//
-// /**
-// * {@inheritDoc}
-// */
-// public void close() throws JsonException
-// {
-// try
-// {
-// writer.close();
-// }
-// catch (IOException e)
-// {
-// new JsonException(e);
-// }
-// }
-//
-// /**
-// * Write single String.
-// *
-// * @param value String.
-// * @throws JsonException if any errors occurs.
-// */
-// private void write(String value) throws JsonException
-// {
-// try
-// {
-// if (jsonTokens.isEmpty() || (jsonTokens.peek() != JsonToken.key &&
jsonTokens.peek() != JsonToken.array))
-// throw new JsonException("Sysntax error. Unexpected characters
'" + value + "'.");
-// if (commaFirst)
-// writer.write(',');
-// writer.write(value);
-// commaFirst = true;
-// if (jsonTokens.peek() == JsonToken.key)
-// jsonTokens.pop();
-// }
-// catch (IOException e)
-// {
-// throw new JsonException(e);
-// }
-// }
-
-
/** Stack for control position in document. */
private final JsonStack<JsonToken> stack;
@@ -305,7 +58,6 @@
* Constructs JsonWriter.
*
* @param out OutputStream.
- * @throws UnsupportedEncodingException
*/
public JsonWriterImpl(OutputStream out)
{
Modified:
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/ObjectBuilder.java
===================================================================
---
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/ObjectBuilder.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.frameworks.json/src/main/java/org/exoplatform/ws/frameworks/json/impl/ObjectBuilder.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -481,7 +481,6 @@
case DOUBLE :
return jsonValue.getDoubleValue();
case CHAR :
- // TODO check String length
return jsonValue.getStringValue().charAt(0);
case STRING :
return jsonValue.getStringValue();
@@ -568,7 +567,6 @@
char[] params = new char[jsonValue.size()];
Iterator<JsonValue> values = jsonValue.getElements();
int i = 0;
- // TODO better checking an transformation string to char
while (values.hasNext())
{
params[i++] = values.next().getStringValue().charAt(0);
Modified:
ws/trunk/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AliasedURLRequestRedirector.java
===================================================================
---
ws/trunk/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AliasedURLRequestRedirector.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/AliasedURLRequestRedirector.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -41,7 +41,6 @@
public class AliasedURLRequestRedirector implements Filter
{
- //TODO
private static String START_ESCAPED = "%7B$";
private static String END_ESCAPED = "%7D";
@@ -169,7 +168,6 @@
* @param path
* @return
*/
- //TODO
private String replaceByMap(String path)
{
if (path == null)
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -41,8 +41,8 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.Variant;
-import javax.ws.rs.core.Response.ResponseBuilder;
/**
* @author <a href="mailto:andrew00x@gmail.com">Andrey
Parfonov</a>
@@ -355,8 +355,9 @@
public Variant selectVariant(List<Variant> variants)
{
if (variants == null || variants.isEmpty())
+ {
throw new IllegalArgumentException("The list of variants is null or
empty");
- // TODO constructs and set 'Vary' header in response
+ }
// Response will be set in RequestDispatcher if set Response
// now then it will be any way rewrite in RequestDispatcher.
return VariantsHandler.handleVariants(this, variants);
@@ -432,9 +433,10 @@
*/
public Locale getLanguage()
{
- // TODO Not efficient implementation, header map can be checked few times
if (contentLanguage == null && httpHeaders.getFirst(CONTENT_LANGUAGE) !=
null)
+ {
contentLanguage = Language.getLocale(httpHeaders.getFirst(CONTENT_LANGUAGE));
+ }
return contentLanguage;
}
@@ -444,9 +446,10 @@
*/
public MediaType getMediaType()
{
- // TODO Not efficient implementation, if header map can be checked few times
if (contentType == null && httpHeaders.getFirst(CONTENT_TYPE) != null)
+ {
contentType = MediaType.valueOf(httpHeaders.getFirst(CONTENT_TYPE));
+ }
return contentType;
}
@@ -488,10 +491,11 @@
EntityTag otherEtag = EntityTag.valueOf(ifMatch);
- // TODO check is status 412 valid if one of tag is weak
if ((etag.isWeak() || otherEtag.isWeak()) // one of tag is weak
|| (!"*".equals(otherEtag.getValue()) &&
!etag.getValue().equals(otherEtag.getValue())))
+ {
return Response.status(Response.Status.PRECONDITION_FAILED);
+ }
// if tags are not matched then do as tag 'if-match' is absent
return null;
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/DependencySupplier.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/DependencySupplier.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/DependencySupplier.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -134,8 +134,10 @@
if (parameterActualTypes[0] instanceof Class<?>)
{
Class<?> actualType =
(Class<?>)parameterActualTypes[0];
- if (actualType == injectedType)
+ if (actualType == injectedType) //NOSONAR
+ {
return provider;
+ }
}
else if (parameterActualTypes[0] instanceof ParameterizedType)
{
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/FieldInjectorImpl.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -280,7 +280,6 @@
{
throw new WebApplicationException(e,
Response.status(Response.Status.INTERNAL_SERVER_ERROR).build());
}
- // TODO Need to throw exception ?????
}
}
}
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/InputHeadersMap.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -36,8 +36,6 @@
* @author <a href="mailto:andrew00x@gmail.com">Andrey
Parfonov</a>
* @version $Id: $
*/
-// TODO this implementation is not efficient, probably can be better extend
-// java.util.AbstractMap
public final class InputHeadersMap extends HashMap<String, List<String>>
implements MultivaluedMap<String, String>
{
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/OutputHeadersMap.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/OutputHeadersMap.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/OutputHeadersMap.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -31,8 +31,6 @@
* @author <a href="mailto:andrew00x@gmail.com">Andrey
Parfonov</a>
* @version $Id: $
*/
-//TODO this implementation is not efficient, probably can be better extend
-//java.util.AbstractMap
public final class OutputHeadersMap extends HashMap<String, List<Object>>
implements MultivaluedMap<String, Object>
{
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ResourceBinder.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ResourceBinder.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ResourceBinder.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -210,7 +210,6 @@
this.invokerFactory = invokerFactory;
// Initialize RuntimeDelegate instance
// This is first component in life cycle what needs.
- // TODO better solution to initialize RuntimeDelegate
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
{
public Void run()
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RuntimeDelegateImpl.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RuntimeDelegateImpl.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RuntimeDelegateImpl.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -45,8 +45,8 @@
import javax.ws.rs.core.EntityTag;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.NewCookie;
-import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.Variant.VariantListBuilder;
import javax.ws.rs.ext.RuntimeDelegate;
@@ -102,7 +102,6 @@
@Override
public <T> HeaderDelegate<T> createHeaderDelegate(Class<T> type)
{
- // TODO mechanism for use external HeaderDelegate
return (HeaderDelegate<T>)headerDelegates.get(type);
}
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/method/ParameterHelper.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/method/ParameterHelper.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/method/ParameterHelper.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -214,7 +214,6 @@
* @param annotation parameter annotation
* @return true it parameter is valid, false otherwise
*/
- // TODO remove this method
boolean isValidAnnotatedParameter(Class<?> parameterClass, Type parameterType,
Annotation annotation)
{
if (parameterClass == List.class || parameterClass == Set.class || parameterClass
== SortedSet.class)
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/JsonEntityProvider.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/JsonEntityProvider.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/JsonEntityProvider.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -24,9 +24,9 @@
import org.exoplatform.ws.frameworks.json.impl.JsonGeneratorImpl;
import org.exoplatform.ws.frameworks.json.impl.JsonParserImpl;
import org.exoplatform.ws.frameworks.json.impl.JsonUtils;
+import org.exoplatform.ws.frameworks.json.impl.JsonUtils.Types;
import org.exoplatform.ws.frameworks.json.impl.JsonWriterImpl;
import org.exoplatform.ws.frameworks.json.impl.ObjectBuilder;
-import org.exoplatform.ws.frameworks.json.impl.JsonUtils.Types;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
import java.io.File;
@@ -63,7 +63,7 @@
{
// It is common task for #isReadable() and #isWriteable
- // TODO Not sure it is required but ...
+ // Not sure it is required but ...
// Investigation about checking can type be write as JSON (useful JSON).
// Probably should be better added this checking in JSON framework.
// Or probably enough check only content type 'application/json'
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/AbstractResourceDescriptorImpl.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -528,7 +528,6 @@
o.add(new OptionsRequestResourceMethodDescriptorImpl(null, "OPTIONS",
mps, this, consumes, produces,
new OptionsRequestMethodInvoker()));
}
- // TODO need process sub-resources ?
}
/**
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/ResourceDescriptorValidator.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/ResourceDescriptorValidator.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/resource/ResourceDescriptorValidator.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -309,8 +309,6 @@
}
}
// not parameterized type
- // TODO must be tolerant for not parameterized type and use string as
- // default ?
return false;
}
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/uri/UriComponent.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/uri/UriComponent.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/uri/UriComponent.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -181,7 +181,6 @@
* @param component component of URI, scheme, host, port, etc
* @return encoded string
*/
- // TODO encoding for IPv6
public static String encode(String str, int component, boolean containsUriParams)
{
if (str == null)
@@ -197,7 +196,6 @@
* @param containsUriParams true if the source string contains URI parameters
* @return the source string
*/
- // TODO validation for IPv6
public static String validate(String str, int component, boolean containsUriParams)
{
for (int i = 0; i < str.length(); i++)
@@ -315,7 +313,6 @@
* addresses
* @return decoded string
*/
- // TODO decoding for IPv6
public static String decode(String str, int component)
{
if (str == null)
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/uri/UriTemplateParser.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/uri/UriTemplateParser.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/uri/UriTemplateParser.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -243,13 +243,13 @@
else
throw new IllegalArgumentException("Wrong character at part " +
str);
}
+
name = sb.toString();
- // TODO remove restriction that not allowed have few path parameters with
- // the same name. This should be allowed but part of URI template also MUST
- // be the same. E.g. /a/{x}/b/{x} and /a/{x:\d+}/b/{x:\d+} must be allowed,
- // but /a/{x}/b/{x:\d+} is not allowed. This task is not high priority.
if (names.contains(name))
+ {
throw new IllegalArgumentException("URI template variables name " +
name + " already registered.");
+ }
+
names.add(name);
return p;
}
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/util/MediaTypeMap.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/util/MediaTypeMap.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/util/MediaTypeMap.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -70,8 +70,10 @@
// should e compared lexicographically, otherwise new entry with the
// same 'weight' will be not added in map.
if (r == 0)
- // TODO weak solution
+ {
r = _toString(o1).compareToIgnoreCase(_toString(o2));
+ }
+
return r;
}
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/wadl/BaseWadlGeneratorImpl.java
===================================================================
---
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/wadl/BaseWadlGeneratorImpl.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/wadl/BaseWadlGeneratorImpl.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -93,7 +93,7 @@
public org.exoplatform.services.rest.wadl.research.Method
createMethod(ResourceMethodDescriptor rmd)
{
String httpMethod = rmd.getHttpMethod();
- // TODO Ignore HEAD methods currently.
+ // Ignore HEAD methods currently.
// Implementation of wadl2java for generation client code does not support
// HEAD method. See
https://wadl.dev.java.net/ .
// If WADL contains HEAD method description then client code get part of
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -51,7 +51,6 @@
public final ConcurrentMap<String, Future<URL>> findResourceURLTasks = new
ConcurrentHashMap<String, Future<URL>>();
- // TODO need configurable ?
private int maxEntries = 512;
protected final Map<String, URL> resources;
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ExtendedGroovyClassLoader.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ExtendedGroovyClassLoader.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ExtendedGroovyClassLoader.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -81,13 +81,17 @@
ClassNode targetClassNode = null;
SourceUnit targetSunit = null;
ModuleNode module = classNode.getModule();
+
if (module != null)
{
targetClassNode = (ClassNode)module.getClasses().get(0);
targetSunit = module.getContext();
}
- if (targetSunit == sunit && targetClassNode == classNode)
+
+ if (targetSunit == sunit && targetClassNode == classNode) //NOSONAR
+ {
target = clazz;
+ }
}
return clazz;
}
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyJaxrsPublisher.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyJaxrsPublisher.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyJaxrsPublisher.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -540,8 +540,7 @@
new
AbstractResourceDescriptorImpl(rc).accept(ResourceDescriptorValidator.getInstance());
}
catch (RuntimeException e)
- {
- // TODO : Need have proper exception for invalid resources in
'exo.ws.rest.core'.
+ {
throw new MalformedScriptException(e.getMessage());
}*/
}
Modified:
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
===================================================================
---
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -237,7 +237,7 @@
*/
public String encodeRedirectURL(String url)
{
- return url; // TODO encode
+ return url;
}
/**
@@ -245,7 +245,7 @@
*/
public String encodeRedirectUrl(String url)
{
- return url;// TODO encode
+ return url;
}
/**
@@ -253,7 +253,7 @@
*/
public String encodeURL(String url)
{
- return url;// TODO encode
+ return url;
}
/**
@@ -261,7 +261,7 @@
*/
public String encodeUrl(String url)
{
- return url;// TODO encode
+ return url;
}
/**
Modified:
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpSession.java
===================================================================
---
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpSession.java 2011-12-23
07:46:46 UTC (rev 5344)
+++
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpSession.java 2011-12-23
13:18:15 UTC (rev 5345)
@@ -27,7 +27,6 @@
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
-// TODO: Auto-generated Javadoc
/**
* The Class MockHttpSession.
*