Jump to content

updating protection table using p4java


  • Please log in to reply
1 reply to this topic

#1 Murugavel82



  • Members
  • Pip
  • 1 posts

Posted 27 November 2017 - 12:34 PM


I'm trying to update protection table using p4 java and here is what I tried

List<IProtectionEntry> updateList = new ArrayList<IProtectionEntry>();

where my update is  write group groupA * /depot/productA/...

Current protection is read group groupA * //depot/productA/...

Just trying to change the access from "read" to "write" but it is throwing an error

Exception in thread "main" com.perforce.p4java.exception.RequestException: Error in protect specification.
Can't delete last valid 'super' entry from protections table.

at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.handleErrorStr(ResultMapParser.java:134)
at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.parseCommandResultMapIfIsInfoMessageAsString(ResultMapParser.java:95)
at com.perforce.p4java.impl.mapbased.server.cmd.ProtectDelegator.createProtectionEntries(ProtectDelegator.java:40)
at com.perforce.p4java.impl.mapbased.server.cmd.ProtectDelegator.updateProtectionEntries(ProtectDelegator.java:46)
at com.perforce.p4java.impl.mapbased.server.Server.updateProtectionEntries(Server.java:2263)
at perforce.permission.main(permission.java:59)

#2 Sambwise


    Advanced Member

  • Members
  • PipPipPip
  • 1120 posts

Posted 04 December 2017 - 04:02 PM

I'm not positive, but it sounds like the "update" method might actually be a "replace", and it's catching you before you replace your entire protection table with one that locks you out.  You should probably start your updateList with the current protections list and then modify the appropriate entry before writing it back out.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users