[ 
https://jira.duraspace.org/browse/DS-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kim Shepherd updated DS-598:
----------------------------

    Fix Version/s:     (was: 1.7.1)
                   1.8.0

> SWORD will only accept deposits on the URL configured in dspace.cfg
> -------------------------------------------------------------------
>
>                 Key: DS-598
>                 URL: https://jira.duraspace.org/browse/DS-598
>             Project: DSpace
>          Issue Type: Bug
>          Components: DSpace API
>            Reporter: Graham Triggs
>            Assignee: Richard Rodgers
>            Priority: Major
>             Fix For: 1.8.0
>
>
> SWORDURLManager.getDSpaceObject() calls getBaseDepositUrl() to get the base 
> url to strip from the deposit location, in order to retrieve the handle.
> If the deposit is attempted on any url that is not either exactly as 
> configured, or exactly the same length as the url generated from the 
> dspace.url configuration, then the SWORD service will throw an exception 
> saying "The deposit URL does not resolve to a valid deposit target" (as the 
> retrieved handle will not actually be a valid handle).
> Alternate version of method:
>       public DSpaceObject getDSpaceObject(Context context, String location)
>               throws DSpaceSWORDException, SWORDErrorException
>       {
>               try
>               {
>                       URL baseUrl    = new URL(this.getBaseDepositUrl());
>                       URL depositUrl = new URL(location);
>                       
>                       String basePath    = baseUrl.getPath();
>                       String depositPath = depositUrl.getPath();
>                       
>                       if (basePath.length() == depositPath.length())
>                       {
>                               throw new 
> SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The deposit URL is 
> incomplete");
>                       }
>                       String handle = 
> depositPath.substring(basePath.length());
>                       if (handle.startsWith("/"))
>                       {
>                               handle = handle.substring(1);
>                       }
>                       if ("".equals(handle))
>                       {
>                               throw new 
> SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The deposit URL is 
> incomplete");
>                       }
>                       DSpaceObject dso = 
> HandleManager.resolveToObject(context, handle);
>                       if (!(dso instanceof Collection) && !(dso instanceof 
> Item))
>                       {
>                               throw new 
> SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The deposit URL does not 
> resolve to a valid deposit target");
>                       }
>                       return dso;
>               }
>               catch (SQLException e)
>               {
>                       // log.error("Caught exception:", e);
>                       throw new DSpaceSWORDException("There was a problem 
> resolving the collection", e);
>               } catch (MalformedURLException e) {
>                       throw new 
> SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The deposit URL is 
> incomplete");
>               }
>       }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.duraspace.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and publish 
your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to