Hello,

we run dspace 1.8.2 with XMLUI and a derivative of the Mirage theme
under http://stadtteilgeschichten.net/. This is, no hostname such as 
www.stadtteilgeschichten.net. We use tomcat6 and no apache.

The feedback form under <http://stadtteilgeschichten.net/feedback> throws 
errors.
The contact form in comparison works flawlessly: 
<http://stadtteilgeschichten.net/contact>
These are the error messages shown in the browser when clicking on Feedback:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1

Cocoon stacktrace [hide]

Sitemap: error invoking action
context:/resource://aspects/ViewArtifacts/sitemap.xmap - 193:68 <map:act 
type="SendFeedbackAction"> 
context:/resource://aspects/ViewArtifacts/sitemap.xmap - 192:55 <map:match>

Java stacktrace [hide]

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)


The logfiles did not give me any clue to solve the issue myself.
I did not change anything in the associated code.

Then I found these lines of code in the file SendFeedbackAction.java
at the lines indicated by the java stracktrace in the bowser:

        String basicHost = "";
        if ("localhost".equals(host) || "127.0.0.1".equals(host)
                        || 
host.equals(InetAddress.getLocalHost().getHostAddress()))
        {
            basicHost = host;
        }
        else
        {
            // cut off all but the hostname, to cover cases where more than one 
URL
            // arrives at the installation; e.g. presence or absence of "www"
            int lastDot = host.lastIndexOf('.');
            basicHost = host.substring(host.substring(0, 
lastDot).lastIndexOf('.'));
        }

I dont understand exactly what this code does, however I feel the error 
message fitting this code pretty good. As such I guess I found the culprit.

I remember that we had issues long time ago when running DSpace 1.3 or 1.4
under jspui. There was code that made wrong assumptions about the structure of 
the hostname variable. I suspect this to be a kind of undead which celebrates 
ressurection at this point. 

I checked the Contact.java and found that there a no comparable substring
manipulations imposed on the hostname as in the SendFeedbackAction.java code.
This code has not changed in DSpace 3.0, so updating our Repository will
probably not help with our issue.

The feedback form not working is actually a major issue 

I tried to recompile with hostname set to www.stadtteilgeschichten.net. 
However, 
this did not fix the issue. Instead, I got a new error message, stating that 
the 
feedback form would only work with a referrer from the same site. No wonder, 
www.stadtteilgeschichten.net does a 301 redirect to stadtteilgeschichten.net. 
As somebody else runs the nameserver, I did not bother what would happen if we 
request the site with a www. hostname. It is not desirable for us to do such 
a move, as all our google ranking we have built up in years is bound to the 
domain name without preceeding www. hostname.

Now, I am an admin, no programmmer I would certainly break DSpace if I would try
to fix the code. Actually, I tried already to commenct out the if else clause
and even such aesthetically inacceptable solutions as setting basicHost to
a fixed value such as "stadtteilgeschichten", "stadtteilgeschichten.net" or
just host. It did not work, thats it.

I appreciate your help,

Bye, Christian


------------------------------------------------------------------------------
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-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to