auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean isSoftAssertionStatement(ASTStatementExpression expression, Map<String, VariableNameDeclaration> variables) { if (expression != null) { ASTPrimaryExpression pe = expression.getFirstChildOfType(ASTPrimaryExpression.class); if (pe != null) { Node name = pe.getFirstDescendantOfType(ASTName.class); if (name != null) { String img = name.getImage(); if (img.indexOf(".") == -1) { return false; } String[] tokens = img.split("\\."); String methodName = tokens[1]; boolean methodIsAssertAll = "assertAll".equals(methodName); String varName = tokens[0]; boolean variableTypeIsSoftAssertion = variables.containsKey(varName) && variables.get(varName).getTypeImage().endsWith("SoftAssertions"); return methodIsAssertAll && variableTypeIsSoftAssertion; } } } return false; }

Target:
private boolean isSoftAssertionStatement(ASTStatementExpression expression, Map<String, VariableNameDeclaration> variables) { if (expression != null) { ASTPrimaryExpression pe = expression.getFirstChildOfType(ASTPrimaryExpression.class); if (pe != null) { Node name = pe.getFirstDescendantOfType(ASTName.class); if (name != null) { String img = name.getImage(); if (img.indexOf(".") == -1) { return false; } String[] tokens = img.split("\\."); String methodName = tokens[1]; boolean methodIsAssertAll = "assertAll".equals(methodName); String varName = tokens[0]; boolean variableTypeIsSoftAssertion = variables.containsKey(varName) && TypeHelper.isA(variables.get(varName), "org.assertj.core.api.AbstractSoftAssertions"); return methodIsAssertAll && variableTypeIsSoftAssertion; } } } return false; }
Source:
private static void testWrapping(ByteBuffer buffer) { for (int i = 0; i < 50; i++) { buffer.put((byte) i); } Slice slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 50); for (int i = 0; i < 50; i++) { assertEquals(slice.getByte(i), i); } buffer.position(20).limit(30); slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 30); for (int i = 0; i < 30; i++) { assertEquals(slice.getByte(i), i); } buffer = buffer.slice(); slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 10); for (int i = 0; i < 10; i++) { assertEquals(slice.getByte(i), i + 20); } }

Target:
private static void testWrapping(ByteBuffer buffer) { for (int i = 0; i < 50; i++) { buffer.put((byte) i); } buffer.rewind(); Slice slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 50); for (int i = 0; i < 50; i++) { assertEquals(slice.getByte(i), i); } buffer.position(10).limit(30); slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 20); for (int i = 0; i < 20; i++) { assertEquals(slice.getByte(i), i + 10); } buffer = buffer.slice(); slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 20); for (int i = 0; i < 20; i++) { assertEquals(slice.getByte(i), i + 10); } }
Source:
private static MultiPath create(final MultiPath path, final double w, final double h, final double voffset) { path.M(0, 0).L(w, 0).L(w + voffset, h / 2).L(w, h).L(0, h).L(voffset, h / 2).L(0, 0).Z().close(); return path .setFillColor("#F9FAD2") .setStrokeColor(ColorName.BLACK); }

Target:
private static MultiPath create(final MultiPath path, final double w, final double h, final double voffset) { path.M(0, 0).L(w, 0).L(w + voffset, h / 2).L(w, h).L(0, h).L(voffset, h / 2).L(0, 0).Z().close(); return path .setFillColor(ColorName.LIGHTGOLDENRODYELLOW) .setStrokeColor(ColorName.BLACK); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JdbcExtractionNamespace that = (JdbcExtractionNamespace) o; if (!connectorConfig.equals(that.connectorConfig)) { return false; } if (!table.equals(that.table)) { return false; } if (!keyColumn.equals(that.keyColumn)) { return false; } if (!valueColumn.equals(that.valueColumn)) { return false; } if (filter != null ? !filter.equals(that.filter) : that.filter != null) { return false; } if (tsColumn != null ? !tsColumn.equals(that.tsColumn) : that.tsColumn != null) { return false; } return pollPeriod.equals(that.pollPeriod); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JdbcExtractionNamespace that = (JdbcExtractionNamespace) o; return Objects.equals(connectorConfig, that.connectorConfig) && Objects.equals(table, that.table) && Objects.equals(filter, that.filter) && Objects.equals(keyColumn, that.keyColumn) && Objects.equals(valueColumn, that.valueColumn) && Objects.equals(tsColumn, that.tsColumn) && Objects.equals(pollPeriod, that.pollPeriod); }
Source:
private PropagatedDays recalculateSupertaskCompletionPercentage(Task task, TaskContainmentHierarchyFacade facade) { Task[] nestedTasks = facade.getNestedTasks(task); int completedDays = 0; long plannedDays = 0; if (nestedTasks.length > 0) { for (int i = 0; i < nestedTasks.length; i++) { Task next = nestedTasks[i]; PropagatedDays propagatedDays = recalculateSupertaskCompletionPercentage(next, facade); completedDays += propagatedDays.myCompletedDays; plannedDays += propagatedDays.myPlannedDays; } int completionPercentage = plannedDays == 0 ? 0 : (int) (completedDays / plannedDays); task.setCompletionPercentage(completionPercentage); } else { long nextDuration = task.getDuration().getLength(); completedDays += nextDuration * task.getCompletionPercentage(); plannedDays += nextDuration; } return new PropagatedDays(completedDays, plannedDays); }

