Skip to content

Commit

Permalink
improve maven reader
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jul 13, 2024
1 parent bd0f5c7 commit c2f6bd8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 44 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/runtime/mvn/POM.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ private static TreeNode<POM> getDependencyManagement(POM pom, boolean recursive,
}
catch (IOException ioe) {
node.removeChild(p);
if (!p.isOptional()) throw ioe;
// if (!p.isOptional()) throw ioe;
}
}
}
Expand Down
20 changes: 19 additions & 1 deletion core/src/main/java/lucee/runtime/mvn/POMReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;

import lucee.print;
import lucee.commons.io.CharsetUtil;
import lucee.commons.io.IOUtil;
import lucee.commons.io.res.Resource;
import lucee.commons.io.res.ResourcesImpl;
import lucee.commons.lang.StringUtil;
import lucee.runtime.text.xml.XMLUtil;
import lucee.transformer.library.function.FunctionLibEntityResolver;
import lucee.transformer.library.function.FunctionLibException;
Expand Down Expand Up @@ -136,8 +139,23 @@ public void read() throws IOException, SAXException {
try {
init(new InputSource(r = IOUtil.getReader(file.getInputStream(), (Charset) null)));
}
catch (SAXParseException saxe) {
if (saxe.getMessage().indexOf("oslash") != -1) {
IOUtil.closeEL(r);
r = null;

String str = IOUtil.toString(file, (Charset) null);
// TODO PATCH make a better solution for that
str = StringUtil.replace(str, "&oslash;", "ø", false);// (str, "oslash");// &oslash;
IOUtil.write(file, str.getBytes(CharsetUtil.UTF8), false);
init(new InputSource(r = IOUtil.getReader(file.getInputStream(), (Charset) null)));

}
else throw saxe;

}
finally {
IOUtil.close(r);
IOUtil.closeEL(r);
}
}

Expand Down
42 changes: 0 additions & 42 deletions core/src/main/java/lucee/runtime/mvn/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,48 +42,6 @@ public static void main(String[] args) throws Exception {

};

arr = new GAVSO[] {

// new GAVSO("org.apache.maven", "maven-parent", "40"),

// new GAVSO("org.apache", "apache", "30"),

// new GAVSO("com.puppycrawl.tools", "checkstyle", "7.8"),

// new GAVSO("org.apache.commons", "commons-lang3", "3.12.0"),

// new GAVSO("org.apache.httpcomponents", "httpclient", "4.5.14"),

// new GAVSO("org.apache.httpcomponents", "httpcomponents-client", "4.5.14"),

new GAVSO("org.apache.commons", "commons-pool2", "2.12.0"),

// new GAVSO("org.apache.commons", "commons-parent", "62"),

new GAVSO("org.slf4j", "slf4j-api", "1.6.1"),

// new GAVSO("net.bytebuddy", "byte-buddy", "1.14.17"),

// new GAVSO("net.bytebuddy", "byte-buddy-parent", "1.14.17"),

new GAVSO("commons-beanutils", "commons-beanutils", "1.9.4"),

// new GAVSO("org.apache.maven.resolver", "maven-resolver-impl", "2.0.0"),

new GAVSO("jakarta.enterprise", "jakarta.enterprise.cdi-api", "4.0.1"),

new GAVSO("org.lucee", "lucee", "6.1.0.235-RC")

};

arr = new GAVSO[] {

// new GAVSO("com.amazonaws", "aws-java-sdk-core", "1.12.757")
// new GAVSO("com.amazonaws", "aws-java-sdk-core", "1.12.458")
new GAVSO("com.amazonaws", "aws-java-sdk-core", "1.12.757")

};

/*
* new Artifact("org.hibernate.orm", "hibernate-core", "6.5.2.Final"), new Artifact("com.amazonaws",
* "aws-java-sdk-s3", "1.12.756"),
Expand Down

0 comments on commit c2f6bd8

Please sign in to comment.