auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onAdd(SolApplication solApplication) { rootUiElement.setPosition(SolApplication.displayDimensions.getWidth() / 2, SolApplication.displayDimensions.getHeight() / 2); itemList.setItemContainer(myOperation.getItems(solApplication.getGame())); if (descriptionTextBox == null) { descriptionTextBox = new UiTextBox(); interactText = new UiTextBox().setText("Drop"); interactButton = new UiActionButton().addElement(interactText); SolItem selectedItem = itemList.getSelectedItem(); if (selectedItem != null) { descriptionTextBox.setText(itemList.getSelectedItem().getDescription()); } else { descriptionTextBox.setText("No item selected"); } descriptionTextBox.setPosition(0, 0); StringBuilder textPlaceholderBuilder = new StringBuilder(DESCRIPTION_BOX_LINES_LENGTH * DESCRIPTION_BOX_LINES_HEIGHT); for (int lineNo = 0; lineNo < DESCRIPTION_BOX_LINES_HEIGHT; lineNo++) { for (int characterNo = 0; characterNo < DESCRIPTION_BOX_LINES_LENGTH; characterNo++) { textPlaceholderBuilder.append('-'); } textPlaceholderBuilder.append("\n"); } final UiSpacerElement descriptionArea = new UiSpacerElement() .setFromElement(new UiTextBox().setText(textPlaceholderBuilder.toString())) .setContainedElement(descriptionTextBox); ((UiVerticalListLayout) rootUiElement).addElement(descriptionArea).addElement(interactButton); } else { descriptionTextBox.setText(itemList.getSelectedItem().getDescription()); } myOperation.onAdd(this); }

Target:
public void onAdd(SolApplication solApplication) { itemList.setItemContainer(myOperation.getItems(solApplication.getGame())); if (descriptionTextBox == null) { descriptionTextBox = new UiTextBox(); interactText = new UiTextBox().setText("Drop"); interactButton = new UiActionButton().addElement(interactText); SolItem selectedItem = itemList.getSelectedItem(); if (selectedItem != null) { descriptionTextBox.setText(itemList.getSelectedItem().getDescription()); } else { descriptionTextBox.setText("No item selected"); } descriptionTextBox.setPosition(0, 0); StringBuilder textPlaceholderBuilder = new StringBuilder(DESCRIPTION_BOX_LINES_LENGTH * DESCRIPTION_BOX_LINES_HEIGHT); for (int lineNo = 0; lineNo < DESCRIPTION_BOX_LINES_HEIGHT; lineNo++) { for (int characterNo = 0; characterNo < DESCRIPTION_BOX_LINES_LENGTH; characterNo++) { textPlaceholderBuilder.append('-'); } textPlaceholderBuilder.append("\n"); } final UiSpacerElement descriptionArea = new UiSpacerElement() .setFromElement(new UiTextBox().setText(textPlaceholderBuilder.toString())) .setContainedElement(descriptionTextBox); verticalListLayout.addElement(descriptionArea).addElement(interactButton); } else { descriptionTextBox.setText(itemList.getSelectedItem().getDescription()); } myOperation.onAdd(this); }
Source:
public void stop() { memoryPools.forEach(memoryPool -> memoryPool.removeListener(memoryPoolListener)); }

Target:
public void stop() { if (scheduledFuture != null) { scheduledFuture.cancel(true); scheduledFuture = null; } memoryPools.forEach(memoryPool -> memoryPool.removeListener(memoryPoolListener)); }
Source:
public void getJwtDecoderWhenConfiguredWithDecoderAndJwkSetUriThenLastOneWins() { OAuth2ResourceServerConfigurer.JwtConfigurer jwtConfigurer = new OAuth2ResourceServerConfigurer(null).jwt(); JwtDecoder decoder = mock(JwtDecoder.class); jwtConfigurer.jwkSetUri(JWK_SET_URI); jwtConfigurer.decoder(decoder); assertThat(jwtConfigurer.getJwtDecoder()).isEqualTo(decoder); jwtConfigurer = new OAuth2ResourceServerConfigurer(null).jwt(); jwtConfigurer.decoder(decoder); jwtConfigurer.jwkSetUri(JWK_SET_URI); assertThat(jwtConfigurer.getJwtDecoder()).isInstanceOf(NimbusJwtDecoderJwkSupport.class); }

Target:
public void getJwtDecoderWhenConfiguredWithDecoderAndJwkSetUriThenLastOneWins() { ApplicationContext context = mock(ApplicationContext.class); OAuth2ResourceServerConfigurer.JwtConfigurer jwtConfigurer = new OAuth2ResourceServerConfigurer(context).jwt(); JwtDecoder decoder = mock(JwtDecoder.class); jwtConfigurer.jwkSetUri(JWK_SET_URI); jwtConfigurer.decoder(decoder); assertThat(jwtConfigurer.getJwtDecoder()).isEqualTo(decoder); jwtConfigurer = new OAuth2ResourceServerConfigurer(context).jwt(); jwtConfigurer.decoder(decoder); jwtConfigurer.jwkSetUri(JWK_SET_URI); assertThat(jwtConfigurer.getJwtDecoder()).isInstanceOf(NimbusJwtDecoderJwkSupport.class); }
Source:
public synchronized List<SchemaTableName> listViews(ConnectorSession session, String schemaNameOrNull) { return views.keySet().stream() .filter(viewName -> (schemaNameOrNull == null) || schemaNameOrNull.equals(viewName.getSchemaName())) .collect(ImmutableList.toImmutableList()); }

Target:
public synchronized List<SchemaTableName> listViews(ConnectorSession session, String schemaNameOrNull) { return views.keySet().stream() .filter(viewName -> (schemaNameOrNull == null) || schemaNameOrNull.equals(viewName.getSchemaName())) .collect(toImmutableList()); }
Source:
private void setField(ResultSet resultSet, StructuredRecord.Builder recordBuilder, Schema.Field field, int sqlType, int sqlPrecision, int sqlScale) throws SQLException { Object o = DBUtils.transformValue(sqlType, sqlPrecision, sqlScale, resultSet, field.getName()); if (o instanceof Date) { recordBuilder.setDate(field.getName(), ((Date) o).toLocalDate()); } else if (o instanceof Time) { recordBuilder.setTime(field.getName(), ((Time) o).toLocalTime()); } else if (o instanceof Timestamp) { Instant instant = ((Timestamp) o).toInstant(); recordBuilder.setTimestamp(field.getName(), ZonedDateTime.ofInstant(instant, ZoneId.systemDefault())); } else { recordBuilder.set(field.getName(), o); } }

Target:
private void setField(ResultSet resultSet, StructuredRecord.Builder recordBuilder, Schema.Field field, int sqlType, int sqlPrecision, int sqlScale) throws SQLException { Object o = DBUtils.transformValue(sqlType, sqlPrecision, sqlScale, resultSet, field.getName()); if (o instanceof Date) { recordBuilder.setDate(field.getName(), ((Date) o).toLocalDate()); } else if (o instanceof Time) { recordBuilder.setTime(field.getName(), ((Time) o).toLocalTime()); } else if (o instanceof Timestamp) { Instant instant = ((Timestamp) o).toInstant(); recordBuilder.setTimestamp(field.getName(), instant.atZone(ZoneId.ofOffset("UTC", ZoneOffset.UTC))); } else { recordBuilder.set(field.getName(), o); } }
Source:
protected boolean canDoAction() { if (getVmTemplate() != null) { setDescription(getVmTemplateName()); } if (!VmTemplateHandler.isTemplateStatusIsNotLocked(getVmTemplateId())) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } StorageDomainValidator storageDomainValidator = new StorageDomainValidator(getStorageDomain()); boolean retVal = storageDomainValidator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); if (retVal) { if (getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SPECIFY_DOMAIN_IS_NOT_EXPORT_DOMAIN); retVal = false; } } retVal = retVal && super.canDoAction(); if (retVal && !getParameters().getForceOverride()) { retVal = !ExportVmCommand.CheckTemplateInStorageDomain(getVmTemplate().getstorage_pool_id().getValue(), getParameters().getStorageDomainId(), getVmTemplateId()); if (!retVal) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NAME_ALREADY_EXISTS); } } return retVal; }

Target:
protected boolean canDoAction() { if (getVmTemplate() != null) { setDescription(getVmTemplateName()); } if (!VmTemplateHandler.isTemplateStatusIsNotLocked(getVmTemplateId())) { addCanDoActionMessage(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } StorageDomainValidator storageDomainValidator = new StorageDomainValidator(getStorageDomain()); boolean retVal = storageDomainValidator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); if (retVal) { if (getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SPECIFY_DOMAIN_IS_NOT_EXPORT_DOMAIN); retVal = false; } } retVal = retVal && super.canDoAction(); if (retVal && !getParameters().getForceOverride()) { retVal = !ExportVmCommand.CheckTemplateInStorageDomain(getVmTemplate().getstorage_pool_id().getValue(), getParameters().getStorageDomainId(), getVmTemplateId()); if (!retVal) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NAME_ALREADY_EXISTS); } } return retVal; }
Source:
public Router get(@PathParam("id") UUID id) throws StateAccessException, SerializationException { if (!authorizer.authorize(context, AuthAction.READ, id)) { throw new ForbiddenHttpException( "Not authorized to view this router."); } org.midonet.cluster.data.Router routerData = dataClient.routersGet(id); if (routerData == null) { throw new NotFoundHttpException( "The requested resource was not found."); } Router router = RouterDataConverter.fromData(routerData); router.setBaseUri(getBaseUri()); return router; }

Target:
public Router get(@PathParam("id") UUID id) throws StateAccessException, SerializationException { if (!authorizer.authorize(context, AuthAction.READ, id)) { throw new ForbiddenHttpException( "Not authorized to view this router."); } org.midonet.cluster.data.Router routerData = dataClient.routersGet(id); if (routerData == null) { throw new NotFoundHttpException( "The requested resource was not found."); } return RouterDataConverter.fromData(routerData, getBaseUri()); }
Source:
public BlockLease getBlockView(int[] positions, int positionCount) { checkState(outputType != null, "This stream reader produces null block"); return ClosingBlockLease.newLease(RunLengthEncodedBlock.create(outputType, null, positionCount)); }

Target:
public BlockLease getBlockView(int[] positions, int positionCount) { return ClosingBlockLease.newLease(createNullBlock(outputType, positionCount)); }
Source:
public FileObject addDescription(InputStream sourceMdStream, String sourceProfile, InputStream modsStream) throws InvalidRelationshipException { if (sourceProfile == null || sourceProfile == "") { throw new InvalidRelationshipException("No source profile was provided"); } FileObject fileObj = createFileObject(); BinaryObject orig = fileObj.addOriginalFile(sourceMdStream, null, "text/plain", null, null); URI metadataUri = RepositoryPaths.getMetadataUri(orig.getPid()); repoObjFactory.createProperty(orig, Cdr.hasSourceMetadataProfile, sourceProfile); repoObjFactory.createRelationship(orig, RDF.type, Cdr.SourceMetadata); repoObjFactory.createRelationship(this, PcdmModels.hasRelatedObject, fileObj.getResource()); BinaryObject mods = fileObj.addDerivative(null, modsStream, null, "text/plain", null); repoObjFactory.createRelationship(this, Cdr.hasMods, mods.getResource()); return fileObj; }

Target:
public FileObject addDescription(InputStream sourceMdStream, String sourceProfile, InputStream modsStream) throws InvalidRelationshipException { if (sourceProfile == null || sourceProfile == "") { throw new InvalidRelationshipException("No source profile was provided"); } FileObject fileObj = createFileObject(); BinaryObject orig = fileObj.addOriginalFile(sourceMdStream, null, "text/plain", null, null); repoObjFactory.createProperty(orig, Cdr.hasSourceMetadataProfile, sourceProfile); repoObjFactory.createRelationship(orig, RDF.type, Cdr.SourceMetadata); repoObjFactory.createRelationship(this, PcdmModels.hasRelatedObject, fileObj.getResource()); BinaryObject mods = fileObj.addDerivative(null, modsStream, null, "text/plain", null); repoObjFactory.createRelationship(this, Cdr.hasMods, mods.getResource()); return fileObj; }
Source:
public void exportToTsv(@Nullable OutputStream stream) { TableViewer statsViewer = getTableViewer(); if (statsViewer == null) { return; } Table table = statsViewer.getTable(); ExportToTsvUtils.exportTableToTsv(table, stream); }

