auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int read(byte[] buf, int off, int len) throws TTransportException { if (!isOpen) { throw new TTransportException(TTransportException.NOT_OPEN, "read: HTTP transport not open"); } if (readPos == currentFrame.length) { try { currentFrame = frameBuffer.take(); } catch (InterruptedException e) { throw new TTransportException(TTransportException.END_OF_FILE, e.getMessage()); } readPos = 0; } if (currentFrame == FRAME_BUFFER_CLOSED) { throw new TTransportException(TTransportException.END_OF_FILE); } len = Math.min(currentFrame.length - readPos, len); System.arraycopy(currentFrame, readPos, buf, off, len); readPos += len; return len; }

Target:
public int read(byte[] buf, int off, int len) throws TTransportException { if (!isOpen()) { throw new TTransportException(TTransportException.NOT_OPEN, "read: HTTP transport not open"); } if (readPos == currentFrame.length) { try { currentFrame = frameBuffer.take(); } catch (InterruptedException e) { throw new TTransportException(TTransportException.END_OF_FILE, e.getMessage()); } readPos = 0; } if (currentFrame == FRAME_BUFFER_CLOSED) { throw new TTransportException(TTransportException.END_OF_FILE); } len = Math.min(currentFrame.length - readPos, len); System.arraycopy(currentFrame, readPos, buf, off, len); readPos += len; return len; }
Source:
public boolean addPredicates(AbstractSqlWriter writer) throws OseeCoreException { writer.write(getPredicate(writer, txsAlias, relAlias)); writer.write(" AND "); if (OptionsUtil.isHistorical(writer.getOptions())) { if (!OptionsUtil.areDeletedRelationsIncluded(writer.getOptions())) { writer.write(txsAlias); writer.write(".mod_type != "); writer.write(Integer.toString(ModificationType.DELETED.getValue())); writer.write(" AND "); } } else { writer.write(txsAlias); writer.write(".tx_current "); if (OptionsUtil.areDeletedRelationsIncluded(writer.getOptions())) { writer.write(" IN ("); writer.write(String.valueOf(TxChange.CURRENT.getValue())); writer.write(", "); writer.write(String.valueOf(TxChange.DELETED.getValue())); writer.write(", "); writer.write(String.valueOf(TxChange.ARTIFACT_DELETED.getValue())); writer.write(") AND"); } else { writer.write(" = "); writer.write(String.valueOf(TxChange.CURRENT.getValue())); writer.write(" AND "); } } if (withClause != null) { writer.write(txsAlias); writer.write(".transaction_id = "); writer.write(withClauseName); writer.write(".transaction_id AND "); } writer.write(writer.getTxBranchFilter(txsAlias)); return true; }

Target:
public boolean addPredicates(AbstractSqlWriter writer) throws OseeCoreException { writer.write(getPredicate(writer, txsAlias, relAlias)); if (withClause != null) { writer.writeAndLn(); writer.write(txsAlias); writer.write(".transaction_id = "); writer.write(withClauseName); writer.write(".transaction_id"); } writer.writeAndLn(); boolean includeDeletedRelations = OptionsUtil.areDeletedRelationsIncluded(writer.getOptions()); writer.write(writer.getTxBranchFilter(txsAlias, includeDeletedRelations)); return true; }
Source:
private List<Map<String, String>> availableConsoles(String userIdAsString) { List<Map<String, String>> jsonVms = new ArrayList<>(); Guid userGuid = null; try { if (StringUtils.isNotEmpty(userIdAsString)) { userGuid = Guid.createGuidFromString(userIdAsString); } } catch (IllegalArgumentException e) { log.debug("Could not read User GUID"); } if (userGuid != null) { VdcReturnValueBase loginResult = backend.runInternalAction(VdcActionType.LoginOnBehalf, new LoginOnBehalfParameters(userGuid)); String engineSessionId = loginResult.getActionReturnValue(); try { IdQueryParameters userParam = new IdQueryParameters(userGuid); VdcQueryReturnValue retVms = backend.runInternalQuery(VdcQueryType.GetAllVms, userParam); if (retVms != null) { List<VM> vmsList = retVms.getReturnValue(); for (VM vm : vmsList) { Map<String, String> jsonVm = new HashMap<String, String>(); if (vm.getRunOnVds() != null) { VdcQueryReturnValue retValue = backend.runInternalQuery(VdcQueryType.GetVdsByVdsId, new IdQueryParameters(vm.getRunOnVds())); if (retValue != null && retValue.getReturnValue() != null) { VDS vds = (VDS) retValue.getReturnValue(); jsonVm.put("vmid", vm.getId().toString()); jsonVm.put("vmname", vm.getName()); jsonVm.put("host", vds.getHostName()); jsonVm.put("console", "default"); jsonVms.add(jsonVm); } } } } } finally { if (StringUtils.isNotEmpty(engineSessionId)) { backend.runInternalAction(VdcActionType.LogoutSession, new VdcActionParametersBase(engineSessionId)); } } } return jsonVms; }

Target:
private List<Map<String, String>> availableConsoles(String userIdAsString) { List<Map<String, String>> jsonVms = new ArrayList<>(); Guid userGuid = null; try { if (StringUtils.isNotEmpty(userIdAsString)) { userGuid = Guid.createGuidFromString(userIdAsString); } } catch (IllegalArgumentException e) { log.debug("Could not read User GUID"); } if (userGuid != null) { String engineSessionId = backend.runInternalAction(VdcActionType.LoginOnBehalf, new LoginOnBehalfParameters(userGuid)).getActionReturnValue(); if (StringUtils.isNotEmpty(engineSessionId)) { try { VdcQueryReturnValue retVms = backend.runInternalQuery(VdcQueryType.GetAllVms, new VdcQueryParametersBase(), new EngineContext().withSessionId(engineSessionId)); if (retVms != null) { List<VM> vmsList = retVms.getReturnValue(); for (VM vm : vmsList) { Map<String, String> jsonVm = new HashMap<String, String>(); if (vm.getRunOnVds() != null) { VdcQueryReturnValue retValue = backend.runInternalQuery(VdcQueryType.GetVdsByVdsId, new IdQueryParameters(vm.getRunOnVds())); if (retValue != null && retValue.getReturnValue() != null) { VDS vds = (VDS) retValue.getReturnValue(); jsonVm.put("vmid", vm.getId().toString()); jsonVm.put("vmname", vm.getName()); jsonVm.put("host", vds.getHostName()); jsonVm.put("console", "default"); jsonVms.add(jsonVm); } } } } } finally { backend.runInternalAction(VdcActionType.LogoutSession, new VdcActionParametersBase(engineSessionId)); } } } return jsonVms; }
Source:
public int getCircuitBreakerAspectOrder() { return Ordered.LOWEST_PRECEDENCE - 2; }

