diff --git a/dspace-api/src/main/java/org/dspace/license/CreativeCommons.java b/dspace-api/src/main/java/org/dspace/license/CreativeCommons.java index de651ade21..7a60671826 100644 --- a/dspace-api/src/main/java/org/dspace/license/CreativeCommons.java +++ b/dspace-api/src/main/java/org/dspace/license/CreativeCommons.java @@ -129,6 +129,7 @@ public class CreativeCommons String cc_license_url) throws SQLException, IOException, AuthorizeException { + boolean hasCCnamespace = true; Bundle bundle = getCcBundle(item); // get some more information @@ -137,20 +138,46 @@ public class CreativeCommons // here we need to transform the license_rdf into a document_rdf // first we find the beginning of "") + 10; - String document_rdf = "\n" - + "\n" - + "\n" - + "\n\n" - + license_rdf.substring(license_start, license_end) - + "\n\n"; + int license_end; + String document_rdf; + + if (hasCCnamespace) + { + // the 13 is the length of the license closing tag. + license_end = license_rdf.indexOf("") + 13; + document_rdf = "\n" + + "\n" + + "\n" + + "\n\n" + + license_rdf.substring(license_start, license_end) + + "\n\n"; + } + else + { + // the 10 is the length of the license closing tag. + license_end = license_rdf.indexOf("") + 10; + document_rdf = "\n" + + "\n" + + "\n" + + "\n\n" + + license_rdf.substring(license_start, license_end) + + "\n\n"; + } // set the format BitstreamFormat bs_format = BitstreamFormat.findByShortDescription( @@ -187,7 +214,7 @@ public class CreativeCommons BSN_LICENSE_RDF : BSN_LICENSE_TEXT); bs.setFormat(bs_format); bs.update(); - } + } public static void removeLicense(Context context, Item item) throws SQLException, IOException, AuthorizeException