Target:
public void exportToTsv(@Nullable OutputStream stream) { TableViewer tableViewer = getTableViewer(); if (tableViewer == null) { return; } Table table = tableViewer.getTable(); ExportToTsvUtils.exportTableToTsv(table, stream); }
Source:
private Object interpretDistanceToSpritePosition(Sprite currentSprite, String secondSpriteName) { Sprite secondSprite; try { secondSprite = ProjectManager.getInstance().getSceneToPlay().getSpriteBySpriteName(secondSpriteName); } catch (Resources.NotFoundException exception) { return 0d; } float secondSpriteXPosition = secondSprite.look.getXInUserInterfaceDimensionUnit(); float secondSpriteYPosition = secondSprite.look.getYInUserInterfaceDimensionUnit(); return currentSprite.look.getDistanceToInUserInterfaceDimensions(secondSpriteXPosition, secondSpriteYPosition); }

Target:
private Object interpretDistanceToSpritePosition(Sprite currentSprite, String secondSpriteName) { Sprite secondSprite; secondSprite = ProjectManager.getInstance().getSceneToPlay().getSpriteBySpriteName(secondSpriteName); float secondSpriteXPosition = secondSprite.look.getXInUserInterfaceDimensionUnit(); float secondSpriteYPosition = secondSprite.look.getYInUserInterfaceDimensionUnit(); return currentSprite.look.getDistanceToInUserInterfaceDimensions(secondSpriteXPosition, secondSpriteYPosition); }
Source:
private List<String> checkSeitenOhneDocstructs(FileformatInterface inRdf) throws PreferencesException { List<String> result = new ArrayList<>(); DocStructInterface boundBook = inRdf.getDigitalDocument().getPhysicalDocStruct(); if (boundBook == null || boundBook.getAllChildren() == null) { return result; } for (DocStructInterface docStructInterface : boundBook.getAllChildren()) { List<ReferenceInterface> refs = docStructInterface.getAllFromReferences(); String physical = ""; String logical = ""; if (refs.size() == 0) { for (MetadataInterface metadataInterface : docStructInterface.getAllMetadata()) { if (metadataInterface.getMetadataType().getName().equals("logicalPageNumber")) { logical = " (" + metadataInterface.getValue() + ")"; } if (metadataInterface.getMetadataType().getName().equals("physPageNumber")) { physical = metadataInterface.getValue(); } } result.add(physical + logical); } } return result; }

Target:
private List<String> checkSeitenOhneDocstructs(FileformatInterface inRdf) throws PreferencesException { List<String> result = new ArrayList<>(); DocStructInterface boundBook = inRdf.getDigitalDocument().getPhysicalDocStruct(); if (boundBook == null || boundBook.getAllChildren() == null) { return result; } for (DocStructInterface docStruct : boundBook.getAllChildren()) { List<ReferenceInterface> refs = docStruct.getAllFromReferences(); String physical = ""; String logical = ""; if (refs.size() == 0) { for (MetadataInterface metadata : docStruct.getAllMetadata()) { if (metadata.getMetadataType().getName().equals("logicalPageNumber")) { logical = " (" + metadata.getValue() + ")"; } if (metadata.getMetadataType().getName().equals("physPageNumber")) { physical = metadata.getValue(); } } result.add(physical + logical); } } return result; }
Source:
protected boolean canRunActionOnNonManagedVm() { ValidationResult nonManagedVmValidationResult = VmHandler.canRunActionOnNonManagedVm(getVm(), getActionType()); if (!nonManagedVmValidationResult.isValid()) { return failCanDoAction(nonManagedVmValidationResult.getMessage()); } return true; }

Target:
protected boolean canRunActionOnNonManagedVm() { ValidationResult nonManagedVmValidationResult = VmHandler.canRunActionOnNonManagedVm(getVm(), this.getActionType()); if (!nonManagedVmValidationResult.isValid()) { return failCanDoAction(nonManagedVmValidationResult.getMessage()); } return true; }
Source:
public long fastForwardFromEdits(DataTree dt, Map<Long, Integer> sessions, PlayBackListener listener) throws IOException { TxnIterator itr = txnLog.read(dt.lastProcessedZxid+1); long highestZxid = dt.lastProcessedZxid; TxnHeader hdr; int txnLoaded = 0; long startTime = Time.currentElapsedTime(); try { while (true) { hdr = itr.getHeader(); if (hdr == null) { return dt.lastProcessedZxid; } if (hdr.getZxid() < highestZxid && highestZxid != 0) { LOG.error("{}(highestZxid) > {}(next log) for type {}", highestZxid, hdr.getZxid(), hdr.getType()); } else { highestZxid = hdr.getZxid(); } try { processTransaction(hdr,dt,sessions, itr.getTxn()); txnLoaded ++; } catch(KeeperException.NoNodeException e) { throw new IOException("Failed to process transaction type: " + hdr.getType() + " error: " + e.getMessage(), e); } listener.onTxnLoaded(hdr, itr.getTxn()); if (!itr.next()) break; } } finally { if (itr != null) { itr.close(); } } long loadTime = Time.currentElapsedTime() - startTime; LOG.info("{} txns loaded in ms", txnLoaded, loadTime); ServerMetrics.STARTUP_TXNS_LOADED.add(txnLoaded); ServerMetrics.STARTUP_TXNS_LOAD_TIME.add(loadTime); return highestZxid; }

Target:
public long fastForwardFromEdits(DataTree dt, Map<Long, Integer> sessions, PlayBackListener listener) throws IOException { TxnIterator itr = txnLog.read(dt.lastProcessedZxid+1); long highestZxid = dt.lastProcessedZxid; TxnHeader hdr; int txnLoaded = 0; long startTime = Time.currentElapsedTime(); try { while (true) { hdr = itr.getHeader(); if (hdr == null) { return dt.lastProcessedZxid; } if (hdr.getZxid() < highestZxid && highestZxid != 0) { LOG.error("{}(highestZxid) > {}(next log) for type {}", highestZxid, hdr.getZxid(), hdr.getType()); } else { highestZxid = hdr.getZxid(); } try { processTransaction(hdr,dt,sessions, itr.getTxn()); txnLoaded++; } catch(KeeperException.NoNodeException e) { throw new IOException("Failed to process transaction type: " + hdr.getType() + " error: " + e.getMessage(), e); } listener.onTxnLoaded(hdr, itr.getTxn()); if (!itr.next()) break; } } finally { if (itr != null) { itr.close(); } } long loadTime = Time.currentElapsedTime() - startTime; LOG.info("{} txns loaded in ms", txnLoaded, loadTime); ServerMetrics.getMetrics().STARTUP_TXNS_LOADED.add(txnLoaded); ServerMetrics.getMetrics().STARTUP_TXNS_LOAD_TIME.add(loadTime); return highestZxid; }
Source:
public void getMessages() { testingClient.server().run(session -> { try { ThemeProvider extending = session.getProvider(ThemeProvider.class, "extending"); Theme theme = extending.getTheme("base", Theme.Type.LOGIN); System.out.println(theme.getMessages("messages", Locale.ENGLISH)); Assert.assertNotNull(theme.getMessages("messages", Locale.ENGLISH).get("test.keycloak-8818")); Assert.assertEquals("Keycloak Admin Console (from theme-resources)", theme.getMessages("admin-messages", Locale.ENGLISH).get("consoleTitle")); } catch (IOException e) { Assert.fail(e.getMessage()); } }); }