Target:
public int getCircuitBreakerAspectOrder() { return circuitBreakerAspectOrder; }
Source:
public String deflatePropertyName(Graph graph, String propertyName, Visibility propertyVisibility) { String visibilityHash = getVisibilityHash(graph, propertyName, propertyVisibility); return this.nameSubstitutionStrategy.deflate(propertyName) + "_" + visibilityHash; }

Target:
protected String deflatePropertyName(Graph graph, String propertyName, Visibility propertyVisibility) { String visibilityHash = getVisibilityHash(graph, propertyName, propertyVisibility); return this.nameSubstitutionStrategy.deflate(propertyName) + "_" + visibilityHash; }
Source:
public ArrayList<CrfVersionMedia> findByCrfVersionId(int crf_version_id) { String query = "from " + getDomainClassName() + " crf_version_media where crf_version_media.crfVersion.crfVersionId = :crfversionid "; org.hibernate.Query q = getCurrentSession().createQuery(query); q.setInteger("crfversionid", crf_version_id); return (ArrayList<CrfVersionMedia>) q.list(); }

Target:
public ArrayList<CrfVersionMedia> findByCrfVersionId(int crf_version_id) { String query = "from " + getDomainClassName() + " crf_version_media where crf_version_media.crfVersion.crfVersionId = :crfversionid "; Query q = getCurrentSession().createQuery(query); q.setInteger("crfversionid", crf_version_id); return (ArrayList<CrfVersionMedia>) q.list(); }
Source:
public String toString() { return "UserToken [userId=" + userId + ", active=" + active + ", admin=" + admin + ", email=" + email + ", creationRequired=" + creationRequired + "]"; }

Target:
public String toString() { return String.format("UserToken [userId=[%s], active=[%s], admin=[%s], email=[%s], creationRequired=[%s]", userId, active, admin, email, creationRequired); }
Source:
public void addValue(long value) { nonNullValueCount++; minimum = Math.min(value, minimum); maximum = Math.max(value, maximum); try { sum = addExact(sum, value); } catch (ArithmeticException e) { overflow = true; } }

Target:
public void addValue(long value) { nonNullValueCount++; minimum = Math.min(value, minimum); maximum = Math.max(value, maximum); if (!overflow) { try { sum = addExact(sum, value); } catch (ArithmeticException e) { overflow = true; } } }
Source:
public Provider createProviderFromUser(User user) { Provider p = new Provider(); if (user == null || user.getPerson() == null) { throw new RuntimeException("User can not be null"); } else if (Context.getProviderService().getProvidersByPerson(user.getPerson()).isEmpty()) { p.setPerson(user.getPerson()); } else { throw new RuntimeException("Unable to create Provider from user"); } return Context.getProviderService().saveProvider(p); }

Target:
public Provider createProviderFromUser(User user) { Provider p = new Provider(); if (user == null || user.getPerson() == null) { throw new APIException("User can not be null"); } else if (Context.getProviderService().getProvidersByPerson(user.getPerson()).isEmpty()) { p.setPerson(user.getPerson()); return Context.getProviderService().saveProvider(p); } else { log.warn("Provider already exists for user"); return Context.getProviderService().getProvidersByPerson(user.getPerson()).iterator().next(); } }
Source:
private boolean createAndUploadSegments() { File localTempDir = new File(FileUtils.getTempDirectory(), "pinot-compat-test-" + UUID.randomUUID()); File localOutputTempDir = new File(localTempDir, "output"); try { FileUtils.forceMkdir(localOutputTempDir); File segmentTarFile = generateSegment(localOutputTempDir); uploadSegment(segmentTarFile); Pair<Long, Long> onlineSegmentCount = getOnlineSegmentCount(getTableExternalView()); if (onlineSegmentCount.getFirst() <= 0 && onlineSegmentCount.getSecond() <= 0) { LOGGER.error("Uploaded segment not found or not in state.", _segmentName, STATE_ONLINE); return false; } LOGGER.info("Successfully verified segment and its current status is {}.", _segmentName, STATE_ONLINE); return true; } catch (Exception e) { LOGGER.error("Failed to create and upload segment for input data file {}.", _inputDataFileName, e); return false; } finally { FileUtils.deleteQuietly(localTempDir); } }

Target:
private boolean createAndUploadSegments() { File localTempDir = new File(FileUtils.getTempDirectory(), "pinot-compat-test-" + UUID.randomUUID()); localTempDir.deleteOnExit(); File localOutputTempDir = new File(localTempDir, "output"); try { FileUtils.forceMkdir(localOutputTempDir); File segmentTarFile = generateSegment(localOutputTempDir); uploadSegment(segmentTarFile); return verifySegmentInState(STATE_ONLINE); } catch (Exception e) { LOGGER.error("Failed to create and upload segment for input data file {}.", _inputDataFileName, e); return false; } finally { FileUtils.deleteQuietly(localTempDir); } }
Source:
public boolean testSourceType(CommandSource source) { return testPermission(source); }

Target:
public boolean testSourceType(CommandSource source) { return true; }
Source:
private boolean isTargetTable(Entity entity, Table targetTable) { long targetWriteId = targetTable.getTTable().getWriteId(); long entityWriteId = entity.getTable().getTTable().getWriteId(); targetTable.getTTable().setWriteId(0L); entity.getTable().getTTable().setWriteId(0L); boolean result = targetTable.equals(entity.getTable()); targetTable.getTTable().setWriteId(targetWriteId); entity.getTable().getTTable().setWriteId(entityWriteId); return result; }

