[DS-707] Correctness

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5633 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-25 12:57:45 +00:00
parent c64399459f
commit 5fa0e9deae
23 changed files with 110 additions and 93 deletions

View File

@@ -528,25 +528,26 @@ public class X509Authentication implements AuthenticationMethod
if (authenticated) if (authenticated)
{ {
List<String> groupNames = new ArrayList<String>(); List<String> groupNames = getX509Groups();
List<Integer> groupIDs = new ArrayList<Integer>(); List<Integer> groupIDs = new ArrayList<Integer>();
groupNames = getX509Groups(); if (groupNames != null)
for (String groupName : groupNames)
{ {
if (groupName != null) for (String groupName : groupNames)
{ {
Group group = Group.findByName(context, groupName); if (groupName != null)
if (group != null)
{ {
groupIDs.add(Integer.valueOf(group.getID())); Group group = Group.findByName(context, groupName);
} if (group != null)
else {
{ groupIDs.add(Integer.valueOf(group.getID()));
log.warn(LogManager.getHeader(context, }
"configuration_error", "unknown_group=" else
+ groupName)); {
log.warn(LogManager.getHeader(context,
"configuration_error", "unknown_group="
+ groupName));
}
} }
} }
} }

View File

@@ -204,6 +204,7 @@ public class DSIndexer
{ {
case 3: case 3:
indexConfigArr[i].qualifier = parts[2]; indexConfigArr[i].qualifier = parts[2];
// Fall through for other parts of the array
case 2: case 2:
indexConfigArr[i].schema = parts[0]; indexConfigArr[i].schema = parts[0];
indexConfigArr[i].element = parts[1]; indexConfigArr[i].element = parts[1];

View File

@@ -78,11 +78,11 @@ public class UsageEvent extends Event {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private HttpServletRequest request; private transient HttpServletRequest request;
private Context context; private transient Context context;
private DSpaceObject object; private transient DSpaceObject object;
private Action action; private Action action;

View File

@@ -1018,9 +1018,6 @@ public class WorkflowManager
private static void recordStart(Context c, Item myitem) private static void recordStart(Context c, Item myitem)
throws SQLException, IOException, AuthorizeException throws SQLException, IOException, AuthorizeException
{ {
// Get non-internal format bitstreams
Bitstream[] bitstreams = myitem.getNonInternalBitstreams();
// get date // get date
DCDate now = DCDate.getCurrent(); DCDate now = DCDate.getCurrent();

View File

@@ -804,7 +804,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
} catch (Exception e) { } catch (Exception e) {
// this will never happen, but compiler is now // this will never happen, but compiler is now
// happy. // happy.
// log.error(e.getMessage(), e); log.trace(e.getMessage(), e);
} }
} }
} }

View File

@@ -84,7 +84,7 @@ public class BrowseListTag extends TagSupport
private static Logger log = Logger.getLogger(BrowseListTag.class); private static Logger log = Logger.getLogger(BrowseListTag.class);
/** Items to display */ /** Items to display */
private BrowseItem[] items; private transient BrowseItem[] items;
/** Row to highlight, -1 for no row */ /** Row to highlight, -1 for no row */
private int highlightRow = -1; private int highlightRow = -1;
@@ -125,7 +125,9 @@ public class BrowseListTag extends TagSupport
private static int authorLimit = -1; private static int authorLimit = -1;
private BrowseInfo browseInfo; private transient BrowseInfo browseInfo;
private static final long serialVersionUID = 8091584920304256107L;
public BrowseListTag() public BrowseListTag()
{ {

View File

@@ -59,7 +59,9 @@ import org.dspace.content.Collection;
public class CollectionListTag extends TagSupport public class CollectionListTag extends TagSupport
{ {
/** Collections to display */ /** Collections to display */
private Collection[] collections; private transient Collection[] collections;
private static final long serialVersionUID = -9040013543196580904L;
public CollectionListTag() public CollectionListTag()
{ {

View File

@@ -60,7 +60,9 @@ import org.dspace.content.Community;
public class CommunityListTag extends TagSupport public class CommunityListTag extends TagSupport
{ {
/** Communities to display */ /** Communities to display */
private Community[] communities; private transient Community[] communities;
private static final long serialVersionUID = 5788338729470292501L;
public CommunityListTag() public CommunityListTag()
{ {

View File

@@ -58,11 +58,13 @@ import org.dspace.content.DCDate;
public class DateTag extends TagSupport public class DateTag extends TagSupport
{ {
/** The date to display */ /** The date to display */
private DCDate date; private transient DCDate date;
/** Display the time? */ /** Display the time? */
private boolean displayTime = true; private boolean displayTime = true;
private static final long serialVersionUID = 6665825578727713535L;
/** /**
* Get the date * Get the date
* *

View File

@@ -93,7 +93,7 @@ public class ItemListTag extends TagSupport
private static Logger log = Logger.getLogger(ItemListTag.class); private static Logger log = Logger.getLogger(ItemListTag.class);
/** Items to display */ /** Items to display */
private Item[] items; private transient Item[] items;
/** Row to highlight, -1 for no row */ /** Row to highlight, -1 for no row */
private int highlightRow = -1; private int highlightRow = -1;
@@ -134,7 +134,9 @@ public class ItemListTag extends TagSupport
private static int authorLimit = -1; private static int authorLimit = -1;
private SortOption sortOption = null; private transient SortOption sortOption = null;
private static final long serialVersionUID = 348762897199116432L;
public ItemListTag() public ItemListTag()
{ {

View File

@@ -69,7 +69,9 @@ import javax.servlet.jsp.tagext.TagSupport;
public class ItemPreviewTag extends TagSupport public class ItemPreviewTag extends TagSupport
{ {
/** Item to display */ /** Item to display */
private Item item; private transient Item item;
private static final long serialVersionUID = -5535762797556685631L;
public ItemPreviewTag() public ItemPreviewTag()
{ {

View File

@@ -213,10 +213,10 @@ public class ItemTag extends TagSupport
private static final String DOI_DEFAULT_BASEURL = "http://dx.doi.org/"; private static final String DOI_DEFAULT_BASEURL = "http://dx.doi.org/";
/** Item to display */ /** Item to display */
private Item item; private transient Item item;
/** Collections this item appears in */ /** Collections this item appears in */
private Collection[] collections; private transient Collection[] collections;
/** The style to use - "default" or "full" */ /** The style to use - "default" or "full" */
private String style; private String style;
@@ -240,6 +240,8 @@ public class ItemTag extends TagSupport
/** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */ /** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */
private Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)"); private Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)");
private static final long serialVersionUID = -3841266490729417240L;
public ItemTag() public ItemTag()
{ {

View File

@@ -62,12 +62,14 @@ public class SFXLinkTag extends TagSupport
{ {
/** Item to display SFX link for */ /** Item to display SFX link for */
private Item item; private transient Item item;
/** The fully qualified pathname of the SFX XML file */ /** The fully qualified pathname of the SFX XML file */
private String sfxFile = ConfigurationManager.getProperty("dspace.dir") + File.separator private String sfxFile = ConfigurationManager.getProperty("dspace.dir") + File.separator
+ "config" + File.separator + "sfx.xml"; + "config" + File.separator + "sfx.xml";
private static final long serialVersionUID = 7028793612957710128L;
public SFXLinkTag() public SFXLinkTag()
{ {
super(); super();

View File

@@ -79,7 +79,9 @@ public class SelectEPersonTag extends TagSupport
private boolean multiple; private boolean multiple;
/** Which eperson/epeople are initially in the list? */ /** Which eperson/epeople are initially in the list? */
private EPerson[] epeople; private transient EPerson[] epeople;
private static final long serialVersionUID = -7323789442034590853L;
public SelectEPersonTag() public SelectEPersonTag()
{ {

View File

@@ -75,7 +75,9 @@ public class SelectGroupTag extends TagSupport
private boolean multiple; private boolean multiple;
/** Which groups are initially in the list? */ /** Which groups are initially in the list? */
private Group[] groups; private transient Group[] groups;
private static final long serialVersionUID = -3330389128849427302L;
public SelectGroupTag() public SelectGroupTag()

View File

@@ -107,7 +107,6 @@ public class SimpleSearchServlet extends DSpaceServlet
String order = request.getParameter("order"); String order = request.getParameter("order");
int rpp = UIUtil.getIntParameter(request, "rpp"); int rpp = UIUtil.getIntParameter(request, "rpp");
String advancedQuery = ""; String advancedQuery = "";
Map<String, String> queryHash = new HashMap<String, String>();
// can't start earlier than 0 in the results! // can't start earlier than 0 in the results!
if (start < 0) if (start < 0)
@@ -402,11 +401,14 @@ public class SimpleSearchServlet extends DSpaceServlet
request.setAttribute("communities", communities); request.setAttribute("communities", communities);
request.setAttribute("no_results", "yes"); request.setAttribute("no_results", "yes");
queryHash = qArgs.buildQueryMap(request); Map<String, String> queryHash = qArgs.buildQueryMap(request);
for (Map.Entry<String, String> entry : queryHash.entrySet()) if (queryHash != null)
{ {
request.setAttribute(entry.getKey(), entry.getValue()); for (Map.Entry<String, String> entry : queryHash.entrySet())
{
request.setAttribute(entry.getKey(), entry.getValue());
}
} }
JSPManager.showJSP(request, response, "/search/advanced.jsp"); JSPManager.showJSP(request, response, "/search/advanced.jsp");

View File

@@ -470,7 +470,6 @@ class DAVItem extends DAVDSpaceObject
* *
* @throws SQLException the SQL exception * @throws SQLException the SQL exception
* @throws AuthorizeException the authorize exception * @throws AuthorizeException the authorize exception
* @throws ServletException the servlet exception
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
* @throws DAVStatusException the DAV status exception * @throws DAVStatusException the DAV status exception
*/ */
@@ -482,7 +481,6 @@ class DAVItem extends DAVDSpaceObject
AuthorizeManager.authorizeAction(this.context, this.item, Constants.READ); AuthorizeManager.authorizeAction(this.context, this.item, Constants.READ);
String packageType = this.request.getParameter("package"); String packageType = this.request.getParameter("package");
Bundle[] original = this.item.getBundles("ORIGINAL");
if (packageType == null) if (packageType == null)
{ {

View File

@@ -23,16 +23,16 @@ package org.dspace.statistics.content;
public abstract class DatasetGenerator { public abstract class DatasetGenerator {
/** The type of generator can either be CATEGORY or SERIE **/ /** The type of generator can either be CATEGORY or SERIE **/
public int DatasetType; protected int datasetType;
public boolean includeTotal = false; protected boolean includeTotal = false;
public int getDatasetType(){ public int getDatasetType(){
return DatasetType; return datasetType;
} }
public void setDatasetType(int datasetType){ public void setDatasetType(int datasetType){
DatasetType = datasetType; this.datasetType = datasetType;
} }
public boolean isIncludeTotal() { public boolean isIncludeTotal() {

View File

@@ -330,7 +330,6 @@ public class FlowContainerUtils
*/ */
public static FlowResult processReimportCollection(Context context, int collectionID, Request request) throws SQLException, IOException, AuthorizeException, CrosswalkException, ParserConfigurationException, SAXException, TransformerException, BrowseException public static FlowResult processReimportCollection(Context context, int collectionID, Request request) throws SQLException, IOException, AuthorizeException, CrosswalkException, ParserConfigurationException, SAXException, TransformerException, BrowseException
{ {
FlowResult result = new FlowResult();
Collection collection = Collection.find(context, collectionID); Collection collection = Collection.find(context, collectionID);
HarvestedCollection hc = HarvestedCollection.find(context, collectionID); HarvestedCollection hc = HarvestedCollection.find(context, collectionID);
@@ -347,9 +346,7 @@ public class FlowContainerUtils
collection.update(); collection.update();
context.commit(); context.commit();
result = processRunCollectionHarvest(context, collectionID, request); return processRunCollectionHarvest(context, collectionID, request);
return result;
} }

View File

@@ -117,7 +117,7 @@ public class EditContainerPolicies extends AbstractDSpaceTransformer
int highlightID = parameters.getParameterAsInteger("highlightID",-1); int highlightID = parameters.getParameterAsInteger("highlightID",-1);
String baseURL = contextPath+"/admin/epeople?administrative-continue="+knot.getId(); String baseURL = contextPath+"/admin/epeople?administrative-continue="+knot.getId();
ArrayList<ResourcePolicy> policies = new ArrayList<ResourcePolicy>(); ArrayList<ResourcePolicy> policies;
// DIVISION: edit-container-policies // DIVISION: edit-container-policies
Division main = body.addInteractiveDivision("edit-container-policies",contextPath+"/admin/authorize",Division.METHOD_POST,"primary administrative authorization"); Division main = body.addInteractiveDivision("edit-container-policies",contextPath+"/admin/authorize",Division.METHOD_POST,"primary administrative authorization");
@@ -144,40 +144,44 @@ public class EditContainerPolicies extends AbstractDSpaceTransformer
header.addCell().addContent(T_head_id); header.addCell().addContent(T_head_id);
header.addCell().addContent(T_head_action); header.addCell().addContent(T_head_action);
header.addCell().addContent(T_head_group); header.addCell().addContent(T_head_group);
for (ResourcePolicy policy : policies) if (policies != null)
{ {
Row row; for (ResourcePolicy policy : policies)
if (policy.getID() == highlightID)
{ {
row = table.addRow(null, null, "highlight"); Row row;
if (policy.getID() == highlightID)
{
row = table.addRow(null, null, "highlight");
}
else
{
row = table.addRow();
}
CheckBox select = row.addCell().addCheckBox("select_policy");
select.setLabel(String.valueOf(policy.getID()));
select.addOption(String.valueOf(policy.getID()));
// Accounting for the funky case of an empty policy
Group policyGroup = policy.getGroup();
row.addCell().addXref(baseURL + "&submit_edit&policy_id=" + policy.getID(), String.valueOf(policy.getID()));
row.addCell().addXref(baseURL + "&submit_edit&policy_id=" + policy.getID(), policy.getActionText());
if (policyGroup != null) {
Cell groupCell = row.addCell();
groupCell.addContent(policyGroup.getName());
Highlight groupHigh = groupCell.addHighlight("fade");
groupHigh.addContent(" [");
groupHigh.addXref(baseURL + "&submit_edit_group&group_id=" + policyGroup.getID(), T_group_edit);
groupHigh.addContent("]");
}
else {
row.addCell().addContent("...");
}
} }
else }
{
row = table.addRow();
}
CheckBox select = row.addCell().addCheckBox("select_policy");
select.setLabel(String.valueOf(policy.getID()));
select.addOption(String.valueOf(policy.getID()));
// Accounting for the funky case of an empty policy
Group policyGroup = policy.getGroup();
row.addCell().addXref(baseURL + "&submit_edit&policy_id=" + policy.getID(), String.valueOf(policy.getID()));
row.addCell().addXref(baseURL + "&submit_edit&policy_id=" + policy.getID(), policy.getActionText());
if (policyGroup != null) {
Cell groupCell = row.addCell();
groupCell.addContent(policyGroup.getName());
Highlight groupHigh = groupCell.addHighlight("fade");
groupHigh.addContent(" [");
groupHigh.addXref(baseURL + "&submit_edit_group&group_id=" + policyGroup.getID(), T_group_edit);
groupHigh.addContent("]");
}
else {
row.addCell().addContent("...");
}
}
Para buttons = main.addPara(); Para buttons = main.addPara();
buttons.addButton("submit_delete").setValue(T_submit_delete); buttons.addButton("submit_delete").setValue(T_submit_delete);
buttons.addButton("submit_return").setValue(T_submit_return); buttons.addButton("submit_return").setValue(T_submit_return);

View File

@@ -141,9 +141,6 @@ public class EditItemPolicies extends AbstractDSpaceTransformer
ArrayList<ResourcePolicy> itemPolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, item); ArrayList<ResourcePolicy> itemPolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, item);
ArrayList<ResourcePolicy> bundlePolicies = new ArrayList<ResourcePolicy>();
ArrayList<ResourcePolicy> bitstreamPolicies = new ArrayList<ResourcePolicy>();
// DIVISION: main // DIVISION: main
Division main = body.addInteractiveDivision("edit-item-policies",contextPath+"/admin/authorize",Division.METHOD_POST,"primary administrative authorization"); Division main = body.addInteractiveDivision("edit-item-policies",contextPath+"/admin/authorize",Division.METHOD_POST,"primary administrative authorization");
main.setHead(T_main_head.parameterize(item.getHandle(),item.getID())); main.setHead(T_main_head.parameterize(item.getHandle(),item.getID()));
@@ -172,7 +169,7 @@ public class EditItemPolicies extends AbstractDSpaceTransformer
subheader.addCell(null, null, 1, 4, "indent").addHighlight("bold").addContent(T_subhead_bundle.parameterize(bundle.getName(),bundle.getID())); subheader.addCell(null, null, 1, 4, "indent").addHighlight("bold").addContent(T_subhead_bundle.parameterize(bundle.getName(),bundle.getID()));
subheader.addCell().addHighlight("bold").addXref(baseURL + "&submit_add_bundle_" + bundle.getID(), T_add_bundlePolicy_link); subheader.addCell().addHighlight("bold").addXref(baseURL + "&submit_add_bundle_" + bundle.getID(), T_add_bundlePolicy_link);
bundlePolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, bundle); ArrayList<ResourcePolicy> bundlePolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, bundle);
this.rowBuilder(baseURL, table, bundlePolicies, bundle.getID(), Constants.BUNDLE, highlightID); this.rowBuilder(baseURL, table, bundlePolicies, bundle.getID(), Constants.BUNDLE, highlightID);
// And eventually to the bundle's bitstreams // And eventually to the bundle's bitstreams
@@ -182,7 +179,7 @@ public class EditItemPolicies extends AbstractDSpaceTransformer
subheader.addCell(null, null, 1, 4, "doubleIndent").addContent(T_subhead_bitstream.parameterize(bitstream.getName(),bitstream.getID())); subheader.addCell(null, null, 1, 4, "doubleIndent").addContent(T_subhead_bitstream.parameterize(bitstream.getName(),bitstream.getID()));
subheader.addCell().addXref(baseURL + "&submit_add_bitstream_" + bitstream.getID(), T_add_bitstreamPolicy_link); subheader.addCell().addXref(baseURL + "&submit_add_bitstream_" + bitstream.getID(), T_add_bitstreamPolicy_link);
bitstreamPolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, bitstream); ArrayList<ResourcePolicy> bitstreamPolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, bitstream);
this.rowBuilder(baseURL, table, bitstreamPolicies, bitstream.getID(), Constants.BITSTREAM, highlightID); this.rowBuilder(baseURL, table, bitstreamPolicies, bitstream.getID(), Constants.BITSTREAM, highlightID);
} }
} }

View File

@@ -190,8 +190,8 @@ public class DescribeStep extends AbstractSubmissionStep
Collection collection = submission.getCollection(); Collection collection = submission.getCollection();
String actionURL = contextPath + "/handle/"+collection.getHandle() + "/submit/" + knot.getId() + ".continue"; String actionURL = contextPath + "/handle/"+collection.getHandle() + "/submit/" + knot.getId() + ".continue";
DCInputSet inputSet = null; DCInputSet inputSet;
DCInput[] inputs = {}; DCInput[] inputs;
try try
{ {
inputSet = getInputsReader().getInputs(submission.getCollection().getHandle()); inputSet = getInputsReader().getInputs(submission.getCollection().getHandle());
@@ -201,8 +201,6 @@ public class DescribeStep extends AbstractSubmissionStep
{ {
throw new UIException(se); throw new UIException(se);
} }
Division div = body.addInteractiveDivision("submit-describe",actionURL,Division.METHOD_POST,"primary submission"); Division div = body.addInteractiveDivision("submit-describe",actionURL,Division.METHOD_POST,"primary submission");
div.setHead(T_submission_head); div.setHead(T_submission_head);
@@ -357,7 +355,7 @@ public class DescribeStep extends AbstractSubmissionStep
String inputType = input.getInputType(); String inputType = input.getInputType();
String pairsName = input.getPairsType(); String pairsName = input.getPairsType();
DCValue[] values = new DCValue[0]; DCValue[] values;
if (inputType.equals("qualdrop_value")) if (inputType.equals("qualdrop_value"))
{ {
@@ -368,7 +366,7 @@ public class DescribeStep extends AbstractSubmissionStep
values = submission.getItem().getMetadata(input.getSchema(), input.getElement(), input.getQualifier(), Item.ANY); values = submission.getItem().getMetadata(input.getSchema(), input.getElement(), input.getQualifier(), Item.ANY);
} }
if (values.length > 0) if (values != null && values.length > 0)
{ {
for (DCValue value : values) for (DCValue value : values)
{ {

View File

@@ -40,6 +40,8 @@
package org.dspace.app.xmlui.wing; package org.dspace.app.xmlui.wing;
import java.io.Serializable;
/** /**
* This simple class just provides the Namespace datatype. It stores a URI that * This simple class just provides the Namespace datatype. It stores a URI that
* is publicly accessible. The actually definitions of namespaces is found in * is publicly accessible. The actually definitions of namespaces is found in
@@ -48,7 +50,7 @@ package org.dspace.app.xmlui.wing;
* @author Scott Phillips * @author Scott Phillips
*/ */
public class Namespace public class Namespace implements Serializable
{ {
/** The URI for this namespace */ /** The URI for this namespace */
public final String URI; public final String URI;