Target:
public void getMessages() { testingClient.server().run(session -> { try { ThemeProvider extending = session.getProvider(ThemeProvider.class, "extending"); Theme theme = extending.getTheme("base", Theme.Type.LOGIN); Assert.assertNotNull(theme.getMessages("messages", Locale.ENGLISH).get("test.keycloak-8818")); Assert.assertNotEquals("Full name (Theme-resources)", theme.getMessages("messages", Locale.ENGLISH).get("fullName")); } catch (IOException e) { Assert.fail(e.getMessage()); } }); }
Source:
public ClientServiceInvokeRequest(BinaryReaderExImpl reader) { super(reader); name = reader.readString(); flags = reader.readByte(); timeout = reader.readLong(); int cnt = reader.readInt(); nodeIds = U.newHashSet(cnt); for (int i = 0; i < cnt; i++) nodeIds.add(reader.readUuid()); methodName = reader.readString(); paramTypeIds = reader.readIntArray(); int argCnt = reader.readInt(); args = new Object[argCnt]; this.reader = reader; int argsStartPos = reader.in().position(); for (int i = 0; i < argCnt; i++) args[i] = reader.readObjectDetached(); reader.in().position(argsStartPos); }

Target:
public ClientServiceInvokeRequest(BinaryReaderExImpl reader) { super(reader); name = reader.readString(); flags = reader.readByte(); timeout = reader.readLong(); int cnt = reader.readInt(); nodeIds = new ArrayList<>(cnt); for (int i = 0; i < cnt; i++) nodeIds.add(new UUID(reader.readLong(), reader.readLong())); methodName = reader.readString(); int argCnt = reader.readInt(); paramTypeIds = hasParameterTypes() ? new int[argCnt] : null; args = new Object[argCnt]; this.reader = reader; int argsStartPos = reader.in().position(); for (int i = 0; i < argCnt; i++) { if (paramTypeIds != null) paramTypeIds[i] = reader.readInt(); args[i] = reader.readObjectDetached(); } reader.in().position(argsStartPos); }
Source:
public void stopLifecyclesInRole(String role) { if (this.lazyLifecycles.size() > 0) { addLazyLifecycles(); } List<SmartLifecycle> lifecycles = new ArrayList<SmartLifecycle>(this.lifecycles.get(role)); if (lifecycles != null) { Collections.sort(lifecycles, new Comparator<SmartLifecycle>() { @Override public int compare(SmartLifecycle o1, SmartLifecycle o2) { return o1.getPhase() < o2.getPhase() ? 1 : o1.getPhase() > o2.getPhase() ? -1 : 0; } }); for (SmartLifecycle lifecycle : lifecycles) { try { lifecycle.stop(); } catch (Exception e) { logger.error("Failed to stop " + lifecycle + " in role " + role); } } } }

Target:
public void stopLifecyclesInRole(String role) { if (this.lazyLifecycles.size() > 0) { addLazyLifecycles(); } List<SmartLifecycle> lifecycles = this.lifecycles.get(role); if (lifecycles != null) { lifecycles = new ArrayList<SmartLifecycle>(lifecycles); Collections.sort(lifecycles, new Comparator<SmartLifecycle>() { @Override public int compare(SmartLifecycle o1, SmartLifecycle o2) { return o1.getPhase() < o2.getPhase() ? 1 : o1.getPhase() > o2.getPhase() ? -1 : 0; } }); for (SmartLifecycle lifecycle : lifecycles) { try { lifecycle.stop(); } catch (Exception e) { logger.error("Failed to stop " + lifecycle + " in role " + role); } } } }
Source:
public void onVisitorPickup(final PlayerPickupItemEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (!IslandGuard.inWorld(e.getPlayer())) { return; } if (plugin.getGrid().isAtSpawn(e.getItem().getLocation())) { if (Settings.allowSpawnVisitorItemPickup || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) { return; } } if (plugin.getGrid().getIslandAt(e.getItem().getLocation()).getIgsFlag(Flags.allowVisitorItemDrop) || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) { return; } e.setCancelled(true); }

Target:
public void onVisitorPickup(final PlayerPickupItemEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (!IslandGuard.inWorld(e.getPlayer())) { return; } if (plugin.getGrid().isAtSpawn(e.getItem().getLocation())) { if (Settings.allowSpawnVisitorItemPickup || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) { return; } } if ((plugin.getGrid().getIslandAt(e.getItem().getLocation()) != null && plugin.getGrid().getIslandAt(e.getItem().getLocation()).getIgsFlag(Flags.allowVisitorItemDrop)) || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) { return; } e.setCancelled(true); }
Source:
public PriamConfigurationPersister(IConfiguration config) { super(config); mergedConfigDirectory = Paths.get(config.getMergedConfigurationDirectory()); structuredPath = Paths.get(config.getMergedConfigurationDirectory(), "structured.json"); initialized = false; canWrite = false; }

Target:
public PriamConfigurationPersister(IConfiguration config) { super(config); mergedConfigDirectory = Paths.get(config.getMergedConfigurationDirectory()); structuredPath = Paths.get(config.getMergedConfigurationDirectory(), "structured.json"); }
Source:
private CollectedUpdateMetrics extractMetrics(String[] lines) throws IOException { CollectedUpdateMetrics collectedUpdateMetrics = new CollectedUpdateMetrics(); Iterator<String> lineIterator = Stream.of(lines) .filter(line -> line.startsWith("><body<p>totalElapsed")) .collect(Collectors.toList()) .iterator(); for (MultiSyncStep step : MultiSyncStep.values()) { if (lineIterator.hasNext()) collectedUpdateMetrics.add(step, getUpdateMetrics(lineIterator.next())); else break; } Map<String, String> lastLineMetrics = Stream.of(lines) .filter(line -> line.contains(COMMIT_TOTAL_ELAPSED)) .flatMap(this::extractStandardLinesMetrics) .collect(toMapCollector()); Integer commitTotalElapsed = asInt(lastLineMetrics.get(COMMIT_TOTAL_ELAPSED)); if (commitTotalElapsed != null) collectedUpdateMetrics.setCommitTotalElapsed(commitTotalElapsed); Integer mutationCount = asInt(lastLineMetrics.get("mutationCount")); if (mutationCount == null) throw new IOException("Couldn't find the mutation count!"); if (mutationCount != null) collectedUpdateMetrics.setMutationCount(mutationCount); return collectedUpdateMetrics; }

Target:
private CollectedUpdateMetrics extractMetrics(String[] lines) throws IOException { CollectedUpdateMetrics collectedUpdateMetrics = new CollectedUpdateMetrics(); Iterator<String> lineIterator = getPerQueryResponses(lines); for (MultiSyncStep step : MultiSyncStep.values()) { if (lineIterator.hasNext()) collectedUpdateMetrics.add(step, getUpdateMetrics(lineIterator.next())); else break; }§ Map<String, String> summaryMetrics = extractSummaryMetrics(lines); Integer commitTotalElapsed = asInt(summaryMetrics.get(COMMIT_TOTAL_ELAPSED)); if (commitTotalElapsed != null) collectedUpdateMetrics.setCommitTotalElapsed(commitTotalElapsed); Integer mutationCount = asInt(summaryMetrics.get(MUTATION_COUNT)); if (mutationCount == null) throw new IOException("Couldn't find the mutation count!"); collectedUpdateMetrics.setMutationCount(mutationCount); return collectedUpdateMetrics; }
Source:
public Handler[] getHandlers() { return handlers.keySet().stream().map(key -> handlers.get(key)).toArray(Handler[]::new); }

Target:
public Handler[] getHandlers() { return handlers.entrySet().stream().map(e -> e.getValue()).toArray(Handler[]::new); }
Source:
private void generateBloomFilterAndPersist() throws IOException { List<IndexEntry> entries = new ArrayList<>(); getIndexEntriesSince(null, new FindEntriesCondition(Long.MAX_VALUE), entries, new AtomicLong(0), true); for (IndexEntry entry : entries) { bloomFilter.add(ByteBuffer.wrap(entry.getKey().toBytes())); } persistBloomFilter(); }

Target:
private void generateBloomFilterAndPersist() throws IOException { List<IndexEntry> entries = new ArrayList<>(); getIndexEntriesSince(null, new FindEntriesCondition(Long.MAX_VALUE), entries, new AtomicLong(0), true); bloomFilter = FilterFactory.getFilter(entries.size(), config.storeIndexBloomMaxFalsePositiveProbability); for (IndexEntry entry : entries) { bloomFilter.add(ByteBuffer.wrap(entry.getKey().toBytes())); } persistBloomFilter(); }
Source:
private void createSourceFile(GeneratedType model, ModelWriter modelWriter, Filer filer) { String fileName = ""; if ( !Strings.isEmpty( model.getPackageName() ) ) { fileName += model.getPackageName() + "."; } fileName += model.getName(); JavaFileObject sourceFile; try { sourceFile = filer.createSourceFile( fileName ); } catch ( IOException e ) { throw new RuntimeException( e ); } modelWriter.writeModel( sourceFile, model ); }

Target:
private void createSourceFile(GeneratedType model, ModelWriter modelWriter, Filer filer) { String fileName = ""; if ( model.hasPackageName() ) { fileName += model.getPackageName() + "."; } fileName += model.getName(); JavaFileObject sourceFile; try { sourceFile = filer.createSourceFile( fileName ); } catch ( IOException e ) { throw new RuntimeException( e ); } modelWriter.writeModel( sourceFile, model ); }
Source:
public Iterable<ConnectorIssue> analyze(MavenProject mavenProject) { List<ConnectorIssue> issues = Lists.newArrayList(super.analyze(mavenProject)); if (issues.isEmpty()) { Collection<File> testFiles = FileUtils.listFiles(fileSystem.baseDir(), new WildcardFileFilter(PATH), TrueFileFilter.INSTANCE); if (testFiles.size() > 1) { issues.add(new ConnectorIssue(KEY, "More than one .gitignore file in project.")); } else { try { List<String> gitIgnoreElements = FileUtils.readLines(Iterables.getOnlyElement(testFiles), StandardCharsets.UTF_8); Iterable<String> missingRequiredFields = Iterables.filter(requiredGitignoreFields, new matchesPredicate(gitIgnoreElements, applyByTrue)); if (!Iterables.isEmpty(missingRequiredFields)) { missingRequiredFields = Iterables.transform(missingRequiredFields, new Function<String, String>() { @Override public String apply(String input) { return input.replaceAll("(\\\\)|( *\\[/]\\?)|( *\\[\\*]\\?)", ""); } }); issues.add(new ConnectorIssue(KEY, String.format(issueMessage, Joiner.on(", ") .join(missingRequiredFields)))); } } catch (IOException e) { Throwables.propagate(e); } } } return issues; }

Target:
public Iterable<ConnectorIssue> analyze(MavenProject mavenProject) { List<ConnectorIssue> issues = Lists.newArrayList(super.analyze(mavenProject)); System.out.println(getFileSystem().baseDir()); if (FileUtils.listFiles(getFileSystem().baseDir(), new WildcardFileFilter(PATH), TrueFileFilter.INSTANCE).size() > BigInteger.ONE.intValue()) { issues.add(new ConnectorIssue(KEY, "More than one .gitignore file in project.")); } return issues; }
Source:
private static String checkVoltDBRootExistence(String newRootPath) { Path newRoot = Paths.get(newRootPath); if (!Files.exists(newRoot)) { return newRoot + " doesn't exist."; } else if (!Files.isDirectory(newRoot)) { return newRoot + " does exist, but it doesn't look like a directory."; } return "Success"; }

Target:
private static String checkVoltDBRootExistence(String newRootPath) { Path newRoot = Paths.get(newRootPath); if (!Files.exists(newRoot)) { return newRoot + " doesn't exist."; } else if (!Files.isDirectory(newRoot)) { return newRoot + " is not a directory."; } return SUCCESS; }
Source:
public void visitStatementList(PyStatementListTree pyStatementListTree) { if (isStmtListIncrementsNestingLevel(pyStatementListTree) && !pyStatementListTree.parent().is(Kind.FILE_INPUT)) { nestingLevelStack.peek().increment(); super.visitStatementList(pyStatementListTree); nestingLevelStack.peek().decrement(); } else { super.visitStatementList(pyStatementListTree); } }

Target:
public void visitStatementList(PyStatementListTree pyStatementListTree) { if (isStmtListIncrementsNestingLevel(pyStatementListTree)) { nestingLevelStack.peek().increment(); super.visitStatementList(pyStatementListTree); nestingLevelStack.peek().decrement(); } else { super.visitStatementList(pyStatementListTree); } }
Source:
public boolean isEmpty() { return (elementsInFile == 0) && this.list.size() == 0; }

Target:
public boolean isEmpty() { return this.size() == 0; }
Source:
private static String getUserName(Cause cause) { if (Cause.UserIdCause.class.isInstance(cause)) { Cause.UserIdCause userIdCause = (UserIdCause) cause; return userIdCause.getUserName(); } return null; }

Target:
private static String getUserName(Cause cause) { if (cause instanceof UserIdCause) { Cause.UserIdCause userIdCause = (UserIdCause) cause; return userIdCause.getUserName(); } else if (cause instanceof UserCause) { Cause.UserCause userCause = (UserCause) cause; return userCause.getUserName(); } return ""; }
Source:
private boolean validateFilesystemLocation() { final String pathString = fsPathText.getText().trim(); if (pathString.length() == 0 || !new Path("").isValidPath(pathString)) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemError); return false; } final File file = new File(pathString); if (!file.isAbsolute()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemInvalidError); return false; } if (file.isDirectory()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryError); return false; } if (pathString.endsWith("/") || pathString.endsWith("\\")) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError); return false; } final File parent = file.getParentFile(); if (!parent.exists() || !parent.isDirectory()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError); return false; } return true; }

Target:
private boolean validateFilesystemLocation() { final String pathString = fsPathText.getText().trim(); if (pathString.length() == 0 || !new Path("").isValidPath(pathString)) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemError); return false; } final File file = new File(pathString); if (!file.isAbsolute()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemInvalidError); return false; } if (file.isDirectory()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryError); return false; } if (pathString.endsWith("/") || pathString.endsWith("\\")) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError); return false; } final File parent = file.getParentFile(); if (!parent.isDirectory()) { setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError); return false; } return true; }
Source:
public boolean matches(RelOptRuleCall call) { FlinkLogicalAggregate agg = call.rel(0); if (agg.getGroupType() != Aggregate.Group.SIMPLE || agg.indicator) { throw new TableException("GROUPING SETS are currently not supported."); } List<AggregateCall> aggCalls = agg.getAggCallList(); boolean existGeneralPythonFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.GENERAL)); boolean existPandasFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.PANDAS)); boolean existUserDefinedJavaFunction = aggCalls.stream().anyMatch(x -> !PythonUtil.isPythonAggregate(x, null) && !PythonUtil.isBuiltInAggregate(x)); if (existPandasFunction || existGeneralPythonFunction) { if (existPandasFunction) { throw new TableException("Pandas UDAFs are not supported in streaming mode currently."); } if (existUserDefinedJavaFunction) { throw new TableException("Python UDAF and Java/Scala UDAF cannot be used together."); } return true; } else { return false; } }

Target:
public boolean matches(RelOptRuleCall call) { FlinkLogicalAggregate agg = call.rel(0); if (agg.getGroupType() != Aggregate.Group.SIMPLE || agg.indicator) { throw new TableException("GROUPING SETS are currently not supported."); } List<AggregateCall> aggCalls = agg.getAggCallList(); boolean existGeneralPythonFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.GENERAL)); boolean existPandasFunction = aggCalls.stream().anyMatch(x -> PythonUtil.isPythonAggregate(x, PythonFunctionKind.PANDAS)); boolean existJavaUserDefinedFunction = aggCalls.stream().anyMatch(x -> !PythonUtil.isPythonAggregate(x, null) && !PythonUtil.isBuiltInAggregate(x)); if (existPandasFunction || existGeneralPythonFunction) { if (existPandasFunction) { throw new TableException("Pandas UDAFs are not supported in streaming mode currently."); } if (existJavaUserDefinedFunction) { throw new TableException("Python UDAF and Java/Scala UDAF cannot be used together."); } return true; } else { return false; } }
Source:
private WorkerMetrics buildMetricsMsg(final int numDataBlocks, final double elapsedTime) { return WorkerMetrics.newBuilder() .setNumDataBlocks(numDataBlocks) .setTotalCompTime(computeTracer.totalElapsedTime()) .setTotalPullTime(pullTracer.totalElapsedTime()) .setTotalPushTime(pushTracer.totalElapsedTime()) .setTotalTime(elapsedTime) .setTotalCompTime(computeTracer.totalElapsedTime()) .setTotalPullTime(pullTracer.totalElapsedTime()) .setAvgPullTime(pullTracer.avgTimePerRecord()) .setTotalPushTime(pushTracer.totalElapsedTime()) .setAvgPushTime(pushTracer.avgTimePerRecord()) .build(); }

Target:
private WorkerMetrics buildMetricsMsg(final int numDataBlocks, final double elapsedTime) { return WorkerMetrics.newBuilder() .setItrIdx(iteration) .setNumMiniBatchPerItr(numMiniBatchesPerItr) .setProcessedDataItemCount(NUM_DATA_ITEMS_TO_PROCESS) .setNumDataBlocks(numDataBlocks) .setTotalTime(elapsedTime) .setTotalCompTime(computeTracer.totalElapsedTime()) .setTotalPullTime(pullTracer.totalElapsedTime()) .setAvgPullTime(pullTracer.avgTimePerRecord()) .setTotalPushTime(pushTracer.totalElapsedTime()) .setAvgPushTime(pushTracer.avgTimePerRecord()) .build(); }
Source:
private static int sizeof(Object obj) { if (obj instanceof String) { return obj.toString().length() << 1; } if (obj instanceof Symbol) { return ((Symbol) obj).length() << 1; } if (obj instanceof Integer) { return Integer.BYTES; } if (obj instanceof Long) { return Long.BYTES; } if (obj instanceof Short) { return Short.BYTES; } if (obj instanceof Character) { return Character.BYTES; } if (obj instanceof Float) { return Float.BYTES; } if (obj instanceof Double) { return Double.BYTES; } throw new IllegalArgumentException(String.format("Encoding Type: %s is not supported", obj.getClass())); }

Target:
private static int sizeof(Object obj) { if (obj instanceof String) { return obj.toString().length() << 1; } if (obj instanceof Symbol) { return ((Symbol) obj).length() << 1; } if (obj instanceof Integer) { return Integer.BYTES; } if (obj instanceof Long) { return Long.BYTES; } if (obj instanceof Short) { return Short.BYTES; } if (obj instanceof Character) { return Character.BYTES; } if (obj instanceof Float) { return Float.BYTES; } if (obj instanceof Double) { return Double.BYTES; } throw new IllegalArgumentException(String.format(Messages.ENCODING_TYPE_NOT_SUPPORTED, obj.getClass())); }
Source:
public void executePostLoad(Set<Long> nodeIds, Set<Long> edgeIds) { Set<Long> seenIds = new HashSet<>(); for (Long id : nodeIds) { Object o = mappingContext.getNodeEntity(id); if (!seenIds.contains(id)) { executePostLoad(o); seenIds.add(id); } } seenIds.clear(); for (Long id : edgeIds) { Object o = mappingContext.getRelationshipEntity(id); if (!seenIds.contains(id)) { if (o != null) { executePostLoad(o); } seenIds.add(id); } } }

Target:
public void executePostLoad(Set<Long> nodeIds, Set<Long> edgeIds) { for (Long id : nodeIds) { Object o = mappingContext.getNodeEntity(id); executePostLoad(o); } for (Long id : edgeIds) { Object o = mappingContext.getRelationshipEntity(id); if (o != null) { executePostLoad(o); } } }
Source:
private void onSyncthingStarted() { onApiChange(State.ACTIVE); Log.i(TAG, "onSyncthingStarted(): State.ACTIVE reached."); boolean prefUseFolderObserver = mPreferences.getBoolean(Constants.PREF_USE_FOLDER_OBSERVER, false); if (prefUseFolderObserver) { Log.i(TAG, "onSyncthingStarted(): Enumerating folders to create FolderObserver instances."); Handler handler = new Handler(); new Thread(() -> { for (Folder r : mApi.getFolders()) { try { mObservers.add(new FolderObserver(mApi, r, handler)); } catch (FolderObserver.FolderNotExistingException e) { Log.w(TAG, "Failed to add observer for folder", e); } catch (StackOverflowError e) { Log.w(TAG, "Failed to add folder observer", e); Toast.makeText(SyncthingService.this, R.string.toast_folder_observer_stack_overflow, Toast.LENGTH_LONG) .show(); } } }).start(); } else { Log.i(TAG, "onSyncthingStarted(): FolderObserver instances were disabled by experimental preference."); } }

Target:
private void onSyncthingStarted() { onApiChange(State.ACTIVE); Log.i(TAG, "onSyncthingStarted(): State.ACTIVE reached."); }
Source:
public static VariantContext swapAlleles(final VariantContext originalVc, final Allele oldAllele, final Allele newAllele) { if (!originalVc.getAlleles().contains(oldAllele)) return originalVc; final LinkedList<Allele> alleles = new LinkedList<>(originalVc.getAlleles()); alleles.set(alleles.indexOf(oldAllele), newAllele); VariantContextBuilder vcBuilder = new VariantContextBuilder(originalVc).alleles(alleles); GenotypesContext newGTs = GenotypesContext.create(originalVc.getGenotypes().size()); for (final Genotype g : originalVc.getGenotypes()) { if (!g.getAlleles().contains(oldAllele)) { newGTs.add(g); } else { final GenotypeBuilder gb = new GenotypeBuilder(g); final LinkedList<Allele> genotypeAlleles = new LinkedList<>(g.getAlleles()); genotypeAlleles.set(genotypeAlleles.indexOf(oldAllele), newAllele); gb.alleles(genotypeAlleles); newGTs.add(gb.make()); } } vcBuilder.genotypes(newGTs); return vcBuilder.make(); }

Target:
public static VariantContext swapAlleles(final VariantContext originalVc, final Allele oldAllele, final Allele newAllele) throws IllegalArgumentException{ if (!originalVc.getAlleles().contains(oldAllele)) throw new IllegalArgumentException("Couldn't find allele " + oldAllele + " in VariantContext " + originalVc); final List<Allele> alleles = new ArrayList<>(originalVc.getAlleles()); alleles.set(alleles.indexOf(oldAllele), newAllele); VariantContextBuilder vcBuilder = new VariantContextBuilder(originalVc).alleles(alleles); GenotypesContext newGTs = GenotypesContext.create(originalVc.getGenotypes().size()); for (final Genotype g : originalVc.getGenotypes()) { if (!g.getAlleles().contains(oldAllele)) { newGTs.add(g); } else { final GenotypeBuilder gb = new GenotypeBuilder(g); gb.alleles(g.getAlleles().stream().map(a -> a.equals(oldAllele) ? newAllele : a).collect(Collectors.toList())); newGTs.add(gb.make()); } } vcBuilder.genotypes(newGTs); return vcBuilder.make(); }
Source:
public static Matrix4 createRotationMatrix(double x, double y, double z, double angle) { Matrix4 ret = new Matrix4(); return ret.setToRotation(x, y, z, angle); }

Target:
public static Matrix4 createRotationMatrix(double x, double y, double z, double angle) { return new Matrix4().setToRotation(x, y, z, angle); }
Source:
@Deprecated protected byte[] getWriteBytes() { if (writeBuffer == null) { throw new UnsupportedOperationException("No write buffer set on FTranspprt"); } byte[] data = writeBuffer.toByteArray(); writeBuffer.reset(); return data; }

Target:
protected byte[] getWriteBytes() { if (writeBuffer == null) { throw new UnsupportedOperationException("No write buffer set on FTranspprt"); } return writeBuffer.toByteArray(); }
Source:
public void close() throws ZkInterruptedException { int retryCount = 0; do { try { zkClient.close(); return; } catch (ZkInterruptedException e) { Thread.interrupted(); retryCount += 1; LOG.warn("Interrupted when closing zkClient. Clearing the interrupted status and retrying.", e); } } while (retryCount < MAX_RETRY_COUNT); }

Target:
public void close() throws ZkInterruptedException { try { zkClient.close(); } catch (ZkInterruptedException e) { LOG.warn("Interrupted when closing zkClient. Clearing the interrupted status and retrying.", e); Thread.interrupted(); zkClient.close(); Thread.currentThread().interrupt(); } }
Source:
protected GetStoreFileRequest unmarshal0( ReadableChannel channel ) throws IOException, EndOfStreamException { StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal( channel ); long requiredTransactionId = channel.getLong(); int fileNameLength = channel.getInt(); byte[] fileNameBytes = new byte[fileNameLength]; channel.get( fileNameBytes, fileNameLength ); return new GetStoreFileRequest( storeId, new File( new String( fileNameBytes ) ), requiredTransactionId ); }

Target:
protected GetStoreFileRequest unmarshal0( ReadableChannel channel ) throws IOException, EndOfStreamException { StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal( channel ); long requiredTransactionId = channel.getLong(); int fileNameLength = channel.getInt(); byte[] fileNameBytes = new byte[fileNameLength]; channel.get( fileNameBytes, fileNameLength ); return new GetStoreFileRequest( storeId, new File( UTF8.decode( fileNameBytes ) ), requiredTransactionId ); }
Source:
public List<Object> executeHqlQuery(String hqlQuery, Map<String, Object> parameterValues) { Query q = sessionFactory.getHibernateSessionFactory().getCurrentSession().createQuery(hqlQuery); for (Map.Entry<String, Object> e : parameterValues.entrySet()) { if (e.getValue() instanceof Collection) { q.setParameterList(e.getKey(), (Collection)e.getValue()); } else if (e.getValue() instanceof Object[]) { q.setParameterList(e.getKey(), (Object[])e.getValue()); } else if (e.getValue() instanceof Cohort) { q.setParameterList(e.getKey(), ((Cohort)e.getValue()).getMemberIds()); } else if (e.getValue() instanceof IdSet) { q.setParameterList(e.getKey(), ((IdSet)e.getValue()).getMemberIds()); } else { q.setParameter(e.getKey(), e.getValue()); } } return q.list(); }

Target:
public List<Object> executeHqlQuery(String hqlQuery, Map<String, Object> parameterValues) { Query q = sessionFactory.getCurrentSession().createQuery(hqlQuery); for (Map.Entry<String, Object> e : parameterValues.entrySet()) { if (e.getValue() instanceof Collection) { q.setParameterList(e.getKey(), (Collection)e.getValue()); } else if (e.getValue() instanceof Object[]) { q.setParameterList(e.getKey(), (Object[])e.getValue()); } else if (e.getValue() instanceof Cohort) { q.setParameterList(e.getKey(), ((Cohort)e.getValue()).getMemberIds()); } else if (e.getValue() instanceof IdSet) { q.setParameterList(e.getKey(), ((IdSet)e.getValue()).getMemberIds()); } else { q.setParameter(e.getKey(), e.getValue()); } } return q.list(); }
Source:
@Override public boolean handle(Ignite ignite, FailureContext failureCtx) { if (!testIsRunning.getAndSet(false)) { ignite.log().info("Critical issue detected after test finished. Test failure handler ignore it."); return true; } boolean nodeStopped = super.handle(ignite, failureCtx); TestCase.fail(failureCtx.toString()); test.handleFailure(failureCtx.error()); return nodeStopped; }

Target:
@Override public boolean handle(Ignite ignite, FailureContext failureCtx) { String debug = " asd123 handle error="+failureCtx.error().getClass()+", msg="+failureCtx.error().getMessage()+", cause="+(failureCtx.error().getCause()==null?"null":failureCtx.error().getCause().getClass().getSimpleName()); if (ignite != null && ignite.log() != null) ignite.log().info("ignite.log" + debug); else System.out.println("sout" + debug); if (isFailureExpected(ignite, failureCtx)) return false; if (!testIsRunning.getAndSet(false)) { ignite.log().info("Critical issue detected after test finished. Test failure handler ignore it."); return true; } boolean nodeStopped = super.handle(ignite, failureCtx); test.handleFailure(failureCtx.error()); return nodeStopped; }
Source:
RollingHistogram(int size) { current = new Histogram(LOWEST_DISCERNABLE_VALUE.nanos(), HIGHEST_TRACKABLE_VALUE.nanos(), SIGNIFICANT_DIGITS); list = new ArrayList<>(); recorder = new Recorder(LOWEST_DISCERNABLE_VALUE.nanos(), HIGHEST_TRACKABLE_VALUE.nanos(), SIGNIFICANT_DIGITS); this.size = size; }

Target:
RollingHistogram(int size) { current = new Histogram(LOWEST_DISCERNABLE_VALUE.nanos(), HIGHEST_TRACKABLE_VALUE.nanos(), SIGNIFICANT_DIGITS); list = new ArrayList<>(); recorder = new Recorder(LOWEST_DISCERNABLE_VALUE.nanos(), HIGHEST_TRACKABLE_VALUE.nanos(), SIGNIFICANT_DIGITS); assert size > 0; this.size = size; }
Source:
public void testInjectionShouldBeSuccessfulWithoutHead() { when(options.isEnabled()).thenReturn(true); String htmlBody = "<!doctype html><html lang='en'><body></body></head>"; msg.setResponseBody(htmlBody); frontEndScannerProxyListener.onHttpResponseReceive(msg); String expectedHtmlFormat = "<!doctype html><html lang='en'><head><script src='https:\\/\\/" + HOSTNAME + "\\/zapCallBackUrl\\/-?[0-9]+\\?action=getFile&filename=front-end-scanner.js&historyReferenceId=42'><\\/script><\\/head><body><\\/body></head>"; String result = msg.getResponseBody().toString(); assertTrue(result.matches(expectedHtmlFormat)); }

Target:
public void testInjectionShouldBeSuccessfulWithoutHead() { when(options.isEnabled()).thenReturn(true); String htmlBody = "<!doctype html><html lang='en'><body></body></head></html>"; msg.setResponseBody(htmlBody); frontEndScannerProxyListener.onHttpResponseReceive(msg); String expectedHtmlFormat = "<!doctype html><html lang='en'><head><script src='https:\\/\\/" + HOSTNAME + "\\/zapCallBackUrl\\/-?[0-9]+\\?action=getFile&filename=front-end-scanner.js&historyReferenceId=42'><\\/script><\\/head><body><\\/body></head></html>"; String result = msg.getResponseBody().toString(); assertTrue(result.matches(expectedHtmlFormat)); }
Source:
private void checkCanceled(IProgressMonitor pm) { if (pm.isCanceled()) throw new OperationCanceledException(); }

Target:
private static void checkCanceled(IProgressMonitor pm) { if (pm.isCanceled()) throw new OperationCanceledException(); }