Target:
private boolean isTargetTable(Entity entity, Table targetTable) { return targetTable.equalsWithIgnoreWriteId(entity); }
Source:
public static synchronized HttpTransport getStaticHttpTransport() throws IOException, GeneralSecurityException { if (staticHttpTransport == null) { staticHttpTransport = HttpTransportFactory.createHttpTransport(HttpTransportType.JAVA_NET); } return staticHttpTransport; }

Target:
private static synchronized HttpTransport getStaticHttpTransport() throws IOException, GeneralSecurityException { if (staticHttpTransport == null) { staticHttpTransport = HttpTransportFactory.createHttpTransport(HttpTransportType.JAVA_NET); } return staticHttpTransport; }
Source:
protected Date convertFromString(String stringValue) { if (stringValue == null || stringValue.isEmpty() || stringValue.length() < 6) { return null; } int lastSeparator = stringValue.lastIndexOf('/'); if (stringValue.contains("-")) { return convertDate("yyyy-MM-dd", stringValue); } else if (lastSeparator == -1) { return new Date(Long.parseLong(stringValue)); } else if (stringValue.length() - lastSeparator - 1 == 2) { return convertDate("MM/dd/yy", stringValue); } else { return convertDate("MM/dd/yyyy", stringValue); } }

Target:
protected Date convertFromString(String stringValue) { if (stringValue == null || stringValue.isEmpty() || stringValue.length() < 6) { return null; } int lastSeparator = stringValue.lastIndexOf('/'); if (stringValue.contains("-")) { return convertDate("yyyy-MM-dd", stringValue); } else if (isTimestampFormat(lastSeparator)) { return new Date(Long.parseLong(stringValue)); } else if (isSimpleYearFormat(stringValue, lastSeparator)) { return convertDate("MM/dd/yy", stringValue); } else { return convertDate("MM/dd/yyyy", stringValue); } }
Source:
public synchronized void allHostNTProcedureCallback(ClientResponse clientResponse) { int hostId = Integer.parseInt(clientResponse.getAppStatusString()); boolean removed = m_outstandingAllHostProcedureHostIds.remove(hostId); assert(removed); final Map<Integer,ClientResponse> allHostResponses = m_allHostResponses; m_allHostResponses.put(hostId, clientResponse); if (m_outstandingAllHostProcedureHostIds.size() == 0) { m_outstandingAllHostProc.set(false); m_executorService.submit(new Runnable() { @Override public void run() { m_allHostFut.complete(allHostResponses); } }); } }

Target:
public synchronized void allHostNTProcedureCallback(ClientResponse clientResponse) { int hostId = Integer.parseInt(clientResponse.getAppStatusString()); boolean removed = m_outstandingAllHostProcedureHostIds.remove(hostId); if (!removed) { Log.error(String.format( "ProcedureRunnerNT.allHostNTProcedureCallback for procedure %s received late or unexepected response from hostID %d.", m_procedureName, hostId)); return; } final Map<Integer,ClientResponse> allHostResponses = m_allHostResponses; m_allHostResponses.put(hostId, clientResponse); if (m_outstandingAllHostProcedureHostIds.size() == 0) { m_outstandingAllHostProc.set(false); m_executorService.submit(new Runnable() { @Override public void run() { m_allHostFut.complete(allHostResponses); } }); } }
Source:
public Optional<TextureData> getAssetData(ResourceUrn urn) throws IOException { if (TerasologyConstants.ENGINE_MODULE.equals(urn.getModuleName()) && TextureUtil.EMPTY_RESOURCE_NAME.equals(urn.getResourceName())) { Name fragmentName = urn.getFragmentName(); if (!fragmentName.isEmpty()) { String[] parts = fragmentName.toLowerCase().split("\\."); if (parts.length == 3) { int width = Integer.parseInt(parts[0]); int height = Integer.parseInt(parts[1]); return Optional.of(new TextureData(width,height, Texture.WrapMode.CLAMP, Texture.FilterMode.LINEAR)); } } } return Optional.empty(); }

Target:
public Optional<TextureData> getAssetData(ResourceUrn urn) throws IOException { if (TerasologyConstants.ENGINE_MODULE.equals(urn.getModuleName()) && TextureUtil.EMPTY_RESOURCE_NAME.equals(urn.getResourceName())) { Name fragmentName = urn.getFragmentName(); if (!fragmentName.isEmpty()) { String[] parts = fragmentName.toLowerCase().split("\\."); if (parts.length == 3) { int width = Integer.parseInt(parts[0]); int height = Integer.parseInt(parts[1]); return Optional.of(new TextureData(width,height, Texture.WrapMode.CLAMP, Texture.FilterMode.LINEAR)); } } } logger.info("illegal texture urn:" + urn.toString()); return Optional.empty(); }
Source:
protected Object callMethod(Object instance, Method method, Object[] convertedArgs) throws Throwable { try { Object result; if (instance instanceof InteractionAwareFixture) { result = ((InteractionAwareFixture)instance).aroundSlimInvoke(this, method, convertedArgs); } else { result = methodInvoke(method, instance, convertedArgs); } return result; } catch (InvocationTargetException e) { if(e.getCause() != null){ throw e.getCause(); }else{ throw e.getTargetException(); } } }

