Thanks to visit codestin.com
Credit goes to github.com

Skip to content

import exists poorly on '.' as path/file #552

@Niels-Erik

Description

@Niels-Erik

Describe the bug
If an import only has a dot,., for the file path, Jolie will crash with the error: fromIndex(0) > toIndex(-1)
With --stackTraces:

java.lang.IllegalArgumentException: fromIndex(0) > toIndex(-1)
        at java.base/java.util.AbstractList.subListRangeCheck(AbstractList.java:511)
        at java.base/java.util.ArrayList$SubList.subList(ArrayList.java:1482)
        at java.base/java.util.Collections$UnmodifiableRandomAccessList.subList(Collections.java:1593)
        at jolie.lang.parse.module.ModuleFinderImpl.moduleLookup(ModuleFinderImpl.java:143)
        at jolie.lang.parse.module.ModuleFinderImpl.find(ModuleFinderImpl.java:76)
        at jolie.lang.parse.module.ModuleCrawler.findModule(ModuleCrawler.java:96)
        at jolie.lang.parse.module.ModuleCrawler.crawlModule(ModuleCrawler.java:106)
        at jolie.lang.parse.module.ModuleCrawler.crawl(ModuleCrawler.java:159)
        at jolie.lang.parse.module.ModuleCrawler.crawl(ModuleCrawler.java:202)
        at jolie.lang.parse.module.Modules.parseModule(Modules.java:75)
        at jolie.Interpreter.buildOOIT(Interpreter.java:1195)
        at jolie.Interpreter.init(Interpreter.java:1000)
        at jolie.Interpreter.run(Interpreter.java:1084)
        at jolie.Jolie.main(Jolie.java:86)

To Reproduce
Steps to reproduce the behavior:

  1. Create bug.ol with from . import anything
  2. Run jolie bug.ol
  3. See error

Expected behavior
Jolie should tell that I the path/file does not exist or that I wrote the path wrong.

Desktop (please complete the following information):

  • OS: windos
  • Jolie version 1.13.0-git
  • Java Version 21

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions