cdarras / clamav-client

Java client library for the ClamAV antivirus daemon
MIT License
79 stars 24 forks source link

Result failed if scanned via Stream - INSTREAM Command #1

Closed renierr closed 8 years ago

renierr commented 8 years ago

The Result looks something like this: "stream: Eicar-Test-Signature FOUND"

The Pattern searches for a "filePath" Group but has none and throw a IllegalStateException -> Not Found Exception.

Pattern: (.+: )?(?<filePath>.+): (?<virus>.+) FOUND$

Code Line: return new VirusInfo(matcher.group("filePath"), matcher.group("virus"));

ClamAv Version: 0.99

renierr commented 8 years ago

The Pattern is correct. It seams, that in my case the Line: assert matcher.matches(); is not evaluated cause of assert- have to check for Java Options, cause i did not set anything.

If i write a small programm and remove assert it worked. Proposal to remove the assert and use an if

renierr commented 8 years ago

Its possible to enable assertion only for this package, via Java Option: -ea:xyz.capybara.clamav...

But i would prefere to not set this and do not force someone to enable asserts. Create a variable with the command and use the variable in the assert block or remove it with a check.

calling group on matcher without calling matches() or any find on the matcher lead to an IllegalStateException. In other words, if you not enable asserts you always get a IllegalStateException.

cdarras commented 8 years ago

Sorry for the late answer, I was on holiday during the past two weeks. I'm gonna look into it and I'll reply to you by then.

renierr commented 8 years ago

thx for the fix. Is there a release build planned? I guess there will be not much changes in the future.

cdarras commented 8 years ago

Version 1.0.3 with the fix has been released :)