Target:
protected Object callMethod(Object instance, Method method, Object[] convertedArgs) throws Throwable { try { Object result; if (instance instanceof InteractionAwareFixture) { Object[] args = { this, method, convertedArgs }; result = methodInvoke(AROUND_METHOD, instance, args); } else { result = methodInvoke(method, instance, convertedArgs); } return result; } catch (InvocationTargetException e) { if(e.getCause() != null){ throw e.getCause(); }else{ throw e.getTargetException(); } } }
Source:
private int moveDexFilesLI(PackageParser.Package newPackage) { if ((newPackage.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) { int retCode = mInstaller.movedex(newPackage.mScanPath, newPackage.mPath); if (retCode != 0) { mInstaller.rmdex(newPackage.mPath); } } return PackageManager.INSTALL_SUCCEEDED; }

Target:
private int moveDexFilesLI(PackageParser.Package newPackage) { if ((newPackage.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) { final String instructionSet = getAppInstructionSet(newPackage.applicationInfo); int retCode = mInstaller.movedex(newPackage.mScanPath, newPackage.mPath, instructionSet); if (retCode != 0) { mInstaller.rmdex(newPackage.mPath, instructionSet); } } return PackageManager.INSTALL_SUCCEEDED; }
Source:
private DataSource ff4jDataSource() throws NamingException, SQLException { Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:/comp/env/jdbc/openchpl"); return (DataSource) ds; }

Target:
private DataSource ff4jDataSource() throws NamingException, SQLException { Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(env.getProperty("jndiName")); return (DataSource) ds; }
Source:
protected void configureCache(ConfigurationBuilder builder) { builder.statistics().available(false); if (transactional != null) { builder.transaction().transactionMode(transactionMode()); if (lockingMode != null) { builder.transaction().lockingMode(lockingMode); } } if (isolationLevel != null) { builder.locking().isolationLevel(isolationLevel); } if (persistence) { builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class); builder.persistence().passivation(passivation); } }

Target:
protected void configureCache(ConfigurationBuilder builder) { builder.statistics().enabled(true); if (transactional != null) { builder.transaction().transactionMode(transactionMode()); if (lockingMode != null) { builder.transaction().lockingMode(lockingMode); } } if (isolationLevel != null) { builder.locking().isolationLevel(isolationLevel); } if (persistence) { builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class); builder.persistence().passivation(passivation); } }
Source:
void registerOp(final LongKeyOperation operation, final int numSubOperations) { if (operation.isFromLocalClient()) { final LongKeyOperation unhandledOperation = ongoingOp.put(operation.getOperationId(), operation); if (unhandledOperation != null) { LOG.log(Level.SEVERE, "Discard the exceptionally unhandled operation: {0}", unhandledOperation); } } operation.setNumSubOps(numSubOperations); }

Target:
void registerOp(final LongKeyOperation operation, final int numSubOperations) { if (operation.isFromLocalClient()) { final LongKeyOperation unhandledOperation = ongoingOp.put(operation.getOperationId(), operation); if (unhandledOperation != null) { LOG.log(Level.SEVERE, "Discard the exceptionally unhandled operation: {0}", unhandledOperation.getOperationId()); } } operation.setNumSubOps(numSubOperations); }
Source:
public List<BlockMetaData> visit(FilterCompat.FilterPredicateCompat filterPredicateCompat) { if (skipStatisticsChecks) { return blocks; } FilterPredicate filterPredicate = filterPredicateCompat.getFilterPredicate(); SchemaCompatibilityValidator.validate(filterPredicate, schema); List<BlockMetaData> filteredBlocks = new ArrayList<BlockMetaData>(); for (BlockMetaData block : blocks) { if (!StatisticsFilter.canDrop(filterPredicate, block.getColumns())) { filteredBlocks.add(block); } } return filteredBlocks; }

Target:
public List<BlockMetaData> visit(FilterCompat.FilterPredicateCompat filterPredicateCompat) { FilterPredicate filterPredicate = filterPredicateCompat.getFilterPredicate(); SchemaCompatibilityValidator.validate(filterPredicate, schema); List<BlockMetaData> filteredBlocks = new ArrayList<BlockMetaData>(); for (BlockMetaData block : blocks) { if (!StatisticsFilter.canDrop(filterPredicate, block.getColumns())) { filteredBlocks.add(block); } } return filteredBlocks; }
Source:
public void initializeParsers(ExtensionParsingContext context) { context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_1_0.NAMESPACE, MessagingSubsystemParser_1_0::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_2_0.NAMESPACE, MessagingSubsystemParser_2_0::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_3_0.NAMESPACE, MessagingSubsystemParser_3_0::new); }

Target:
public void initializeParsers(ExtensionParsingContext context) { context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_1_0.NAMESPACE, MessagingSubsystemParser_1_0::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_2_0.NAMESPACE, MessagingSubsystemParser_2_0::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_3_0.NAMESPACE, PARSER); }
Source:
public void testReplaceValueUnequalStoreEntryEqualCacheWriterEntry() throws Exception { final FakeStore realStore = new FakeStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(realStore); final FakeCacheWriter realCache = new FakeCacheWriter(Collections.singletonMap("key", "oldValue")); final Ehcache<String, String> ehcache = this.getEhcache(realCache); assertFalse(ehcache.replace("key", "oldValue", "newValue")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(realStore.getEntryMap().get("key"), is(equalTo("unequalValue"))); assertThat(realCache.getEntryMap().get("key"), is(equalTo("oldValue"))); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ReplaceOutcome.MISS)); }

Target:
public void testReplaceValueUnequalStoreEntryEqualCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(fakeStore); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "oldValue")); final Ehcache<String, String> ehcache = this.getEhcache(fakeWriter); assertFalse(ehcache.replace("key", "oldValue", "newValue")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(fakeStore.getEntryMap().get("key"), is(equalTo("unequalValue"))); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ReplaceOutcome.MISS)); }
Source:
public void init(Config config, TaskContext context) { final SystemStreamPartition ssp = Iterables.getFirst(context.getSystemStreamPartitions(), null); if (ssp == null ? false : ssp.getPartition().getPartitionId() == 0) { final int count = checkEachTask ? context.getSamzaContainerContext().taskNames.size() : 1; LATCHES.put(id, new CountDownLatch(count)); timer.schedule(timerTask, TIMEOUT); } }

Target:
public void init(Config config, TaskContext context) { final SystemStreamPartition ssp = Iterables.getFirst(context.getSystemStreamPartitions(), null); if (ssp != null || ssp.getPartition().getPartitionId() == 0) { final int count = checkEachTask ? context.getSamzaContainerContext().taskNames.size() : 1; LATCHES.put(id, new CountDownLatch(count)); timer.schedule(timerTask, TIMEOUT); } }
Source:
private MimeMessage[] filterMessagesThruSelector(Message[] messages) throws MessagingException { List<Message> filteredMessages = new LinkedList<Message>(); for (int i = 0; i < messages.length; i++) { MimeMessage message = (MimeMessage) messages[i]; if (this.selectorExpression != null) { if (this.selectorExpression.getValue(this.evaluationContext, message, Boolean.class)) { filteredMessages.add(message); } else { if (this.logger.isDebugEnabled()) { this.logger.debug("Fetched email with subject '" + message.getSubject() + "' will be discarded by the matching filter" + " and will not be flagged as SEEN."); } } } else { filteredMessages.add(message); } } return filteredMessages.toArray(new MimeMessage[filteredMessages.size()]); }

