rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { | IObject[] candidates = em.getLockCandidates(iObject); for (IObject object : candidates) { | public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return; Set<IObject> s = new HashSet<IObject>(); if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { s.add(object); // TODO NEED TO CHECK FOR OWNERSHIP etc. etc. } CurrentDetails.appendLockCandidates( s ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
CurrentDetails.appendLockCandidates( s ); | CurrentDetails.appendLockCandidates(s); | public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return; Set<IObject> s = new HashSet<IObject>(); if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { s.add(object); // TODO NEED TO CHECK FOR OWNERSHIP etc. etc. } CurrentDetails.appendLockCandidates( s ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public Collection<Long> memberOfGroups() { | public Collection<Long> memberOfGroups() { | public Collection<Long> memberOfGroups() { checkReady("memberOfGroups"); return CurrentDetails.getMemberOfGroups(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void newEvent( EventType type ) { CurrentDetails.newEvent( type, token ); | public void newEvent(EventType type) { CurrentDetails.newEvent(type, token); | public void newEvent( EventType type ) { CurrentDetails.newEvent( type, token ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void runAsAdmin( AdminAction action ) { | public void runAsAdmin(AdminAction action) { | public void runAsAdmin( AdminAction action ) { Assert.notNull(action); CurrentDetails.setAdmin(true); try { action.runAsAdmin(); } finally { CurrentDetails.setAdmin(false); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
try { | try { | public void runAsAdmin( AdminAction action ) { Assert.notNull(action); CurrentDetails.setAdmin(true); try { action.runAsAdmin(); } finally { CurrentDetails.setAdmin(false); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void setCurrentDetails() { | public void setCurrentDetails() { | public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
||
if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); | if (ec == null) throw new InternalException( "EventContext is null in EventContext. Invalid configuration."); | public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
final Principal p = ec.getPrincipal(); final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); | if (ec.getPrincipal() == null) throw new InternalException( "Principal is null in EventContext. Security system failure."); | public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); | if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); | public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); | final Principal p = ec.getPrincipal(); | public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } | public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
|
} | final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); List<Long> memberOfGroupsIds = exp .eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class, p .getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type, token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.", ex); setCurrentEvent(event); } } | public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void setCurrentEvent( Event event ) { CurrentDetails.setCreationEvent( event ); | public void setCurrentEvent(Event event) { CurrentDetails.setCreationEvent(event); | public void setCurrentEvent( Event event ) { CurrentDetails.setCreationEvent( event ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public final void setExtendedMetadata( ExtendedMetadata metadata ) { if ( this.em != null ) throw new InternalException( "Cannot reset metadata." ); | public final void setExtendedMetadata(ExtendedMetadata metadata) { if (this.em != null) throw new InternalException("Cannot reset metadata."); | public final void setExtendedMetadata( ExtendedMetadata metadata ) { if ( this.em != null ) throw new InternalException( "Cannot reset metadata." ); this.em = metadata; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void throwCreationViolation( IObject iObject ) throws SecurityViolation { | public void throwCreationViolation(IObject iObject) throws SecurityViolation { | public void throwCreationViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( iObject.getClass().getName() +" is a System-type, and may only be " +"created through privileged APIs."); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
throw new SecurityViolation( iObject.getClass().getName() +" is a System-type, and may only be " +"created through privileged APIs."); | throw new SecurityViolation(iObject.getClass().getName() + " is a System-type, and may only be " + "created through privileged APIs."); | public void throwCreationViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( iObject.getClass().getName() +" is a System-type, and may only be " +"created through privileged APIs."); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void throwDeleteViolation( IObject iObject ) throws SecurityViolation { | public void throwDeleteViolation(IObject iObject) throws SecurityViolation { | public void throwDeleteViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Deleting "+iObject+" not allowed." ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
throw new SecurityViolation( "Deleting "+iObject+" not allowed." ); | throw new SecurityViolation("Deleting " + iObject + " not allowed."); | public void throwDeleteViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Deleting "+iObject+" not allowed." ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void throwLoadViolation( IObject iObject ) throws SecurityViolation { | public void throwLoadViolation(IObject iObject) throws SecurityViolation { | public void throwLoadViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Cannot read "+iObject.getClass().getName()); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
throw new SecurityViolation( "Cannot read "+iObject.getClass().getName()); | throw new SecurityViolation("Cannot read " + iObject.getClass().getName()); | public void throwLoadViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Cannot read "+iObject.getClass().getName()); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public void throwUpdateViolation( IObject iObject ) throws SecurityViolation { | public void throwUpdateViolation(IObject iObject) throws SecurityViolation { | public void throwUpdateViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Updating "+iObject+" not allowed." ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
throw new SecurityViolation( "Updating "+iObject+" not allowed." ); | throw new SecurityViolation("Updating " + iObject + " not allowed."); | public void throwUpdateViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Updating "+iObject+" not allowed." ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); | public Details transientDetails(IObject obj) { | public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
if ( source != null ) { | checkReady("transientDetails"); | public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } | if (hasPrivilegedToken(obj)) return obj.getDetails(); | public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } | Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); | public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
return newDetails; | if (source != null) { | public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
} | copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } | public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java |
return isAdminHolder.get() == null ? false : isAdminHolder.get().booleanValue(); | return data.get().isAdmin; | public static boolean isAdmin( ) { return isAdminHolder.get() == null ? false : isAdminHolder.get().booleanValue(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
Set<String> s = disabledSubsystemsHolder.get( ); | Set<String> s = data.get().disabledSubsystems; | public static boolean addAllDisabled(String...ids) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s == null ) { s = new HashSet<String>(); disabledSubsystemsHolder.set( s ); } if (ids != null ) { return Collections.addAll(s, ids); } return false; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
disabledSubsystemsHolder.set( s ); | data.get().disabledSubsystems = s; | public static boolean addAllDisabled(String...ids) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s == null ) { s = new HashSet<String>(); disabledSubsystemsHolder.set( s ); } if (ids != null ) { return Collections.addAll(s, ids); } return false; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
disabledSubsystemsHolder.remove(); | data.get().disabledSubsystems = null; | public static void clearDisabled() { disabledSubsystemsHolder.remove(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
Set<String> s = disabledSubsystemsHolder.get( ); | Set<String> s = data.get().disabledSubsystems; | public static boolean removeAllDisabled(String...ids) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s != null && ids != null ) { boolean changed = false; for (String string : ids) { changed |= s.remove(string); } } return false; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
Set<String> s = disabledSubsystemsHolder.get( ); | Set<String> s = data.get().disabledSubsystems; | public static boolean isDisabled(String id) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s == null || id == null || ! s.contains(id)) return false; return true; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
Collection<Long> c = leaderOfGroupsHolder.get(); | Collection<Long> c = data.get().leaderOfGroups; | public static Collection<Long> getLeaderOfGroups( ) { Collection<Long> c = leaderOfGroupsHolder.get(); if ( c == null || c.size() == 0 ) { c = Collections.singletonList(Long.MIN_VALUE); // FIXME hack as well. } return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
Set<IObject> s = lockCandidatesHolder.get(); | Set<IObject> s = data.get().lockCandidates; | public static Set<IObject> getLockCandidates() { Set<IObject> s = lockCandidatesHolder.get(); if ( s == null ) return new HashSet<IObject>(); return s; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
void markLockedIfNecessary( IObject iObject, Details trustedDetails ); | void markLockedIfNecessary( IObject iObject ); | void markLockedIfNecessary( IObject iObject, Details trustedDetails ); | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/SecuritySystem.java/buggy/components/server/src/ome/security/SecuritySystem.java |
Holder h = classNameHolder.get( iObject.getClass().getName() ); return h.getLockCandidates( iObject ); | Locks l = locksHolder.get( iObject.getClass().getName() ); return l.getLockCandidates( iObject ); | public IObject[] getLockCandidates( IObject iObject ) { if ( iObject == null ) return new IObject[]{}; Holder h = classNameHolder.get( iObject.getClass().getName() ); return h.getLockCandidates( iObject ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e30f801c3b2923483e1f69853136328bb21a1d79/ExtendedMetadata.java/buggy/components/server/src/ome/tools/hibernate/ExtendedMetadata.java |
Set<IObject> s = lockCandidatesHolder.get(); | Set<IObject> s = data.get().lockCandidates; | public static void appendLockCandidates( Set<IObject> set ) { Set<IObject> s = lockCandidatesHolder.get(); if ( s == null ) { s = new HashSet<IObject>( ); lockCandidatesHolder.set( s ); } s.addAll( set ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
lockCandidatesHolder.set( s ); | data.get().lockCandidates = s; | public static void appendLockCandidates( Set<IObject> set ) { Set<IObject> s = lockCandidatesHolder.get(); if ( s == null ) { s = new HashSet<IObject>( ); lockCandidatesHolder.set( s ); } s.addAll( set ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
Collection<Long> c = memberOfGroupsHolder.get(); | Collection<Long> c = data.get().memberOfGroups; | public static Collection<Long> getMemberOfGroups( ) { Collection<Long> c = memberOfGroupsHolder.get(); if ( c == null || c.size() == 0 ) { c = Collections.singletonList(Long.MIN_VALUE); // FIXME hack as well. } return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
isAdminHolder.set( Boolean.valueOf(isAdmin)); | data.get().isAdmin = isAdmin; | public static void setAdmin( boolean isAdmin ) { isAdminHolder.set( Boolean.valueOf(isAdmin)); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
memberOfGroupsHolder.set( groupIds ); | data.get().memberOfGroups = groupIds; | public static void setMemberOfGroups( Collection<Long> groupIds ) { memberOfGroupsHolder.set( groupIds ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
leaderOfGroupsHolder.set( groupIds ); | data.get().leaderOfGroups = groupIds; | public static void setLeaderOfGroups( Collection<Long> groupIds ) { leaderOfGroupsHolder.set( groupIds ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e6b7ac4062ce844e31078de77a00a7ab77e5e5d5/CurrentDetails.java/buggy/components/server/src/ome/security/CurrentDetails.java |
public void accept(TreeImageDisplayVisitor visitor, int algoType) | public void accept(TreeImageDisplayVisitor visitor) | public void accept(TreeImageDisplayVisitor visitor, int algoType) { if (visitor == null) throw new NullPointerException("No visitor."); if (!checkAlgoType(algoType)) throw new IllegalArgumentException("Algorithm not supported."); Iterator i = childrenDisplay.iterator(); TreeImageDisplay child; switch (algoType) { case TreeImageDisplayVisitor.TREEIMAGE_NODE_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } if (this instanceof TreeImageNode) doAccept(visitor); break; case TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); if (child instanceof TreeImageSet) child.accept(visitor, algoType); } if (this instanceof TreeImageSet) doAccept(visitor); break; case TreeImageDisplayVisitor.ALL_NODES: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } doAccept(visitor); break; } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/146920a8791fff71320ced0f240b9d8f3d319a13/TreeImageDisplay.java/buggy/SRC/org/openmicroscopy/shoola/agents/treeviewer/browser/TreeImageDisplay.java |
if (!checkAlgoType(algoType)) throw new IllegalArgumentException("Algorithm not supported."); Iterator i = childrenDisplay.iterator(); TreeImageDisplay child; switch (algoType) { case TreeImageDisplayVisitor.TREEIMAGE_NODE_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } if (this instanceof TreeImageNode) doAccept(visitor); break; case TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); if (child instanceof TreeImageSet) child.accept(visitor, algoType); } if (this instanceof TreeImageSet) doAccept(visitor); break; case TreeImageDisplayVisitor.ALL_NODES: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } doAccept(visitor); break; } | accept(visitor, TreeImageDisplayVisitor.ALL_NODES); | public void accept(TreeImageDisplayVisitor visitor, int algoType) { if (visitor == null) throw new NullPointerException("No visitor."); if (!checkAlgoType(algoType)) throw new IllegalArgumentException("Algorithm not supported."); Iterator i = childrenDisplay.iterator(); TreeImageDisplay child; switch (algoType) { case TreeImageDisplayVisitor.TREEIMAGE_NODE_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } if (this instanceof TreeImageNode) doAccept(visitor); break; case TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); if (child instanceof TreeImageSet) child.accept(visitor, algoType); } if (this instanceof TreeImageSet) doAccept(visitor); break; case TreeImageDisplayVisitor.ALL_NODES: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } doAccept(visitor); break; } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/146920a8791fff71320ced0f240b9d8f3d319a13/TreeImageDisplay.java/buggy/SRC/org/openmicroscopy/shoola/agents/treeviewer/browser/TreeImageDisplay.java |
data.setName(summary.getName()); tdm.getAttributeMap().putAttribute(pix); | public void run() { addLoaderThread(controller,this); int count = 1; int total = refList.size(); for(Iterator iter = refList.iterator(); (iter.hasNext() && !kill);) { ImageSummary summary = (ImageSummary)iter.next(); try { Pixels pix = summary.getDefaultPixels().getPixels(); Image image = ps.getThumbnail(pix); ImageData data = new ImageData(); data.setID(pix.getID()); ThumbnailDataModel tdm = new ThumbnailDataModel(data); // TODO: figure out strategy for adding attributes. do it here? final Thumbnail t = new Thumbnail(image,tdm); final int theCount = count; final int theTotal = total; Runnable addTask = new Runnable() { public void run() { model.addThumbnail(t); String message = ProgressMessageFormatter.format("Loaded image %n of %t...", theCount,theTotal); status.processAdvanced(message); } }; SwingUtilities.invokeLater(addTask); count++; } catch(ImageServerException ise) { UserNotifier un = registry.getUserNotifier(); un.notifyError("ImageServer Error",ise.getMessage(),ise); status.processFailed("Error loading images."); return; } } if(!kill) { Runnable finalTask = new Runnable() { public void run() { status.processSucceeded("All images loaded."); } }; SwingUtilities.invokeLater(finalTask); return; } removeLoaderThread(controller,this); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ad867bc3f360d4a9ce481731c0723126b9112b54/BrowserAgent.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/BrowserAgent.java |
|
if(heatMapManager != null) { manager.addSelectionListener(heatMapManager); } if(colorMapManager != null) { manager.addSelectionListener(colorMapManager); } | public void setBrowserManager(BrowserManager manager) { this.browserManager = manager; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e83036080b3a8ade884eca150f3f3c2004b556c9/BrowserEnvironment.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/BrowserEnvironment.java |
|
public void setActiveBrowser(BrowserController browser) | public void setActiveBrowser(UIWrapper browser) | public void setActiveBrowser(BrowserController browser) { synchronized(browserList) // will this lock? { int prevIndex = browserList.indexOf(browser)+1; browserList.add(0,browser); browserList.remove(prevIndex); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a74dcf148f6dd7ae6d4c17a9e0406afba262a755/BrowserManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/BrowserManager.java |
defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); | to50Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); | public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9ad2d2709e2cdefc9a414f2e51f6a883a2403c7a/PaletteFactory.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/PaletteFactory.java |
defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, | to75Actions.setMouseClickAction(PiccoloModifiers.NORMAL, | public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9ad2d2709e2cdefc9a414f2e51f6a883a2403c7a/PaletteFactory.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/PaletteFactory.java |
defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, | to100Actions.setMouseClickAction(PiccoloModifiers.NORMAL, | public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9ad2d2709e2cdefc9a414f2e51f6a883a2403c7a/PaletteFactory.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/PaletteFactory.java |
defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, | to200Actions.setMouseClickAction(PiccoloModifiers.NORMAL, | public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9ad2d2709e2cdefc9a414f2e51f6a883a2403c7a/PaletteFactory.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/PaletteFactory.java |
to50Icon.setMouseDownActions(to200Actions); | to200Icon.setMouseDownActions(to200Actions); | public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9ad2d2709e2cdefc9a414f2e51f6a883a2403c7a/PaletteFactory.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/PaletteFactory.java |
paletteStatusMap.put(palette,new Integer(PALETTE_HIDDEN)); | public void addPalette(String paletteName, BPalette palette) { if(paletteName == null || palette == null) { return; } paletteMap.put(paletteName,palette); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/913e45a73e803bf6a97dca24496a64546a51c9d5/BrowserTopModel.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/BrowserTopModel.java |
|
public void addBrowser(BrowserController browser) | public void addBrowser(UIWrapper browser) | public void addBrowser(BrowserController browser) { if (browser != null) { browserList.add(0,browser); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a74dcf148f6dd7ae6d4c17a9e0406afba262a755/BrowserManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/BrowserManager.java |
public DatasetData retrieveDataset(int datasetID) | public DatasetData retrieveDataset(int datasetID, DatasetData retVal) | public DatasetData retrieveDataset(int datasetID) throws DSOutOfServiceException, DSAccessException; | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java |
public BrowserController getBrowser(int index) | public UIWrapper getBrowser(int index) | public BrowserController getBrowser(int index) { try { return (BrowserController) browserList.get(index); } catch (Exception e) { // TODO: log message here return null; } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a74dcf148f6dd7ae6d4c17a9e0406afba262a755/BrowserManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/BrowserManager.java |
return (BrowserController) browserList.get(index); | return (UIWrapper) browserList.get(index); | public BrowserController getBrowser(int index) { try { return (BrowserController) browserList.get(index); } catch (Exception e) { // TODO: log message here return null; } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a74dcf148f6dd7ae6d4c17a9e0406afba262a755/BrowserManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/BrowserManager.java |
message.replaceAll("%n",String.valueOf(stepsComplete)); message.replaceAll("%t",String.valueOf(totalSteps)); | message = message.replaceAll("%n",String.valueOf(stepsComplete)); message = message.replaceAll("%t",String.valueOf(totalSteps)); | public static String format(String message, int stepsComplete, int totalSteps) { message.replaceAll("%n",String.valueOf(stepsComplete)); message.replaceAll("%t",String.valueOf(totalSteps)); return message; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/b430f8c6bd05687b350e025694f7e1b08ab0c3ff/ProgressMessageFormatter.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/datamodel/ProgressMessageFormatter.java |
if (file.isDirectory()) | if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) | private void addInstrumentation(File file) { if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); return; } if (!isClass(file)) { return; } if (logger.isDebugEnabled()) { logger.debug("instrumenting " + file.getAbsolutePath()); } InputStream inputStream = null; ClassWriter cw; ClassInstrumenter cv; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); cw = new ClassWriter(true); cv = new ClassInstrumenter(projectData, cw, ignoreRegexp); cr.accept(cv, false); } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } OutputStream outputStream = null; try { if (cv.isInstrumented()) { // If destinationDirectory is null, then overwrite // the original, uninstrumented file. File outputFile; if (destinationDirectory == null) outputFile = file; else outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); File parentFile = outputFile.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } byte[] instrumentedClass = cw.toByteArray(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/6febec9638071e32d498b4bd4a149cb4872b0993/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java |
return; | private void addInstrumentation(File file) { if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); return; } if (!isClass(file)) { return; } if (logger.isDebugEnabled()) { logger.debug("instrumenting " + file.getAbsolutePath()); } InputStream inputStream = null; ClassWriter cw; ClassInstrumenter cv; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); cw = new ClassWriter(true); cv = new ClassInstrumenter(projectData, cw, ignoreRegexp); cr.accept(cv, false); } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } OutputStream outputStream = null; try { if (cv.isInstrumented()) { // If destinationDirectory is null, then overwrite // the original, uninstrumented file. File outputFile; if (destinationDirectory == null) outputFile = file; else outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); File parentFile = outputFile.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } byte[] instrumentedClass = cw.toByteArray(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/6febec9638071e32d498b4bd4a149cb4872b0993/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java |
|
if (!isClass(file)) | else if (isArchive(file)) | private void addInstrumentation(File file) { if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); return; } if (!isClass(file)) { return; } if (logger.isDebugEnabled()) { logger.debug("instrumenting " + file.getAbsolutePath()); } InputStream inputStream = null; ClassWriter cw; ClassInstrumenter cv; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); cw = new ClassWriter(true); cv = new ClassInstrumenter(projectData, cw, ignoreRegexp); cr.accept(cv, false); } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } OutputStream outputStream = null; try { if (cv.isInstrumented()) { // If destinationDirectory is null, then overwrite // the original, uninstrumented file. File outputFile; if (destinationDirectory == null) outputFile = file; else outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); File parentFile = outputFile.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } byte[] instrumentedClass = cw.toByteArray(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/6febec9638071e32d498b4bd4a149cb4872b0993/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java |
return; } if (logger.isDebugEnabled()) { logger.debug("instrumenting " + file.getAbsolutePath()); } InputStream inputStream = null; ClassWriter cw; ClassInstrumenter cv; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); cw = new ClassWriter(true); cv = new ClassInstrumenter(projectData, cw, ignoreRegexp); cr.accept(cv, false); } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } OutputStream outputStream = null; try { if (cv.isInstrumented()) { File outputFile; if (destinationDirectory == null) outputFile = file; else outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); File parentFile = outputFile.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } byte[] instrumentedClass = cw.toByteArray(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } | addInstrumentationToArchive(file); | private void addInstrumentation(File file) { if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); return; } if (!isClass(file)) { return; } if (logger.isDebugEnabled()) { logger.debug("instrumenting " + file.getAbsolutePath()); } InputStream inputStream = null; ClassWriter cw; ClassInstrumenter cv; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); cw = new ClassWriter(true); cv = new ClassInstrumenter(projectData, cw, ignoreRegexp); cr.accept(cv, false); } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } OutputStream outputStream = null; try { if (cv.isInstrumented()) { // If destinationDirectory is null, then overwrite // the original, uninstrumented file. File outputFile; if (destinationDirectory == null) outputFile = file; else outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); File parentFile = outputFile.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } byte[] instrumentedClass = cw.toByteArray(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn( "Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/6febec9638071e32d498b4bd4a149cb4872b0993/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java |
System.out.println("Instrument time: " + (stopTime - startTime) + "ms"); | System.out.println("Instrument time: " + (stopTime - startTime) + "ms"); | public static void main(String[] args) { long startTime = System.currentTimeMillis(); Main main = new Main(); boolean hasCommandsFile = false; String commandsFileName = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--commandsfile")) { hasCommandsFile = true; commandsFileName = args[++i]; } } if (hasCommandsFile) { List arglist = new ArrayList(); BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader( commandsFileName)); String line; while ((line = bufferedReader.readLine()) != null) arglist.add(line); } catch (IOException e) { logger.fatal("Unable to read temporary commands file " + commandsFileName + "."); logger.info(e); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { } } } args = (String[])arglist.toArray(new String[arglist.size()]); } main.parseArguments(args); long stopTime = System.currentTimeMillis(); System.out.println("Instrument time: " + (stopTime - startTime) + "ms"); } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/6febec9638071e32d498b4bd4a149cb4872b0993/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java |
Pattern ignoreRegexp) | final Collection ignoreRegexs) | public ClassInstrumenter(ProjectData projectData, final ClassVisitor cv, Pattern ignoreRegexp) { super(cv); this.projectData = projectData; this.ignoreRegex = ignoreRegexp; } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/ClassInstrumenter.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/ClassInstrumenter.java |
this.ignoreRegex = ignoreRegexp; | this.ignoreRegexs = ignoreRegexs; | public ClassInstrumenter(ProjectData projectData, final ClassVisitor cv, Pattern ignoreRegexp) { super(cv); this.projectData = projectData; this.ignoreRegex = ignoreRegexp; } | 50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/ClassInstrumenter.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/ClassInstrumenter.java |
return defineClassUnder(name, superClass, objectClass); | return defineClassUnder(name, superClass, objectClass.getCRef()); | public RubyClass defineClass(String name, RubyClass superClass) { return defineClassUnder(name, superClass, objectClass); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
public RubyClass defineClassUnder(String name, RubyClass superClass, RubyModule parentModule) { | public RubyClass defineClassUnder(String name, RubyClass superClass, SinglyLinkedList parentCRef) { | public RubyClass defineClassUnder(String name, RubyClass superClass, RubyModule parentModule) { if (superClass == null) { superClass = objectClass; } return superClass.newSubClass(name, parentModule); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
return superClass.newSubClass(name, parentModule); | return superClass.newSubClass(name, parentCRef); | public RubyClass defineClassUnder(String name, RubyClass superClass, RubyModule parentModule) { if (superClass == null) { superClass = objectClass; } return superClass.newSubClass(name, parentModule); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
return defineModuleUnder(name, objectClass); | return defineModuleUnder(name, objectClass.getCRef()); | public RubyModule defineModule(String name) { return defineModuleUnder(name, objectClass); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
public RubyModule defineModuleUnder(String name, RubyModule parentModule) { RubyModule newModule = RubyModule.newModule(this, name, parentModule); | public RubyModule defineModuleUnder(String name, SinglyLinkedList parentCRef) { RubyModule newModule = RubyModule.newModule(this, name, parentCRef); | public RubyModule defineModuleUnder(String name, RubyModule parentModule) { RubyModule newModule = RubyModule.newModule(this, name, parentModule); parentModule.setConstant(name, newModule); return newModule; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
parentModule.setConstant(name, newModule); | ((RubyModule)parentCRef.getValue()).setConstant(name, newModule); | public RubyModule defineModuleUnder(String name, RubyModule parentModule) { RubyModule newModule = RubyModule.newModule(this, name, parentModule); parentModule.setConstant(name, newModule); return newModule; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
return (RubyModule) objectClass.getConstant(name, false); | return (RubyModule) objectClass.getConstantAt(name); | public RubyModule getModule(String name) { return (RubyModule) objectClass.getConstant(name, false); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
RubyModule module = (RubyModule) getCurrentContext().getRubyClass().getConstant(name, false); | RubyModule module = (RubyModule) getCurrentContext().getRubyClass().getConstantAt(name); | public RubyModule getOrCreateModule(String name) { RubyModule module = (RubyModule) getCurrentContext().getRubyClass().getConstant(name, false); if (module == null) { module = (RubyModule) getCurrentContext().getRubyClass().setConstant(name, defineModule(name)); } else if (getSafeLevel() >= 4) { throw newSecurityError("Extending module prohibited."); } if (getCurrentContext().getWrapper() != null) { module.getSingletonClass().includeModule(getCurrentContext().getWrapper()); module.includeModule(getCurrentContext().getWrapper()); } return module; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
getObject().defineConstant("TOPLEVEL_BINDING", newBinding()); | private void init() { nilObject = new RubyNil(this); trueObject = new RubyBoolean(this, true); falseObject = new RubyBoolean(this, false); verbose = falseObject; javaSupport = new JavaSupport(this); initLibraries(); getCurrentContext().preInit(); getCurrentContext().setCurrentVisibility(Visibility.PRIVATE); initCoreClasses(); RubyGlobal.createGlobals(this); topSelf = TopSelfFactory.createTopSelf(this); getCurrentContext().pushRubyClass(objectClass); Frame frame = getCurrentContext().getCurrentFrame(); frame.setSelf(topSelf); frame.getEvalState().setSelf(topSelf); initBuiltinClasses(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
|
RubyClass metaClass = objectClass.makeMetaClass(classClass, getCurrentContext().getRubyClass()); metaClass = moduleClass.makeMetaClass(metaClass, getCurrentContext().getRubyClass()); metaClass = classClass.makeMetaClass(metaClass, getCurrentContext().getRubyClass()); | RubyClass metaClass = objectClass.makeMetaClass(classClass, objectMetaClass.getCRef()); metaClass = moduleClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); metaClass = classClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); | private void initCoreClasses() { ObjectMetaClass objectMetaClass = new ObjectMetaClass(this); objectMetaClass.initializeClass(); objectClass = objectMetaClass; objectClass.setConstant("Object", objectClass); RubyClass moduleClass = new ModuleMetaClass(this, objectClass); objectClass.setConstant("Module", moduleClass); RubyClass classClass = new RubyClass(this, null /* Would be Class if it could */, moduleClass, null, "Class"); objectClass.setConstant("Class", classClass); RubyClass metaClass = objectClass.makeMetaClass(classClass, getCurrentContext().getRubyClass()); metaClass = moduleClass.makeMetaClass(metaClass, getCurrentContext().getRubyClass()); metaClass = classClass.makeMetaClass(metaClass, getCurrentContext().getRubyClass()); ((ObjectMetaClass) moduleClass).initializeBootstrapClass(); objectClass.includeModule(RubyKernel.createKernelModule(this)); RubyClass.createClassClass(classClass); RubyNil.createNilClass(this); // We cannot define this constant until nil itself was made objectClass.defineConstant("NIL", getNil()); // Pre-create the core classes we know we will get referenced by starting up the runtime. RubyBoolean.createFalseClass(this); RubyBoolean.createTrueClass(this); RubyComparable.createComparable(this); defineModule("Enumerable"); // Impl: src/builtin/enumerable.rb new StringMetaClass(this).initializeClass(); new SymbolMetaClass(this).initializeClass(); RubyThreadGroup.createThreadGroupClass(this); RubyThread.createThreadClass(this); RubyException.createExceptionClass(this); new NumericMetaClass(this).initializeClass(); new IntegerMetaClass(this).initializeClass(); new FixnumMetaClass(this).initializeClass(); new HashMetaClass(this).initializeClass(); new IOMetaClass(this).initializeClass(); new ArrayMetaClass(this).initializeClass(); Java.createJavaModule(this); RubyStruct.createStructClass(this); RubyFloat.createFloatClass(this); new BignumMetaClass(this).initializeClass(); RubyMath.createMathModule(this); // depends on all numeric types RubyRegexp.createRegexpClass(this); RubyRange.createRangeClass(this); RubyObjectSpace.createObjectSpaceModule(this); RubyGC.createGCModule(this); new ProcMetaClass(this).initializeClass(); RubyMethod.createMethodClass(this); RubyMatchData.createMatchDataClass(this); RubyMarshal.createMarshalModule(this); RubyDir.createDirClass(this); RubyFileTest.createFileTestModule(this); new FileMetaClass(this).initializeClass(); // depends on IO, FileTest RubyPrecision.createPrecisionModule(this); RubyProcess.createProcessModule(this); RubyTime.createTimeClass(this); RubyUnboundMethod.defineUnboundMethodClass(this); RubyClass exceptionClass = getClass("Exception"); RubyClass standardError = defineClass("StandardError", exceptionClass); RubyClass runtimeError = defineClass("RuntimeError", standardError); RubyClass ioError = defineClass("IOError", standardError); RubyClass scriptError = defineClass("ScriptError", exceptionClass); RubyClass nameError = defineClass("NameError", scriptError); defineClass("SystemExit", exceptionClass); defineClass("Fatal", exceptionClass); defineClass("Interrupt", exceptionClass); defineClass("SignalException", exceptionClass); defineClass("TypeError", standardError); defineClass("ArgumentError", standardError); defineClass("IndexError", standardError); defineClass("RangeError", standardError); defineClass("SyntaxError", scriptError); defineClass("LoadError", scriptError); defineClass("NotImplementedError", scriptError); defineClass("NoMethodError", nameError); defineClass("SecurityError", standardError); defineClass("NoMemError", exceptionClass); defineClass("RegexpError", standardError); defineClass("EOFError", ioError); defineClass("LocalJumpError", standardError); defineClass("ThreadError", standardError); defineClass("SystemStackError", exceptionClass); NativeException.createClass(this, runtimeError); systemCallError = defineClass("SystemCallError", standardError); errnoModule = defineModule("Errno"); initErrnoErrors(); getLoadService().addAutoload("UnboundMethod", new IAutoloadMethod() { public IRubyObject load(IRuby ruby, String name) { return RubyUnboundMethod.defineUnboundMethodClass(ruby); } }); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
new BindingMetaClass(this).initializeClass(); | private void initCoreClasses() { ObjectMetaClass objectMetaClass = new ObjectMetaClass(this); objectMetaClass.initializeClass(); objectClass = objectMetaClass; objectClass.setConstant("Object", objectClass); RubyClass moduleClass = new ModuleMetaClass(this, objectClass); objectClass.setConstant("Module", moduleClass); RubyClass classClass = new RubyClass(this, null /* Would be Class if it could */, moduleClass, null, "Class"); objectClass.setConstant("Class", classClass); RubyClass metaClass = objectClass.makeMetaClass(classClass, getCurrentContext().getRubyClass()); metaClass = moduleClass.makeMetaClass(metaClass, getCurrentContext().getRubyClass()); metaClass = classClass.makeMetaClass(metaClass, getCurrentContext().getRubyClass()); ((ObjectMetaClass) moduleClass).initializeBootstrapClass(); objectClass.includeModule(RubyKernel.createKernelModule(this)); RubyClass.createClassClass(classClass); RubyNil.createNilClass(this); // We cannot define this constant until nil itself was made objectClass.defineConstant("NIL", getNil()); // Pre-create the core classes we know we will get referenced by starting up the runtime. RubyBoolean.createFalseClass(this); RubyBoolean.createTrueClass(this); RubyComparable.createComparable(this); defineModule("Enumerable"); // Impl: src/builtin/enumerable.rb new StringMetaClass(this).initializeClass(); new SymbolMetaClass(this).initializeClass(); RubyThreadGroup.createThreadGroupClass(this); RubyThread.createThreadClass(this); RubyException.createExceptionClass(this); new NumericMetaClass(this).initializeClass(); new IntegerMetaClass(this).initializeClass(); new FixnumMetaClass(this).initializeClass(); new HashMetaClass(this).initializeClass(); new IOMetaClass(this).initializeClass(); new ArrayMetaClass(this).initializeClass(); Java.createJavaModule(this); RubyStruct.createStructClass(this); RubyFloat.createFloatClass(this); new BignumMetaClass(this).initializeClass(); RubyMath.createMathModule(this); // depends on all numeric types RubyRegexp.createRegexpClass(this); RubyRange.createRangeClass(this); RubyObjectSpace.createObjectSpaceModule(this); RubyGC.createGCModule(this); new ProcMetaClass(this).initializeClass(); RubyMethod.createMethodClass(this); RubyMatchData.createMatchDataClass(this); RubyMarshal.createMarshalModule(this); RubyDir.createDirClass(this); RubyFileTest.createFileTestModule(this); new FileMetaClass(this).initializeClass(); // depends on IO, FileTest RubyPrecision.createPrecisionModule(this); RubyProcess.createProcessModule(this); RubyTime.createTimeClass(this); RubyUnboundMethod.defineUnboundMethodClass(this); RubyClass exceptionClass = getClass("Exception"); RubyClass standardError = defineClass("StandardError", exceptionClass); RubyClass runtimeError = defineClass("RuntimeError", standardError); RubyClass ioError = defineClass("IOError", standardError); RubyClass scriptError = defineClass("ScriptError", exceptionClass); RubyClass nameError = defineClass("NameError", scriptError); defineClass("SystemExit", exceptionClass); defineClass("Fatal", exceptionClass); defineClass("Interrupt", exceptionClass); defineClass("SignalException", exceptionClass); defineClass("TypeError", standardError); defineClass("ArgumentError", standardError); defineClass("IndexError", standardError); defineClass("RangeError", standardError); defineClass("SyntaxError", scriptError); defineClass("LoadError", scriptError); defineClass("NotImplementedError", scriptError); defineClass("NoMethodError", nameError); defineClass("SecurityError", standardError); defineClass("NoMemError", exceptionClass); defineClass("RegexpError", standardError); defineClass("EOFError", ioError); defineClass("LocalJumpError", standardError); defineClass("ThreadError", standardError); defineClass("SystemStackError", exceptionClass); NativeException.createClass(this, runtimeError); systemCallError = defineClass("SystemCallError", standardError); errnoModule = defineModule("Errno"); initErrnoErrors(); getLoadService().addAutoload("UnboundMethod", new IAutoloadMethod() { public IRubyObject load(IRuby ruby, String name) { return RubyUnboundMethod.defineUnboundMethodClass(ruby); } }); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
|
if (!wrap) { secure(4); /* should alter global state */ | try { if (!wrap) { secure(4); /* should alter global state */ context.preNodeEval(null, objectClass, self); } else { /* load in anonymous module as toplevel */ context.preNodeEval(RubyModule.newModule(this, null), context.getWrapper(), self); self = getTopSelf().rbClone(); self.extendObject(context.getRubyClass()); } | public void loadNode(String scriptName, Node node, boolean wrap) { IRubyObject self = getTopSelf(); ThreadContext context = getCurrentContext(); RubyModule wrapper = context.getWrapper(); if (!wrap) { secure(4); /* should alter global state */ context.preNodeEval(null, objectClass, self); } else { /* load in anonymous module as toplevel */ context.preNodeEval(RubyModule.newModule(this, null), context.getWrapper(), self); self = getTopSelf().rbClone(); self.extendObject(context.getRubyClass()); } /* default visibility is private at loading toplevel */ getCurrentContext().setCurrentVisibility(Visibility.PRIVATE); try { self.eval(node); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.ReturnJump) { // Make sure this does not bubble out to java caller. } else { throw je; } } finally { context.postNodeEval(wrapper); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
context.preNodeEval(null, objectClass, self); } else { /* load in anonymous module as toplevel */ context.preNodeEval(RubyModule.newModule(this, null), context.getWrapper(), self); | /* default visibility is private at loading toplevel */ getCurrentContext().setCurrentVisibility(Visibility.PRIVATE); | public void loadNode(String scriptName, Node node, boolean wrap) { IRubyObject self = getTopSelf(); ThreadContext context = getCurrentContext(); RubyModule wrapper = context.getWrapper(); if (!wrap) { secure(4); /* should alter global state */ context.preNodeEval(null, objectClass, self); } else { /* load in anonymous module as toplevel */ context.preNodeEval(RubyModule.newModule(this, null), context.getWrapper(), self); self = getTopSelf().rbClone(); self.extendObject(context.getRubyClass()); } /* default visibility is private at loading toplevel */ getCurrentContext().setCurrentVisibility(Visibility.PRIVATE); try { self.eval(node); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.ReturnJump) { // Make sure this does not bubble out to java caller. } else { throw je; } } finally { context.postNodeEval(wrapper); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
self = getTopSelf().rbClone(); self.extendObject(context.getRubyClass()); } /* default visibility is private at loading toplevel */ getCurrentContext().setCurrentVisibility(Visibility.PRIVATE); try { | public void loadNode(String scriptName, Node node, boolean wrap) { IRubyObject self = getTopSelf(); ThreadContext context = getCurrentContext(); RubyModule wrapper = context.getWrapper(); if (!wrap) { secure(4); /* should alter global state */ context.preNodeEval(null, objectClass, self); } else { /* load in anonymous module as toplevel */ context.preNodeEval(RubyModule.newModule(this, null), context.getWrapper(), self); self = getTopSelf().rbClone(); self.extendObject(context.getRubyClass()); } /* default visibility is private at loading toplevel */ getCurrentContext().setCurrentVisibility(Visibility.PRIVATE); try { self.eval(node); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.ReturnJump) { // Make sure this does not bubble out to java caller. } else { throw je; } } finally { context.postNodeEval(wrapper); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/Ruby.java/buggy/src/org/jruby/Ruby.java |
|
super("Bignum", RubyBignum.class, runtime.getObject()); | super("Bignum", RubyBignum.class, runtime.getClass("Integer")); | public BignumMetaClass(Ruby runtime) { super("Bignum", RubyBignum.class, runtime.getObject()); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1136d8f3c5d8cb8b35bf7e5cdb843eaa91cd81c/BignumMetaClass.java/buggy/src/org/jruby/runtime/builtin/meta/BignumMetaClass.java |
return new GCDefinition(ruby).getModule(); | RubyModule result = ruby.defineModule("GC"); CallbackFactory callbackFactory = ruby.callbackFactory(); result.defineSingletonMethod("start", callbackFactory.getSingletonMethod(RubyGC.class, "start")); result.defineSingletonMethod("garbage_collect", callbackFactory.getSingletonMethod(RubyGC.class, "start")); return result; | public static RubyModule createGCModule(Ruby ruby) { return new GCDefinition(ruby).getModule(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/1c602493a83e2050f401fa6925ec7e9269b45e4e/RubyGC.java/buggy/src/org/jruby/RubyGC.java |
process_status.defineMethod("==", process_statusCallbackFactory.getMethod("op_eq", IRubyObject.class)); | public static RubyModule createProcessModule(IRuby runtime) { RubyModule process = runtime.defineModule("Process"); RubyModule process_status = process.defineClassUnder("Status", runtime.getObject()); CallbackFactory processCallbackFactory = runtime.callbackFactory(RubyProcess.class); CallbackFactory process_statusCallbackFactory = runtime.callbackFactory(RubyProcess.RubyStatus.class);// process.defineModuleFunction("fork", processCallbackFactory.getSingletonMethod("fork"));// process.defineModuleFunction("exit!", processCallbackFactory.getOptSingletonMethod("exit_bang"));// process.defineModuleFunction("exit", processCallbackFactory.getOptSingletonMethod("exit"));// process.defineModuleFunction("abort", processCallbackFactory.getOptSingletonMethod("abort"));// process.defineModuleFunction("kill", processCallbackFactory.getOptSingletonMethod("kill"));// process.defineModuleFunction("wait", processCallbackFactory.getOptSingletonMethod("wait"));// process.defineModuleFunction("wait2", processCallbackFactory.getOptSingletonMethod("wait2"));// process.defineModuleFunction("waitpid", processCallbackFactory.getOptSingletonMethod("waitpid"));// process.defineModuleFunction("waitpid2", processCallbackFactory.getOptSingletonMethod("waitpid2"));// process.defineModuleFunction("waitall", processCallbackFactory.getSingletonMethod("waitall"));// process.defineModuleFunction("detach", processCallbackFactory.getSingletonMethod("detach", IRubyObject.class));// process.defineModuleFunction("pid", processCallbackFactory.getSingletonMethod("pid"));// process.defineModuleFunction("ppid", processCallbackFactory.getSingletonMethod("ppid"));//// process.defineModuleFunction("getpgrp", processCallbackFactory.getSingletonMethod("getprgrp"));// process.defineModuleFunction("setpgrp", processCallbackFactory.getSingletonMethod("setpgrp"));// process.defineModuleFunction("getpgid", processCallbackFactory.getSingletonMethod("getpgid", IRubyObject.class));// process.defineModuleFunction("setpgid", processCallbackFactory.getSingletonMethod("setpgid", IRubyObject.class, IRubyObject.class));//// process.defineModuleFunction("setsid", processCallbackFactory.getSingletonMethod("setsid"));//// process.defineModuleFunction("getpriority", processCallbackFactory.getSingletonMethod("getpriority", IRubyObject.class, IRubyObject.class));// process.defineModuleFunction("setpriority", processCallbackFactory.getSingletonMethod("setpriority", IRubyObject.class, IRubyObject.class, IRubyObject.class));// #ifdef HAVE_GETPRIORITY// rb_define_const(rb_mProcess, "PRIO_PROCESS", INT2FIX(PRIO_PROCESS));// rb_define_const(rb_mProcess, "PRIO_PGRP", INT2FIX(PRIO_PGRP));// rb_define_const(rb_mProcess, "PRIO_USER", INT2FIX(PRIO_USER));// #endif// process.defineModuleFunction("uid", processCallbackFactory.getSingletonMethod("uid"));// process.defineModuleFunction("uid=", processCallbackFactory.getSingletonMethod("uid_set", IRubyObject.class));// process.defineModuleFunction("gid", processCallbackFactory.getSingletonMethod("gid"));// process.defineModuleFunction("gid=", processCallbackFactory.getSingletonMethod("gid_set", IRubyObject.class));// process.defineModuleFunction("euid", processCallbackFactory.getSingletonMethod("euid"));// process.defineModuleFunction("euid=", processCallbackFactory.getSingletonMethod("euid_set", IRubyObject.class));// process.defineModuleFunction("egid", processCallbackFactory.getSingletonMethod("egid"));// process.defineModuleFunction("egid=", processCallbackFactory.getSingletonMethod("egid_set", IRubyObject.class));// process.defineModuleFunction("initgroups", processCallbackFactory.getSingletonMethod("initgroups", IRubyObject.class, IRubyObject.class));// process.defineModuleFunction("groups", processCallbackFactory.getSingletonMethod("groups"));// process.defineModuleFunction("groups=", processCallbackFactory.getSingletonMethod("groups_set", IRubyObject.class));// process.defineModuleFunction("maxgroups", processCallbackFactory.getSingletonMethod("maxgroups"));// process.defineModuleFunction("maxgroups=", processCallbackFactory.getSingletonMethod("maxgroups_set", IRubyObject.class)); process.defineModuleFunction("times", processCallbackFactory.getSingletonMethod("times")); // Process::Status methods // process_status.defineMethod("==", process_statusCallbackFactory.getMethod("op_eq"));// process_status.defineMethod("&", process_statusCallbackFactory.getMethod("op_and")); process_status.defineMethod(">>", process_statusCallbackFactory.getMethod("rightshift_op", IRubyObject.class)); process_status.defineMethod("to_i", process_statusCallbackFactory.getMethod("to_i"));// process_status.defineMethod("to_int", process_statusCallbackFactory.getMethod("to_int")); process_status.defineMethod("to_s", process_statusCallbackFactory.getMethod("to_s")); process_status.defineMethod("inspect", process_statusCallbackFactory.getMethod("inspect"));// process_status.defineMethod("pid", process_statusCallbackFactory.getMethod("pid"));// process_status.defineMethod("stopped?", process_statusCallbackFactory.getMethod("stopped_p"));// process_status.defineMethod("stopsig", process_statusCallbackFactory.getMethod("stopsig"));// process_status.defineMethod("signaled?", process_statusCallbackFactory.getMethod("signaled_p"));// process_status.defineMethod("termsig", process_statusCallbackFactory.getMethod("termsig"));// process_status.defineMethod("exited?", process_statusCallbackFactory.getMethod("exited_p")); process_status.defineMethod("exitstatus", process_statusCallbackFactory.getMethod("exitstatus")); process_status.defineMethod("success?", process_statusCallbackFactory.getMethod("success_p"));// process_status.defineMethod("coredump?", process_statusCallbackFactory.getMethod("coredump_p")); return process; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/16ddb479a8f0fcdf42d51532bc7de3f2d2d03f2b/RubyProcess.java/buggy/src/org/jruby/RubyProcess.java |
|
mtime = runtime.newFixnum(file.lastModified()); | mtime = runtime.newTime(file.lastModified()); | protected RubyFileStat(IRuby runtime, JRubyFile file) { super(runtime, runtime.getClass("File").getClass("Stat")); if(!file.exists()) { throw runtime.newErrnoENOENTError("No such file or directory - " + file.getPath()); } // We cannot determine, so always return 4096 (better than blowing up) blksize = runtime.newFixnum(4096); isDirectory = runtime.newBoolean(file.isDirectory()); isFile = runtime.newBoolean(file.isFile()); ftype = file.isDirectory()? runtime.newString("directory") : (file.isFile() ? runtime.newString("file") : null); // implementation to lowest common denominator...Windows has no file mode, but C ruby returns either 0100444 or 0100666 int baseMode = 0100000; if (file.canRead()) { baseMode += READ; } if (file.canWrite()) { baseMode += WRITE; } mode = runtime.newFixnum(baseMode); mtime = runtime.newFixnum(file.lastModified()); isReadable = runtime.newBoolean(file.canRead()); isWritable = runtime.newBoolean(file.canWrite()); size = runtime.newFixnum(file.length()); // We cannot determine this in Java, so we will always return false (better than blowing up) isSymlink = runtime.getFalse(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/7c9ec57d0ce44adc41c27cdfce89439cec7da0ed/RubyFileStat.java/buggy/src/org/jruby/RubyFileStat.java |
return 16; | PixelsType type = pixels.getPixelsType(); if (type.getValue().equals("int8") || type.getValue().equals("uint8")) { return 8; } else if (type.getValue().equals("int16") || type.getValue().equals("uint16")) { return 16; } else if (type.getValue().equals("int32") || type.getValue().equals("uint32") || type.getValue().equals("float")) { return 32; } else if (type.getValue().equals("double")) { return 64; } throw new RuntimeException("Pixels type '" + type.getValue() + "' unsupported by nio."); | int getBitDepth() { return 16; // FIXME pixels.getPixelsType(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/4190152881c7f58e1a3f87c9e6736e403a241c86/PixelBuffer.java/buggy/components/omeio-nio/src/ome/io/nio/PixelBuffer.java |
private boolean flatten(ArrayList ary) { boolean mod = false; for (int i = ary.size() - 1; i >= 0; i--) { if (ary.get(i) instanceof RubyArray) { ArrayList ary2 = ((RubyArray) ary.remove(i)).getList(); flatten(ary2); ary.addAll(i, ary2); mod = true; } } return mod; | private boolean flatten(ArrayList array) { return flatten(array, new IdentitySet()); | private boolean flatten(ArrayList ary) { boolean mod = false; for (int i = ary.size() - 1; i >= 0; i--) { if (ary.get(i) instanceof RubyArray) { ArrayList ary2 = ((RubyArray) ary.remove(i)).getList(); flatten(ary2); ary.addAll(i, ary2); mod = true; } } return mod; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/385e3f4e7eba5184dfea0a1e9d23b8ab7d46b1a5/RubyArray.java/buggy/org/jruby/RubyArray.java |
RubyArray ary = newArray(getRuntime(), list); | RubyArray ary = newArray(getRuntime(), new ArrayList(list)); | public IRubyObject rbClone() { RubyArray ary = newArray(getRuntime(), list); ary.setupClone(this); return ary; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/385e3f4e7eba5184dfea0a1e9d23b8ab7d46b1a5/RubyArray.java/buggy/org/jruby/RubyArray.java |
public static Callback getSelfMethod() { | public static Callback getSelfMethod(final int arity) { | public static Callback getSelfMethod() { return new Callback() { public RubyObject execute(RubyObject recv, RubyObject[] args, Ruby ruby) { return recv; } }; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/6076c5ab87d25a488469aa1a32f1d2c9c9e470b2/CallbackFactory.java/buggy/org/jruby/runtime/CallbackFactory.java |
public int getArity() { return arity; } | public static Callback getSelfMethod() { return new Callback() { public RubyObject execute(RubyObject recv, RubyObject[] args, Ruby ruby) { return recv; } }; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/6076c5ab87d25a488469aa1a32f1d2c9c9e470b2/CallbackFactory.java/buggy/org/jruby/runtime/CallbackFactory.java |
|
RubyClass type = getInternalClass().isSingleton() ? | RubyClass type = getInternalClass().isSingleton() ? | public RubyClass getSingletonClass() { if (isNil()) { return getNilSingletonClass(); } RubyClass type = getInternalClass().isSingleton() ? getInternalClass() : makeMetaClass(getInternalClass()); type.setTaint(isTaint()); type.setFrozen(isFrozen()); return type; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/3db6c9249a0b029b0a43fa8b53b9d42de5c34174/RubyObject.java/buggy/org/jruby/RubyObject.java |
public IRubyObject yieldUnder(RubyModule under) { return under.executeUnder(new Callback() { public IRubyObject execute(IRubyObject self, IRubyObject[] args) { // if () { Block oldBlock = runtime.getBlockStack().getCurrent().cloneBlock(); /* copy the block to avoid modifying global data. */ runtime.getBlockStack().getCurrent().getFrame().setNamespace(runtime.getCurrentFrame().getNamespace()); try { return runtime.yield(args[0], args[0], runtime.getRubyClass(), false); } finally { runtime.getBlockStack().setCurrent(oldBlock); } // } /* static block, no need to restore */ // ruby.getBlock().frame.setNamespace(ruby.getRubyFrame().getNamespace()); // return ruby.yield0(args[0], args[0], ruby.getRubyClass(), false); } public int getArity() { return -1; } }, new IRubyObject[] { this }); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/3db6c9249a0b029b0a43fa8b53b9d42de5c34174/RubyObject.java/buggy/org/jruby/RubyObject.java |
||
public IRubyObject execute(IRubyObject self, IRubyObject[] args) { // if () { Block oldBlock = runtime.getBlockStack().getCurrent().cloneBlock(); /* copy the block to avoid modifying global data. */ runtime.getBlockStack().getCurrent().getFrame().setNamespace(runtime.getCurrentFrame().getNamespace()); try { return runtime.yield(args[0], args[0], runtime.getRubyClass(), false); } finally { runtime.getBlockStack().setCurrent(oldBlock); } // } /* static block, no need to restore */ // ruby.getBlock().frame.setNamespace(ruby.getRubyFrame().getNamespace()); // return ruby.yield0(args[0], args[0], ruby.getRubyClass(), false); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/3db6c9249a0b029b0a43fa8b53b9d42de5c34174/RubyObject.java/buggy/org/jruby/RubyObject.java |
||
String message = "Your connection was closed due to an error."; | String message = Res.getString("message.disconnected.error"); | public void connectionClosedOnError(final Exception ex) { SwingUtilities.invokeLater(new Runnable() { public void run() { Log.error("Connection closed on error.", ex); String message = "Your connection was closed due to an error."; if (ex instanceof XMPPException) { XMPPException xmppEx = (XMPPException)ex; StreamError error = xmppEx.getStreamError(); String reason = error.getCode(); if ("conflict".equals(reason)) { message = "Your connection was closed due to the same user logging in from another location."; } } Collection rooms = SparkManager.getChatManager().getChatContainer().getChatRooms(); Iterator iter = rooms.iterator(); while (iter.hasNext()) { ChatRoom chatRoom = (ChatRoom)iter.next(); chatRoom.getChatInputEditor().setEnabled(false); chatRoom.getSendButton().setEnabled(false); chatRoom.getTranscriptWindow().insertNotificationMessage(message); } } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/97917d876023996dcd3bd220e88b62b3f6dcb7fc/SessionManager.java/buggy/src/java/org/jivesoftware/spark/SessionManager.java |
message = "Your connection was closed due to the same user logging in from another location."; | message = Res.getString("message.disconnected.conflict.error"); | public void connectionClosedOnError(final Exception ex) { SwingUtilities.invokeLater(new Runnable() { public void run() { Log.error("Connection closed on error.", ex); String message = "Your connection was closed due to an error."; if (ex instanceof XMPPException) { XMPPException xmppEx = (XMPPException)ex; StreamError error = xmppEx.getStreamError(); String reason = error.getCode(); if ("conflict".equals(reason)) { message = "Your connection was closed due to the same user logging in from another location."; } } Collection rooms = SparkManager.getChatManager().getChatContainer().getChatRooms(); Iterator iter = rooms.iterator(); while (iter.hasNext()) { ChatRoom chatRoom = (ChatRoom)iter.next(); chatRoom.getChatInputEditor().setEnabled(false); chatRoom.getSendButton().setEnabled(false); chatRoom.getTranscriptWindow().insertNotificationMessage(message); } } }); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/97917d876023996dcd3bd220e88b62b3f6dcb7fc/SessionManager.java/buggy/src/java/org/jivesoftware/spark/SessionManager.java |
String message = "Your connection was closed due to an error."; | String message = Res.getString("message.disconnected.error"); | public void run() { Log.error("Connection closed on error.", ex); String message = "Your connection was closed due to an error."; if (ex instanceof XMPPException) { XMPPException xmppEx = (XMPPException)ex; StreamError error = xmppEx.getStreamError(); String reason = error.getCode(); if ("conflict".equals(reason)) { message = "Your connection was closed due to the same user logging in from another location."; } } Collection rooms = SparkManager.getChatManager().getChatContainer().getChatRooms(); Iterator iter = rooms.iterator(); while (iter.hasNext()) { ChatRoom chatRoom = (ChatRoom)iter.next(); chatRoom.getChatInputEditor().setEnabled(false); chatRoom.getSendButton().setEnabled(false); chatRoom.getTranscriptWindow().insertNotificationMessage(message); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/97917d876023996dcd3bd220e88b62b3f6dcb7fc/SessionManager.java/buggy/src/java/org/jivesoftware/spark/SessionManager.java |
message = "Your connection was closed due to the same user logging in from another location."; | message = Res.getString("message.disconnected.conflict.error"); | public void run() { Log.error("Connection closed on error.", ex); String message = "Your connection was closed due to an error."; if (ex instanceof XMPPException) { XMPPException xmppEx = (XMPPException)ex; StreamError error = xmppEx.getStreamError(); String reason = error.getCode(); if ("conflict".equals(reason)) { message = "Your connection was closed due to the same user logging in from another location."; } } Collection rooms = SparkManager.getChatManager().getChatContainer().getChatRooms(); Iterator iter = rooms.iterator(); while (iter.hasNext()) { ChatRoom chatRoom = (ChatRoom)iter.next(); chatRoom.getChatInputEditor().setEnabled(false); chatRoom.getSendButton().setEnabled(false); chatRoom.getTranscriptWindow().insertNotificationMessage(message); } } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/97917d876023996dcd3bd220e88b62b3f6dcb7fc/SessionManager.java/buggy/src/java/org/jivesoftware/spark/SessionManager.java |
p.setStatus("User has locked their workstation."); | p.setStatus(Res.getString("message.locked.workstation")); | private void setIdleListener() throws Exception { final Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { LocalPreferences localPref = SettingsManager.getLocalPreferences(); int delay = 0; if (localPref.isIdleOn()) { delay = localPref.getIdleTime() * 60000; } else { return; } long idleTime = SystemInfo.getSessionIdleTime(); boolean isLocked = SystemInfo.isSessionLocked(); if (idleTime > delay) { try { // Handle if spark is not connected to the server. if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) { return; } // Change Status Workspace workspace = SparkManager.getWorkspace(); Presence presence = workspace.getStatusBar().getPresence(); if (workspace != null && presence.getMode() == Presence.Mode.available) { unavaliable = true; StatusItem away = workspace.getStatusBar().getStatusItem("Away"); Presence p = away.getPresence(); if (isLocked) { p.setStatus("User has locked their workstation."); } else { p.setStatus("Away due to idle."); } previousPriority = presence.getPriority(); p.setPriority(0); SparkManager.getSessionManager().changePresence(p); } } catch (Exception e) { Log.error("Error with IDLE status.", e); timer.cancel(); } } else { if (unavaliable) { setAvailableIfActive(); } } } }, 1000, 1000); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/97917d876023996dcd3bd220e88b62b3f6dcb7fc/SessionManager.java/buggy/src/java/org/jivesoftware/spark/SessionManager.java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.