Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/Runtime/JavaRuntimeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ public function getPath(JSignParam $params): string
$downloadUrl = $params->getJavaDownloadUrl();

if ($javaPath && !$downloadUrl) {
if (is_file($javaPath) && is_executable($javaPath)) {
return $javaPath;
}
throw new InvalidArgumentException('Java path defined is not executable: ' . $javaPath);
return $javaPath;
}

if ($downloadUrl && $javaPath) {
Expand Down
10 changes: 5 additions & 5 deletions tests/Runtime/JavaRuntimeServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ public function testGetPathWithCustomAndValidJavaPath(): void
$this->assertEquals('vfs://download/bin/java', $path);
}

public function testGetPathWithCustomAndInvalidJavaPath(): void
public function testGetPathWithCustomJavaPath(): void
{
$jsignParam = new JSignParam();
$service = new JavaRuntimeService();
$jsignParam->setJavaPath(__FILE__);
$expectedPath = __FILE__;
$jsignParam->setJavaPath($expectedPath);
$jsignParam->setJavaDownloadUrl('');
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessageMatches('/not executable/');
$service->getPath($jsignParam);
$actual = $service->getPath($jsignParam);
$this->assertEquals($expectedPath, $actual);
}

public function testGetPathWithDownloadUrlAndNotRealDirectory(): void
Expand Down