Skip to content

Commit

Permalink
Merge hotfix branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gquerret committed Oct 20, 2019
2 parents 90fa5b8 + ffb4a94 commit 5c0a0db
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 53 deletions.
2 changes: 1 addition & 1 deletion database-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>

<name>OpenEdge database definition lexer and parser</name>
<description>OpenEdge dump files parser</description>
Expand Down
2 changes: 1 addition & 1 deletion listing-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>

<name>OpenEdge listing so-called parser</name>
<description>OpenEdge listing files parser</description>
Expand Down
6 changes: 3 additions & 3 deletions openedge-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>

<name>OpenEdge checks</name>
<description>OpenEdge checks</description>
Expand Down Expand Up @@ -54,12 +54,12 @@
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
Expand Down
8 changes: 4 additions & 4 deletions openedge-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
<packaging>sonar-plugin</packaging>

<name>OpenEdge plugin for SonarQube</name>
Expand Down Expand Up @@ -62,17 +62,17 @@
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;

import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.misc.ParseCancellationException;
Expand Down Expand Up @@ -82,7 +84,9 @@
import org.sonar.plugins.openedge.foundation.OpenEdgeRulesDefinition;
import org.sonar.plugins.openedge.foundation.OpenEdgeSettings;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import com.google.common.base.Joiner;
import com.google.common.base.Strings;
Expand All @@ -104,6 +108,7 @@ public class OpenEdgeProparseSensor implements Sensor {
private final DocumentBuilder dBuilder;
private final JAXBContext context;
private final Unmarshaller unmarshaller;
private final SAXParserFactory sax;

// File statistics
private int numFiles;
Expand All @@ -126,12 +131,14 @@ public class OpenEdgeProparseSensor implements Sensor {
public OpenEdgeProparseSensor(OpenEdgeSettings settings, OpenEdgeComponents components) {
this.settings = settings;
this.components = components;

dbFactory = DocumentBuilderFactory.newInstance();
sax = SAXParserFactory.newInstance();
sax.setNamespaceAware(false);

try {
dbFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dBuilder = dbFactory.newDocumentBuilder();
context = JAXBContext.newInstance(CrossReference.class);
context = JAXBContext.newInstance("com.progress.xref", CrossReference.class.getClassLoader());
unmarshaller = context.createUnmarshaller();
} catch (ParserConfigurationException | JAXBException caught) {
throw new IllegalStateException(caught);
Expand Down Expand Up @@ -214,7 +221,6 @@ private Document parseXREF(File xrefFile) {
doc = dBuilder.parse(
settings.useXrefFilter() ? new InvalidXMLFilterStream(settings.getXrefBytes(), inpStream) : inpStream);
xmlParseTime += (System.currentTimeMillis() - startTime);
numXREF++;
} catch (SAXException | IOException caught) {
LOG.error("Unable to parse XREF file " + xrefFile.getAbsolutePath(), caught);
}
Expand All @@ -229,11 +235,14 @@ private CrossReference jaxbXREF(File xrefFile) {
LOG.debug("Parsing XML XREF file {}", xrefFile.getAbsolutePath());
try (InputStream inpStream = new FileInputStream(xrefFile)) {
long startTime = System.currentTimeMillis();
doc = (CrossReference) unmarshaller.unmarshal(
InputSource is = new InputSource(
settings.useXrefFilter() ? new InvalidXMLFilterStream(settings.getXrefBytes(), inpStream) : inpStream);
XMLReader reader = sax.newSAXParser().getXMLReader();
SAXSource source = new SAXSource(reader, is);
doc = (CrossReference) unmarshaller.unmarshal(source);
xmlParseTime += (System.currentTimeMillis() - startTime);
numXREF++;
} catch (JAXBException | IOException caught) {
} catch (JAXBException | SAXException | ParserConfigurationException | IOException caught) {
LOG.error("Unable to parse XREF file " + xrefFile.getAbsolutePath(), caught);
}
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>eu.rssw</groupId>
<artifactId>sonar-openedge</artifactId>
<packaging>pom</packaging>
<version>2.6.1</version>
<version>2.6.2</version>
<name>OpenEdge plugin for SonarQube</name>
<url>http://www.riverside-software.fr/</url>
<description>Open source code analysis for OpenEdge</description>
Expand Down
2 changes: 1 addition & 1 deletion profiler-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>

<name>OpenEdge profiler output lexer and parser</name>
<description>OpenEdge profiler files parser</description>
Expand Down
4 changes: 2 additions & 2 deletions proparse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>

<name>Proparse</name>
<description>ABL code parser</description>
Expand Down Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
Expand Down
4 changes: 1 addition & 3 deletions proparse/src/main/java/com/progress/xref/CrossReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"source"
})
@XmlType(name = "", propOrder = {"source"})
@XmlRootElement(name = "Cross-reference")
public class CrossReference {

Expand Down
24 changes: 0 additions & 24 deletions proparse/src/main/java/com/progress/xref/package-info.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ public static void attachXrefToTreeParser(ProgramRootNode root, CrossReference x
&& ((src.getFileNum() == 1 && recNode.getFileIndex() == 0)
|| Files.isSameFile(srcFile.toPath(), new File(recNode.getStatement().getFileName()).toPath()))) {
recNode.setLink(IConstants.WHOLE_INDEX, "WHOLE-INDEX".equals(ref.getDetail()));
recNode.setLink(IConstants.SEARCH_INDEX_NAME, ref.getObjectContext());
recNode.setLink(IConstants.SEARCH_INDEX_NAME,
recNode.getTableBuffer().getTable().getName() + "." + ref.getObjectContext());
lFound = true;
break;
}
Expand Down
25 changes: 19 additions & 6 deletions proparse/src/test/java/org/prorefactor/core/JPNodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;

import org.prorefactor.core.nodetypes.RecordNameNode;
import org.prorefactor.core.util.UnitTestModule;
Expand All @@ -39,6 +42,9 @@
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import com.google.inject.Guice;
import com.google.inject.Injector;
Expand Down Expand Up @@ -68,7 +74,7 @@ public class JPNodeTest {
@BeforeTest
public void setUp() throws IOException, InvalidRCodeException {
try {
context = JAXBContext.newInstance(CrossReference.class);
context = JAXBContext.newInstance("com.progress.xref", this.getClass().getClassLoader());
unmarshaller = context.createUnmarshaller();
} catch (JAXBException caught) {
throw new IllegalStateException(caught);
Expand Down Expand Up @@ -347,10 +353,17 @@ public void testFormatPhrase() {
}

@Test
public void testXref01() throws JAXBException, IOException {
public void testXref01() throws JAXBException, IOException, SAXException, ParserConfigurationException {
ParseUnit unit = genericTest("xref.p");
unit.treeParser01();
CrossReference doc = (CrossReference) unmarshaller.unmarshal(new FileInputStream(SRC_DIR + "/xref.p.xref"));

InputSource is = new InputSource(new FileInputStream(SRC_DIR + "/xref.p.xref"));
SAXParserFactory sax = SAXParserFactory.newInstance();
sax.setNamespaceAware(false);
XMLReader reader = sax.newSAXParser().getXMLReader();
SAXSource source = new SAXSource(reader, is);

CrossReference doc = (CrossReference) unmarshaller.unmarshal(source);
unit.attachXref(doc);

List<JPNode> nodes = unit.getTopNode().query(ABLNodeType.RECORD_NAME);
Expand All @@ -360,14 +373,14 @@ public void testXref01() throws JAXBException, IOException {
RecordNameNode item = (RecordNameNode) nodes.get(2);

assertEquals(warehouse.getLink(IConstants.WHOLE_INDEX), Boolean.TRUE);
assertEquals(warehouse.getLink(IConstants.SEARCH_INDEX_NAME), "warehousenum");
assertEquals(warehouse.getLink(IConstants.SEARCH_INDEX_NAME), "Warehouse.warehousenum");

assertEquals(customer.getLink(IConstants.WHOLE_INDEX), Boolean.FALSE);
assertEquals(customer.getLink(IConstants.SEARCH_INDEX_NAME), "CountryPost");
assertEquals(customer.getLink(IConstants.SEARCH_INDEX_NAME), "Customer.CountryPost");
assertEquals(customer.getLink(IConstants.SORT_ACCESS), "Address");

assertEquals(item.getLink(IConstants.WHOLE_INDEX), Boolean.TRUE);
assertEquals(item.getLink(IConstants.SEARCH_INDEX_NAME), "ItemNum");
assertEquals(item.getLink(IConstants.SEARCH_INDEX_NAME), "Item.ItemNum");
}

}
2 changes: 1 addition & 1 deletion rcode-reader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>

<name>rcode-reader</name>
<description>rcode reader</description>
Expand Down

0 comments on commit 5c0a0db

Please sign in to comment.