Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MediaWiki versions #34

Closed
lorinczz opened this issue Oct 13, 2014 · 19 comments
Closed

Update MediaWiki versions #34

lorinczz opened this issue Oct 13, 2014 · 19 comments
Assignees
Milestone

Comments

@lorinczz
Copy link

Add 1.24 and 1.25 to the available versions and issue warning if the version is unknown.

@eldur
Copy link
Owner

eldur commented Oct 13, 2014

Can you give me the warning message?
btw: 1.24 and 1.25 aren't released versions of mediawiki

@lorinczz
Copy link
Author

"Unknown MediaWiki version"
The current live version is 1.25:
http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&format=jsonfm

@eldur
Copy link
Owner

eldur commented Oct 14, 2014

Sorry I tried to find your warning message in the sources, to remove it completely.

I tried git ls-files | egrep -v "Test" | xargs egrep "\.warn\(" with no result.

The best match, in case of version logging, I found at GetVersion.java ... but it is a debug logging.

My warning messages look like the following one - do you have a similar line, or a classname of the logger where the warning was logged?

2014-10-13 00:23:57,544 [main] WARN  n.s.j.m.a.e.PostDelete - The page you requested doesn't exist

@lorinczz
Copy link
Author

The warning message doesn't exist. I ask you to throw warning if the version resolves to UNKNOWN. I don't understand why is this necessary. UA should contain the version of the library not the MediaWiki version. I get "Version unknown" warning for UA.

@eldur
Copy link
Owner

eldur commented Oct 14, 2014

I assume UA means User Agent and you try to pass a version of your tool to mediawiki's api - correct?

What do you think about a code example to explain where we have a problem or what can be improved?

@lorinczz
Copy link
Author

I run the example code from the main page:

    public static void main(String[] args) {
        MediaWikiBot wikiBot = new MediaWikiBot("https://en.wikipedia.org/w/");
        Article article = wikiBot.getArticle("42");
        System.out.println(article.getText().substring(5, 42));
    }

and I get:
[main] WARN net.sourceforge.jwbf.core.actions.HttpActionClient - "Version unknown" was changed to "Version_unknown"; because of User-Agent name/version rules

@lorinczz
Copy link
Author

Instead of "JWBF/Version unknown" the UA could default to "JWBF/3.0.0-SNAPSHOT" if I use that snapshot. I can't figure out what is the problem. I get this warning only for a while.

@lorinczz
Copy link
Author

Managed to checkout the project. Running

    public static void main(String[] args) {
        System.out.println(new MediaWikiBot("http://en.wikipedia.org/w/").getVersion());
    }

with System.out.println(makeUserAgentString(userAgentParts)); got
2014-10-15 21:54:25,097 [main] WARN n.s.j.c.a.HttpActionClient - "Version unknown" was changed to "Version_unknown"; because of User-Agent name/version rules
Unknown/Unknown JWBF/Version_unknown Apache-HttpClient/4.3.4 (java 1.5)
DEVELOPMENT

@eldur
Copy link
Owner

eldur commented Oct 15, 2014

I got it, this warning has nothing to do with current mediawiki version. Give me a moment

@eldur eldur self-assigned this Oct 15, 2014
@eldur eldur added this to the 3.0 milestone Oct 15, 2014
@eldur
Copy link
Owner

eldur commented Oct 15, 2014

The problem was, if you work with a development version of jwbf there is no versionconfig defined, so its is difficult to say This is JWBF/3.0.0-${git scm id} so I used the fallback value "Version unknown". "Version unknown" contains a space and this triggers the warning.

I've added a test and removed the space. Thanks for the hint.

btw: If you work with regular build snapshot, based on a public github commit there will be no warning 😉 -- see Developer resources

(You can ignore this particular warning - I think I'll push a fix tomorrow)

@eldur
Copy link
Owner

eldur commented Oct 16, 2014

I tend to close this task -- can you confirm that the warning is absent?

@lorinczz
Copy link
Author

Yes, the warning message has gone.
Thank you.

@lorinczz
Copy link
Author

Two tests fail because of this.

@eldur
Copy link
Owner

eldur commented Oct 20, 2014

Which?
At Travis no test failed - https://travis-ci.org/eldur/jwbf

@lorinczz
Copy link
Author

HttpActionClientTest.testGet_headers_customUserAgent
HttpActionClientTest.testPostParameters
because of "Version unknown" in userAgentString method.

@eldur
Copy link
Owner

eldur commented Oct 20, 2014

Can you give me the assertion message / exception too? I can't reproduce it at my local testsetup.

try to run mvn clean test

expected:

Connection=keep-alive
Content-Length=???
Content-Type=multipart/form-data; boundary=????
Host=localhost:????
User-Agent=Unknown/Unknown JWBF/DEVEL Apache-HttpClient/4.3.4 (java 1.5)

actual:

...

@lorinczz
Copy link
Author

Instead of DEVEL is "Version unknown" and Version_unknown.

@eldur
Copy link
Owner

eldur commented Oct 21, 2014

You are right, this can happen. I'll fix it tomorrow.

@eldur
Copy link
Owner

eldur commented Oct 25, 2014

I've created an new issue for this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants