I have created issue SHINDIG-1223 about this problem and attached a patch with 
an improved version of my fix.

Bruce Godden

-----Original Message-----
From: Bruce Godden [mailto:bruce.god...@oerc.ox.ac.uk] 
Sent: 06 November 2009 16:08
To: Shindig Developer List
Subject: Build failures on Windows

Hi,

I'm new to this list. I have been trying to build Java Shindig on a Windows 
machine (yes, sorry about that!) but I hit a build problem. The build fails 
reporting errors in tests:

  
registerFromFileFeatureXmlFileScheme(org.apache.shindig.gadgets.features.FeatureRegistryTest)
  
registerFromFileFeatureXmlNoScheme(org.apache.shindig.gadgets.features.FeatureRegistryTest)
  
registerFromFileInNestedDirectoryFeatureXmlFile(org.apache.shindig.gadgets.features.FeatureRegistryTest)

I have tracked these down to the way that Shindig handles file paths. The tests 
create some test files or directories then pass the actual paths of these into 
UriBuilder(). This results in malformed URIs being reported as the path is 
expected to start with a slash. Also, the way that test XML feature files are 
constructed using replaceAll() means that the Windows backslash path separators 
are discard from the URIs inserted into the test files.

Sadly this problem is not only in the test code. The FeatureRegistry class does 
the same sort of thing when searching a directory tree for feature files.

I have a slightly unpleasant fix for the problem. I created a function:

  private static String standardisePath(String path) {
    path = path.replaceAll("\\\\", "/");
    if (path.charAt(0) != '/') {
        path = "/" + path;
    }
    return path;
  }

And passed real file paths through this before creating URIs. (That is at 3 
places in FeatureRegistryTest and 1 in FeatureRegistry.) This has fixed my 
build problem. Should I raise a JIRA issue for this?

Bruce Godden
VRE Developer
Oxford e-Research Centre

Reply via email to