auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ResourcePack fromUriUnchecked(URI uri) { return new SpongeURIResourcePack(Preconditions.checkNotNull(uri, "uri"), Optional.<String>absent()); }

Target:
public ResourcePack fromUriUnchecked(URI uri) { return SpongeResourcePack.create(checkNotNull(uri, "uri"), null); }
Source:
private String getSurveyForPhone(String devicePhoneNumber, String imei) { DeviceSurveyJobQueueDAO dsjqDAO = new DeviceSurveyJobQueueDAO(); SurveyDAO surveyDao = new SurveyDAO(); SurveyGroupDAO sgDao = new SurveyGroupDAO(); StringBuilder sb = new StringBuilder(); String sgName; String surveyName; Double ver; Boolean isInMonitoringGroup; String newLocaleSurveyId; for (DeviceSurveyJobQueue dsjq : dsjqDAO.get(devicePhoneNumber, imei)) { Survey s = surveyDao.getById(dsjq.getSurveyID()); SurveyGroup sg = s != null ? sgDao.getByKey(s.getSurveyGroupId()) : null; if (s != null && sg != null) { ver = s.getVersion(); surveyName = s.getName(); sgName = sg.getCode() != null ? sg.getCode() : "unknown"; isInMonitoringGroup = Boolean.valueOf(sg.getMonitoringGroup() != null ? sg .getMonitoringGroup() : false); newLocaleSurveyId = sg.getNewLocaleSurveyId() != null ? sg.getNewLocaleSurveyId() .toString() : "null"; if (ver == null) { ver = new Double(1.0); } sb.append(devicePhoneNumber + "," + dsjq.getSurveyID() + "," + surveyName + "," + dsjq.getLanguage() + "," + ver + "," + s.getSurveyGroupId() + "," + sgName + "," + isInMonitoringGroup + "," + newLocaleSurveyId + "\n"); } } return sb.toString(); }

Target:
private String getSurveyForPhone(String devicePhoneNumber, String imei) { DeviceSurveyJobQueueDAO dsjqDAO = new DeviceSurveyJobQueueDAO(); SurveyDAO surveyDao = new SurveyDAO(); SurveyGroupDAO sgDao = new SurveyGroupDAO(); StringBuilder sb = new StringBuilder(); String sgName; String surveyName; Double ver; Boolean isInMonitoringGroup; String newLocaleSurveyId; for (DeviceSurveyJobQueue dsjq : dsjqDAO.get(devicePhoneNumber, imei)) { Survey s = surveyDao.getById(dsjq.getSurveyID()); SurveyGroup sg = s != null && s.getSurveyGroupId() != null ? sgDao.getByKey(s.getSurveyGroupId()) : null; if (s != null && sg != null) { ver = s.getVersion(); surveyName = s.getName(); sgName = sg.getCode() != null ? sg.getCode() : "unknown"; isInMonitoringGroup = Boolean.valueOf(sg.getMonitoringGroup() != null ? sg .getMonitoringGroup() : false); newLocaleSurveyId = sg.getNewLocaleSurveyId() != null ? sg.getNewLocaleSurveyId() .toString() : "null"; if (ver == null) { ver = new Double(1.0); } sb.append(devicePhoneNumber + "," + dsjq.getSurveyID() + "," + surveyName + "," + dsjq.getLanguage() + "," + ver + "," + s.getSurveyGroupId() + "," + sgName + "," + isInMonitoringGroup + "," + newLocaleSurveyId + "\n"); } } return sb.toString(); }
Source:
public Map<String, String> setConfig(ConfigRequest request) throws ApiException { Map<String, String> result = new HashMap<>(); try (GitConnection gitConnection = getGitConnection()) { Config config = gitConnection.getConfig(); for (Map.Entry<String, String> configData : request.getConfigEntries().entrySet()) { try { config.set(configData.getKey(), configData.getValue()); result.put(configData.getKey(), configData.getValue()); } catch (GitException exception) { final String msg = "Cannot write to config file"; LOG.error(msg, exception); throw new GitException(msg); } } } return result; }

Target:
public void setConfig(ConfigRequest request) throws ApiException { try (GitConnection gitConnection = getGitConnection()) { Config config = gitConnection.getConfig(); for (Map.Entry<String, String> configData : request.getConfigEntries().entrySet()) { try { config.set(configData.getKey(), configData.getValue()); } catch (GitException exception) { final String msg = "Cannot write to config file"; LOG.error(msg, exception); throw new GitException(msg); } } } }
Source:
public <S extends FieldValueCounter> S save(S fieldValueCounter) { reset(fieldValueCounter.getName(), MARKER); increment(fieldValueCounter.getName(), MARKER, 0); for (Map.Entry<String, Double> entry : fieldValueCounter.getFieldValueCount().entrySet()) { increment(fieldValueCounter.getName(), entry.getKey(), entry.getValue()); } return fieldValueCounter; }

Target:
public <S extends FieldValueCounter> S save(S fieldValueCounter) { reset(fieldValueCounter.getName(), MARKER); increment(fieldValueCounter.getName(), MARKER, 0); for (Map.Entry<String, Double> entry : fieldValueCounter.getFieldValueCounts().entrySet()) { increment(fieldValueCounter.getName(), entry.getKey(), entry.getValue()); } return fieldValueCounter; }
Source:
public KualiDecimal calculateAppliedPaymentAmount(CustomerInvoiceDocument invoice) { Map<String, Object> criteria = new HashMap<>(); KualiDecimal totalPayments = KualiDecimal.ZERO; criteria.put("financialDocumentReferenceInvoiceNumber", invoice.getDocumentNumber()); List<String> allowedOwningDocumentTypes = new ArrayList<>(); allowedOwningDocumentTypes.add(ArConstants.PAYMENT_APPLICATION_DOCUMENT_TYPE_CODE); allowedOwningDocumentTypes.add(ArConstants.CUSTOMER_CREDIT_MEMO_DOCUMENT_TYPE_CODE); criteria.put(KFSPropertyConstants.DOCUMENT_HEADER+"."+KFSPropertyConstants.WORKFLOW_DOCUMENT_TYPE_NAME, allowedOwningDocumentTypes); Collection<InvoicePaidApplied> invoicePaidApplieds = businessObjectService.findMatching(InvoicePaidApplied.class, criteria); for (InvoicePaidApplied invoicePapidApplied : invoicePaidApplieds) { totalPayments = totalPayments.add(invoicePapidApplied.getInvoiceItemAppliedAmount()); } return totalPayments; }

Target:
public KualiDecimal calculateAppliedPaymentAmount(CustomerInvoiceDocument invoice) { Map<String, Object> criteria = new HashMap<>(); KualiDecimal totalPayments = KualiDecimal.ZERO; criteria.put(ArPropertyConstants.CustomerInvoiceDocumentFields.FINANCIAL_DOCUMENT_REF_INVOICE_NUMBER, invoice.getDocumentNumber()); List<String> allowedOwningDocumentTypes = new ArrayList<>(); allowedOwningDocumentTypes.add(ArConstants.PAYMENT_APPLICATION_DOCUMENT_TYPE_CODE); allowedOwningDocumentTypes.add(ArConstants.CUSTOMER_CREDIT_MEMO_DOCUMENT_TYPE_CODE); criteria.put(KFSPropertyConstants.DOCUMENT_HEADER+"."+KFSPropertyConstants.WORKFLOW_DOCUMENT_TYPE_NAME, allowedOwningDocumentTypes); Collection<InvoicePaidApplied> invoicePaidApplieds = businessObjectService.findMatching(InvoicePaidApplied.class, criteria); for (InvoicePaidApplied invoicePapidApplied : invoicePaidApplieds) { totalPayments = totalPayments.add(invoicePapidApplied.getInvoiceItemAppliedAmount()); } return totalPayments; }
Source:
public void serialize(XMLExtendedStreamWriter writer, RemoteStoreConfiguration configuration) throws XMLStreamException { AttributeSet attributes = configuration.attributes(); writer.writeStartElement(Element.REMOTE_STORE); attributes.write(writer, RemoteStoreConfiguration.BALANCING_STRATEGY, Attribute.BALANCING_STRATEGY); attributes.write(writer, RemoteStoreConfiguration.CONNECTION_TIMEOUT, Attribute.CONNECT_TIMEOUT); attributes.write(writer, RemoteStoreConfiguration.FORCE_RETURN_VALUES, Attribute.FORCE_RETURN_VALUES); attributes.write(writer, RemoteStoreConfiguration.HOTROD_WRAPPING, Attribute.HOTROD_WRAPPING); attributes.write(writer, RemoteStoreConfiguration.KEY_SIZE_ESTIMATE, Attribute.KEY_SIZE_ESTIMATE); attributes.write(writer, RemoteStoreConfiguration.VALUE_SIZE_ESTIMATE, Attribute.VALUE_SIZE_ESTIMATE); attributes.write(writer, RemoteStoreConfiguration.MARSHALLER, Attribute.MARSHALLER); attributes.write(writer, RemoteStoreConfiguration.PROTOCOL_VERSION, Attribute.PROTOCOL_VERSION); attributes.write(writer, RemoteStoreConfiguration.REMOTE_CACHE_NAME, Attribute.REMOTE_CACHE_NAME); attributes.write(writer, RemoteStoreConfiguration.SOCKET_TIMEOUT, Attribute.SOCKET_TIMEOUT); attributes.write(writer, RemoteStoreConfiguration.TCP_NO_DELAY, Attribute.TCP_NO_DELAY); attributes.write(writer, RemoteStoreConfiguration.TRANSPORT_FACTORY, Attribute.TRANSPORT_FACTORY); writeCommonStoreAttributes(writer, configuration); writeAsyncExecutor(writer, configuration.asyncExecutorFactory()); writeConnectionPool(writer, configuration.connectionPool()); writeServers(writer, configuration.servers()); writeCommonStoreElements(writer, configuration); writer.writeEndElement(); }

Target:
public void serialize(XMLExtendedStreamWriter writer, RemoteStoreConfiguration configuration) throws XMLStreamException { writer.writeStartElement(Element.REMOTE_STORE); configuration.attributes().write(writer); writeCommonStoreSubAttributes(writer, configuration); writeAsyncExecutor(writer, configuration.asyncExecutorFactory()); writeConnectionPool(writer, configuration.connectionPool()); writeServers(writer, configuration.servers()); writeCommonStoreElements(writer, configuration); writer.writeEndElement(); }
Source:
void configureAddsListeners() { Mockito.when(jdbi.onDemand(LobbyChatHistoryDao.class)).thenReturn(lobbyChatHistoryDao); ChatMessagingService.build(chatters, jdbi).configure(webSocketMessagingBus); verify(webSocketMessagingBus, atLeastOnce()).addListener(any(), any()); }

Target:
void configureAddsListeners() { when(jdbi.onDemand(LobbyChatHistoryDao.class)).thenReturn(lobbyChatHistoryDao); ChatMessagingService.build(chatters, jdbi).configure(webSocketMessagingBus); verify(webSocketMessagingBus, atLeastOnce()).addListener(any(), any()); }
Source:
public boolean processHarbormaster() { final boolean harbormasterSuccess = buildResult.isBetterOrEqualTo(Result.SUCCESS); if (runHarbormaster) { logger.info("harbormaster", "Sending Harbormaster BUILD_URL via PHID: " + phid); Task.Result sendUriResult = new SendHarbormasterUriTask(logger, diffClient, phid, buildUrl).run(); if (sendUriResult != Task.Result.SUCCESS) { logger.info(LOGGING_TAG, "Unable to send BUILD_URL to Harbormaster"); } if (getCoverage() != null) { logger.info( LOGGING_TAG, String.format("Publishing coverage data to Harbormaster for %d files.", getCoverage().size()) ); } logger.info( LOGGING_TAG, String.format("Sending build result to Harbormaster with PHID %s, success: %s", phid, harbormasterSuccess ) ); Task.Result result = new SendHarbormasterResultTask(logger, diffClient, phid, harbormasterSuccess, getCoverage()).run(); if (result != Task.Result.SUCCESS) { logger.info(LOGGING_TAG, "Unable to post to harbormaster"); return false; } } else { logger.info("uberalls", "Harbormaster integration not enabled for this build."); if (buildResult.isBetterOrEqualTo(Result.SUCCESS)) { commentAction = "resign"; } else if (buildResult.isWorseOrEqualTo(Result.UNSTABLE)) { commentAction = "reject"; } } return true; }

Target:
public boolean processHarbormaster() { final boolean harbormasterSuccess = buildResult.isBetterOrEqualTo(Result.SUCCESS); if (runHarbormaster) { logger.info("harbormaster", "Sending Harbormaster BUILD_URL via PHID: " + phid); Task.Result sendUriResult = new SendHarbormasterUriTask(logger, diffClient, phid, buildUrl).run(); if (sendUriResult != Task.Result.SUCCESS) { logger.info(LOGGING_TAG, "Unable to send BUILD_URL to Harbormaster"); } if (harbormasterCoverage != null) { logger.info( LOGGING_TAG, String.format("Publishing coverage data to Harbormaster for %d files.", harbormasterCoverage.size()) ); } logger.info( LOGGING_TAG, String.format("Sending build result to Harbormaster with PHID %s, success: %s", phid, harbormasterSuccess ) ); Task.Result result = new SendHarbormasterResultTask(logger, diffClient, phid, harbormasterSuccess, getCoverage()).run(); if (result != Task.Result.SUCCESS) { return false; } } else { logger.info("uberalls", "Harbormaster integration not enabled for this build."); if (buildResult.isBetterOrEqualTo(Result.SUCCESS)) { commentAction = "resign"; } else if (buildResult.isWorseOrEqualTo(Result.UNSTABLE)) { commentAction = "reject"; } } return true; }
Source:
private JButton getBtnReopenEdit(WebSocketPanelSender sender){ if(btnReopenEdit == null) { btnReopenEdit = new JButton(); btnReopenEdit.setIcon(REOPEN_EDIT_ICON); btnReopenEdit.setEnabled(true); btnReopenEdit.setToolTipText(Constant.messages.getString("websocket.manual_send.btn_reopen_edit_hint")); btnReopenEdit.addActionListener(e -> { try { wsUiHelper.setSecWebsocketKeyField(sender.getSecWebKeyFrom(wsUiHelper.getSelectedChannelId())); JOptionPane.showMessageDialog(this, getReopenPanel(), Constant.messages.getString("websocket.manual_send.adv_dialog.title"), JOptionPane.PLAIN_MESSAGE); } catch (IllegalArgumentException e1) { View.getSingleton().showWarningDialog(Constant.messages.getString("websocket.manual_send.fail.invalid_channel")); } catch (DatabaseException e1) { LOGGER.info(e1.getStackTrace().toString()); } catch (HttpMalformedHeaderException e1) { LOGGER.info(e1.getStackTrace().toString()); } }); } return btnReopenEdit; }

Target:
private JButton getBtnReopenEdit(WebSocketPanelSender sender){ if(btnReopenEdit == null) { btnReopenEdit = new JButton(); btnReopenEdit.setIcon(REOPEN_EDIT_ICON); btnReopenEdit.setEnabled(true); btnReopenEdit.setToolTipText(Constant.messages.getString("websocket.manual_send.btn_reopen_edit_hint")); btnReopenEdit.addActionListener(e -> { try { wsUiHelper.setSecWebSocketKeyField(sender.getWebSocketKey(wsUiHelper.getSelectedChannelId())); JOptionPane.showMessageDialog(this, getReopenPanel(), Constant.messages.getString("websocket.manual_send.adv_dialog.title"), JOptionPane.PLAIN_MESSAGE); } catch (IllegalArgumentException e1) { View.getSingleton().showWarningDialog(Constant.messages.getString("websocket.manual_send.fail.invalid_channel")); } catch (Exception e1) { LOGGER.error(e1,e1); View.getSingleton().showWarningDialog(Constant.messages.getString("websocket.manual_send.fail.unable_reopen")); } }); } return btnReopenEdit; }
Source:
public void process(Exchange exchange) throws Exception { ExecCommand execCommand = getBinding().readInput(exchange, endpoint); ExecCommandExecutor executor = endpoint.getCommandExecutor(); if (executor == null) { executor = new DefaultExecCommandExecutor(); } Consumer<String> logMethod; switch(execCommand.getCommandLogLevel()) { case DEBUG: logMethod = log::debug; break; case ERROR: logMethod = log::error; break; case INFO: logMethod = log::info; break; case OFF: logMethod = x-> { }; break; case TRACE: logMethod = log::trace; break; case WARN: logMethod = log::warn; break; default: logMethod = log::info; } logMethod.accept(String.format("Executing %s", execCommand)); ExecResult result = executor.execute(execCommand); ObjectHelper.notNull(result, "The command executor must return a not-null result"); logMethod.accept(String.format("The command %s had exit value %s", execCommand, result.getExitValue())); if (result.getExitValue() != 0) { log.error("The command returned exit value {}", execCommand, result.getExitValue()); } getBinding().writeOutput(exchange, result); }

Target:
public void process(Exchange exchange) throws Exception { ExecCommand execCommand = getBinding().readInput(exchange, endpoint); ExecCommandExecutor executor = endpoint.getCommandExecutor(); if (executor == null) { executor = new DefaultExecCommandExecutor(); } logger.log(String.format("Executing %s", execCommand), execCommand.getCommandLogLevel()); ExecResult result = executor.execute(execCommand); ObjectHelper.notNull(result, "The command executor must return a not-null result"); logger.log(String.format("The command %s had exit value %s", execCommand, result.getExitValue()), execCommand.getCommandLogLevel()); if (result.getExitValue() != 0) { log.error("The command returned exit value {}", execCommand, result.getExitValue()); } getBinding().writeOutput(exchange, result); }
Source:
private void consumeFieldAlias(Field field, Schema.Field recordField) { if (field.isAnnotationPresent(AvroAlias.class)) { AvroAlias alias = field.getAnnotation(AvroAlias.class); if (!alias.space().equals(AvroAlias.NULL)) { throw new AvroRuntimeException( "Namespaces are not allowed on field aliases. " + "Offending field: " + recordField.name()); } recordField.addAlias(alias.alias()); } }

Target:
private void consumeFieldAlias(Field field, Schema.Field recordField) { AvroAlias alias = field.getAnnotation(AvroAlias.class); if (alias != null) { if (!alias.space().equals(AvroAlias.NULL)) { throw new AvroRuntimeException( "Namespaces are not allowed on field aliases. " + "Offending field: " + recordField.name()); } recordField.addAlias(alias.alias()); } }
Source:
public void detach() { boolean setNetToDcValues = false; if (!isInSync() && isManaged()){ getSetupModel().getNetworksToSync().add(getName()); setNetToDcValues = true; } assert attachedToNic != null; NetworkInterfaceModel attachingNic = attachedToNic; attachedToNic = null; List<LogicalNetworkModel> nicNetworks = attachingNic.getItems(); nicNetworks.remove(this); VdsNetworkInterface nicEntity = attachingNic.getEntity(); NetworkParameters netParams = new NetworkParameters(); if (!hasVlan()){ netParams.setBootProtocol(nicEntity.getBootProtocol()); netParams.setAddress(nicEntity.getAddress()); netParams.setSubnet(nicEntity.getSubnet()); }else{ netParams.setBootProtocol(bridge.getEntity().getBootProtocol()); netParams.setAddress(bridge.getEntity().getAddress()); netParams.setSubnet(bridge.getEntity().getSubnet()); } if (isManagement()){ netParams.setGateway(nicEntity.getGateway()); } getSetupModel().getNetworkToLastDetachParams().put(getName(), netParams); if (!hasVlan()) { nicEntity.setNetworkName(null); nicEntity.setBootProtocol(null); nicEntity.setAddress(null); nicEntity.setSubnet(null); nicEntity.setGateway(null); } setBridge(null); if (nicEntity.getIsManagement()) { nicEntity.setType(0); } if (setNetToDcValues){ setNetworkToDcValues(); } }

Target:
public void detach() { boolean syncNetworkValues = false; if (!isInSync() && isManaged()){ getSetupModel().getNetworksToSync().add(getName()); syncNetworkValues = true; } assert attachedToNic != null; NetworkInterfaceModel attachingNic = attachedToNic; attachedToNic = null; List<LogicalNetworkModel> nicNetworks = attachingNic.getItems(); nicNetworks.remove(this); VdsNetworkInterface nicEntity = attachingNic.getEntity(); NetworkParameters netParams = new NetworkParameters(); if (!hasVlan()){ netParams.setBootProtocol(nicEntity.getBootProtocol()); netParams.setAddress(nicEntity.getAddress()); netParams.setSubnet(nicEntity.getSubnet()); }else{ netParams.setBootProtocol(bridge.getEntity().getBootProtocol()); netParams.setAddress(bridge.getEntity().getAddress()); netParams.setSubnet(bridge.getEntity().getSubnet()); } if (isManagement()){ netParams.setGateway(nicEntity.getGateway()); } getSetupModel().getNetworkToLastDetachParams().put(getName(), netParams); if (!hasVlan()) { nicEntity.setNetworkName(null); nicEntity.setBootProtocol(null); nicEntity.setAddress(null); nicEntity.setSubnet(null); nicEntity.setGateway(null); } setBridge(null); if (nicEntity.getIsManagement()) { nicEntity.setType(0); } if (syncNetworkValues){ syncNetworkValues(); } }
Source:
public void testInvalidWindowFunctionCall() { Symbol windowSymbol = symbolAllocator.newSymbol("sum", DOUBLE); FunctionHandle functionHandle = FUNCTION_MANAGER.lookupFunction("sum", fromTypes(DOUBLE)); WindowNode.Frame frame = new WindowNode.Frame( RANGE, UNBOUNDED_PRECEDING, Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty()); WindowNode.Function function = new WindowNode.Function(call("sum", functionHandle, BIGINT, new VariableReferenceExpression(columnA.getName(), BIGINT)), frame); WindowNode.Specification specification = new WindowNode.Specification(ImmutableList.of(), Optional.empty()); PlanNode node = new WindowNode( newId(), baseTableScan, specification, ImmutableMap.of(windowSymbol, function), Optional.empty(), ImmutableSet.of(), 0); assertTypesValid(node); }

Target:
public void testInvalidWindowFunctionCall() { Symbol windowSymbol = symbolAllocator.newSymbol("sum", DOUBLE); VariableReferenceExpression windowVariable = new VariableReferenceExpression(windowSymbol.getName(), DOUBLE); FunctionHandle functionHandle = FUNCTION_MANAGER.lookupFunction("sum", fromTypes(DOUBLE)); WindowNode.Frame frame = new WindowNode.Frame( RANGE, UNBOUNDED_PRECEDING, Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty()); WindowNode.Function function = new WindowNode.Function(call("sum", functionHandle, BIGINT, new VariableReferenceExpression(columnA.getName(), BIGINT)), frame); WindowNode.Specification specification = new WindowNode.Specification(ImmutableList.of(), Optional.empty()); PlanNode node = new WindowNode( newId(), baseTableScan, specification, ImmutableMap.of(windowVariable, function), Optional.empty(), ImmutableSet.of(), 0); assertTypesValid(node); }
Source:
private static JSONObject createJsonFileObject(InputStream stream) throws IOException, JSONException { String line; StringBuilder result = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); try { while ((line = reader.readLine()) != null) { result.append(line); } } finally { reader.close(); } return new JSONObject(result.toString()); }

Target:
private static JSONObject createJsonFileObject(InputStream stream) throws IOException, JSONException { String line; StringBuilder result = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); while ((line = reader.readLine()) != null) { result.append(line); } reader.close(); return new JSONObject(result.toString()); }
Source:
public CacheRecord merge(CacheMergeTypes<Object, Object> mergingEntry, SplitBrainMergePolicy<Object, CacheMergeTypes<Object, Object>, Object> mergePolicy, CallerProvenance callerProvenance) { final long now = Clock.currentTimeMillis(); final long start = isStatisticsEnabled() ? System.nanoTime() : 0; injectDependencies(mergingEntry); injectDependencies(mergePolicy); boolean merged = false; assert mergingEntry instanceof CacheMergingEntryImpl; CacheMergingEntryImpl<Object, Object> mergingEntryImpl = (CacheMergingEntryImpl<Object, Object>) mergingEntry; Data key = mergingEntryImpl.getRawKey(); long expiryTime = mergingEntry.getExpirationTime(); R record = records.get(key); boolean isExpired = processExpiredEntry(key, record, now); boolean disableWriteThrough = !persistenceEnabledFor(callerProvenance); if (record == null || isExpired) { Object newValue = mergePolicy.merge(mergingEntry, null); if (newValue != null) { record = createRecordWithExpiry(key, newValue, expiryTime, now, disableWriteThrough, IGNORE_COMPLETION); merged = record != null; } } else { Data oldValue = ss.toData(record.getValue()); CacheMergeTypes<Object, Object> existingEntry = createMergingEntry(ss, key, oldValue, record); Object newValue = mergePolicy.merge(mergingEntry, existingEntry); merged = updateWithMergingValue(key, oldValue, newValue, record, expiryTime, now, disableWriteThrough); } if (merged && isStatisticsEnabled()) { statistics.increaseCachePuts(1); statistics.addPutTimeNanos(System.nanoTime() - start); } return merged ? record : null; }

Target:
public CacheRecord merge(CacheMergeTypes<Object, Object> mergingEntry, SplitBrainMergePolicy<Object, CacheMergeTypes<Object, Object>, Object> mergePolicy, CallerProvenance callerProvenance) { final long now = Clock.currentTimeMillis(); final long start = isStatisticsEnabled() ? System.nanoTime() : 0; injectDependencies(mergingEntry); injectDependencies(mergePolicy); boolean merged = false; Data key = (Data) mergingEntry.getRawKey(); long expiryTime = mergingEntry.getExpirationTime(); R record = records.get(key); boolean isExpired = processExpiredEntry(key, record, now); boolean disableWriteThrough = !persistenceEnabledFor(callerProvenance); if (record == null || isExpired) { Object newValue = mergePolicy.merge(mergingEntry, null); if (newValue != null) { record = createRecordWithExpiry(key, newValue, expiryTime, now, disableWriteThrough, IGNORE_COMPLETION); merged = record != null; } } else { Data oldValue = ss.toData(record.getValue()); CacheMergeTypes<Object, Object> existingEntry = createMergingEntry(ss, key, oldValue, record); Object newValue = mergePolicy.merge(mergingEntry, existingEntry); merged = updateWithMergingValue(key, oldValue, newValue, record, expiryTime, now, disableWriteThrough); } if (merged && isStatisticsEnabled()) { statistics.increaseCachePuts(1); statistics.addPutTimeNanos(System.nanoTime() - start); } return merged ? record : null; }
Source:
private void setAlbum(Album album) { this.album = album; loadAlbumCover(); loadWiki(); albumTitleView.setText(album.getTitle()); adapter.swapDataSet(album.songs); }

Target:
private void setAlbum(Album album) { this.album = album; loadAlbumCover(); if (Util.isAllowedToDownloadMetadata(this)) { loadWiki(); } albumTitleView.setText(album.getTitle()); adapter.swapDataSet(album.songs); }
Source:
protected final void prepareAdd() { if (currentPageBuilder.isFull()) { totalPositions += currentPageBuilder.getPositionCount(); valueBlocksRetainedSizeInBytes += currentPageBuilder.getRetainedSizeInBytes(); sumPositions.add(totalPositions); currentPageBuilder = currentPageBuilder.newPageBuilderLike(); values.add(currentPageBuilder); verify(values.size() <= MAX_NUM_BLOCKS); } long currentGroupId = getGroupId(); short insertedBlockIndex = (short) (values.size() - 1); int insertedPosition = currentPageBuilder.getPositionCount(); if (totalPositions + insertedPosition == capacity) { capacity *= 1.5; nextBlockIndex.ensureCapacity(capacity); nextPosition.ensureCapacity(capacity); } if (isEmpty()) { headBlockIndex.set(currentGroupId, insertedBlockIndex); headPosition.set(currentGroupId, insertedPosition); } else { long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId)); nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex); nextPosition.set(absoluteTailAddress, insertedPosition); } tailBlockIndex.set(currentGroupId, insertedBlockIndex); tailPosition.set(currentGroupId, insertedPosition); groupEntryCount.increment(currentGroupId); currentPageBuilder.declarePosition(); }

Target:
protected final void prepareAdd() { if (currentPageBuilder.isFull()) { valueBlocksRetainedSizeInBytes += currentPageBuilder.getRetainedSizeInBytes(); sumPositions.add(totalPositions); currentPageBuilder = currentPageBuilder.newPageBuilderLike(); values.add(currentPageBuilder); verify(values.size() <= MAX_NUM_BLOCKS); } long currentGroupId = getGroupId(); short insertedBlockIndex = (short) (values.size() - 1); int insertedPosition = currentPageBuilder.getPositionCount(); if (totalPositions == capacity) { capacity *= 1.5; nextBlockIndex.ensureCapacity(capacity); nextPosition.ensureCapacity(capacity); } if (isEmpty()) { headBlockIndex.set(currentGroupId, insertedBlockIndex); headPosition.set(currentGroupId, insertedPosition); } else { long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId)); nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex); nextPosition.set(absoluteTailAddress, insertedPosition); } tailBlockIndex.set(currentGroupId, insertedBlockIndex); tailPosition.set(currentGroupId, insertedPosition); groupEntryCount.increment(currentGroupId); currentPageBuilder.declarePosition(); totalPositions++; }
Source:
public static boolean isOsTypeSupportedForVirtioScsi(int osId, Version clusterVersion, List<String> reasons) { boolean result = VmValidationUtils.isOsSupportedForVirtIoScsi(osId, clusterVersion); if (!result) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_IS_DOES_NOT_SUPPORT_VIRTIO_SCSI.toString()); } return result; }

Target:
public static boolean isOsTypeSupportedForVirtioScsi(int osId, Version clusterVersion, List<String> reasons) { boolean result = VmValidationUtils.isDiskInterfaceSupportedByOs(osId, clusterVersion, DiskInterface.VirtIO_SCSI); if (!result) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_IS_DOES_NOT_SUPPORT_VIRTIO_SCSI.name()); } return result; }
Source:
private void trackSessionIfNeeded(boolean autoCaptured, Session session) { String releaseStage = getReleaseStage(); boolean notifyForRelease = client != null && configuration.shouldNotifyForReleaseStage(releaseStage); if ((configuration.shouldAutoCaptureSessions() || !autoCaptured) && notifyForRelease) { sessionQueue.add(session); sessionStore.write(session); trackedFirstSession = true; } }

Target:
private void trackSessionIfNeeded(boolean autoCaptured, Session session) { String releaseStage = getReleaseStage(); boolean notifyForRelease = configuration.shouldNotifyForReleaseStage(releaseStage); if ((configuration.shouldAutoCaptureSessions() || !autoCaptured) && notifyForRelease) { sessionQueue.add(session); sessionStore.write(session); trackedFirstSession = true; } }
Source:
public void writeObject(ObjectOutput output, ScriptMetadata object) throws IOException { output.writeUTF(object.name); output.writeUTF(object.extension); output.writeUTF(object.mode.name()); writeSet(output, object.parameters); OptionalObjectInputOutput.writeOptional(output, object.language); OptionalObjectInputOutput.writeOptional(output, object.role); OptionalObjectInputOutput.writeOptional(output, object.reducer); OptionalObjectInputOutput.writeOptional(output, object.collator); OptionalObjectInputOutput.writeOptional(output, object.combiner); }

Target:
public void writeObject(ObjectOutput output, ScriptMetadata object) throws IOException { output.writeUTF(object.name); output.writeUTF(object.extension); output.writeUTF(object.mode.name()); output.writeObject(object.parameters); output.writeObject(object.language); output.writeObject(object.role); output.writeObject(object.reducer); output.writeObject(object.collator); output.writeObject(object.combiner); }
Source:
private void setVote(boolean vote, int otherUserVotes){ if (vote){ addVote(otherUserVotes); }else{ removeVote(otherUserVotes); } }

Target:
private void setVote(boolean vote, int otherUserVotes) { voteViewContainer.setSelected(vote); threadVoteTextView.setText(ResourceUtil.getFormattedStringForQuantity( threadVoteTextView.getResources(), R.plurals.discussion_responses_action_bar_vote_text, vote ? otherUserVotes + 1 : otherUserVotes)); threadVoteIconImageView.setIconColorResource(vote ? R.color.edx_brand_primary_base : R.color.edx_brand_gray_base); }
Source:
private boolean _isParent(String parentDeckName, String childDeckName) { List<String> parentDeckPath = path(parentDeckName); List<String> childDeckPath = path(childDeckName); parentDeckPath.add(basename(childDeckName)); if (parentDeckPath.size() != childDeckPath.size()) { return false; } Iterator<String> cpIt = childDeckPath.iterator(); Iterator<String> ppIt = parentDeckPath.iterator(); while (cpIt.hasNext() && ppIt.hasNext()) { if (!cpIt.next().equals(ppIt.next())) { return false; } } return true; }

Target:
private boolean _isParent(String parentDeckName, String childDeckName) { String[] parentDeckPath = path(parentDeckName); String[] childDeckPath = path(childDeckName); if (parentDeckPath.length + 1 != childDeckPath.length) { return false; } for (int i = 0; i < parentDeckPath.length; i++) { if (! parentDeckPath[i].equals(childDeckPath[i])) { return false; } } return true; }
Source:
public CompletableFuture<ClientResponse> run(String theTable, String otherTable) { String sql = "@SwapTables " + theTable + " " + otherTable; Object[] userParams = null; CatalogContext context = VoltDB.instance().getCatalogContext(); List<String> sqlStatements = new ArrayList<>(1); sqlStatements.add(sql); for (Table t: context.database.getTables()) { if (t.getTypeName().equalsIgnoreCase(theTable) && t.getTimetolive() != null) { return makeQuickResponse(ClientResponse.GRACEFUL_FAILURE, String.format("Table %s cannot be swaped since it uses TTL.",theTable)); } } return runNonDDLAdHoc(context, sqlStatements, true, null, ExplainMode.NONE, false, true, userParams); }

Target:
public CompletableFuture<ClientResponse> run(String theTable, String otherTable) { String sql = "@SwapTables " + theTable + " " + otherTable; Object[] userParams = null; CatalogContext context = VoltDB.instance().getCatalogContext(); List<String> sqlStatements = new ArrayList<>(1); sqlStatements.add(sql); Map<String, Table> ttlTables = CatalogUtil.getTimeToLiveTables(context.database); if (ttlTables.containsKey(theTable.toUpperCase())) { return makeQuickResponse(ClientResponse.GRACEFUL_FAILURE, String.format("Table %s cannot be swapped since it uses TTL.",theTable)); } return runNonDDLAdHoc(context, sqlStatements, true, null, ExplainMode.NONE, false, true, userParams); }
Source:
public void testAddAdd() throws Exception { Note add1 = newNote("add1"); Note add2 = newNote("add2"); Note result = merger.merge(baseNote, add1, add2); assertEquals(result, noteOn); assertEquals(result.getData(), tr.blob("add1add2")); result = merger.merge(baseNote, add2, add1); assertEquals(result, noteOn); assertEquals(result.getData(), tr.blob("add2add1")); }

Target:
public void testAddAdd() throws Exception { Note add1 = newNote("add1"); Note add2 = newNote("add2"); Note result = merger.merge(null, add1, add2); assertEquals(result, noteOn); assertEquals(result.getData(), tr.blob("add1add2")); result = merger.merge(null, add2, add1); assertEquals(result, noteOn); assertEquals(result.getData(), tr.blob("add2add1")); }
Source:
public static BackupPhase map(org.ovirt.engine.core.common.businessentities.VmBackupPhase action) { switch (action) { case Initializing: return BackupPhase.INITIALIZING; case Starting: return BackupPhase.STARTING; case Ready: return BackupPhase.READY; case Finalizing: return BackupPhase.FINALIZING; default: return null; } }

Target:
public static BackupPhase map(org.ovirt.engine.core.common.businessentities.VmBackupPhase action) { switch (action) { case INITIALIZING: return BackupPhase.INITIALIZING; case STARTING: return BackupPhase.STARTING; case READY: return BackupPhase.READY; case FINALIZING: return BackupPhase.FINALIZING; default: return null; } }
Source:
private Optional<Symbol> getSymbol(RelationPlan plan, Expression expression) { if (!analysis.isColumnReference(expression)) { return Optional.empty(); } return plan.getScope() .tryResolveField(expression) .filter(ResolvedField::isLocal) .map(field -> plan.getFieldMappings().get(field.getHierarchyFieldIndex())); }

Target:
private Optional<Symbol> getSymbol(RelationPlan plan, Expression expression) { if (!analysis.isColumnReference(expression)) { return Optional.empty(); } return plan.getScope() .tryResolveField(expression) .filter(ResolvedField::isLocal) .map(field -> requireNonNull(plan.getFieldMappings().get(field.getHierarchyFieldIndex()))); }
Source:
protected boolean shouldDrawBox(TraditionalMemoryByte bytes[], int col) { TraditionalRendering ren = fRendering.getTraditionalRendering(); if(ren.getBoxEdit()) for(TraditionalMemoryByte tmb : bytes) if(tmb.isEdited()) return true; if(ren.getBoxChanged()) for(int i = 0; i < fRendering.getHistoryDepth(); i++) for(TraditionalMemoryByte tmb : bytes) if(tmb.isChanged(i)) return true; return false; }

Target:
protected boolean shouldDrawBox(TraditionalMemoryByte bytes[], int col) { TraditionalRendering ren = fRendering.getTraditionalRendering(); if (ren.getBoxEdit()) { for (TraditionalMemoryByte tmb : bytes) { if (tmb.isEdited()) { return true; } } } if (ren.getBoxChanged()) { for (int i = 0; i < fRendering.getHistoryDepth(); i++) { for (TraditionalMemoryByte tmb : bytes) { if (tmb.isChanged(i)) { return true; } } } } return false; }
Source:
private static File findNodeInCurrentFileSystem(){ Runtime rt = Runtime.getRuntime(); String instancePath; try { Process p = rt.exec(returnCommandThatSearchesForDefaultNode()); p.waitFor(); instancePath = getProcessOutput(p.getInputStream()); } catch (Exception e) { throw new RuntimeException(e); } File result; if (StringUtils.isBlank(instancePath) || !(result = new File(instancePath + File.separator + NODE_MODULES_FOLDER + APPIUM_NODE_MASK)).exists()) throw new InvalidServerInstanceException( "There is no installed nodes! Please install " + " node via NPM (<LINK_0> or download and " + "install Appium app (<LINK_1>", new IOException("There is no installed nodes! Please install " + " node via NPM (<LINK_0> or download and " + "install Appium app (<LINK_1>")); return result; }

Target:
private static File findNodeInCurrentFileSystem(){ Runtime rt = Runtime.getRuntime(); String instancePath; try { Process p = rt.exec(returnCommandThatSearchesForDefaultNode()); p.waitFor(); instancePath = getProcessOutput(p.getInputStream()); } catch (Exception e) { throw new RuntimeException(e); } File result; if (StringUtils.isBlank(instancePath) || !(result = new File(instancePath + File.separator + NODE_MODULES_FOLDER + APPIUM_NODE_MASK)).exists()) throw new InvalidServerInstanceException( "There is no installed nodes! Please install " + " node via NPM (<LINK_0> or download and " + "install Appium app (<LINK_1>", new IOException("The installed appium node package has not been found.")); return result; }
Source:
private BuildAction getBuildAction(IWorkbenchWindow window) { BuildAction buildAction = (BuildAction) buildActions.get(window); if (buildAction != null) { return buildAction; } buildAction = new BuildAction(window, IncrementalProjectBuilder.INCREMENTAL_BUILD); buildActions.put(window, buildAction); window.addPageListener(new IPageListener() { public void pageOpened(IWorkbenchPage page) { } public void pageClosed(IWorkbenchPage page) { IWorkbenchWindow closedWindow = page.getWorkbenchWindow(); buildActions.remove(closedWindow); closedWindow.removePageListener(this); } public void pageActivated(IWorkbenchPage page) { } }); return buildAction; }

Target:
private BuildAction getBuildAction(IWorkbenchWindow window) { BuildAction buildAction = (BuildAction) buildActions.get(window); if (buildAction != null) { return buildAction; } buildAction = new BuildAction(window, IncrementalProjectBuilder.INCREMENTAL_BUILD); buildActions.put(window, buildAction); return buildAction; }
Source:
public IStatus transferSettings(IPath newWorkspaceRoot) { try { IPath currentLocation = getNewWorkbenchStateLocation(Platform.getLocation()); File workspaceFile = createFileAndDirectories(newWorkspaceRoot); if (workspaceFile == null) return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, WorkbenchMessages.WorkbenchSettings_CouldNotCreateDirectories); File deltas = new File(currentLocation.toOSString(), "deltas.xml"); if (deltas.exists()) { byte[] bytes = new byte[8192]; FileOutputStream outputStream; try (FileInputStream inputStream = new FileInputStream(deltas)) { outputStream = new FileOutputStream(new File(workspaceFile, "deltas.xml")); int read = inputStream.read(bytes, 0, 8192); while (read != -1) { outputStream.write(bytes, 0, read); read = inputStream.read(bytes, 0, 8192); } } outputStream.close(); } File workbenchModel = new File(currentLocation.toOSString(), "workbench.xmi"); if (workbenchModel.exists()) { byte[] bytes = new byte[8192]; FileOutputStream outputStream; try (FileInputStream inputStream = new FileInputStream(workbenchModel)) { outputStream = new FileOutputStream(new File(workspaceFile, "workbench.xmi")); int read = inputStream.read(bytes, 0, 8192); while (read != -1) { outputStream.write(bytes, 0, read); read = inputStream.read(bytes, 0, 8192); } } outputStream.close(); } } catch (IOException e) { return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, WorkbenchMessages.Workbench_problemsSavingMsg, e); } return Status.OK_STATUS; }

Target:
public IStatus transferSettings(IPath newWorkspaceRoot) { try { IPath currentLocation = getNewWorkbenchStateLocation(Platform.getLocation()); File workspaceFile = createFileAndDirectories(newWorkspaceRoot); if (workspaceFile == null) return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, WorkbenchMessages.WorkbenchSettings_CouldNotCreateDirectories); File deltas = new File(currentLocation.toOSString(), "deltas.xml"); if (deltas.exists()) { byte[] bytes = new byte[8192]; try (FileInputStream inputStream = new FileInputStream(deltas); FileOutputStream outputStream = new FileOutputStream(new File(workspaceFile, "deltas.xml")); ) { int read = inputStream.read(bytes, 0, 8192); while (read != -1) { outputStream.write(bytes, 0, read); read = inputStream.read(bytes, 0, 8192); } } } File workbenchModel = new File(currentLocation.toOSString(), "workbench.xmi"); if (workbenchModel.exists()) { byte[] bytes = new byte[8192]; try (FileInputStream inputStream = new FileInputStream(workbenchModel); FileOutputStream outputStream = new FileOutputStream(new File(workspaceFile, "workbench.xmi")); ) { int read = inputStream.read(bytes, 0, 8192); while (read != -1) { outputStream.write(bytes, 0, read); read = inputStream.read(bytes, 0, 8192); } } } } catch (IOException e) { return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, WorkbenchMessages.Workbench_problemsSavingMsg, e); } return Status.OK_STATUS; }
Source:
private ExtensionEntry(Properties props, File file) { this.file = file; this.name = props.getProperty( Base.ConfigKeys.NAME, String.format("__unamed_%1$03d__", extensionNameIndex++) ); this.enabled = Boolean.valueOf(props.getProperty(Base.ConfigKeys.ENABLED, "true")); this.isDefault = Boolean.valueOf(props.getProperty(Authn.ConfigKeys.DEFAULT.getUuid().getName(), "false")); }

