Updated commons-lang to version 3

This commit is contained in:
Patrick Gotthard 2014-04-12 14:40:31 +02:00
parent 5ab23e22d0
commit 05dd80dd82
3 changed files with 51 additions and 38 deletions

View file

@ -69,8 +69,8 @@
<artifactId>commons-httpclient</artifactId> <artifactId>commons-httpclient</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-beanutils</groupId> <groupId>commons-beanutils</groupId>

View file

@ -21,7 +21,7 @@ import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.rometools.propono.atom.common.AtomService; import org.rometools.propono.atom.common.AtomService;
@ -36,7 +36,9 @@ import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed; import com.sun.syndication.feed.atom.Feed;
/** /**
* File-based {@link com.sun.syndication.propono.atom.server.AtomHandler} implementation that stores entries and media-entries to disk. Implemented using * File-based {@link com.sun.syndication.propono.atom.server.AtomHandler}
* implementation that stores entries and media-entries to disk. Implemented
* using
* {@link com.sun.syndication.propono.atom.server.impl.FileBasedAtomService}. * {@link com.sun.syndication.propono.atom.server.impl.FileBasedAtomService}.
*/ */
public class FileBasedAtomHandler implements AtomHandler { public class FileBasedAtomHandler implements AtomHandler {
@ -84,8 +86,9 @@ public class FileBasedAtomHandler implements AtomHandler {
} }
/** /**
* Method used for validating user. Developers can overwrite this method and use credentials stored in Database or LDAP to confirm if the user is allowed to * Method used for validating user. Developers can overwrite this method and
* access this service. * use credentials stored in Database or LDAP to confirm if the user is
* allowed to access this service.
* *
* @param login user submitted login id * @param login user submitted login id
* @param password user submitted password * @param password user submitted password
@ -121,7 +124,8 @@ public class FileBasedAtomHandler implements AtomHandler {
/** /**
* Return introspection document * Return introspection document
* *
* @throws com.sun.syndication.propono.atom.server.AtomException Unexpected exception. * @throws com.sun.syndication.propono.atom.server.AtomException Unexpected
* exception.
* @return AtomService object with workspaces and collections. * @return AtomService object with workspaces and collections.
*/ */
@Override @Override
@ -132,7 +136,8 @@ public class FileBasedAtomHandler implements AtomHandler {
/** /**
* Returns null because we use in-line categories. * Returns null because we use in-line categories.
* *
* @throws com.sun.syndication.propono.atom.server.AtomException Unexpected exception. * @throws com.sun.syndication.propono.atom.server.AtomException Unexpected
* exception.
* @return Categories object * @return Categories object
*/ */
@Override @Override
@ -150,7 +155,8 @@ public class FileBasedAtomHandler implements AtomHandler {
* *
* @param areq Details of HTTP request * @param areq Details of HTTP request
* @return ROME feed representing collection. * @return ROME feed representing collection.
* @throws com.sun.syndication.propono.atom.server.AtomException Invalid collection or other exception. * @throws com.sun.syndication.propono.atom.server.AtomException Invalid
* collection or other exception.
*/ */
@Override @Override
public Feed getCollection(final AtomRequest areq) throws AtomException { public Feed getCollection(final AtomRequest areq) throws AtomException {
@ -163,11 +169,14 @@ public class FileBasedAtomHandler implements AtomHandler {
} }
/** /**
* Create a new entry specified by pathInfo and posted entry. We save the submitted Atom entry verbatim, but we do set the id and reset the update time. * Create a new entry specified by pathInfo and posted entry. We save the
* submitted Atom entry verbatim, but we do set the id and reset the update
* time.
* *
* @param entry Entry to be added to collection. * @param entry Entry to be added to collection.
* @param areq Details of HTTP request * @param areq Details of HTTP request
* @throws com.sun.syndication.propono.atom.server.AtomException On invalid collection or other error. * @throws com.sun.syndication.propono.atom.server.AtomException On invalid
* collection or other error.
* @return Entry as represented on server. * @return Entry as represented on server.
*/ */
@Override @Override
@ -191,7 +200,8 @@ public class FileBasedAtomHandler implements AtomHandler {
* Get entry specified by pathInfo. * Get entry specified by pathInfo.
* *
* @param areq Details of HTTP request * @param areq Details of HTTP request
* @throws com.sun.syndication.propono.atom.server.AtomException On invalid pathinfo or other error. * @throws com.sun.syndication.propono.atom.server.AtomException On invalid
* pathinfo or other error.
* @return ROME Entry object. * @return ROME Entry object.
*/ */
@Override @Override
@ -260,8 +270,9 @@ public class FileBasedAtomHandler implements AtomHandler {
} }
/** /**
* Store media data in collection specified by pathInfo, create an Atom media-link entry to store metadata for the new media file and return that entry to * Store media data in collection specified by pathInfo, create an Atom
* the caller. * media-link entry to store metadata for the new media file and return that
* entry to the caller.
* *
* @param areq Details of HTTP request * @param areq Details of HTTP request
* @param entry New entry initialzied with only title and content type * @param entry New entry initialzied with only title and content type
@ -306,7 +317,8 @@ public class FileBasedAtomHandler implements AtomHandler {
/** /**
* Update the media file part of a media-link entry. * Update the media file part of a media-link entry.
* *
* @param areq Details of HTTP request Assuming pathInfo of form /user-name/resource/name * @param areq Details of HTTP request Assuming pathInfo of form
* /user-name/resource/name
*/ */
@Override @Override
public void putMedia(final AtomRequest areq) throws AtomException { public void putMedia(final AtomRequest areq) throws AtomException {
@ -412,13 +424,14 @@ public class FileBasedAtomHandler implements AtomHandler {
public boolean isMediaEditURI(final AtomRequest areq) { public boolean isMediaEditURI(final AtomRequest areq) {
log.debug("isMediaEditURI"); log.debug("isMediaEditURI");
// workspace/collection-singular/fsid/media/fsid // workspace/collection-singular/fsid/media/fsid
// if length is 4, points to a valid collection and fsid is mentioned twice then YES // if length is 4, points to a valid collection and fsid is mentioned
// twice then YES
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
if (pathInfo.length == 4) { if (pathInfo.length == 4) {
final String handle = pathInfo[0]; final String handle = pathInfo[0];
final String collection = pathInfo[1]; final String collection = pathInfo[1];
final String media = pathInfo[2]; final String media = pathInfo[2];
final String fsid = pathInfo[3]; // final String fsid = pathInfo[3];
if (service.findCollectionByHandle(handle, collection) != null && media.equals("media")) { if (service.findCollectionByHandle(handle, collection) != null && media.equals("media")) {
return true; return true;
} }

View file

@ -25,7 +25,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;