vmichalak / sonos-controller

Java API for controlling SONOS players
MIT License
43 stars 9 forks source link

IllegalStateException at com.vmichalak.sonoscontroller.ParserHelper.findOne(ParserHelper.java:11) #1

Closed esba closed 7 years ago

esba commented 7 years ago

While doing "getZoneName()" on a "SonosDevice" object I get the following:

(...)
java.lang.IllegalStateException: No successful match so far
                      at java.util.regex.Matcher.ensureMatch(Matcher.java:471)
                      at java.util.regex.Matcher.group(Matcher.java:578)
                      at com.vmichalak.sonoscontroller.ParserHelper.findOne(ParserHelper.java:11)
                      at com.vmichalak.sonoscontroller.SonosDevice.getSpeakerInfo(SonosDevice.java:463)
                      at com.vmichalak.sonoscontroller.SonosDevice.getZoneName(SonosDevice.java:373)
                      (...)

"String regex" in findOne contents: <ZoneName>(.*)</ZoneName>

"String content" in findOne contents (SerialNumber, MACAddress and CutomerID removed):

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="/xml/review.xsl"?><ZPSupportInfo><ZPInfo><ZoneName>0. Køkken</ZoneName><ZoneIcon>x-rincon-roomicon:kitchen</ZoneIcon><Configuration>1</Configuration><LocalUID>RINCON_B8E937568F5A01400</LocalUID><SerialNumber>XX-XX-XX-XX-XX-XX:0</SerialNumber><SoftwareVersion>35.3-37210</SoftwareVersion><SoftwareDate>2017-01-21 22:51:23.323408</SoftwareDate><SoftwareScm>296936</SoftwareScm><MinCompatibleVersion>34.0-00000</MinCompatibleVersion><LegacyCompatibleVersion>25.0-00000</LegacyCompatibleVersion><HardwareVersion>1.8.3.7-2</HardwareVersion><DspVersion>0.25.3</DspVersion><HwFlags>0x0</HwFlags><HwFeatures>0x0</HwFeatures><Variant>0</Variant><GeneralFlags>0x0</GeneralFlags><IPAddress>192.168.10.110</IPAddress><MACAddress>XX-XX-XX-XX-XX-XX</MACAddress><Copyright>© 2003-2017, Sonos, Inc. All rights reserved.</Copyright><ExtraInfo>OTP: </ExtraInfo><HTAudioInCode>0</HTAudioInCode><IdxTrk></IdxTrk><MDP2Ver>0</MDP2Ver><MDP3Ver>0</MDP3Ver><RegState>3</RegState><CustomerID>XXXX</CustomerID></ZPInfo></ZPSupportInfo>

I'm new to GitHub and Java, so let me know if you need anything else!

vmichalak commented 7 years ago

Hi esba, What is the normal name of your zone. I see "0. Køkken" but i don't understand it :p. I watch this tomorrow.

Thanks for using sonos-controller

esba commented 7 years ago

The name in the Sonos App is "0. Køkken". "Køkken" is "kitchen" in Danish, and the "0." is my way of naming zones - where 0 is ground floor and 1 is first floor. I tried renaming to "0. Koekken" but the result is the same.

I hope you can fix it, and let me know if there is anything i can test for you :)

vmichalak commented 7 years ago

Done, Problem solved :blush:

esba commented 7 years ago

Thank you very much, no crashing now :) And thank you for making this library available!

Anyway to fix the encoding of the Danish (and other) characters? It still shows "ø" instead of "ø".