Target:
private ExtensionEntry(Properties props, File file) { this.file = file; this.name = props.getProperty( Base.ConfigKeys.NAME, String.format("__unamed_%1$03d__", extensionNameIndex++) ); this.enabled = Boolean.valueOf(props.getProperty(Base.ConfigKeys.ENABLED, "true")); }
Source:
protected List<WorkflowStep> getCompletedSteps() { switch (nextStepNumber) { case 0: return Collections.emptyList(); case 1: return Collections.singletonList(step0); default: return Arrays.asList(step0, step1); } }

Target:
protected List<WorkflowStep> getCompletedSteps() { return steps.subList(0, nextStepNumber); }
Source:
public Time(String timeStr) { if (timeStr.length() == 11) { DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("HH:mm Z"); DateTime localTime = DateTime.parse(timeStr, dateTimeFormatter).withZone(DateTimeZone.UTC); this.hour = localTime.getHourOfDay(); this.minute = localTime.getMinuteOfHour(); } else { String[] tokens = timeStr.split(":"); if (tokens.length < TIME_TOKEN_MIN_LENGTH || tokens.length > TIME_TOKEN_MAX_LENGTH) { throw new IllegalArgumentException("Invalid time string: " + timeStr); } try { this.hour = Integer.parseInt(tokens[0]); this.minute = Integer.parseInt(tokens[1]); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid time string: " + timeStr, e); } } }

Target:
public Time(String timeStr) { if (isTimeContainsZone(timeStr)) { DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("HH:mm Z"); DateTime localTime = DateTime.parse(timeStr, dateTimeFormatter).withZone(DateTimeZone.UTC); this.hour = localTime.getHourOfDay(); this.minute = localTime.getMinuteOfHour(); } else { String[] tokens = timeStr.split(":"); if (tokens.length < TIME_TOKEN_MIN_LENGTH || tokens.length > TIME_TOKEN_MAX_LENGTH) { throw new IllegalArgumentException("Invalid time string: " + timeStr); } try { this.hour = Integer.parseInt(tokens[0]); this.minute = Integer.parseInt(tokens[1]); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid time string: " + timeStr, e); } } }
Source:
public Condition(CodedOrFreeText condition, ConditionClinicalStatus clinicalStatus, ConditionVerificationStatus verificationStatus, Condition previousVersion, String additionalDetail, Date onsetDate, Date endDate, Patient patient) { this.condition = condition; this.clinicalStatus = clinicalStatus; this.verificationStatus = verificationStatus; this.previousVersion = previousVersion; this.additionalDetail = additionalDetail; this.onsetDate = new Date(onsetDate.getTime()); this.endDate = new Date(endDate.getTime()); this.patient = patient; }

Target:
public Condition(CodedOrFreeText condition, ConditionClinicalStatus clinicalStatus, ConditionVerificationStatus verificationStatus, Condition previousVersion, String additionalDetail, Date onsetDate, Date endDate, Patient patient) { this.condition = condition; this.clinicalStatus = clinicalStatus; this.verificationStatus = verificationStatus; this.previousVersion = previousVersion; this.additionalDetail = additionalDetail; this.onsetDate = onsetDate != null ? new Date(onsetDate.getTime()) : null; this.endDate = endDate != null ? new Date(endDate.getTime()) : null; this.patient = patient; }
Source:
public void update(Observable arg0, Object argN) { if (arg0 != player) { return; } final String arg1 = OoyalaNotification.getNameOrUnknown(argN); if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME) { return; } if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION_NAME) { final String msg = "Error Event Received"; if (player != null && player.getError() != null) { Log.e(TAG, msg, player.getError()); } else { Log.e(TAG, msg); } return; } String text="Notification Received: " + arg1 + " - state: " + player.getState(); playbacklog.writeToSdcardLog(text); Log.d(TAG, "Notification Received: " + arg1 + " - state: " + player.getState()); }

Target:
public void update(Observable arg0, Object argN) { if (arg0 != player) { return; } final String arg1 = OoyalaNotification.getNameOrUnknown(argN); if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME) { return; } if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION_NAME) { final String msg = "Error Event Received"; if (player != null && player.getError() != null) { Log.e(TAG, msg, player.getError()); } else { Log.e(TAG, msg); } return; } String text="Notification Received: " + arg1 + " - state: " + player.getState(); playbacklog.writeToSdcardLog(text); Log.d(TAG, text); }
Source:
private void reserveSpace(int reserve) { clockLock.lock(); try { long live = liveBytes + reserve; if (maxBytes < live) { Ref prev = clockHand; Ref hand = clockHand.next; do { if (hand.hot) { hand.hot = false; prev = hand; hand = hand.next; continue; } else if (prev == hand) break; Ref dead = hand; hand = hand.next; prev.next = hand; dead.next = null; dead.value = null; live -= dead.size; dead.pack.cachedSize.addAndGet(-dead.size); int slot = slot(dead.pack, dead.position); for (HashEntry entry = table .get(slot); entry != null; entry = entry.next) { if (entry.ref == dead) { ReentrantLock regionLock = lockFor(dead.pack, dead.position); regionLock.lock(); try { table.compareAndSet(slot, entry, clean(entry)); break; } finally { regionLock.unlock(); } } } statEvict++; } while (maxBytes < live); clockHand = prev; } liveBytes = live; } finally { clockLock.unlock(); } }

Target:
private void reserveSpace(int reserve) { clockLock.lock(); try { long live = liveBytes + reserve; if (maxBytes < live) { Ref prev = clockHand; Ref hand = clockHand.next; do { if (hand.hot) { hand.hot = false; prev = hand; hand = hand.next; continue; } else if (prev == hand) break; Ref dead = hand; hand = hand.next; prev.next = hand; dead.next = null; dead.value = null; live -= dead.size; dead.pack.cachedSize.addAndGet(-dead.size); statEvict++; } while (maxBytes < live); clockHand = prev; } liveBytes = live; } finally { clockLock.unlock(); } }
Source:
public void accumulateValue(Long newValue) { setValue(newValue + getValue()); }

Target:
public void accumulateValue(Long newValue) { value.addAndGet(newValue); }