Target:
private MimeMessage[] filterMessagesThruSelector(Message[] messages) throws MessagingException { List<MimeMessage> filteredMessages = new LinkedList<MimeMessage>(); for (int i = 0; i < messages.length; i++) { MimeMessage message = (MimeMessage) messages[i]; if (this.selectorExpression != null) { if (this.selectorExpression.getValue(this.evaluationContext, message, Boolean.class)) { filteredMessages.add(message); } else { if (this.logger.isDebugEnabled()) { this.logger.debug("Fetched email with subject '" + message.getSubject() + "' will be discarded by the matching filter" + " and will not be flagged as SEEN."); } } } else { filteredMessages.add(message); } } return filteredMessages.toArray(new MimeMessage[filteredMessages.size()]); }
Source:
public Court getByCourtId(Long courtId) { Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("courtId", courtId); String sql = "SELECT * FROM courts WHERE id = :courtId"; Court court = jdbcTemplate.queryForObject(sql, parameterMap, new CourtSQLMapper()); return court; }

Target:
public Court getByCourtId(Long courtId){ try{ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("courtId", courtId); String sql = "SELECT * FROM courts WHERE id = :courtId"; Court court = jdbcTemplate.queryForObject(sql, parameterMap, new CourtSQLMapper()); return court; }catch (Exception e){ return null; } }
Source:
protected String resolveJava(SlaveComputer computer, TaskListener listener) throws InterruptedException, IOException2 { if (StringUtils.isNotBlank(javaPath)) { return expandExpression(computer, javaPath); } final String workingDirectory = getWorkingDirectory(computer); if (workingDirectory == null) { throw new IOException2("Cannot retrieve a working directory of " + computer, null); } List<String> tried = new ArrayList<String>(); for (JavaProvider provider : JavaProvider.all()) { for (String javaCommand : provider.getJavas(computer, listener, connection)) { LOGGER.fine("Trying Java at "+javaCommand); try { tried.add(javaCommand); String java = checkJavaVersion(listener, javaCommand); return java; } catch (IOException e) { LOGGER.log(FINE, "Failed to check the Java version",e); } } } try { return attemptToInstallJDK(listener, workingDirectory); } catch (IOException e) { throw new IOException2("Could not find any known supported java version in "+tried+", and we also failed to install JDK as a fallback",e); } }

Target:
protected String resolveJava(SlaveComputer computer, TaskListener listener) throws InterruptedException, IOException2 { if (StringUtils.isNotBlank(javaPath)) { return expandExpression(computer, javaPath); } final String workingDirectory = getWorkingDirectory(computer); if (workingDirectory == null) { throw new IOException2("Cannot retrieve a working directory of " + computer, null); } List<String> tried = new ArrayList<String>(); for (JavaProvider provider : JavaProvider.all()) { for (String javaCommand : provider.getJavas(computer, listener, connection)) { LOGGER.fine("Trying Java at "+javaCommand); try { tried.add(javaCommand); return checkJavaVersion(listener, javaCommand); } catch (IOException e) { LOGGER.log(FINE, "Failed to check the Java version",e); } } } try { return attemptToInstallJDK(listener, workingDirectory); } catch (IOException e) { throw new IOException2("Could not find any known supported java version in "+tried+", and we also failed to install JDK as a fallback",e); } }
Source:
private void addHumanResourcesSubmenu(List<Action> actions) { if (getTaskSelectionManager().getSelectedTasks().size()==1) { Task task = getTaskSelectionManager().getSelectedTasks().get(0); HumanResource[] myResources = myProject.getHumanResourceManager().getResourcesArray(); ArrayList<ResourceAssignment> assignments = new ArrayList<ResourceAssignment>(Arrays.asList(task.getAssignmentCollection().getAssignments())); HashMap<HumanResource, AssignmentToggleAction> humanAssignments = new HashMap<>(); AssignmentToggleAction assignmentAction; for (HumanResource hr : myResources) { assignmentAction = new AssignmentToggleAction(hr, myUIFacade, getTaskSelectionManager().getSelectedTasks().get(0)); humanAssignments.put(hr, assignmentAction); actions.add(assignmentAction); } for (ResourceAssignment ra : assignments) { assignmentAction = humanAssignments.get(ra.getResource()); assignmentAction.putValue(Action.SELECTED_KEY, true); } } }

Target:
private void addHumanResourcesSubmenu(List<Action> actions) { if (getTaskSelectionManager().getSelectedTasks().size() == 1) { Task task = getTaskSelectionManager().getSelectedTasks().get(0); List<HumanResource> resources = myProject.getHumanResourceManager().getResources(); HashMap<HumanResource, AssignmentToggleAction> human2action = new HashMap<>(); for (HumanResource hr : resources) { AssignmentToggleAction assignmentAction = new AssignmentToggleAction(hr, task, myUIFacade); assignmentAction.putValue(Action.SELECTED_KEY, false); human2action.put(hr, assignmentAction); actions.add(assignmentAction); } ResourceAssignment[] assignments = task.getAssignmentCollection().getAssignments(); for (ResourceAssignment ra : assignments) { AssignmentToggleAction assignmentAction = human2action.get(ra.getResource()); assignmentAction.putValue(Action.SELECTED_KEY, true); } } }
Source:
public void testInterpolatedStitchPoints() { EmbroideryStream stream = new DSTStream(); stream.addStitchPoint(0, 0); stream.addStitchPoint(80, 80); assertEquals(5, stream.getPointList().size()); assertEquals(new PointF(0, 0), stream.getPointList().get(0).getPoint()); assertEquals(new PointF(0, 0), stream.getPointList().get(1).getPoint()); assertTrue(stream.getPointList().get(1).isJumpPoint()); assertEquals(new PointF(40, 40), stream.getPointList().get(2).getPoint()); assertTrue(stream.getPointList().get(2).isJumpPoint()); assertEquals(new PointF(80, 80), stream.getPointList().get(3).getPoint()); assertTrue(stream.getPointList().get(3).isJumpPoint()); assertEquals(new PointF(80, 80), stream.getPointList().get(4).getPoint()); }

