[
https://issues.jboss.org/browse/DROOLS-240?page=com.atlassian.jira.plugin...
]
Demian Calcaprina commented on DROOLS-240:
------------------------------------------
I also made a test using java.net.URLConnection that reproduces the issue:
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import org.codehaus.plexus.util.Base64;
public class UrlTest {
public static void main(String[] args) {
try {
String webPage =
"http://localhost:8080/drools-/guvnor/rest/packages/myrule/binary";
String name = "admin";
String password = "admin";
String authString = name + ":" + password;
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String authStringEnc = new String(authEncBytes);
URL url = new URL(webPage);
URLConnection urlConnection = url.openConnection();
((HttpURLConnection) urlConnection).setRequestMethod( "HEAD" );
//If you comment the next line, last modified will return 0!
urlConnection.setRequestProperty("Authorization", "Basic " +
authStringEnc);
System.out.println(urlConnection.getLastModified());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
ResourceChangeScanner not removing UrlResources
-----------------------------------------------
Key: DROOLS-240
URL:
https://issues.jboss.org/browse/DROOLS-240
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 5.5.0.Final
Environment: java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
Reporter: Demian Calcaprina
Assignee: Mark Proctor
Priority: Critical
I am seing that the resources in the KnowledgeBase are being deleted without aparent
reason.
I have some URL resources configured to get it from guvnor using the basic auth.
It seems this method,
https://github.com/droolsjbpm/drools/blob/5.5.x/drools-core/src/main/java...
is not including auth parameters to get the last modified date from the resource url.
This is causing (in my environment), to get last modified date as 0, and this makes the
ResourceChangeScanner to remove the resource from the kbase. I made the fix and seems to
work fine in my machine.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira