Skip to content

Commit 7746e81

Browse files
committed
Change indexOf() in favour of contains()
1 parent 8df10dc commit 7746e81

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

exist-core/src/main/java/org/exist/client/ClientFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ private synchronized void type(final KeyEvent e) {
652652
shell.setCaretPosition(doc.getLength());
653653
}
654654
}
655-
if (e.paramString().indexOf(Messages.getString("ClientFrame.93")) > Constants.STRING_NOT_FOUND) { //$NON-NLS-1$
655+
if (e.paramString().contains(Messages.getString("ClientFrame.93"))) { //$NON-NLS-1$
656656
if (shell.getCaretPosition() <= commandStart) {
657657
e.consume();
658658
}

exist-core/src/main/java/org/exist/http/Descriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public boolean allowSource(String path) {
293293
path = path.replace('\\', '/');
294294

295295
//does the path match the <allow-source><xquery path=""/></allow-source> path
296-
if ((s.equals(path)) || (path.indexOf(s) > -1)) {
296+
if ((s.equals(path)) || (path.contains(s))) {
297297
//yes, return true
298298
return (true);
299299
}

exist-core/src/main/java/org/exist/http/filter/GuestFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
9090
LOG.info("username [" + username + "]");
9191
LOG.info("requestURI [" + requestURI + "]");
9292

93-
if (requestURI.indexOf("/webdav/") >= 0) {
93+
if (requestURI.contains("/webdav/")) {
9494
if (username != null && username.equalsIgnoreCase("guest")) {
9595
LOG.info("Permission denied to : " + requestURI);
9696
httpServletResponse.sendError(HttpServletResponse.SC_FORBIDDEN);

exist-core/src/main/java/org/exist/http/filter/PathFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
9999
LOG.info("queryString = [" + queryString + "]");
100100
LOG.info("method = [" + httpServletRequest.getMethod() + "]");
101101

102-
if ((queryString != null && queryString.indexOf("_query=") >= 0) && filterNames.contains(TEST_GET_QUERY)) {
102+
if ((queryString != null && queryString.contains("_query=")) && filterNames.contains(TEST_GET_QUERY)) {
103103
LOG.info(TEST_GET_QUERY + " met");
104104
conditionMet = true;
105-
} else if (requestURI != null && requestURI.indexOf("/rest/") >= 0 && filterNames.contains(TEST_REST)) {
105+
} else if (requestURI != null && requestURI.contains("/rest/") && filterNames.contains(TEST_REST)) {
106106
conditionMet = true;
107107
LOG.info(TEST_REST + " met");
108108
} else if (httpServletRequest.getMethod().equalsIgnoreCase("PUT") && filterNames.contains(TEST_PUT)) {

exist-core/src/main/java/org/exist/util/Configuration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,10 +1475,10 @@ private void configureValidation( final Optional<Path> dbHome, Document doc, Ele
14751475
if( uri != null ) { // when uri attribute is filled in
14761476

14771477
// Substitute string, creating an uri from a local file
1478-
if( uri.indexOf( "${WEBAPP_HOME}" ) != -1 ) {
1478+
if(uri.contains("${WEBAPP_HOME}")) {
14791479
uri = uri.replaceAll( "\\$\\{WEBAPP_HOME\\}", webappHome.toUri().toString() );
14801480
}
1481-
if( uri.indexOf( "${EXIST_HOME}" ) != -1 ) {
1481+
if(uri.contains("${EXIST_HOME}")) {
14821482
uri = uri.replaceAll( "\\$\\{EXIST_HOME\\}", dbHome.toString() );
14831483
}
14841484

exist-core/src/main/java/org/exist/xquery/DynamicPIConstructor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathExc
119119
buf.deleteCharAt(0);
120120
contentString = buf.toString();
121121
}
122-
if (contentString.indexOf("?>") != Constants.STRING_NOT_FOUND)
122+
if (contentString.contains("?>"))
123123
{throw new XPathException(this, ErrorCodes.XQDY0026, contentString + "' is not a valid processing intruction content", contentSeq);}
124124
final int nodeNo = builder.processingInstruction(nameSeq.getStringValue(), contentString);
125125
final Sequence result = ((DocumentImpl)builder.getDocument()).getNode(nodeNo);

0 commit comments

Comments
 (0)