Permalink
Browse files

Updated MG4J version to 5.2.1.

Fixed owlapi dependencies.
Fix Paranoid ticket 6739626. (Stack trace/Information Disclosure issue)
  • Loading branch information...
1 parent aba623e commit 87a9db2d57dea20281510a5ce936d0181295d25d @Timpy Timpy committed Jan 15, 2014
View
@@ -22,8 +22,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
</configuration>
</plugin>
<plugin>
@@ -60,17 +60,21 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.semanticweb.yars</groupId>
<artifactId>nxparser</artifactId>
<version>1.2.strictNulls-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>it.unimi.di.big</groupId>
- <artifactId>mg4j</artifactId>
- <version>5.1</version>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+ <dependency>
+ <groupId>it.unimi.di</groupId>
+ <artifactId>mg4j-big</artifactId>
+ <version>5.2.1</version>
<exclusions>
<exclusion>
<artifactId>jetty</artifactId>
@@ -81,8 +85,8 @@
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
- <artifactId>org.apache.hadoop</artifactId>
- <groupId>hadoop-core</groupId>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-core</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -113,7 +117,12 @@
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
- <artifactId>owlapi</artifactId>
+ <artifactId>owlapi-api</artifactId>
+ <version>3.3</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.owlapi</groupId>
+ <artifactId>owlapi-apibinding</artifactId>
<version>3.3</version>
</dependency>
<dependency>
@@ -17,6 +17,7 @@
import it.unimi.di.big.mg4j.query.nodes.AbstractQueryBuilderVisitor;
import it.unimi.di.big.mg4j.query.nodes.Align;
import it.unimi.di.big.mg4j.query.nodes.And;
+import it.unimi.di.big.mg4j.query.nodes.Annotation;
import it.unimi.di.big.mg4j.query.nodes.Consecutive;
import it.unimi.di.big.mg4j.query.nodes.Difference;
import it.unimi.di.big.mg4j.query.nodes.False;
@@ -344,5 +345,10 @@ public Query visitPost(Weight node, Query subNode) throws QueryBuilderVisitorExc
public MyVisitor copy() {
return new MyVisitor();
}
+
+ @Override
+ public Query visitPost(Annotation node, Query subNode) throws QueryBuilderVisitorException {
+ return new Annotation( subNode );
+ }
}
}
@@ -137,7 +137,8 @@ private QueryResultItem createRdfResultItem(RDFIndex index, long docId, double s
BySubjectRecord record = new BySubjectRecord();
if (!record.parse(new InputStreamReader(docInputStream))) {
- throw new RuntimeException("Couldn't parse doc with id:" + docId);
+ return null;
+ // throw new RuntimeException("Couldn't parse doc with id:" + docId);
}
if (docId != record.getId()) {
@@ -18,6 +18,7 @@
import java.io.IOException;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -30,6 +31,8 @@
import org.apache.log4j.Logger;
import org.springframework.http.converter.HttpMessageConversionException;
import org.springframework.stereotype.Controller;
+import org.springframework.validation.BindException;
+import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -123,7 +126,7 @@ public RDFIndex getIndex(@RequestParam(required = false) String index) {
try {
id = Long.parseLong(idOrSubject);
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Query " + query + " failed to parse as a numeric subject ID(int)");
+ throw new IllegalArgumentException("Query " + query + " failed to parse as a numeric subject ID.");
}
} else {
id = index.getSubjectId(idOrSubject);
@@ -153,8 +156,15 @@ public RDFIndex getIndex(@RequestParam(required = false) String index) {
if (!(ex instanceof HttpMessageConversionException)) {
LOGGER.error("Exception when processing:" + request.getQueryString(), ex);
}
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return Collections.singletonMap(OBJECT_KEY, ex.getMessage());
+ if (ex instanceof IllegalArgumentException) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return Collections.singletonMap(OBJECT_KEY, ex.getMessage());
+ } else if (ex instanceof BindException) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ List<FieldError> errors = ((BindException) ex).getFieldErrors();
+ return Collections.singletonMap(OBJECT_KEY, "Error binding on parameter:" + errors.get(0).getField());
+ }
+ throw new RuntimeException(ex);
}
private static String decodeEntities(String query) {
@@ -0,0 +1 @@
+[ "\nHTTP page not found error - 404.\nOops, sorry!" ]
@@ -0,0 +1 @@
+[ "\nHTTP Internal server error - 500.\nOops, sorry!" ]
@@ -12,7 +12,7 @@
<servlet-name>glimmer</servlet-name>
<url-pattern>/ajax/*</url-pattern>
</servlet-mapping>
-
+
<servlet-mapping>
<servlet-name>glimmer</servlet-name>
<url-pattern>/v1/search</url-pattern>
@@ -25,4 +25,14 @@
<session-config>
<session-timeout>60</session-timeout>
</session-config>
+
+ <error-page>
+ <error-code>404</error-code>
+ <location>/404.json</location>
+ </error-page>
+
+ <error-page>
+ <error-code>500</error-code>
+ <location>/500.json</location>
+ </error-page>
</web-app>

0 comments on commit 87a9db2

Please sign in to comment.