From 06371ca2580dc9938e07a9ff0ab86a72ab10fa2f Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Fri, 30 May 2014 02:58:29 +0200 Subject: #682: bugfix work in progress to fix IllegalArgumentException ‘Path must include project and resource name’. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/changelog.markdown | 1 + src/core/lombok/eclipse/EclipseAST.java | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 4a9958ed..4f4cbca7 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -2,6 +2,7 @@ Lombok Changelog ---------------- ### v1.14.1 "Edgy Guinea Pig" +* BUGFIX-IN-PROGRESS: As yet unknown conditions in eclipse result in lots of `IllegalArgumentException` in the log with message "Path must include project and resource name". This edge release will no longer error out, but we need to know when or how this occurs, thus, warnings will appear instead in your log with information pertinent to solving this issue. Please report these warnings back to us. [Issue #682](https://code.google.com/p/projectlombok/issues/detail?id=682) * BUGFIX: mvn builds fail with a 'URI not absolute' exception. [Issue #683](https://code.google.com/p/projectlombok/issues/detail?id=683) ### v1.14.0 "Branching Cobra" (May 27th, 2014) diff --git a/src/core/lombok/eclipse/EclipseAST.java b/src/core/lombok/eclipse/EclipseAST.java index 45551d1c..62a01e59 100644 --- a/src/core/lombok/eclipse/EclipseAST.java +++ b/src/core/lombok/eclipse/EclipseAST.java @@ -70,9 +70,20 @@ public class EclipseAST extends AST { private static volatile boolean skipEclipseWorkspaceBasedFileResolver = false; public URI getAbsoluteFileLocation() { + String fileName = getFileName(); + if (!skipEclipseWorkspaceBasedFileResolver) { try { - return EclipseWorkspaceBasedFileResolver.resolve(getFileName()); + /*if (fileName.startsWith("/") && fileName.indexOf('/', 1) > -1) */ + try { + return EclipseWorkspaceBasedFileResolver.resolve(fileName); + } catch (IllegalArgumentException e) { + String msg = e.getMessage(); + if (msg != null && msg.startsWith("Path must include project and resource name")) { + // go with the fallthrough, but log that this happened. + addProblem(new ParseProblem(true, "Path resolution for lombok.config failed. Path: " + fileName + " -- falling back to: " + new File(fileName).getAbsoluteFile(), 0, 1)); + } else throw e; + } } catch (NoClassDefFoundError e) { skipEclipseWorkspaceBasedFileResolver = true; } @@ -80,7 +91,7 @@ public class EclipseAST extends AST { // Our fancy workspace based source file to absolute disk location algorithm only works in a fully fledged eclipse. // This fallback works when using 'ecj', which has a much simpler project/path system. For example, no 'linked' resources. - return new File(getFileName()).getAbsoluteFile().toURI(); + return new File(fileName).getAbsoluteFile().toURI(); } private static class EclipseWorkspaceBasedFileResolver { -- cgit