Target:
public void testInterpolatedStitchPoints() { stream.addStitchPoint(0, 0); stream.addStitchPoint(80, 80); assertEquals(5, stream.getPointList().size()); assertTrue(pointAtPositionEqualsCoordinates(0, 0, 0)); assertTrue(pointAtPositionEqualsCoordinates(1, 0, 0)); assertTrue(stream.getPointList().get(1).isJumpPoint()); assertTrue(pointAtPositionEqualsCoordinates(2, 40, 40)); assertTrue(stream.getPointList().get(2).isJumpPoint()); assertTrue(pointAtPositionEqualsCoordinates(3, 80, 80)); assertTrue(stream.getPointList().get(3).isJumpPoint()); assertTrue(pointAtPositionEqualsCoordinates(4, 80, 80)); verify(header, times(1)).initialize(0, 0); verify(header, times(4)).update(anyFloat(), anyFloat()); }
Source:
protected void evalEnvironmentVariables(Map<String, String> newParametersToSave) { for (Object keyObject : userConfig.keySet()) { String key = (String) keyObject; String value = userConfig.getProperty(key); Matcher matcher = ENV_VALUE_PATTERN.matcher(value); while (matcher.find()) { boolean booleanValue = "?".equals(matcher.group("boolean")); String envVarName = matcher.group("envparam"); String defaultValue = matcher.group("defaultvalue"); String envValue = getEnvironmentVariableValue(envVarName); String result = ""; if (booleanValue) { result = StringUtils.isBlank(envValue) ? "false" : "true"; } else { result = StringUtils.isBlank(envValue) ? defaultValue : envValue; } result = matcher.replaceFirst(result); newParametersToSave.put(key, result); matcher = ENV_VALUE_PATTERN.matcher(result); } } }

Target:
protected void evalEnvironmentVariables(Map<String, String> newParametersToSave) { for (Object keyObject : userConfig.keySet()) { String key = (String) keyObject; String value = userConfig.getProperty(key); Matcher matcher = ENV_VALUE_PATTERN.matcher(value); StringBuffer sb = new StringBuffer(); while (matcher.find()) { boolean booleanValue = "??".equals(matcher.group("boolean")); String envVarName = matcher.group("envparam"); String defaultValue = matcher.group("defaultvalue"); String envValue = getEnvironmentVariableValue(envVarName); String result; if (booleanValue) { result = StringUtils.isBlank(envValue) ? "false" : "true"; } else { result = StringUtils.isBlank(envValue) ? defaultValue : envValue; } matcher.appendReplacement(sb, result); } matcher.appendTail(sb); if (matcher.hitEnd()) { newParametersToSave.put(key, sb.toString()); } } }
Source:
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 2) { throw new NotEnoughArgumentsException(); } BigDecimal startingBalance = ess.getSettings().getStartingBalance(); try { cmd = Commandeco.EcoCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH)); if (args[2].contains("%") && !(cmd == Commandeco.EcoCommands.RESET)) { isPercent = true; amount = new BigDecimal(args[2].substring(0,args[2].length()-1)); } else { amount = (cmd == Commandeco.EcoCommands.RESET) ? startingBalance : new BigDecimal(args[2].replaceAll("[^0-9\\.]", "")); } } catch (Exception ex) { throw new NotEnoughArgumentsException(ex); } loopOfflinePlayers(server, sender, false, true, args[1], args); if (cmd == Commandeco.EcoCommands.RESET || cmd == Commandeco.EcoCommands.SET) { if (args[1].contentEquals("**")) { server.broadcastMessage(tl("resetBalAll", NumberUtil.displayCurrency(amount, ess))); } else if (args[1].contentEquals("*")) { server.broadcastMessage(tl("resetBal", NumberUtil.displayCurrency(amount, ess))); } } }

Target:
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 2) { throw new NotEnoughArgumentsException(); } BigDecimal startingBalance = ess.getSettings().getStartingBalance(); try { cmd = Commandeco.EcoCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH)); isPercent = args[2].endsWith("%"); amount = (cmd == Commandeco.EcoCommands.RESET) ? startingBalance : new BigDecimal(args[2].replaceAll("[^0-9\\.]", "")); } catch (Exception ex) { throw new NotEnoughArgumentsException(ex); } loopOfflinePlayers(server, sender, false, true, args[1], args); if (cmd == Commandeco.EcoCommands.RESET || cmd == Commandeco.EcoCommands.SET) { if (args[1].contentEquals("**")) { server.broadcastMessage(tl("resetBalAll", NumberUtil.displayCurrency(amount, ess))); } else if (args[1].contentEquals("*")) { server.broadcastMessage(tl("resetBal", NumberUtil.displayCurrency(amount, ess))); } } }
Source:
MockReplicationManager(ReplicationConfig replicationConfig, ClusterMapConfig clusterMapConfig, StoreConfig storeConfig, StorageManager storageManager, ClusterMap clusterMap, DataNodeId dataNodeId) throws ReplicationException { super(replicationConfig, clusterMapConfig, storeConfig, storageManager, new StoreKeyFactory() { @Override public StoreKey getStoreKey(DataInputStream stream) throws IOException { return null; } @Override public StoreKey getStoreKey(String base64String) throws IOException { return null; } }, clusterMap, null, dataNodeId, null, clusterMap.getMetricRegistry(), null); this.dataNodeId = dataNodeId; reset(); }

Target:
MockReplicationManager(ReplicationConfig replicationConfig, ClusterMapConfig clusterMapConfig, StoreConfig storeConfig, StorageManager storageManager, ClusterMap clusterMap, DataNodeId dataNodeId) throws ReplicationException { super(replicationConfig, clusterMapConfig, storeConfig, storageManager, new StoreKeyFactory() { @Override public StoreKey getStoreKey(DataInputStream stream) { return null; } @Override public StoreKey getStoreKey(String input) { return null; } }, clusterMap, null, dataNodeId, null, clusterMap.getMetricRegistry(), null); this.dataNodeId = dataNodeId; reset(); }
Source:
public void removeAttribute(String name) { if (_asyncAttributes == null) _attributes.removeAttribute(name); else _asyncAttributes.removeAttribute(name); }

