REST Service: whitespace in tokens causes error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
collatex |
Fix Committed
|
Medium
|
Gregor Middell |
Bug Description
Usage of whitespace in tokens sent to the collator through the REST API causes an error.
CollateX release version: 0.9
This bug was originally reported by Vincent Neyt.
This bug was also reported during the september bootcamp by Alexander Czmiel.
A temporary fix is preprocessing the tokens to delete the whitespaces.
Original bugreport by Vincent Neyt (in Dutch) follows:
>> Een iets is me al opgevallen bij het testen: de JSON string is heel
>> streng wat whitespace betreft, dit bijvoorbeeld:
>>
>> {"witnesses"
>>
>> geeft een empty error, wegens de spatie tussen " en hallo. Dit
>> probleem heb ik kunnen omzeilen door de JSON string eerst door een
>> javascript te sturen dat overal " gevolgd door spatie, vervangt door
>> gewoon " zonder spatie.
>>
>> Daarnaast had ik ook problemen met harde returns in de xml,
>> bijvoorbeeld:
>>
>> <seg>
>> hallo hallo
>> <pb/>
>> hallo
>> </seg>
>>
>> in JSON werd dat dan
>>
>> "hallo hallo
>> hallo"
>>
>> wat een error gaf. Deze witregels stonden daar voor de leesbaarheid
>> van de xml. Daarvoor heb ik uit mijn xml bestanden alle overbodige
>> harde returns weggehaald, waardoor collatex nu nergens nog een error
>> geeft.
Fixed in trunk. The REST layer checked for empty tokens and threw an exception in case it encountered one. Now they are passed through to the aligner.