@@ -3952,16 +3952,25 @@ protected Revision parseRevision(String xml, String title)
39523952
39533953 // summary
39543954 String summary = null , parsedsummary = null ;
3955+ boolean commentdeleted = xml .contains ("commenthidden=\" " );
39553956 if (xml .contains ("comment=\" " ))
39563957 {
39573958 summary = parseAttribute (xml , "comment" , 0 );
39583959 parsedsummary = parseAttribute (xml , "parsedcomment" , 0 );
39593960 }
3961+ else if (commentdeleted )
3962+ {
3963+ summary = Event .COMMENT_DELETED ;
3964+ parsedsummary = Event .COMMENT_DELETED ;
3965+ }
39603966
39613967 // user
39623968 String user2 = null ;
3969+ boolean userdeleted = xml .contains ("userhidden=\" " );
39633970 if (xml .contains ("user=\" " ))
39643971 user2 = parseAttribute (xml , "user" , 0 );
3972+ else if (userdeleted )
3973+ user2 = Event .USER_DELETED ;
39653974
39663975 // flags: minor, bot, new
39673976 boolean minor = xml .contains ("minor=\" \" " );
@@ -3977,10 +3986,18 @@ else if (xml.contains("size=\""))
39773986 else if (xml .contains ("len=\" " )) // deletedrevs
39783987 size = Integer .parseInt (parseAttribute (xml , "len" , 0 ));
39793988
3980- // sha1
3989+ // sha1/content
3990+ // Silly workaround: prop=revisions, prop=deletedrevisions,
3991+ // list=recentchanges and list=alldeletedrevisions all don't tell you
3992+ // whether content has been revision deleted until you fetch the content.
3993+ // Instead, fetch the SHA-1 of the content to minimize data transfer.
3994+ // list=usercontribs does tell you
39813995 String sha1 = null ;
3996+ boolean contentdeleted = xml .contains ("sha1hidden=\" " ) || xml .contains ("texthidden=\" " );
39823997 if (xml .contains ("sha1=\" " ))
39833998 sha1 = parseAttribute (xml , "sha1" , 0 );
3999+ else if (contentdeleted )
4000+ sha1 = Wiki .Event .CONTENT_DELETED ;
39844001
39854002 Revision revision = new Revision (oldid , timestamp , user2 , summary , parsedsummary , title , sha1 , minor , bot , rvnew , size );
39864003 // set rcid
@@ -4009,16 +4026,9 @@ else if (xml.contains("sizediff=\""))
40094026 revision .setTags (tags );
40104027
40114028 // revisiondelete
4012- revision .setCommentDeleted (xml .contains ("commenthidden=\" " ));
4013- revision .setUserDeleted (xml .contains ("userhidden=\" " ));
4014- // Silly workaround: prop=revisions, prop=deletedrevisions,
4015- // list=recentchanges and list=alldeletedrevisions all don't tell you
4016- // whether content has been revision deleted until you fetch the content.
4017- // Instead, fetch the SHA-1 of the content to minimize data transfer.
4018- revision .setContentDeleted (xml .contains ("sha1hidden=\" " ));
4019- // list=usercontribs does tell you
4020- if (xml .contains ("texthidden=\" " ))
4021- revision .setContentDeleted (true );
4029+ revision .setCommentDeleted (commentdeleted );
4030+ revision .setUserDeleted (userdeleted );
4031+ revision .setContentDeleted (contentdeleted );
40224032 return revision ;
40234033 }
40244034
@@ -6070,6 +6080,11 @@ else if (xml.contains("reason=\""))
60706080 reason = parseAttribute (xml , "reason" , 0 );
60716081 parsedreason = null ; // not available in list=blocks / getBlockList!
60726082 }
6083+ else if (reasonhidden )
6084+ {
6085+ reason = Wiki .Event .COMMENT_DELETED ;
6086+ parsedreason = Wiki .Event .COMMENT_DELETED ;
6087+ }
60736088 else
60746089 {
60756090 reason = parseAttribute (xml , "comment" , 0 );
@@ -6080,11 +6095,15 @@ else if (xml.contains("reason=\""))
60806095 boolean userhidden = xml .contains ("userhidden=\" \" " );
60816096 if (user == null && xml .contains ("user=\" " ))
60826097 user = parseAttribute (xml , "user" , 0 );
6098+ else if (userhidden )
6099+ user = Wiki .Event .USER_DELETED ;
60836100
60846101 // generic target name
60856102 // space is important -- commons.getImageHistory("File:Chief1.gif");
60866103 if (target == null && xml .contains (" title=\" " ))
60876104 target = parseAttribute (xml , "title" , 0 );
6105+ else if (actionhidden )
6106+ target = Wiki .Event .CONTENT_DELETED ;
60886107
60896108 OffsetDateTime timestamp = OffsetDateTime .parse (parseAttribute (xml , "timestamp" , 0 ));
60906109
@@ -6912,6 +6931,33 @@ public abstract class Event implements Comparable<Event>
69126931 private List <String > tags ;
69136932 private boolean commentDeleted = false , userDeleted = false ,
69146933 contentDeleted = false ;
6934+
6935+ /**
6936+ * Placeholder string for the event reason when it is RevisionDeleted
6937+ * without access. Currently null, but proposed to be changed to an
6938+ * illegal value in a future version to distinguish between different
6939+ * types of "comment not available".
6940+ * @since 0.38
6941+ */
6942+ protected static final String COMMENT_DELETED = null ;
6943+
6944+ /**
6945+ * Placeholder string for the event user when it is RevisionDeleted
6946+ * without access. Currently null, but proposed to be changed to an
6947+ * illegal value in a future version to distinguish between different
6948+ * types of "user not available".
6949+ * @since 0.38
6950+ */
6951+ protected static final String USER_DELETED = null ;
6952+
6953+ /**
6954+ * Placeholder string for event content when it is RevisionDeleted
6955+ * without access. Currently null, but proposed to be changed to an
6956+ * illegal value in a future version to distinguish between different
6957+ * types of "content not available".
6958+ * @since 0.38
6959+ */
6960+ protected static final String CONTENT_DELETED = null ;
69156961
69166962 /**
69176963 * Creates a new Event record.
0 commit comments