Target:
public void removeAttribute(String name) { getAttributes().removeAttribute(name); }
Source:
public List<RowMap> jsonMaps() { ArrayList<RowMap> list = new ArrayList<>(); Object value; for ( Iterator<Row> ri = filteredRows().iterator() ; ri.hasNext(); ) { Row r = ri.next(); RowMap rowMap = new RowMap(); rowMap.setRowType(getType()); rowMap.setTable(getTable().getName()); rowMap.setDatabase(getDatabase().getName()); rowMap.setTimestamp(getHeader().getTimestamp() / 1000); rowMap.setXid(getXid()); rowMap.setCommit(isCommit() && !ri.hasNext()); Iterator<Column> colIter = r.getColumns().iterator(); Iterator<ColumnDef> defIter = table.getColumnList().iterator(); while ( colIter.hasNext() && defIter.hasNext() ) { Column c = colIter.next(); ColumnDef d = defIter.next(); if ( c instanceof DatetimeColumn ) value = ((DatetimeColumn) c).getLongValue(); else value = c.getValue(); if ( value != null ) value = d.asJSON(value); rowMap.putData(d.getName(), value); } list.add(rowMap); } return list; }

Target:
public List<RowMap> jsonMaps() { ArrayList<RowMap> list = new ArrayList<>(); Object value; for ( Iterator<Row> ri = filteredRows().iterator() ; ri.hasNext(); ) { Row r = ri.next(); RowMap rowMap = new RowMap(); rowMap.setRowType(getType()); rowMap.setTable(getTable().getName()); rowMap.setDatabase(getDatabase().getName()); rowMap.setTimestamp(getHeader().getTimestamp() / 1000); rowMap.setXid(getXid()); if ( this.txCommit && !ri.hasNext() ) rowMap.setTXCommit(); Iterator<Column> colIter = r.getColumns().iterator(); Iterator<ColumnDef> defIter = table.getColumnList().iterator(); while ( colIter.hasNext() && defIter.hasNext() ) { Column c = colIter.next(); ColumnDef d = defIter.next(); if ( c instanceof DatetimeColumn ) value = ((DatetimeColumn) c).getLongValue(); else value = c.getValue(); if ( value != null ) value = d.asJSON(value); rowMap.putData(d.getName(), value); } list.add(rowMap); } return list; }
Source:
public void simpleTestTripleDES() throws Exception { KeyPair caPair = KeyPairGenerator.getInstance("RSA").generateKeyPair(); X509Certificate ca = X509Certificates.createEphemeral( new X500Principal("CN=CA"), caPair); KeyPair clientPair = KeyPairGenerator.getInstance("RSA") .generateKeyPair(); X509Certificate client = X509Certificates.createEphemeral( new X500Principal("CN=Client"), clientPair); PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(ca, "DES3"); PkiMessageEncoder encoder = new PkiMessageEncoder( clientPair.getPrivate(), client, envEncoder); PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(ca, caPair.getPrivate()); PkiMessageDecoder decoder = new PkiMessageDecoder(client, envDecoder); PkiMessage<?> actual = decoder.decode(encoder.encode(message)); assertEquals(message, actual); }

Target:
public void simpleTestTripleDES() throws Exception { KeyPair caPair = KeyPairGenerator.getInstance("RSA").generateKeyPair(); X509Certificate ca = X509Certificates.createEphemeral( new X500Principal("CN=CA"), caPair); KeyPair clientPair = KeyPairGenerator.getInstance("RSA") .generateKeyPair(); X509Certificate client = X509Certificates.createEphemeral( new X500Principal("CN=Client"), clientPair); PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(ca, "DESede"); PkiMessageEncoder encoder = new PkiMessageEncoder( clientPair.getPrivate(), client, envEncoder); PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(ca, caPair.getPrivate()); PkiMessageDecoder decoder = new PkiMessageDecoder(client, envDecoder); PkiMessage<?> actual = decoder.decode(encoder.encode(message)); assertEquals(message, actual); }
Source:
public void returnsNullWhenUsingDottedNotation() { Map<String, Object> query = new HashMap<String, Object>(); query.put("name", "mike"); assertThat(im.find(query, 0, Long.MAX_VALUE, Arrays.asList("name.blah"), null), is(nullValue())); }

Target:
public void returnsNullWhenUsingDottedNotation() { Map<String, Object> query = new HashMap<String, Object>(); query.put("name", "mike"); QueryResult queryResult = im.find(query, 0, Long.MAX_VALUE, Arrays.asList("name.blah"), null); assertThat(queryResult, is(nullValue())); }
Source:
default Bundle install() throws Exception { byte[] build = LaunchpadBuilder.workspace.build(LaunchpadBuilder.projectDir.getAbsolutePath(), x().spec); String name = x().spec.bundleSymbolicName.toString(); String version = x().spec.bundleVersion; version = (version == null) ? "0" : version; ByteArrayInputStream bin = new ByteArrayInputStream(build); return x().ws.getBundleContext() .installBundle(name + ';' + version, bin); }

Target:
default Bundle install() throws Exception { BuilderSpecification spec = x().spec; byte[] build = LaunchpadBuilder.workspace.build(LaunchpadBuilder.projectDir.getAbsolutePath(), spec); String location; if (spec.location == null) { String name = spec.bundleSymbolicName.toString(); String version = spec.bundleVersion; version = (version == null) ? "0" : version; location = name + '-' + version; } else { location = spec.location; } ByteArrayInputStream bin = new ByteArrayInputStream(build); return x().ws.getBundleContext() .installBundle(location, bin); }
Source:
public void readTimeout() throws Throwable { final CountDownLatch startupLatch = new CountDownLatch(1); final CountDownLatch cleanupLatch = new CountDownLatch(1); Thread server = new Thread(new Runnable() { @Override public void run() { ServerSocket serverSocket = null; Socket socket = null; BufferedWriter w = null; try { serverSocket = ServerSocketFactory.getDefault() .createServerSocket(54321); startupLatch.countDown(); socket = serverSocket.accept(); w = new BufferedWriter(new OutputStreamWriter(socket .getOutputStream())); w.write("HTTP/1.0 200 OK"); w.flush(); Thread.sleep(500); } catch (Throwable e) { TEST_LOG.logger.log(Level.SEVERE, "Exception in readTimeout test server", e); } finally { startupLatch.countDown(); IOUtils.closeQuietly(w); IOUtils.closeQuietly(socket); IOUtils.closeQuietly(serverSocket); cleanupLatch.countDown(); } } }); server.start(); startupLatch.await(); try { CloudantClient c = new CloudantClient("http://localhost:54321", "", "", new ConnectOptions().setReadTimeout(new TimeoutCustomizationInterceptor .TimeoutOption(250, TimeUnit.MILLISECONDS))); c.getAllDbs(); } catch (CouchDbException e) { if (e.getCause() != null) { throw e.getCause(); } else { throw e; } } finally { cleanupLatch.await(); } }

