mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 14:03:17 +00:00
Merge pull request #1437 from aschweer/DS-3246-cocoon-recycling-ds6
[DS-3246] Improve cleanup in recyclable components
This commit is contained in:
@@ -312,6 +312,8 @@ public class ItemExport extends AbstractDSpaceTransformer implements
|
|||||||
this.errors = null;
|
this.errors = null;
|
||||||
this.message = null;
|
this.message = null;
|
||||||
this.availableExports = null;
|
this.availableExports = null;
|
||||||
|
this.response = null;
|
||||||
|
this.request = null;
|
||||||
super.recycle();
|
super.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -393,6 +393,7 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
|||||||
public void recycle()
|
public void recycle()
|
||||||
{
|
{
|
||||||
this.validity = null;
|
this.validity = null;
|
||||||
|
this.availableExports = null;
|
||||||
super.recycle();
|
super.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,8 +91,6 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
|
|||||||
private final String sfxFile = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("dspace.dir")
|
private final String sfxFile = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("dspace.dir")
|
||||||
+ File.separator + "config" + File.separator + "sfx.xml";
|
+ File.separator + "config" + File.separator + "sfx.xml";
|
||||||
|
|
||||||
private String sfxQuery = null;
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ItemViewer.class);
|
private static final Logger log = LoggerFactory.getLogger(ItemViewer.class);
|
||||||
|
|
||||||
protected SFXFileReaderService sfxFileReaderService = SfxServiceFactory.getInstance().getSfxFileReaderService();
|
protected SFXFileReaderService sfxFileReaderService = SfxServiceFactory.getInstance().getSfxFileReaderService();
|
||||||
@@ -201,7 +199,7 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
|
|||||||
String sfxserverUrl = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("sfx.server.url");
|
String sfxserverUrl = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("sfx.server.url");
|
||||||
if (sfxserverUrl != null && sfxserverUrl.length() > 0)
|
if (sfxserverUrl != null && sfxserverUrl.length() > 0)
|
||||||
{
|
{
|
||||||
sfxQuery = "";
|
String sfxQuery = "";
|
||||||
|
|
||||||
// parse XML file -> XML document will be build
|
// parse XML file -> XML document will be build
|
||||||
sfxQuery = sfxFileReaderService.loadSFXFile(sfxFile, item);
|
sfxQuery = sfxFileReaderService.loadSFXFile(sfxFile, item);
|
||||||
|
@@ -71,15 +71,10 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
|||||||
public static final String OFFSET = "offset";
|
public static final String OFFSET = "offset";
|
||||||
public static final String FACET_FIELD = "field";
|
public static final String FACET_FIELD = "field";
|
||||||
|
|
||||||
private ConfigurationService config = null;
|
|
||||||
|
|
||||||
private SearchService searchService = null;
|
private SearchService searchService = null;
|
||||||
|
|
||||||
public BrowseFacet() {
|
public BrowseFacet() {
|
||||||
|
|
||||||
config = DSpaceServicesFactory.getInstance().getConfigurationService();
|
|
||||||
searchService = DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(SearchService.class.getName(),SearchService.class);
|
searchService = DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(SearchService.class.getName(),SearchService.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -448,6 +443,7 @@ public class BrowseFacet extends AbstractDSpaceTransformer implements CacheableP
|
|||||||
// Clear out our item's cache.
|
// Clear out our item's cache.
|
||||||
this.queryResults = null;
|
this.queryResults = null;
|
||||||
this.validity = null;
|
this.validity = null;
|
||||||
|
this.queryResults = null;
|
||||||
super.recycle();
|
super.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -530,6 +530,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
|
|||||||
public void recycle() {
|
public void recycle() {
|
||||||
// Clear out our item's cache.
|
// Clear out our item's cache.
|
||||||
this.queryResults = null;
|
this.queryResults = null;
|
||||||
|
this.queryArgs = null;
|
||||||
this.validity = null;
|
this.validity = null;
|
||||||
super.recycle();
|
super.recycle();
|
||||||
}
|
}
|
||||||
|
@@ -79,12 +79,6 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
|
|||||||
private static final Message T_filter_notauthority = message("xmlui.Discovery.SimpleSearch.filter.notauthority");
|
private static final Message T_filter_notauthority = message("xmlui.Discovery.SimpleSearch.filter.notauthority");
|
||||||
private static final Message T_did_you_mean = message("xmlui.Discovery.SimpleSearch.did_you_mean");
|
private static final Message T_did_you_mean = message("xmlui.Discovery.SimpleSearch.did_you_mean");
|
||||||
|
|
||||||
private SearchService searchService = null;
|
|
||||||
|
|
||||||
public SimpleSearch() {
|
|
||||||
searchService = DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(SearchService.class.getName(),SearchService.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Page metadata.
|
* Add Page metadata.
|
||||||
|
@@ -132,8 +132,9 @@ public class JSONDiscoverySearcher extends AbstractReader implements Recyclable
|
|||||||
{
|
{
|
||||||
out.write(buffer, 0, length);
|
out.write(buffer, 0, length);
|
||||||
}
|
}
|
||||||
out.flush();
|
|
||||||
}
|
}
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,4 +164,12 @@ public class JSONDiscoverySearcher extends AbstractReader implements Recyclable
|
|||||||
|
|
||||||
return dso;
|
return dso;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recycle() {
|
||||||
|
response = null;
|
||||||
|
JSONStream = null;
|
||||||
|
super.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -282,5 +282,10 @@ public class PageNotFoundTransformer extends AbstractDSpaceTransformer implement
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recycle() {
|
||||||
|
this.bodyEvent = null;
|
||||||
|
super.recycle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,8 +47,7 @@ public class HandleResolverReader extends AbstractReader implements Recyclable {
|
|||||||
private static final Logger log = Logger.getLogger(HandleResolverReader.class);
|
private static final Logger log = Logger.getLogger(HandleResolverReader.class);
|
||||||
|
|
||||||
public static final String CONTENTTYPE = "application/json; charset=utf-8";
|
public static final String CONTENTTYPE = "application/json; charset=utf-8";
|
||||||
|
|
||||||
private Request req;
|
|
||||||
private Response resp;
|
private Response resp;
|
||||||
private String action;
|
private String action;
|
||||||
private String handle;
|
private String handle;
|
||||||
@@ -60,7 +59,6 @@ public class HandleResolverReader extends AbstractReader implements Recyclable {
|
|||||||
Parameters par) throws ProcessingException, SAXException,
|
Parameters par) throws ProcessingException, SAXException,
|
||||||
IOException
|
IOException
|
||||||
{
|
{
|
||||||
this.req = ObjectModelHelper.getRequest(objectModel);
|
|
||||||
this.resp = ObjectModelHelper.getResponse(objectModel);
|
this.resp = ObjectModelHelper.getResponse(objectModel);
|
||||||
this.action = par.getParameter("action", "listprefixes");
|
this.action = par.getParameter("action", "listprefixes");
|
||||||
this.handle = par.getParameter("handle", null);
|
this.handle = par.getParameter("handle", null);
|
||||||
@@ -153,13 +151,13 @@ public class HandleResolverReader extends AbstractReader implements Recyclable {
|
|||||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(jsonString.getBytes("UTF-8"));
|
ByteArrayInputStream inputStream = new ByteArrayInputStream(jsonString.getBytes("UTF-8"));
|
||||||
IOUtils.copy(inputStream, out);
|
IOUtils.copy(inputStream, out);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
out.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error: ", e);
|
log.error("Error: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recycle() {
|
public void recycle() {
|
||||||
this.req = null;
|
|
||||||
this.resp = null;
|
this.resp = null;
|
||||||
this.action = null;
|
this.action = null;
|
||||||
this.handle = null;
|
this.handle = null;
|
||||||
|
@@ -247,6 +247,9 @@ public class CSVOutputter extends AbstractReader implements Recyclable
|
|||||||
public void recycle() {
|
public void recycle() {
|
||||||
this.request = null;
|
this.request = null;
|
||||||
this.response = null;
|
this.response = null;
|
||||||
|
this.context = null;
|
||||||
|
this.writer = null;
|
||||||
|
super.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -35,14 +35,9 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
|||||||
|
|
||||||
private static final Message T_context_swordclient_head = message("xmlui.swordclient.Navigation.context_head");
|
private static final Message T_context_swordclient_head = message("xmlui.swordclient.Navigation.context_head");
|
||||||
private static final Message T_swordclient_copy = message("xmlui.swordclient.Navigation.context_copy");
|
private static final Message T_swordclient_copy = message("xmlui.swordclient.Navigation.context_copy");
|
||||||
|
|
||||||
/** Cached validity object */
|
|
||||||
private SourceValidity validity;
|
|
||||||
|
|
||||||
protected AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
|
protected AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the unique caching key.
|
* Generate the unique caching key.
|
||||||
* This key must be unique inside the space of this component.
|
* This key must be unique inside the space of this component.
|
||||||
|
@@ -51,10 +51,6 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
|||||||
protected AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
|
protected AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
|
||||||
protected GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
protected GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||||
|
|
||||||
|
|
||||||
/** exports available for download */
|
|
||||||
java.util.List<String> availableExports = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the unique cache key.
|
* Generate the unique cache key.
|
||||||
*
|
*
|
||||||
@@ -81,15 +77,6 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
|||||||
return HashUtil.hash("anonymous");
|
return HashUtil.hash("anonymous");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (availableExports != null && availableExports.size()>0) {
|
|
||||||
StringBuilder key = new StringBuilder(context.getCurrentUser().getEmail());
|
|
||||||
for(String fileName : availableExports){
|
|
||||||
key.append(":").append(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return HashUtil.hash(key.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return HashUtil.hash(context.getCurrentUser().getEmail());
|
return HashUtil.hash(context.getCurrentUser().getEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -80,4 +80,5 @@ public class AspectGenerator extends FileGenerator implements
|
|||||||
// Use the standard FileGenerator to get the next Aspect.
|
// Use the standard FileGenerator to get the next Aspect.
|
||||||
super.setup(resolver, objectModel, aspectPath, par);
|
super.setup(resolver, objectModel, aspectPath, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -55,14 +55,16 @@ public class AspectMatcher extends AbstractLogEnabled implements Matcher
|
|||||||
|
|
||||||
String[] parts = uri.split("/");
|
String[] parts = uri.split("/");
|
||||||
|
|
||||||
int aspectID;
|
int aspectID = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
aspectID = Integer.valueOf(parts[0]);
|
if (parts[0].matches("\\d+")) {
|
||||||
|
aspectID = Integer.valueOf(parts[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfe)
|
catch (NumberFormatException nfe)
|
||||||
{
|
{
|
||||||
aspectID = 0;
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -11,6 +11,7 @@ import java.io.*;
|
|||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.mail.internet.MimeUtility;
|
import javax.mail.internet.MimeUtility;
|
||||||
@@ -163,8 +164,8 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
|||||||
/** True if bitstream is readable by anonymous users */
|
/** True if bitstream is readable by anonymous users */
|
||||||
protected boolean isAnonymouslyReadable;
|
protected boolean isAnonymouslyReadable;
|
||||||
|
|
||||||
/** Item containing the Bitstream */
|
/** The last modified date of the item containing the bitstream */
|
||||||
private Item item = null;
|
private Date itemLastModified = null;
|
||||||
|
|
||||||
/** True if user agent making this request was identified as spider. */
|
/** True if user agent making this request was identified as spider. */
|
||||||
private boolean isSpider = false;
|
private boolean isSpider = false;
|
||||||
@@ -202,7 +203,9 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
|||||||
{
|
{
|
||||||
this.request = ObjectModelHelper.getRequest(objectModel);
|
this.request = ObjectModelHelper.getRequest(objectModel);
|
||||||
this.response = ObjectModelHelper.getResponse(objectModel);
|
this.response = ObjectModelHelper.getResponse(objectModel);
|
||||||
|
|
||||||
|
Item item = null;
|
||||||
|
|
||||||
// Check to see if a context already exists or not. We may
|
// Check to see if a context already exists or not. We may
|
||||||
// have been aggregated into an http request by the XSL document
|
// have been aggregated into an http request by the XSL document
|
||||||
// pulling in an XML-based bitstream. In this case the context has
|
// pulling in an XML-based bitstream. In this case the context has
|
||||||
@@ -264,6 +267,10 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item != null) {
|
||||||
|
itemLastModified = item.getLastModified();
|
||||||
|
}
|
||||||
|
|
||||||
// if initial search was by sequence number and found nothing,
|
// if initial search was by sequence number and found nothing,
|
||||||
// then try to find bitstream by name (assuming we have a file name)
|
// then try to find bitstream by name (assuming we have a file name)
|
||||||
if((sequence > -1 && bitstream==null) && name!=null)
|
if((sequence > -1 && bitstream==null) && name!=null)
|
||||||
@@ -603,7 +610,7 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
|||||||
{
|
{
|
||||||
// Check for if-modified-since header -- ONLY if not authenticated
|
// Check for if-modified-since header -- ONLY if not authenticated
|
||||||
long modSince = request.getDateHeader("If-Modified-Since");
|
long modSince = request.getDateHeader("If-Modified-Since");
|
||||||
if (modSince != -1 && item != null && item.getLastModified().getTime() < modSince)
|
if (modSince != -1 && itemLastModified != null && itemLastModified.getTime() < modSince)
|
||||||
{
|
{
|
||||||
// Item has not been modified since requested date,
|
// Item has not been modified since requested date,
|
||||||
// hence bitstream has not been, either; return 304
|
// hence bitstream has not been, either; return 304
|
||||||
@@ -618,12 +625,11 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
|||||||
// users in the cache for a response later to anonymous user.
|
// users in the cache for a response later to anonymous user.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (item != null && (isSpider || ContextUtil.obtainContext(request).getCurrentUser() == null))
|
if (itemLastModified != null && (isSpider || ContextUtil.obtainContext(request).getCurrentUser() == null))
|
||||||
{
|
{
|
||||||
// TODO: Currently just borrow the date of the item, since
|
// TODO: Currently just borrow the date of the item, since
|
||||||
// we don't have last-mod dates for Bitstreams
|
// we don't have last-mod dates for Bitstreams
|
||||||
response.setDateHeader("Last-Modified", item.getLastModified()
|
response.setDateHeader("Last-Modified", itemLastModified.getTime());
|
||||||
.getTime());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
@@ -783,6 +789,10 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
|||||||
this.bitstreamInputStream = null;
|
this.bitstreamInputStream = null;
|
||||||
this.bitstreamSize = 0;
|
this.bitstreamSize = 0;
|
||||||
this.bitstreamMimeType = null;
|
this.bitstreamMimeType = null;
|
||||||
|
this.bitstreamName = null;
|
||||||
|
this.itemLastModified = null;
|
||||||
|
this.tempFile = null;
|
||||||
|
super.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -246,6 +246,7 @@ public class ItemExportDownloadReader extends AbstractReader implements Recyclab
|
|||||||
}
|
}
|
||||||
out.flush();
|
out.flush();
|
||||||
}
|
}
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -264,6 +265,8 @@ public class ItemExportDownloadReader extends AbstractReader implements Recyclab
|
|||||||
this.request = null;
|
this.request = null;
|
||||||
this.compressedExportInputStream = null;
|
this.compressedExportInputStream = null;
|
||||||
this.compressedExportSize = 0;
|
this.compressedExportSize = 0;
|
||||||
|
this.compressedExportName = null;
|
||||||
|
super.recycle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,6 +44,7 @@ public class JSONControlledVocabularyReader extends AbstractReader {
|
|||||||
IOUtils.copy(inputStream, out);
|
IOUtils.copy(inputStream, out);
|
||||||
out.flush();
|
out.flush();
|
||||||
}
|
}
|
||||||
|
out.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error while generating controlled vocabulary json, vocabulary identifier: " + vocabularyIdentifier, e);
|
log.error("Error while generating controlled vocabulary json, vocabulary identifier: " + vocabularyIdentifier, e);
|
||||||
}
|
}
|
||||||
|
@@ -209,7 +209,10 @@ public class MetadataExportReader extends AbstractReader implements Recyclable
|
|||||||
public void recycle() {
|
public void recycle() {
|
||||||
this.response = null;
|
this.response = null;
|
||||||
this.request = null;
|
this.request = null;
|
||||||
|
this.exporter = null;
|
||||||
|
this.filename = null;
|
||||||
|
this.csv = null;
|
||||||
|
super.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -132,6 +132,8 @@ public class SitemapReader extends AbstractReader implements Recyclable
|
|||||||
String fileStem = (param == null ? "sitemap_index" : "sitemap" + param);
|
String fileStem = (param == null ? "sitemap_index" : "sitemap" + param);
|
||||||
|
|
||||||
sendFile(fileStem + ext, this.forSitemapsOrg);
|
sendFile(fileStem + ext, this.forSitemapsOrg);
|
||||||
|
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -206,5 +208,6 @@ public class SitemapReader extends AbstractReader implements Recyclable
|
|||||||
this.request = null;
|
this.request = null;
|
||||||
this.sitemapMimeType = null;
|
this.sitemapMimeType = null;
|
||||||
this.forSitemapsOrg = false;
|
this.forSitemapsOrg = false;
|
||||||
|
super.recycle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,6 +45,6 @@ public class JQueryLoaderReader extends AbstractReader {
|
|||||||
out.write(buffer, 0, length);
|
out.write(buffer, 0, length);
|
||||||
}
|
}
|
||||||
out.flush();
|
out.flush();
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@ public class RequestUtils {
|
|||||||
int i = -1;
|
int i = -1;
|
||||||
|
|
||||||
// Iterate through the values in the form.
|
// Iterate through the values in the form.
|
||||||
valueLoop: while (1 == 1)
|
valueLoop: while (true)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
String value = null;
|
String value = null;
|
||||||
@@ -117,7 +117,7 @@ public class RequestUtils {
|
|||||||
int i = -1;
|
int i = -1;
|
||||||
|
|
||||||
// Iterate through the values in the form.
|
// Iterate through the values in the form.
|
||||||
valueLoop: while (1 == 1)
|
valueLoop: while (true)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
String value = null;
|
String value = null;
|
||||||
@@ -181,16 +181,18 @@ public class RequestUtils {
|
|||||||
public static int getIntParameter(Request request, String param)
|
public static int getIntParameter(Request request, String param)
|
||||||
{
|
{
|
||||||
String val = request.getParameter(param);
|
String val = request.getParameter(param);
|
||||||
|
if (val != null)
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
return Integer.parseInt(val.trim());
|
{
|
||||||
}
|
return Integer.parseInt(val.trim());
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
catch (Exception e)
|
||||||
// Problem with parameter
|
{
|
||||||
return -1;
|
// Problem with parameter -- ignore
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user