Merge branch 'master' into feature/RM-3227-AttemptTwo

This commit is contained in:
Kristijan Conkas
2016-07-08 09:16:11 +01:00
2 changed files with 52 additions and 0 deletions

26
pom.xml
View File

@@ -175,6 +175,32 @@
</includes> </includes>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
<pluginManagement> <pluginManagement>
<plugins> <plugins>

View File

@@ -400,4 +400,30 @@ public final class WebScriptUtils
final int status = e.getStatus(); final int status = e.getStatus();
return status >= lowerLimitInclusive && status < upperLimitExclusive; return status >= lowerLimitInclusive && status < upperLimitExclusive;
} }
/**
* Gets the {@link JSONObject} value of a given key from a json object
*
* @param jsonObject The json object
* @param key The key
* @return The {@link JSONObject} value of the given key from the json object
*/
public static JSONObject getValueFromJSONObject(JSONObject jsonObject, String key)
{
mandatory("jsonObject", jsonObject);
mandatoryString("key", key);
JSONObject value = null;
try
{
value = jsonObject.getJSONObject(key);
}
catch (JSONException error)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the key '" + key + "'.", error);
}
return value;
}
} }