Target:
public void readTimeout() throws Throwable { final CountDownLatch startupLatch = new CountDownLatch(1); final CountDownLatch cleanupLatch = new CountDownLatch(1); Thread server = new Thread(new Runnable() { @Override public void run() { ServerSocket serverSocket = null; Socket socket = null; BufferedWriter w = null; try { serverSocket = ServerSocketFactory.getDefault() .createServerSocket(54321); startupLatch.countDown(); socket = serverSocket.accept(); w = new BufferedWriter(new OutputStreamWriter(socket .getOutputStream())); w.write("HTTP/1.0 200 OK"); w.flush(); Thread.sleep(500); } catch (Throwable e) { TEST_LOG.logger.log(Level.SEVERE, "Exception in readTimeout test server", e); } finally { startupLatch.countDown(); IOUtils.closeQuietly(w); IOUtils.closeQuietly(socket); IOUtils.closeQuietly(serverSocket); cleanupLatch.countDown(); } } }); server.start(); startupLatch.await(); try { CloudantClient c = new CloudantClient("http://localhost:54321", null, (String) null, new ConnectOptions().setReadTimeout(new TimeoutCustomizationInterceptor .TimeoutOption(250, TimeUnit.MILLISECONDS))); c.getAllDbs(); } catch (CouchDbException e) { if (e.getCause() != null) { throw e.getCause(); } else { throw e; } } finally { cleanupLatch.await(); } }
Source:
public void hasSameOrderableAs_shouldReturnTrueIfTheConceptsMatchAndHaveSameDrugNonCodedTrimmingSpaces() throws Exception { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); Drug drug1 = new Drug(); drug1.setConcept(concept); order.setDrug(drug1); order.setDrugNonCoded("Chrocine"); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); otherOrder.setDrug(drug1); otherOrder.setDrugNonCoded(" Chrocine "); assertTrue(order.hasSameOrderableAs(otherOrder)); }

Target:
public void hasSameOrderableAs_shouldReturnTrueIfTheConceptsMatchAndHaveSameDrugNonCodedTrimmingSpaces() throws Exception { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); order.setConcept(concept); order.setDrugNonCoded("Chrocine"); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); otherOrder.setDrugNonCoded(" Chrocine "); assertTrue(order.hasSameOrderableAs(otherOrder)); }
Source:
public SetAttributesCommand( IBlockingProvider<SimpleFeature> feature, IBlockingProvider<ILayer> layer, String xpath[], Object value[] ) { this.xpath = xpath; this.value = value; this.oldValue = new Object[value.length]; editFeature = feature; editLayer = layer; }

Target:
public SetAttributesCommand(IBlockingProvider<SimpleFeature> feature, IBlockingProvider<ILayer> layer, String xpath[], Object value[]) { Validate.notNull(xpath); Validate.notNull(value); Validate.isTrue(xpath.length == value.length, "xpath and values do not have same lenght"); this.xpath = xpath; this.value = value; this.oldValue = new Object[xpath.length]; editFeature = feature; editLayer = layer; }
Source:
protected static FileValue getWorkspaceFile(RootedPath directory, Environment env) throws RepositoryFunctionException, InterruptedException { RootedPath workspaceRootedFile = RootedPath.toRootedPath( directory.getRoot(), directory .getRootRelativePath() .getRelative(LabelConstants.WORKSPACE_DOT_BAZEL_FILE_NAME)); if (!workspaceRootedFile.asPath().exists()) { workspaceRootedFile = RootedPath.toRootedPath( directory.getRoot(), directory .getRootRelativePath() .getRelative(LabelConstants.WORKSPACE_FILE_NAME)); } SkyKey workspaceFileKey = FileValue.key(workspaceRootedFile); FileValue value; try { value = (FileValue) env.getValueOrThrow(workspaceFileKey, IOException.class); } catch (IOException e) { throw new RepositoryFunctionException( new IOException("Could not access " + workspaceRootedFile + ": " + e.getMessage()), Transience.PERSISTENT); } return value; }

Target:
protected static FileValue getWorkspaceFile(RootedPath directory, Environment env) throws RepositoryFunctionException, InterruptedException { RootedPath workspaceRootedFile; try { workspaceRootedFile = WorkspaceFileHelper.getWorkspaceRootedFile(directory, env); if (workspaceRootedFile == null) { return null; } } catch (IOException e) { throw new RepositoryFunctionException( new IOException( "Could not determine workspace file (\"WORKSPACE.bazel\" or \"WORKSPACE\"): " + e.getMessage()), Transience.PERSISTENT); } SkyKey workspaceFileKey = FileValue.key(workspaceRootedFile); FileValue value; try { value = (FileValue) env.getValueOrThrow(workspaceFileKey, IOException.class); } catch (IOException e) { throw new RepositoryFunctionException( new IOException("Could not access " + workspaceRootedFile + ": " + e.getMessage()), Transience.PERSISTENT); } return value; }
Source:
public void mutate(List<? extends Mutation> mutations) throws IOException { ReadLock lock = closeLock.readLock(); try { if (closed.get()) { throw new IllegalStateException("Cannot mutate when the BufferedMutator is closed."); } for (Mutation mutation : mutations) { doMutation(mutation); } } finally { lock.unlock(); } }

Target:
public void mutate(List<? extends Mutation> mutations) throws IOException { ReadLock lock = mutationLock.readLock(); lock.lock(); try { if (closed) { throw new IllegalStateException("Cannot mutate when the BufferedMutator is closed."); } handleExceptions(); for (Mutation mutation : mutations) { doMutation(mutation); } } finally { lock.unlock(); } }