Skip to content

Commit 651bd86

Browse files
authored
Merge pull request #36 from JSignPdf/fix/use-custom-java-path
fix: use custom java path
2 parents 7612eac + e6e9a37 commit 651bd86

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/Runtime/JavaRuntimeService.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ public function getPath(JSignParam $params): string
2323
$downloadUrl = $params->getJavaDownloadUrl();
2424

2525
if ($javaPath && !$downloadUrl) {
26-
if (is_file($javaPath) && is_executable($javaPath)) {
27-
return $javaPath;
28-
}
29-
throw new InvalidArgumentException('Java path defined is not executable: ' . $javaPath);
26+
return $javaPath;
3027
}
3128

3229
if ($downloadUrl && $javaPath) {

tests/Runtime/JavaRuntimeServiceTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public function testGetPathWithCustomAndValidJavaPath(): void
4343
$this->assertEquals('vfs://download/bin/java', $path);
4444
}
4545

46-
public function testGetPathWithCustomAndInvalidJavaPath(): void
46+
public function testGetPathWithCustomJavaPath(): void
4747
{
4848
$jsignParam = new JSignParam();
4949
$service = new JavaRuntimeService();
50-
$jsignParam->setJavaPath(__FILE__);
50+
$expectedPath = __FILE__;
51+
$jsignParam->setJavaPath($expectedPath);
5152
$jsignParam->setJavaDownloadUrl('');
52-
$this->expectException(InvalidArgumentException::class);
53-
$this->expectExceptionMessageMatches('/not executable/');
54-
$service->getPath($jsignParam);
53+
$actual = $service->getPath($jsignParam);
54+
$this->assertEquals($expectedPath, $actual);
5555
}
5656

5757
public function testGetPathWithDownloadUrlAndNotRealDirectory(): void

0 commit comments

Comments
 (0)