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

Ivan Masár updated DS-1467:
---------------------------

    Description: 
https://github.com/DSpace/DSpace/blob/dspace-1_8_x/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/SendFeedbackAction.java#L84

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1943)
        at java.lang.String.substring(String.java:1916)
        at 
org.dspace.app.xmlui.aspect.artifactbrowser.SendFeedbackAction.act(SendFeedbackAction.java:84)

This happens when, although dspace.hostname is set properly, the hostname is 
not defined in the hosts file, therefore not returned by 
InetAddress.getLocalHost().getHostAddress(). In that case the else branch 
executes and fails if there are less than two dots (domain separators) in the 
hostname - which is a common case, e.g. example.com instead of www.example.com.

I see two possible approaches to fix it:
1) Re-think the whole approach - is checking the local host name really 
necessary?
2) Catch the exception and add a message informing about the need to correctly 
set hostname in the hosts file

  was:
https://github.com/DSpace/DSpace/blob/dspace-1_8_x/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/SendFeedbackAction.java#L84

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1943)
        at java.lang.String.substring(String.java:1916)
        at 
org.dspace.app.xmlui.aspect.artifactbrowser.SendFeedbackAction.act(SendFeedbackAction.java:84)

    
> StringIndexOutOfBoundsException in feedback form
> ------------------------------------------------
>
>                 Key: DS-1467
>                 URL: https://jira.duraspace.org/browse/DS-1467
>             Project: DSpace
>          Issue Type: Bug
>    Affects Versions: 1.8.2, 3.0
>            Reporter: Ivan Masár
>              Labels: papercut
>             Fix For: 3.1
>
>
> https://github.com/DSpace/DSpace/blob/dspace-1_8_x/dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/SendFeedbackAction.java#L84
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>         at java.lang.String.substring(String.java:1943)
>         at java.lang.String.substring(String.java:1916)
>         at 
> org.dspace.app.xmlui.aspect.artifactbrowser.SendFeedbackAction.act(SendFeedbackAction.java:84)
> This happens when, although dspace.hostname is set properly, the hostname is 
> not defined in the hosts file, therefore not returned by 
> InetAddress.getLocalHost().getHostAddress(). In that case the else branch 
> executes and fails if there are less than two dots (domain separators) in the 
> hostname - which is a common case, e.g. example.com instead of 
> www.example.com.
> I see two possible approaches to fix it:
> 1) Re-think the whole approach - is checking the local host name really 
> necessary?
> 2) Catch the exception and add a message informing about the need to 
> correctly set hostname in the hosts file

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to