Target:
private SubtreeCompletion recalculateSupertaskCompletionPercentage(Task task, TaskContainmentHierarchyFacade facade) { Task[] nestedTasks = facade.getNestedTasks(task); if (nestedTasks.length == 0) { long nextDuration = task.getDuration().getLength(); return new SubtreeCompletion(nextDuration * task.getCompletionPercentage(), nextDuration); } long completedDays = 0; long plannedDays = 0; for (int i = 0; i < nestedTasks.length; i++) { Task next = nestedTasks[i]; SubtreeCompletion subtreeCompletion = recalculateSupertaskCompletionPercentage(next, facade); completedDays += subtreeCompletion.myCompletedDays; plannedDays += subtreeCompletion.myPlannedDays; } int completionPercentage = (plannedDays == 0) ? 0 : (int) (completedDays / plannedDays); task.setCompletionPercentage(completionPercentage); return new SubtreeCompletion(completedDays, plannedDays); }
Source:
public InitCommand setDirectory(File directory) throws IllegalStateException { this.directory = directory; validateDirs(); return this; }

Target:
public InitCommand setDirectory(File directory) throws IllegalStateException { validateDirs(directory, gitDir, bare); this.directory = directory; return this; }
Source:
public int getReceivedMessagesCountSinceUuid(String uuid) { if (uuid == null) { return 0; } int count = 0; for (int i = messages.size() - 1; i >= 0; i--) { if (Objects.equals(messages.get(i).getUuid(), uuid)) { return count; } if (messages.get(i).getStatus() <= Message.STATUS_RECEIVED) { count = count + 1; } } return 0; }

Target:
public int getReceivedMessagesCountSinceUuid(String uuid) { if (uuid == null) { return 0; } int count = 0; synchronized (this.messages) { for (int i = messages.size() - 1; i >= 0; i--) { final Message message = messages.get(i); if (uuid.equals(message.getUuid())) { return count; } if (message.getStatus() <= Message.STATUS_RECEIVED) { ++count; } } } return 0; }
Source:
void clear() { chunkIndex = -1; chunkBlobSize = -1; chunkBlobId = null; chunkException = null; failedAttempts = 0; partitionId = null; attemptedPartitionIds.clear(); maybeUpdateDefunctBufferInfos(); correlationIdToChunkPutRequestInfo.clear(); state = ChunkState.Free; chunkUserMetadata = userMetadata; chunkFreeAtMs = time.milliseconds(); }

Target:
void clear() { chunkIndex = -1; chunkBlobSize = -1; chunkBlobId = null; chunkException = null; failedAttempts = 0; partitionId = null; attemptedPartitionIds.clear(); maybeUpdateDefunctBufferInfos(); correlationIdToChunkPutRequestInfo.clear(); chunkUserMetadata = userMetadata; encryptedPerBlobKey = null; chunkFreeAtMs = time.milliseconds(); state = ChunkState.Free; }
Source:
public boolean onConnect() { String dataBaseUri = connectionToolBar.getCmbDataBaseUri().getSelectedItem().toString(); if (!dataBaseUri.isEmpty()) { MultiInputPanel passwordDialog = new MultiInputPanel(I18N.tr("Please set a password")); passwordDialog.addInput("password", I18N.tr("Password"), "", new PasswordType(10)); passwordDialog.addValidation(new MIPValidation() { @Override public String validate(MultiInputPanel mid) { if (mid.getInput("password").isEmpty()) { return I18N.tr("The password cannot be null"); } return null; } }); if (UIFactory.showDialog(passwordDialog)) { try { String passWord = passwordDialog.getInput("password"); String properties = connectionToolBar.getDbProperties().getProperty(dataBaseUri); tableTree = getTableTree(properties.split(","), passWord); jScrollPane.setViewportView(tableTree); return true; } catch (DriverException ex) { JOptionPane.showMessageDialog(jScrollPane, I18N.tr("Cannot connect the database")); LOGGER.error(ex); return false; } catch (SQLException ex) { JOptionPane.showMessageDialog(jScrollPane, I18N.tr("Cannot connect the database")); LOGGER.error(ex); return false; } } } return false; }

Target:
public boolean onConnect() { String dataBaseUri = connectionToolBar.getCmbDataBaseUri().getSelectedItem().toString(); if (!dataBaseUri.isEmpty()) { MultiInputPanel passwordDialog = new MultiInputPanel(I18N.tr("Please set a password")); passwordDialog.addInput("password", I18N.tr("Password"), "", new PasswordType(10)); passwordDialog.addValidation(new MIPValidation() { @Override public String validate(MultiInputPanel mid) { if (mid.getInput("password").isEmpty()) { return I18N.tr("The password cannot be empty."); } return null; } }); if (UIFactory.showDialog(passwordDialog)) { try { String passWord = passwordDialog.getInput("password"); String properties = connectionToolBar.getDbProperties().getProperty(dataBaseUri); tableTree = getTableTree(properties.split(","), passWord); jScrollPane.setViewportView(tableTree); return true; } catch (DriverException ex) { JOptionPane.showMessageDialog(jScrollPane, I18N.tr("Cannot connect the database")); LOGGER.error(ex); return false; } catch (SQLException ex) { JOptionPane.showMessageDialog(jScrollPane, I18N.tr("Cannot connect the database")); LOGGER.error(ex); return false; } } } return false; }
Source:
private static GatewaySenderEventImpl createGatewaySenderEventImpl(int transactionId, boolean isLastEventInTransaction) { GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class); when(event.getTransactionId()).thenReturn(new TXId(null, transactionId)); when(event.makeHeapCopyIfOffHeap()).thenReturn(event); when(event.isLastEventInTransaction()).thenReturn(isLastEventInTransaction); return event; }

Target:
private GatewaySenderEventImpl createGatewaySenderEventImpl(int transactionId, boolean isLastEventInTransaction) { GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class); when(event.getTransactionId()).thenReturn(new TXId(null, transactionId)); when(event.makeHeapCopyIfOffHeap()).thenReturn(event); when(event.isLastEventInTransaction()).thenReturn(isLastEventInTransaction); return event; }
Source:
public Response<BlockBlobItem> uploadWithResponse(InputStream data, long length, BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) throws IOException { Objects.requireNonNull(data); Flux<ByteBuffer> fbb = Utility.convertStreamToByteBuffer(data, length, BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE); Mono<Response<BlockBlobItem>> upload = blockBlobAsyncClient .uploadWithResponse(fbb, length, headers, metadata, accessConditions, context); try { return Utility.blockWithOptionalTimeout(upload, timeout); } catch (UncheckedIOException e) { throw e.getCause(); } }

Target:
public Response<BlockBlobItem> uploadWithResponse(InputStream data, long length, BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) throws IOException { Objects.requireNonNull(data); Flux<ByteBuffer> fbb = Utility.convertStreamToByteBuffer(data, length, BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE); Mono<Response<BlockBlobItem>> upload = blockBlobAsyncClient .uploadWithResponse(fbb.subscribeOn(Schedulers.elastic()), length, headers, metadata, accessConditions, context); try { return Utility.blockWithOptionalTimeout(upload, timeout); } catch (UncheckedIOException e) { throw e.getCause(); } }
Source:
private String getLabel(final String value) { if (!isMultipleSelect) { return getValue(value); } final StringBuilder sb = new StringBuilder(); final String[] values = value.split(","); for (int i = 0; i < values.length; i++) { if (i == 0) { sb.append(getValue(values[i])); } else { sb.append(",").append(getValue(values[i])); } } return sb.toString(); }

Target:
private String getLabel(final String value) { if (!isMultipleSelect) { return getValue(value); } final String[] values = value.split(","); return Stream.of(values) .map(s -> getValue(s)) .collect(Collectors.joining(",")); }
Source:
public DB getDatabase() { Object dbNameObject = this.cfg.get( MONGODB_DATABASE ); if ( dbNameObject == null ) { throw new HibernateException( "The property " + MONGODB_DATABASE + " has not been set into the configration file" ); } else { String dbName = (String) dbNameObject; log.tracef( "Retrieve database %1$s", dbName ); if ( !this.mongo.getDatabaseNames().contains( dbName ) ) { throw new HibernateException( "The database called " + dbName + " doesn't exist, check the " + MONGODB_DATABASE + " property" ); } return this.mongo.getDB( dbName ); } }

Target:
public DB getDatabase() { Object dbNameObject = this.cfg.get( MONGODB_DATABASE ); if ( dbNameObject == null ) { throw new HibernateException( "The property " + MONGODB_DATABASE + " has not been set into the configration file" ); } else { String dbName = (String) dbNameObject; if ( log.isTraceEnabled() ) { log.tracef( "Retrieve database %1$s", dbName ); } if ( !this.mongo.getDatabaseNames().contains( dbName ) ) { throw new HibernateException( "The database called " + dbName + " doesn't exist, check the " + MONGODB_DATABASE + " property" ); } return this.mongo.getDB( dbName ); } }
Source:
public Hardware apply(HardwareFlavour from) { int MinRamSize = (int) from.hardware().ram(); if (from.hardware().ram() < 1) { MinRamSize = 1; } List<Volume> volumes = new ArrayList<Volume>(); for (HardwareFlavour.Hardware.Hdd hdd : from.hardware().hdds()) { Volume vol = new VolumeBuilder() .bootDevice(hdd.isMain()) .device("hdd") .type(Volume.Type.LOCAL) .size((float) hdd.size()) .build(); volumes.add(vol); } List<Processor> processors = new ArrayList<Processor>(); for (int i = 0; i < from.hardware().vcore(); i++) { Processor proc = new Processor(from.hardware().coresPerProcessor(), 1); processors.add(proc); } final HardwareBuilder builder; builder = new HardwareBuilder() .ids(from.id()) .name(from.name()) .ram(MinRamSize) .volumes(volumes) .processors(ImmutableList.copyOf(processors)); return builder.build(); }

Target:
public Hardware apply(HardwareFlavour from) { double minRamSize = (int) from.hardware().ram(); if (from.hardware().ram() < 1) { minRamSize = 0.5; } List<Volume> volumes = new ArrayList<Volume>(); for (HardwareFlavour.Hardware.Hdd hdd : from.hardware().hdds()) { Volume vol = new VolumeBuilder() .bootDevice(hdd.isMain()) .device("hdd") .type(Volume.Type.LOCAL) .size((float) hdd.size()) .build(); volumes.add(vol); } List<Processor> processors = new ArrayList<Processor>(); for (int i = 0; i < from.hardware().coresPerProcessor(); i++) { Processor proc = new Processor(from.hardware().vcore(), 1d); processors.add(proc); } final HardwareBuilder builder; builder = new HardwareBuilder() .ids(from.id()) .name(from.name()) .ram((int) (minRamSize * 1024)) .volumes(volumes) .processors(ImmutableList.copyOf(processors)); return builder.build(); }
Source:
public void onSaveInstanceState(Bundle outState) { outState.putString(MapParams.ROUTE_ID, mRouteId); outState.putBoolean(MapParams.ZOOM_TO_ROUTE, mZoomToRoute); outState.putBoolean(MapParams.ZOOM_INCLUDE_CLOSEST_VEHICLE, mZoomIncludeClosestVehicle); Location centerLocation = mFragment.getMapView().getMapCenterAsLocation(); outState.putDouble(MapParams.CENTER_LAT, centerLocation.getLatitude()); outState.putDouble(MapParams.CENTER_LON, centerLocation.getLongitude()); outState.putFloat(MapParams.ZOOM, mFragment.getMapView().getZoomLevelAsFloat()); Log.v("save zoomlevel", mFragment.getMapView().getZoomLevelAsFloat() + ""); }

Target:
public void onSaveInstanceState(Bundle outState) { outState.putString(MapParams.ROUTE_ID, mRouteId); outState.putBoolean(MapParams.ZOOM_TO_ROUTE, mZoomToRoute); outState.putBoolean(MapParams.ZOOM_INCLUDE_CLOSEST_VEHICLE, mZoomIncludeClosestVehicle); Location centerLocation = mFragment.getMapView().getMapCenterAsLocation(); outState.putDouble(MapParams.CENTER_LAT, centerLocation.getLatitude()); outState.putDouble(MapParams.CENTER_LON, centerLocation.getLongitude()); outState.putFloat(MapParams.ZOOM, mFragment.getMapView().getZoomLevelAsFloat()); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; Change change= null; RefactoringProcessor processor= null; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); processor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); change= getChange(refactoringWizard); refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } try { if (newName == null || change == null || isCompositeChange(change) || !(processor instanceof RenameResourceProcessor)) { RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { change.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { } } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; Change change= null; RefactoringProcessor processor= null; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); processor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); change= getChange(refactoringWizard); refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } try { if (newName == null || change == null || isCompositeChange(change) || !(processor instanceof RenameResourceProcessor)) { RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { change.perform(new NullProgressMonitor()); } } catch (InterruptedException e) { } catch (CoreException e) { RefactoringUIPlugin.log(e); } } } return null; }
Source:
protected Map<String, Pair<String, String>> getSharedLocks() { Map<String, Pair<String, String>> sharedLock = new HashMap<>(); if (vmsForDisk != null) { for (Pair<VM, VmDevice> vmForDisk : vmsForDisk) { sharedLock.put(vmForDisk.getFirst().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM, EngineMessage.ACTION_TYPE_FAILED_VM_IS_LOCKED)); } } return sharedLock.isEmpty() ? null : sharedLock; }

Target:
protected Map<String, Pair<String, String>> getSharedLocks() { if (getDiskImage() == null || getDiskImage().getVmEntityType() == null) { return null; } if (getDiskImage().getVmEntityType().isVmType()) { return getSharedLocksForVmDisk(); } if (getDiskImage().getVmEntityType().isTemplateType()) { return getSharedLocksForTemplateDisk(); } log.warn("No shared locks are taken while sparsifying disk of entity: {}", getDiskImage().getVmEntityType()); return null; }
Source:
public void testResourceSubset() throws InterruptedException { _admin.enableInstance(_clusterName, "localhost_12918", false); Thread.sleep(1000); _admin.enableCluster(_clusterName, false); _admin.enableInstance(_clusterName, "localhost_12918", true); BestPossAndExtViewZkVerifier verifier = new BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName, null, Sets.newHashSet(RESOURCES[1])); boolean result = false; try { result = ClusterStateVerifier.verifyByZkCallback(verifier); Assert.assertTrue(result); } finally { verifier.close(); } String[] args = { "--zkSvr", ZK_ADDR, "--cluster", _clusterName, "--resources", RESOURCES[1] }; result = ClusterStateVerifier.verifyState(args); Assert.assertTrue(result); BestPossAndExtViewZkVerifier verifier1 = new BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName); try { boolean fullResult = verifier1.verify(); Assert.assertFalse(fullResult); } finally { verifier1.close(); } _admin.enableCluster(_clusterName, true); }

Target:
public void testResourceSubset() throws InterruptedException { _admin.enableInstance(_clusterName, "localhost_12918", false); Thread.sleep(1000); _admin.enableCluster(_clusterName, false); _admin.enableInstance(_clusterName, "localhost_12918", true); BestPossAndExtViewZkVerifier verifier = new BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName, null, Sets.newHashSet(RESOURCES[1])); boolean result = false; try { result = ClusterStateVerifier.verifyByZkCallback(verifier); Assert.assertTrue(result); } finally { verifier.close(); } String[] args = { "--zkSvr", ZK_ADDR, "--cluster", _clusterName, "--resources", RESOURCES[1] }; result = ClusterStateVerifier.verifyState(args); Assert.assertTrue(result); verifier = new BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName); try { boolean fullResult = verifier.verify(); Assert.assertFalse(fullResult); } finally { verifier.close(); } _admin.enableCluster(_clusterName, true); }
Source:
public List<String> getSuggestions(CommandSource source, String arguments) throws CommandException { String[] parts = arguments.split(" +", 2); List<String> suggestions = new ArrayList<String>(); if (parts.length == 1) { String incompleteCommand = parts[0].toLowerCase(); synchronized (this) { for (CommandMapping mapping : this.commands.values()) { for (String alias : mapping.getAllAliases()) { if (alias.toLowerCase().startsWith(incompleteCommand)) { suggestions.add(alias); } } } } } else { Optional<CommandMapping> mapping = get(parts[0]); if (mapping.isPresent()) { List<String> subSuggestions = mapping.get().getCallable().getSuggestions(source, parts.length > 1 ? parts[1] : ""); for (String alias : mapping.get().getAllAliases()) { if (alias.equalsIgnoreCase(parts[0])) { Joiner joiner = Joiner.on(' '); for(String suggestion : subSuggestions) { suggestions.add(joiner.join(alias, suggestion)); } break; } } } } return Collections.unmodifiableList(suggestions); }

Target:
public List<String> getSuggestions(CommandSource source, String arguments) throws CommandException { String[] parts = arguments.split(" +", 2); List<String> suggestions = new ArrayList<String>(); if (parts.length == 1) { String incompleteCommand = parts[0].toLowerCase(); synchronized (this) { for (CommandMapping mapping : this.commands.values()) { if (!mapping.getCallable().testPermission(source)) continue; for (String alias : mapping.getAllAliases()) { if (alias.toLowerCase().startsWith(incompleteCommand)) { suggestions.add(alias); } } } } } else { Optional<CommandMapping> mapping = get(parts[0]); if (mapping.isPresent() && mapping.get().getCallable().testPermission(source)) { List<String> subSuggestions = mapping.get().getCallable().getSuggestions(source, parts.length > 1 ? parts[1] : ""); for (String alias : mapping.get().getAllAliases()) { if (alias.equalsIgnoreCase(parts[0])) { for (String suggestion : subSuggestions) { suggestions.add(SPACE_JOINER.join(alias, suggestion)); } break; } } } } return Collections.unmodifiableList(suggestions); }
Source:
private void addColumnToTranslatingModel( QueryColumn column, QueryModel translatingModel, QueryModel validatingModel ) throws SqlException { if (validatingModel != null) { CharSequence refColumn = Chars.toLowerCase(column.getAst().token); final int dot = Chars.indexOf(refColumn, '.'); getIndexOfTableForColumn(validatingModel, refColumn, dot, column.getAst().position); if (dot != -1 && validatingModel.getJoinModels().size() == 1) { ExpressionNode base = column.getAst(); column.of( column.getAlias(), expressionNodePool.next().of( base.type, base.token.subSequence(dot + 1, base.token.length()), base.precedence, base.position ) ); } } translatingModel.addBottomUpColumn(column); }

Target:
private void addColumnToTranslatingModel( QueryColumn column, QueryModel translatingModel, QueryModel validatingModel ) throws SqlException { if (validatingModel != null) { CharSequence refColumn = column.getAst().token; final int dot = Chars.indexOf(refColumn, '.'); getIndexOfTableForColumn(validatingModel, refColumn, dot, column.getAst().position); if (dot != -1 && validatingModel.getJoinModels().size() == 1) { ExpressionNode base = column.getAst(); column.of( column.getAlias(), expressionNodePool.next().of( base.type, base.token.subSequence(dot + 1, base.token.length()), base.precedence, base.position ) ); } } translatingModel.addBottomUpColumn(column); }
Source:
int getCpuPercentage() { if (System.currentTimeMillis() <= cpuRecordTime + cpuMaxAllowedDelayInMs) { return cpuPercentage; } cpuPercentage = (int) (osBean.getSystemCpuLoad() * 100); cpuRecordTime = System.currentTimeMillis(); logger.trace("CPU percentage: {}", cpuPercentage); return cpuPercentage; }

Target:
private int getCpuPercentage() { if (System.currentTimeMillis() <= cpuLastSampleTime.get() + cpuSamplingPeriodMs) { return cpuPercentage; } cpuPercentage = (int) (osBean.getSystemCpuLoad() * 100); cpuLastSampleTime.set(System.currentTimeMillis()); logger.trace("CPU percentage: {}", cpuPercentage); return cpuPercentage; }
Source:
public void runCommandByXpath( String idTopMenuCommand, String idCommandName, String xpathSubCommandName) { seleniumWebDriverHelper.waitSuccessCondition( driver -> { runCommand(idTopMenuCommand, idCommandName); WaitUtils.sleepQuietly(1); if (seleniumWebDriverHelper.isVisible(By.xpath(xpathSubCommandName))) { seleniumWebDriverHelper.waitAndClick(By.xpath(xpathSubCommandName)); return true; } return false; }, ELEMENT_TIMEOUT_SEC); }

Target:
public void runCommandByXpath( String idTopMenuCommand, String idCommandName, String xpathSubCommandName) { seleniumWebDriverHelper.waitSuccessCondition( driver -> { runCommand(idTopMenuCommand, idCommandName); if (isMenuItemVisible(By.xpath(xpathSubCommandName))) { runCommand(By.xpath(xpathSubCommandName)); return true; } return false; }, ELEMENT_TIMEOUT_SEC); }
Source:
public List<CorfuQueueRecord<E>> entryList(CorfuRecordId entriesAfter, int maxEntries) { if (maxEntries <= 0) { throw new IllegalArgumentException("entryList given negative maxEntries"); } if (maxEntries > MAX_INDEX_ENTRIES) { throw new IllegalArgumentException( "entryList can't return more than "+MAX_INDEX_ENTRIES+" entries" ); } List<CorfuQueueRecord<E>> copy = new ArrayList<>( Math.min(corfuTable.size(), maxEntries) ); Comparator<Map.Entry<Long, CorfuQueueRecord<E>>> recordIdComparator = (r1, r2) -> r1.getValue().getRecordId().compareTo(r2.getValue().recordId); int index = 0; for (Map.Entry<Long, CorfuQueueRecord<E>> entry : corfuTable.entryStream() .filter(e -> e.getValue().getRecordId().compareTo(entriesAfter) > 0) .sorted(recordIdComparator).collect(Collectors.toList())) { if (++index >= maxEntries) { break; } copy.add(entry.getValue()); } return copy; }

Target:
public List<CorfuQueueRecord<E>> entryList(CorfuRecordId entriesAfter, int maxEntries) { if (maxEntries <= 0) { throw new IllegalArgumentException("entryList can't take zero or negative maxEntries"); } log.trace("entryList: "+maxEntries+" entries after:"+entriesAfter); List<CorfuQueueRecord<E>> copy = new ArrayList<>( Math.min(corfuTable.size(), maxEntries) ); Comparator<Map.Entry<Long, CorfuQueueRecord<E>>> recordIdComparator = (r1, r2) -> r1.getValue().getRecordId().compareTo(r2.getValue().recordId); for (Map.Entry<Long, CorfuQueueRecord<E>> entry : corfuTable.entryStream() .filter(e -> e.getValue().getRecordId().compareTo(entriesAfter) > 0) .limit(maxEntries) .sorted(recordIdComparator).collect(Collectors.toList())) { copy.add(entry.getValue()); } return copy; }
Source:
public boolean reserve(long size) throws IllegalArgumentException { if (size < 0) { throw new IllegalArgumentException("Reservation size cannot be negative"); } while (true) { OffHeapResourceState currentState = state.get(); OffHeapResourceState newState = currentState.reserve(size); if (newState.getUsed() > newState.getCapacity()) { return false; } if (state.compareAndSet(currentState, newState)) { stateUpdated(newState); return true; } } }

Target:
public boolean reserve(long size) throws IllegalArgumentException { if (size < 0) { throw new IllegalArgumentException("Reservation size cannot be negative"); } while (true) { OffHeapResourceState currentState = state.get(); OffHeapResourceState newState = currentState.reserve(size); if (newState.isOverflowed()) { return false; } if (state.compareAndSet(currentState, newState)) { stateUpdated(newState); return true; } } }
Source:
public static void setup() throws Exception { System.setProperty("com.ibm.jsse2.overrideDefaultTLS", "true"); }

Target:
public static void setup() throws Exception { if (Utils.IBM_JDK) { defaultTSLValue = System.setProperty(IBM_JSSE2_DEFAULT_TSL, "true"); } }
Source:
public void closed( BoltConnection connection ) { String id = connection.id(); try { CompletableFuture currentFuture = activeWorkItems.remove( id ); if ( currentFuture != null ) { currentFuture.cancel( true ); } } finally { activeConnections.remove( id ); } }

Target:
public void closed( BoltConnection connection ) { String id = connection.id(); try { CompletableFuture<Boolean> currentFuture = activeWorkItems.remove( id ); if ( currentFuture != null ) { currentFuture.cancel( true ); } } finally { activeConnections.remove( id ); } }
Source:
private List<Project> filterProjectsWithIndices(Set<Project> projects) { List<String> patterns = new ArrayList<>(projects.size()); for (Project project : projects) { String indexPattern = kibanaUtils.formatIndexPattern(project); patterns.add(indexPattern); } LOGGER.trace("Evaluating indexPattern for existing index.", patterns.size()); Set<Project> result = new HashSet<>(projects.size()); SearchResponse response = pluginClient.search(patterns.toArray(new String[]{}), ArrayUtils.EMPTY_STRING_ARRAY, 1000, false); for (SearchHit hit : response.getHits().getHits()){ LOGGER.trace("Evaluating index {}", hit.getIndex()); Project project = kibanaUtils.getProjectFromIndex(hit.getIndex()); LOGGER.trace("Found index for project {}", project); result.add(project); } return new ArrayList<>(result); }

Target:
private List<Project> filterProjectsWithIndices(Set<Project> projects) { List<String> patterns = new ArrayList<>(projects.size()); for (Project project : projects) { String indexPattern = kibanaUtils.formatIndexPattern(project); patterns.add(indexPattern); } LOGGER.trace("Evaluating indexPattern for existing index.", patterns.size()); Set<Project> result = new HashSet<>(projects.size()); SearchResponse response = pluginClient.search(patterns.toArray(new String[]{}), ArrayUtils.EMPTY_STRING_ARRAY, 1000, false); if (response.getHits() == null ) { LOGGER.warn("Searching for indexPatterns returned a response with a null hits (e.g. response.getHits())"); return Collections.emptyList(); } for (SearchHit hit : response.getHits().getHits()){ LOGGER.trace("Evaluating index {}", hit.getIndex()); Project project = kibanaUtils.getProjectFromIndex(hit.getIndex()); LOGGER.trace("Found index for project {}", project); result.add(project); } return new ArrayList<>(result); }
Source:
public void locate() throws Exception { MultiBranchImpl stuff = r.createProject(MultiBranchImpl.class, "stuff"); stuff.getSourcesList().add(new BranchSource(new SingleSCMSource(null, "dev/flow", new NullSCM()))); stuff.scheduleBuild2(0).getFuture().get(); r.waitUntilNoActivity(); showComputation(stuff); FreeStyleProject master = r.jenkins.getItemByFullName("stuff/dev%2fflow", FreeStyleProject.class); assertNotNull(master); assertEquals(r.jenkins.getRootPath().child("workspace/stuff_dev_flow-L5GKER67QGVMJ2UD3JCSGKEV2ACON2O4VO4RNUZ27HGUY32SYVXQ"), r.jenkins.getWorkspaceFor(master)); DumbSlave slave = r.createOnlineSlave(); assertEquals(slave.getWorkspaceRoot().child("stuff_dev_flow-L5GKER67QGVMJ2UD3JCSGKEV2ACON2O4VO4RNUZ27HGUY32SYVXQ"), slave.getWorkspaceFor(master)); FreeStyleProject unrelated = r.createFreeStyleProject("100% crazy"); assertEquals(r.jenkins.getRootPath().child("workspace/100% crazy"), r.jenkins.getWorkspaceFor(unrelated)); }

Target:
public void locate() throws Exception { MultiBranchImpl stuff = r.createProject(MultiBranchImpl.class, "stuff"); stuff.getSourcesList().add(new BranchSource(new SingleSCMSource(null, "dev/flow", new NullSCM()))); stuff.scheduleBuild2(0).getFuture().get(); r.waitUntilNoActivity(); showComputation(stuff); FreeStyleProject master = r.jenkins.getItemByFullName("stuff/dev%2Fflow", FreeStyleProject.class); assertNotNull(master); assertEquals(r.jenkins.getRootPath().child("workspace/stuff_dev_flow-L5GKER67QGVMJ2UD3JCSGKEV2ACON2O4VO4RNUZ27HGUY32SYVXQ"), r.jenkins.getWorkspaceFor(master)); DumbSlave slave = r.createOnlineSlave(); assertEquals(slave.getWorkspaceRoot().child("stuff_dev_flow-L5GKER67QGVMJ2UD3JCSGKEV2ACON2O4VO4RNUZ27HGUY32SYVXQ"), slave.getWorkspaceFor(master)); FreeStyleProject unrelated = r.createFreeStyleProject("100% crazy"); assertEquals(r.jenkins.getRootPath().child("workspace/100% crazy"), r.jenkins.getWorkspaceFor(unrelated)); }
Source:
public View getView(int position, View convertView, ViewGroup parent) { if (appList != null) { View view; if (convertView == null) { view = inflater.inflate(R.layout.kiosk_app_drawer, null); } else { view = convertView; } Holder holder = new Holder(); holder.appName = (TextView) view.findViewById(R.id.name); holder.appIcon = (ImageView) view.findViewById(R.id.icon); PackageManager pm = context.getPackageManager(); String packageName = appList.get(position); if (packageName.equals(NEW_APP)) { holder.appName.setText(NEW_APP); holder.appIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_download)); } else { ApplicationInfo applicationInfo = null; try { applicationInfo = pm.getApplicationInfo(packageName, 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } holder.appName.setText(pm.getApplicationLabel(applicationInfo).toString()); try { holder.appIcon.setImageDrawable(pm.getApplicationIcon(packageName)); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } return view; } else { return null; } }

Target:
public View getView(int position, View convertView, ViewGroup parent) { if (appList != null) { View view; if (convertView == null) { view = inflater.inflate(R.layout.kiosk_app_drawer, null); } else { view = convertView; } Holder holder = new Holder(); holder.appName = (TextView) view.findViewById(R.id.name); holder.appIcon = (ImageView) view.findViewById(R.id.icon); PackageManager pm = context.getPackageManager(); String packageName = appList.get(position); if (packageName.equals(NEW_APP)) { holder.appName.setText(NEW_APP); holder.appIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_download)); } else { ApplicationInfo applicationInfo = null; try { applicationInfo = pm.getApplicationInfo(packageName, 0); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG,"Package name not found", e); } holder.appName.setText(pm.getApplicationLabel(applicationInfo).toString()); try { holder.appIcon.setImageDrawable(pm.getApplicationIcon(packageName)); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG,"Package name not found", e); } } return view; } else { return null; } }
Source:
public void initFileSystem() { try { fileSystem = ioService.newFileSystem(spaces.resolveFileSystemURI(SpacesAPIImpl.Scheme.DEFAULT, SpacesAPI.DEFAULT_SPACE, "security"), new HashMap<String, Object>() {{ put("init", Boolean.TRUE); put("internal", Boolean.TRUE); }}); } catch (FileSystemAlreadyExistsException e) { fileSystem = ioService.getFileSystem(spaces.resolveFileSystemURI(SpacesAPIImpl.Scheme.DEFAULT, SpacesAPI.DEFAULT_SPACE, "security")); } this.root = fileSystem.getRootDirectories().iterator().next(); }

Target:
public void initFileSystem() { try { fileSystem = ioService.newFileSystem(spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT, SpacesAPI.DEFAULT_SPACE, "security"), new HashMap<String, Object>() {{ put("init", Boolean.TRUE); put("internal", Boolean.TRUE); }}); } catch (FileSystemAlreadyExistsException e) { fileSystem = ioService.getFileSystem(spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT, SpacesAPI.DEFAULT_SPACE, "security")); } this.root = fileSystem.getRootDirectories().iterator().next(); }
Source:
public static ClassName bestGuess(String classNameString) { List<String> names = new ArrayList<>(); int p = 0; while (p < classNameString.length() && Character.isLowerCase(classNameString.charAt(p))) { p = classNameString.indexOf('.', p) + 1; checkArgument(p != 0, "couldn't make a guess for %s", classNameString); } names.add(p != 0 ? classNameString.substring(0, p - 1) : ""); for (String part : classNameString.substring(p).split("\\.", -1)) { checkArgument(!part.isEmpty() && Character.isUpperCase(part.charAt(0)), "couldn't make a guess for %s", classNameString); names.add(part); } checkArgument(names.size() >= 2, "couldn't make a guess for %s", classNameString); return new ClassName(names); }

Target:
public static ClassName bestGuess(String classNameString) { List<String> names = new ArrayList<>(); int p = 0; while (p < classNameString.length() && Character.isLowerCase(classNameString.codePointAt(p))) { p = classNameString.indexOf('.', p) + 1; checkArgument(p != 0, "couldn't make a guess for %s", classNameString); } names.add(p != 0 ? classNameString.substring(0, p - 1) : ""); for (String part : classNameString.substring(p).split("\\.", -1)) { checkArgument(!part.isEmpty() && Character.isUpperCase(part.codePointAt(0)), "couldn't make a guess for %s", classNameString); names.add(part); } checkArgument(names.size() >= 2, "couldn't make a guess for %s", classNameString); return new ClassName(names); }
Source:
public void release( T obj ) { LocalSlot<T> localSlot = puddle.get(); if ( localSlot.release( obj ) ) { } else { pool.release( obj ); } }

Target:
public void release( T obj ) { LocalSlot<T> localSlot = puddle.get(); if ( !localSlot.release( obj ) ) { pool.release( obj ); } }
Source:
public void assertionFailureGivesActiveDetails() { TestSubscriber<String> ts = new TestSubscriber<String>(); ts.onNext("a"); ts.onNext("b"); ts.onNext("c"); ts.onError(new TestException("forced failure")); try { ts.assertValues("1", "2"); fail(); } catch (AssertionError expected) { assertEquals("Number of items does not match. Provided: 2 Actual: 3.\n" + "Provided values: [1, 2]\n" + "Actual values: [a, b, c] (0 completions) (+1 errors)", expected.getMessage() ); Throwable ex = expected.getCause(); assertEquals(TestException.class, ex.getClass()); assertEquals("forced failure", ex.getMessage()); } }

Target:
public void assertionFailureGivesActiveDetails() { TestSubscriber<String> ts = new TestSubscriber<String>(); ts.onNext("a"); ts.onNext("b"); ts.onNext("c"); ts.onError(new TestException("forced failure")); try { ts.assertValues("1", "2"); fail(); } catch (AssertionError expected) { assertEquals("Number of items does not match. Provided: 2 Actual: 3.\n" + "Provided values: [1, 2]\n" + "Actual values: [a, b, c]\n (0 completions) (+1 error)", expected.getMessage() ); Throwable ex = expected.getCause(); assertEquals(TestException.class, ex.getClass()); assertEquals("forced failure", ex.getMessage()); } }
Source:
public void handleSetMbusUserKeyByChannelResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException exception) { LOGGER.info("handleSetMbusUserKeyByChannelResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = responseMessageResultType; if (exception != null) { LOGGER.error("Set M-Bus User Key By Channel Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleSetMbusUserKeyByChannelResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException exception) { LOGGER.info("handleSetMbusUserKeyByChannelResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = responseMessageResultType; if (exception != null) { LOGGER.error("Set M-Bus User Key By Channel Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
protected ByteBuffer filterChunkToRange(ByteBuffer buf) { if (options.getBlobOptions.getRange() == null) { return buf; } if (resolvedByteRange.getRangeSize() == 0) { buf.position(0); buf.limit(0); } else { long relativeOffset = offset; if (options.getBlobOptions.getBlobSegment() != -1) { relativeOffset = 0; } long startOffsetInThisChunk = chunkIndex == 0 ? resolvedByteRange.getStartOffset() - relativeOffset : 0; long endOffsetInThisChunkExclusive = chunkIndex == (numChunksTotal - 1) ? resolvedByteRange.getEndOffset() - relativeOffset + 1 : chunkSize; buf.position((int) startOffsetInThisChunk); buf.limit((int) endOffsetInThisChunkExclusive); } return buf.slice(); }

Target:
protected ByteBuffer filterChunkToRange(ByteBuffer buf) { if (options.getBlobOptions.getRange() == null) { return buf; } if (resolvedByteRange.getRangeSize() == 0) { buf.position(0); buf.limit(0); } else { long relativeOffset = offset; if (options.getBlobOptions.hasBlobSegmentIdx()) { relativeOffset = 0; } long startOffsetInThisChunk = chunkIndex == 0 ? resolvedByteRange.getStartOffset() - relativeOffset : 0; long endOffsetInThisChunkExclusive = chunkIndex == (numChunksTotal - 1) ? resolvedByteRange.getEndOffset() - relativeOffset + 1 : chunkSize; buf.position((int) startOffsetInThisChunk); buf.limit((int) endOffsetInThisChunkExclusive); } return buf.slice(); }
Source:
public void onMapReady(GoogleMap googleMap) { mMap = googleMap; if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { finish(); } mMap.setMyLocationEnabled(false); mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() { @Override public void onMapLongClick(LatLng latLng) { placeNewGeofence(latLng); } }); }

Target:
public void onMapReady(GoogleMap googleMap) { mMap = googleMap; if (!ListExamplesActivity.checkLocationPermissions(this)) { finish(); return; } mMap.setMyLocationEnabled(false); mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() { @Override public void onMapLongClick(LatLng latLng) { placeNewGeofence(latLng); } }); }
Source:
public boolean onPrepareOptionsMenu(Menu menu) { menu.getItem(0).setEnabled(savedPagesList.getCount() > 0); return super.onPrepareOptionsMenu(menu); }

Target:
public boolean onPrepareOptionsMenu(Menu menu) { menu.findItem(R.id.menu_clear_all_saved_pages).setEnabled(savedPagesList.getCount() > 0); return super.onPrepareOptionsMenu(menu); }
Source:
public byte exitStatus() { return results.isEmpty() || (runtimeOptions.isWip() ? max(results, SEVERITY).isOkWip(runtimeOptions.isStrict()) : max(results, SEVERITY).isOk(runtimeOptions.isStrict())) ? 0x0 : ERRORS; }

Target:
public byte exitStatus() { if (results.isEmpty()) { return DEFAULT; } if (runtimeOptions.isWip()) { return min(results, SEVERITY).is(Result.Type.PASSED) ? ERRORS : DEFAULT; } return max(results, SEVERITY).isOk(runtimeOptions.isStrict()) ? DEFAULT : ERRORS; }
Source:
public static <C extends ReadableByteChannel & SuspendableReadChannel> int readBlocking(C channel, ByteBuffer buffer, long time, TimeUnit unit) throws IOException { int res = channel.read(buffer); if (res != 0) { return res; } long startTimeNanos = System.nanoTime(); long timeoutNanos = unit.toNanos(time); long remainingNanos; while (res == 0 && buffer.hasRemaining() && (remainingNanos = timeoutNanos - (System.nanoTime() - startTimeNanos)) > 0) { channel.awaitReadable(remainingNanos, TimeUnit.NANOSECONDS); res = channel.read(buffer); } return res; }

Target:
public static <C extends ReadableByteChannel & SuspendableReadChannel> int readBlocking(C channel, ByteBuffer buffer, long time, TimeUnit unit) throws IOException { int res = channel.read(buffer); if (res != 0) { return res; } long remaining = unit.toNanos(time); long now = System.nanoTime(); while (buffer.hasRemaining() && remaining > 0) { channel.awaitReadable(remaining, TimeUnit.NANOSECONDS); res = channel.read(buffer); if (res != 0) { return res; } remaining -= Math.max(-now + (now = System.nanoTime()), 0L); } return res; }