auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void putObjectWithSyncNotSupportedVersion() throws Exception { final Arguments args = new Arguments(new String[]{"ds3_java_cli", "-e", "localhost:8080", "-k", "key!", "-a", "access", "-c", "put_object", "-b", "bucketName", "-o", "obj.txt", "--sync"}); final SystemInformation.BuildInformation buildInformation = mock(SystemInformation.BuildInformation.class); when(buildInformation.getVersion()).thenReturn("1.2.0"); final SystemInformation systemInformation = mock(SystemInformation.class); when(systemInformation.getBuildInformation()).thenReturn(buildInformation); final GetSystemInformationResponse systemInformationResponse = mock(GetSystemInformationResponse.class); when(systemInformationResponse.getSystemInformation()).thenReturn(systemInformation); final Ds3Client client = mock(Ds3Client.class); when(client.getSystemInformation(any(GetSystemInformationRequest.class))).thenReturn(systemInformationResponse); final Ds3ClientHelpers helpers = mock(Ds3ClientHelpers.class); final FileUtils mockedFileUtils = mock(FileUtils.class); when(mockedFileUtils.exists(any(Path.class))).thenReturn(true); when(mockedFileUtils.isRegularFile(any(Path.class))).thenReturn(true); when(mockedFileUtils.size(any(Path.class))).thenReturn(100L); PowerMockito.mockStatic(BlackPearlUtils.class); final Ds3Cli cli = new Ds3Cli(new Ds3ProviderImpl(client, helpers), args, mockedFileUtils); cli.call(); fail(); }

Target:
public void putObjectWithSyncNotSupportedVersion() throws Exception { final Arguments args = new Arguments(new String[]{"ds3_java_cli", "-e", "localhost:8080", "-k", "key!", "-a", "access", "-c", "put_object", "-b", "bucketName", "-o", "obj.txt", "--sync"}); final SystemInformation.BuildInformation buildInformation = mock(SystemInformation.BuildInformation.class); when(buildInformation.getVersion()).thenReturn("1.2.0"); final SystemInformation systemInformation = mock(SystemInformation.class); when(systemInformation.getBuildInformation()).thenReturn(buildInformation); final GetSystemInformationResponse systemInformationResponse = mock(GetSystemInformationResponse.class); when(systemInformationResponse.getSystemInformation()).thenReturn(systemInformation); final Ds3Client client = mock(Ds3Client.class); when(client.getSystemInformation(any(GetSystemInformationRequest.class))).thenReturn(systemInformationResponse); final Ds3ClientHelpers helpers = mock(Ds3ClientHelpers.class); final FileUtils mockedFileUtils = mock(FileUtils.class); when(mockedFileUtils.exists(any(Path.class))).thenReturn(true); when(mockedFileUtils.isRegularFile(any(Path.class))).thenReturn(true); when(mockedFileUtils.size(any(Path.class))).thenReturn(100L); PowerMockito.mockStatic(BlackPearlUtils.class); final Ds3Cli cli = new Ds3Cli(new Ds3ProviderImpl(client, helpers), args, mockedFileUtils); cli.call(); }
Source:
private boolean detectBarCodeInImage(ArrayList<Uri> selectedImages) { InputStream imageStream = null; for (Uri uri : selectedImages) { if (uri == null) return false; try { imageStream = getContentResolver().openInputStream(uri); } catch (FileNotFoundException e) { e.printStackTrace(); } Bitmap bMap = BitmapFactory.decodeStream(imageStream); int[] intArray = new int[bMap.getWidth() * bMap.getHeight()]; bMap.getPixels(intArray, 0, bMap.getWidth(), 0, 0, bMap.getWidth(), bMap.getHeight()); LuminanceSource source = new RGBLuminanceSource(bMap.getWidth(), bMap.getHeight(), intArray); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Reader reader = new MultiFormatReader(); try { Hashtable<DecodeHintType, Object> decodeHints = new Hashtable<DecodeHintType, Object>(); decodeHints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); decodeHints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE); Result result = reader.decode(bitmap, decodeHints); if (result != null) { mBarcode = result.getText(); } if (mBarcode != null) { return true; } } catch (NotFoundException e) { e.printStackTrace(); } catch (ChecksumException e) { e.printStackTrace(); } catch (FormatException e) { Toast.makeText(getApplicationContext(), getString(R.string.format_error), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } } return false; }

Target:
private boolean detectBarCodeInImage(ArrayList<Uri> selectedImages) { InputStream imageStream = null; for (Uri uri : selectedImages) { try { imageStream = getContentResolver().openInputStream(uri); } catch (FileNotFoundException e) { e.printStackTrace(); } Bitmap bMap = BitmapFactory.decodeStream(imageStream); int[] intArray = new int[bMap.getWidth() * bMap.getHeight()]; bMap.getPixels(intArray, 0, bMap.getWidth(), 0, 0, bMap.getWidth(), bMap.getHeight()); LuminanceSource source = new RGBLuminanceSource(bMap.getWidth(), bMap.getHeight(), intArray); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Reader reader = new MultiFormatReader(); try { Hashtable<DecodeHintType, Object> decodeHints = new Hashtable<DecodeHintType, Object>(); decodeHints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); decodeHints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE); Result result = reader.decode(bitmap, decodeHints); if (result != null) { mBarcode = result.getText(); } if (mBarcode != null) { return true; } } catch (NotFoundException e) { e.printStackTrace(); } catch (ChecksumException e) { e.printStackTrace(); } catch (FormatException e) { Toast.makeText(getApplicationContext(), getString(R.string.format_error), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } } return false; }
Source:
protected TypeBinding findNextTypeBinding(int tokenIndex, Scope scope, PackageBinding packageBinding) { LookupEnvironment env = scope.environment(); try { env.missingClassFileLocation = this; if (this.resolvedType == null) { this.resolvedType = scope.getType(this.tokens[tokenIndex], packageBinding); } else { this.resolvedType = scope.getMemberType(this.tokens[tokenIndex], (ReferenceBinding) this.resolvedType); if (!this.resolvedType.isValidBinding()) { this.resolvedType = new ProblemReferenceBinding( CharOperation.subarray(this.tokens, 0, tokenIndex + 1), (ReferenceBinding)this.resolvedType.closestMatch(), this.resolvedType.problemId()); } } for (int j = 0; j < env.resolutionListeners.length; j++) { env.resolutionListeners[j].recordResolution(this, this.resolvedType); } return this.resolvedType; } catch (AbortCompilation e) { e.updateContext(this, scope.referenceCompilationUnit().compilationResult); throw e; } finally { env.missingClassFileLocation = null; } }

Target:
protected TypeBinding findNextTypeBinding(int tokenIndex, Scope scope, PackageBinding packageBinding) { LookupEnvironment env = scope.environment(); try { env.missingClassFileLocation = this; if (this.resolvedType == null) { this.resolvedType = scope.getType(this.tokens[tokenIndex], packageBinding); } else { this.resolvedType = scope.getMemberType(this.tokens[tokenIndex], (ReferenceBinding) this.resolvedType); if (!this.resolvedType.isValidBinding()) { this.resolvedType = new ProblemReferenceBinding( CharOperation.subarray(this.tokens, 0, tokenIndex + 1), (ReferenceBinding)this.resolvedType.closestMatch(), this.resolvedType.problemId()); } } return this.resolvedType; } catch (AbortCompilation e) { e.updateContext(this, scope.referenceCompilationUnit().compilationResult); throw e; } finally { env.missingClassFileLocation = null; } }
Source:
public int process(List<File> files) throws CheckstyleException { fireAuditStarted(); for (final FileSetCheck fsc : fileSetChecks) { fsc.beginProcessing(charset); } for (final File file : files) { try { if (!CommonUtils.matchesFileExtension(file, fileExtensions)) { continue; } final String fileName = file.getAbsolutePath(); fireFileStarted(fileName); final SortedSet<LocalizedMessage> fileMessages = Sets.newTreeSet(); try { final FileText theText = new FileText(file.getAbsoluteFile(), charset); for (final FileSetCheck fsc : fileSetChecks) { fileMessages.addAll(fsc.process(file, theText)); } } catch (final IOException ioe) { LOG.debug("IOException occurred.", ioe); fileMessages.add(new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "general.exception", new String[] {ioe.getMessage()}, null, getClass(), null)); } fireErrors(fileName, fileMessages); fireFileFinished(fileName); } catch (Exception ex) { throw new CheckstyleException("Exception happens during processing of " + file.getPath(), ex); } } for (final FileSetCheck fsc : fileSetChecks) { fsc.finishProcessing(); } for (final FileSetCheck fsc : fileSetChecks) { fsc.destroy(); } final int errorCount = counter.getCount(); fireAuditFinished(); return errorCount; }

Target:
public int process(List<File> files) throws CheckstyleException { fireAuditStarted(); for (final FileSetCheck fsc : fileSetChecks) { fsc.beginProcessing(charset); } for (final File file : files) { try { if (!CommonUtils.matchesFileExtension(file, fileExtensions)) { continue; } final String fileName = file.getAbsolutePath(); fireFileStarted(fileName); final SortedSet<LocalizedMessage> fileMessages = Sets.newTreeSet(); try { final FileText theText = new FileText(file.getAbsoluteFile(), charset); for (final FileSetCheck fsc : fileSetChecks) { fileMessages.addAll(fsc.process(file, theText)); } } catch (final IOException ioe) { LOG.debug("IOException occurred.", ioe); fileMessages.add(new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "general.exception", new String[] {ioe.getMessage()}, null, getClass(), null)); } fireErrors(fileName, fileMessages); fireFileFinished(fileName); } catch (Exception ex) { throw new CheckstyleException("Exception was thrown while processing " + file.getPath(), ex); } } for (final FileSetCheck fsc : fileSetChecks) { fsc.finishProcessing(); } for (final FileSetCheck fsc : fileSetChecks) { fsc.destroy(); } final int errorCount = counter.getCount(); fireAuditFinished(); return errorCount; }
Source:
public boolean mightContain(Write write) { Type valueType = write.getValue().getType(); incrementCounter(numberOfVerifiesInitiated, 1); boolean mightContain = writeCache.mightContainCached(write.getRecord(), write.getKey(), write.getValue()); int increment = mightContain ? 1 : 0; incrementCounter(numberOfVerifiesTouchingPage, increment); if(valueType == Type.STRING) { mightContain = writeCache.mightContainCached(write.getRecord(), write.getKey(), Value.wrap(Convert.javaToThrift(Tag.create((String) write.getValue().getObject())))); increment = mightContain ? 1 : 0; incrementCounter(numberOfVerifiesTouchingPage, increment); } else if(valueType == Type.TAG) { mightContain = writeCache.mightContainCached(write.getRecord(), write.getKey(), Value.wrap(Convert.javaToThrift(write.getValue().getObject().toString()))); increment = mightContain ? 1 : 0; incrementCounter(numberOfVerifiesTouchingPage, increment); } scanned = mightContain; return mightContain; }

Target:
public boolean mightContain(Write write) { Type valueType = write.getValue().getType(); if(writeCache.mightContainCached(write.getRecord(), write.getKey(), write.getValue())) { return true; } else if(valueType == Type.STRING) { return writeCache.mightContainCached(write.getRecord(), write.getKey(), Value.wrap(Convert.javaToThrift(Tag.create( (String) write.getValue().getObject())))); } else if(valueType == Type.TAG) { return writeCache.mightContainCached(write.getRecord(), write.getKey(), Value.wrap(Convert.javaToThrift( write.getValue().getObject().toString()))); } else { return false; } }
Source:
private synchronized void unregisterDiscoveryService(ThingUID bridgeUID) { ServiceRegistration<?> serviceReg = discoveryServiceRegs.get(bridgeUID); if (serviceReg != null) { WeatherUndergroundDiscoveryService service = (WeatherUndergroundDiscoveryService) bundleContext .getService(serviceReg.getReference()); service.deactivate(); serviceReg.unregister(); discoveryServiceRegs.remove(bridgeUID); } }

Target:
private synchronized void unregisterDiscoveryService(ThingUID bridgeUID) { ServiceRegistration<?> serviceReg = discoveryServiceRegs.remove(bridgeUID); if (serviceReg != null) { WeatherUndergroundDiscoveryService service = (WeatherUndergroundDiscoveryService) bundleContext .getService(serviceReg.getReference()); serviceReg.unregister(); service.deactivate(); } }
Source:
public ProblemModule(boolean stacktraces, Map<Integer, StatusType> statuses) { this.stacktraces = stacktraces; this.statuses = Collections.unmodifiableMap(statuses); }

Target:
private ProblemModule(boolean stacktraces, Map<Integer, StatusType> statuses) { this.stacktraces = stacktraces; this.statuses = statuses; }
Source:
public TkCORS(final Take take, final String... domains) { this.origin = take; this.alloweddomains = new HashSet<String>(); if (domains != null) { for (final String domain : domains) { this.alloweddomains.add(domain); } } }

Target:
public TkCORS(final Take take, final String... domains) { this.origin = take; this.allowed = new HashSet<String>(Arrays.asList(domains)); }
Source:
public void onAdClicked() { if (mInterstitialListener != null) { DuAdMediation.d(TAG, "Interstitial onAdClicked "); mInterstitialListener.onAdClicked(mAdapter); } }

Target:
public void onAdClicked() { if (mInterstitialListener != null) { DuAdMediation.d(TAG, "Interstitial onAdClicked "); mInterstitialListener.onAdClicked(mAdapter); mInterstitialListener.onAdLeftApplication(mAdapter); } }
Source:
public SimSwitcherQuery(Similarity similarity, Query subQuery) { this.similarity = Objects.requireNonNull(similarity); this.subQuery = Objects.requireNonNull(subQuery); }

Target:
public SimSwitcherQuery(Similarity similarity, Query subQuery) { this.similarity = requireNonNull(similarity); this.subQuery = requireNonNull(subQuery); }
Source:
private Intent makeTimerIntent() { if (checkBox.isChecked()) { return new Intent(getActivity(), MusicService.class) .setAction(MusicService.ACTION_PENDING_QUIT); } return new Intent(getActivity(), MusicService.class) .setAction(MusicService.ACTION_QUIT); }

Target:
private Intent makeTimerIntent() { Intent intent = new Intent(getActivity(), MusicService.class); if (shouldFinishLastSong.isChecked()) { return intent.setAction(MusicService.ACTION_PENDING_QUIT); } return intent.setAction(MusicService.ACTION_QUIT); }
Source:
public void setConnection(final IDockerConnection connection) { if (connection != null && connection.equals(this.connection)) { return; } if (this.connection != null) { this.connection.removeContainerListener(this); } this.connection = connection; if (this.viewer != null && this.connection != null) { final Job refreshJob = new Job( DVMessages.getString("ContainersRefresh.msg")) { @Override protected IStatus run(IProgressMonitor monitor) { connection.getContainers(true); return Status.OK_STATUS; } }; refreshJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { connection.addContainerListener(DockerContainersView.this); Display.getDefault().asyncExec(() -> { viewer.setInput(connection); refreshViewTitle(); }); } }); refreshJob.schedule(); } else if (this.viewer != null) { viewer.setInput(new IDockerContainer[0]); form.setText(DVMessages.getString(NoConnectionSelected)); } }

Target:
public void setConnection(final IDockerConnection connection) { if (connection != null && connection.equals(this.connection)) { return; } if (this.connection != null) { this.connection.removeContainerListener(this); } this.connection = connection; if (this.viewer != null && this.connection != null) { final Job refreshJob = new Job( DVMessages.getString("ContainersRefresh.msg")) { @Override protected IStatus run(IProgressMonitor monitor) { connection.getContainers(true); connection.addContainerListener(DockerContainersView.this); Display.getDefault().asyncExec(() -> { viewer.setInput(connection); refreshViewTitle(); }); return Status.OK_STATUS; } }; refreshJob.schedule(); } else if (this.viewer != null) { viewer.setInput(new IDockerContainer[0]); form.setText(DVMessages.getString(NoConnectionSelected)); } }
Source:
private void checkServiceAccountRoles(UserRepresentation serviceAccount, boolean rolesExpected) { Assert.assertTrue("User is a service account", serviceAccount.getUsername().startsWith(ServiceAccountConstants.SERVICE_ACCOUNT_USER_PREFIX)); Assert.assertNull("Password should be null", serviceAccount.getCredentials()); if (rolesExpected) { List<String> realmRoles = serviceAccount.getRealmRoles(); Assert.assertEquals(3, realmRoles.size()); Assert.assertTrue(realmRoles.containsAll(Arrays.asList("uma_authorization", "user", "offline_access"))); Map<String, List<String>> clientRoles = serviceAccount.getClientRoles(); Assert.assertNotNull(clientRoles.get("test-app-service-account")); Assert.assertEquals(2, clientRoles.get("test-app-service-account").size()); Assert.assertTrue(clientRoles.get("test-app-service-account").containsAll(Arrays.asList("test-app-service-account", "test-app-service-account-parent"))); Assert.assertEquals(2, clientRoles.get("account").size()); Assert.assertTrue(clientRoles.get("account").containsAll(Arrays.asList("manage-account", "view-profile"))); } else { Assert.assertNull("Service account should be exported without realm roles", serviceAccount.getRealmRoles()); Assert.assertNull("Service account should be exported without client roles", serviceAccount.getClientRoles()); } }

Target:
private void checkServiceAccountRoles(UserRepresentation serviceAccount, boolean rolesExpected) { Assert.assertTrue("User is a service account", serviceAccount.getUsername().startsWith(ServiceAccountConstants.SERVICE_ACCOUNT_USER_PREFIX)); Assert.assertNull("Password should be null", serviceAccount.getCredentials()); if (rolesExpected) { List<String> realmRoles = serviceAccount.getRealmRoles(); Assert.assertThat("Realm roles are OK", realmRoles, Matchers.containsInAnyOrder("uma_authorization", "user", "offline_access")); Map<String, List<String>> clientRoles = serviceAccount.getClientRoles(); Assert.assertNotNull("Client roles are exported", clientRoles); Assert.assertThat("Client roles for test-app-service-account are OK", clientRoles.get("test-app-service-account"), Matchers.containsInAnyOrder("test-app-service-account", "test-app-service-account-parent")); Assert.assertThat("Client roles for account are OK", clientRoles.get("account"), Matchers.containsInAnyOrder("manage-account", "view-profile")); } else { Assert.assertNull("Service account should be exported without realm roles", serviceAccount.getRealmRoles()); Assert.assertNull("Service account should be exported without client roles", serviceAccount.getClientRoles()); } }
Source:
private Class getValueType(String name) { switch (name) { case KEY_TABLE : return OmKeyInfo.class; case VOLUME_TABLE : return OmVolumeArgs.class; case BUCKET_TABLE : return OmBucketInfo.class; default: return null; } }

Target:
protected Class getValueType(String name) { switch (name) { case KEY_TABLE : return OmKeyInfo.class; case VOLUME_TABLE : return OmVolumeArgs.class; case BUCKET_TABLE : return OmBucketInfo.class; default: return null; } }
Source:
void verifySetterBraceStyle(SetterClauseContext ctx) { ParseTree leftSibling = ParseTreeUtil.getLeftSibling(ctx.codeBlock()); Token set = (leftSibling instanceof TerminalNodeImpl) ? ((TerminalNodeImpl) leftSibling).getSymbol() : ((ParserRuleContext) leftSibling).getStop(); verifyCodeBlockOpenBraceStyle(ctx.codeBlock(), set, Messages.SETTER); verifyBodyCloseBraceStyle(ctx.codeBlock(), Messages.SETTER); }

Target:
void verifySetterBraceStyle(SetterClauseContext ctx) { ParseTree leftSibling = ParseTreeUtil.getLeftSibling(ctx.codeBlock()); Token set = ParseTreeUtil.getStopTokenForNode(leftSibling); verifyCodeBlockOpenBraceStyle(ctx.codeBlock(), set, Messages.SETTER); verifyBodyCloseBraceStyle(ctx.codeBlock(), Messages.SETTER); }
Source:
public Set<Tag> updateTags(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Tool to modify.", required = true) @PathParam("containerId") Long containerId, @ApiParam(value = "List of modified tags", required = true) List<Tag> tags) { Tool c = toolDAO.findById(containerId); Helper.checkEntry(c); Helper.checkUser(user, c); Map<Long, Tag> mapOfExistingTags = new HashMap<>(); for (Tag tag : c.getTags()) { mapOfExistingTags.put(tag.getId(), tag); } for (Tag tag : tags) { if (mapOfExistingTags.containsKey(tag.getId())) { Tag existingTag = mapOfExistingTags.get(tag.getId()); if (!existingTag.getCwlPath().equals(tag.getCwlPath()) || !existingTag.getWdlPath().equals(tag.getWdlPath()) || !existingTag.getDockerfilePath().equals(tag.getDockerfilePath()) || !existingTag.getCwlTestParameterFile().equals(tag.getCwlTestParameterFile()) || !existingTag.getWdlTestParameterFile().equals(tag.getWdlTestParameterFile())) { existingTag.setDirtyBit(true); } existingTag.updateByUser(tag); } } Tool result = toolDAO.findById(containerId); Helper.checkEntry(result); return result.getTags(); }

Target:
public Set<Tag> updateTags(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Tool to modify.", required = true) @PathParam("containerId") Long containerId, @ApiParam(value = "List of modified tags", required = true) List<Tag> tags) { Tool c = toolDAO.findById(containerId); Helper.checkEntry(c); Helper.checkUser(user, c); Map<Long, Tag> mapOfExistingTags = new HashMap<>(); for (Tag tag : c.getTags()) { mapOfExistingTags.put(tag.getId(), tag); } for (Tag tag : tags) { if (mapOfExistingTags.containsKey(tag.getId())) { Tag existingTag = mapOfExistingTags.get(tag.getId()); boolean dirtyBitCheck = new EqualsBuilder() .append(existingTag.getCwlPath(), tag.getCwlPath()) .append(existingTag.getWdlPath(), tag.getWdlPath()) .append(existingTag.getDockerfilePath(), tag.getDockerfilePath()) .append(existingTag.getCwlTestParameterFile(), tag.getCwlTestParameterFile()) .append(existingTag.getWdlTestParameterFile(), tag.getWdlTestParameterFile()) .isEquals(); if (!dirtyBitCheck) { existingTag.setDirtyBit(true); } existingTag.updateByUser(tag); } } Tool result = toolDAO.findById(containerId); Helper.checkEntry(result); return result.getTags(); }
Source:
public int compare(final ItemStack o1, final ItemStack o2) { return Integer.signum(o1.getItem().getId().compareTo(o2.getItem().getId())); }

Target:
public int compare(final ItemStack o1, final ItemStack o2) { return o1.getItem().getId().compareTo(o2.getItem().getId()); }
Source:
public Matrix removeRow(int i) { return removeRow(i, this.factory); }

Target:
public Matrix removeRow(int i) { return removeRow(i, factory); }
Source:
private static void loadPokeZPowers() { if (zpowerloaded) { return; } testLoad();; zpowerloaded = true; String path = "db/moves/" + thisGen + "G/zpower.txt"; InfoFiller.fill(path, new FillerByte() { @Override void fillByte(int i, byte b) { moveNames.get(i).zpower = b; } }); }

Target:
private static void loadPokeZPowers() { if (zpowerloaded) { return; } testLoad(); zpowerloaded = true; String path = "db/moves/" + thisGen + "G/zpower.txt"; InfoFiller.fill(path, new FillerByte() { @Override void fillByte(int i, byte b) { moveNames.get(i).zpower = b; } }); }
Source:
public void addRow( final TupleBatch from, final int fromRow, final MutableTupleBuffer to, final int toRow, final int offset) { ReadableColumn fromCol = from.asColumn(column); ReplaceableColumn toCol = to.getColumn(offset, toRow); final int inColumRow = to.getInColumnIndex(toRow); switch (aggOp) { case COUNT: toCol.replaceLong(toCol.getLong(inColumRow) + 1, inColumRow); break; case MAX: toCol.replaceInt(Math.max(fromCol.getInt(fromRow), toCol.getInt(inColumRow)), inColumRow); break; case MIN: toCol.replaceInt(Math.min(fromCol.getInt(fromRow), toCol.getInt(inColumRow)), inColumRow); break; case SUM: toCol.replaceLong( LongMath.checkedAdd((long) fromCol.getInt(fromRow), toCol.getLong(inColumRow)), inColumRow); break; case SUM_SQUARED: toCol.replaceLong( LongMath.checkedAdd( LongMath.checkedMultiply((long) fromCol.getInt(fromRow), fromCol.getInt(fromRow)), toCol.getLong(inColumRow)), inColumRow); break; default: throw new IllegalArgumentException(aggOp + " is invalid"); } }

Target:
public void addRow( final TupleBatch from, final int fromRow, final MutableTupleBuffer to, final int toRow, final int offset) { ReadableColumn fromCol = from.asColumn(column); ReplaceableColumn toCol = to.getColumn(offset, toRow); final int inColumnRow = to.getInColumnIndex(toRow); switch (aggOp) { case COUNT: toCol.replaceLong(toCol.getLong(inColumnRow) + 1, inColumnRow); break; case MAX: toCol.replaceInt(Math.max(fromCol.getInt(fromRow), toCol.getInt(inColumnRow)), inColumnRow); break; case MIN: toCol.replaceInt(Math.min(fromCol.getInt(fromRow), toCol.getInt(inColumnRow)), inColumnRow); break; case SUM: toCol.replaceLong( LongMath.checkedAdd((long) fromCol.getInt(fromRow), toCol.getLong(inColumnRow)), inColumnRow); break; case SUM_SQUARED: toCol.replaceLong( LongMath.checkedAdd( LongMath.checkedMultiply((long) fromCol.getInt(fromRow), fromCol.getInt(fromRow)), toCol.getLong(inColumnRow)), inColumnRow); break; default: throw new IllegalArgumentException(aggOp + " is invalid"); } }
Source:
public String createTopic(String topicName, int numberOfPartitions, Properties topicConfig) { int replicationFactor = Integer.parseInt(topicConfig.getProperty("replicationFactor")); AdminUtils.createTopic(new ZkClient(_zkAddress), topicName, numberOfPartitions, replicationFactor, topicConfig); return String.format(DESTINATION_URI_FORMAT, _zkAddress, topicName); }

Target:
public String createTopic(String topicName, int numberOfPartitions, Properties topicConfig) { Objects.requireNonNull(topicName, "topicName should not be null"); Objects.requireNonNull(topicConfig, "topicConfig should not be null"); int replicationFactor = Integer.parseInt(topicConfig.getProperty("replicationFactor", DEFAULT_REPLICATION_FACTOR)); LOG.info(String.format("Creating topic with name %s partitions %d with properties %s", topicConfig, numberOfPartitions, topicConfig)); try { if (!AdminUtils.topicExists(_zkClient, topicName)) { AdminUtils.createTopic(_zkClient, topicName, numberOfPartitions, replicationFactor, topicConfig); } else { LOG.warn(String.format("Topic with name %s already exists", topicName)); } } catch (Throwable e) { LOG.error(String.format("Creating topic %s failed with exception %s ", topicName, e)); throw e; } return String.format(DESTINATION_URI_FORMAT, _zkAddress, topicName); }
Source:
private boolean areChildrenOptional(EntityDefinition entityDef) { Collection<? extends EntityDefinition> children = AlignmentUtil .getChildrenWithoutContexts(entityDef); if (children == null || children.isEmpty()) return true; for (EntityDefinition child : children) { Definition<?> def = child.getDefinition(); if (def instanceof GroupPropertyDefinition) { Cardinality cardinality = ((GroupPropertyDefinition) def) .getConstraint(Cardinality.class); if (cardinality.getMinOccurs() != 0) return false; else if (!areChildrenOptional(entityDef)) return false; } else if (def instanceof PropertyDefinition) { Cardinality cardinality = ((PropertyDefinition) def) .getConstraint(Cardinality.class); if (cardinality.getMinOccurs() != 0) return false; if (((PropertyDefinition) def).getConstraint(NillableFlag.class).isEnabled()) { if (!areChildrenOptional(child)) return false; } } } return true; }

Target:
private boolean areChildrenOptional(EntityDefinition entityDef) { Collection<? extends EntityDefinition> children = AlignmentUtil .getChildrenWithoutContexts(entityDef); if (children == null || children.isEmpty()) return true; for (EntityDefinition child : children) { Definition<?> def = child.getDefinition(); if (def instanceof GroupPropertyDefinition) { Cardinality cardinality = ((GroupPropertyDefinition) def) .getConstraint(Cardinality.class); if (cardinality.getMinOccurs() != 0 && !areChildrenOptional(entityDef)) return false; } else if (def instanceof PropertyDefinition) { Cardinality cardinality = ((PropertyDefinition) def) .getConstraint(Cardinality.class); if (cardinality.getMinOccurs() != 0 && ((PropertyDefinition) def) .getConstraint(NillableFlag.class).isEnabled()) { if (!areChildrenOptional(child)) return false; } } } return true; }
Source:
public boolean equals(Object obj) { if (!(obj instanceof DependencyFoundEvent<?>)) { return false; } if (!((DependencyFoundEvent<?>)obj).getType().equals(clazz)) { return false; } @SuppressWarnings("unchecked") DependencyFoundEvent<T> event = (DependencyFoundEvent<T>)obj; if ((from == null) != (event.from == null)) { return false; } if ((to == null) != (event.to == null)) { return false; } if ((parent == null) != (event.parent == null)) { return false; } if (from != null && !from.equals(event.from)) { return false; } if (to != null && !to.equals(event.to)) { return false; } if (parent != null && !parent.equals(event.parent)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (!(obj instanceof DependencyFoundEvent<?>)) { return false; } DependencyFoundEvent<?> event = (DependencyFoundEvent<?>)obj; if ((from == null) != (event.from == null)) { return false; } if ((to == null) != (event.to == null)) { return false; } if ((parent == null) != (event.parent == null)) { return false; } if (from != null && !from.equals(event.from)) { return false; } if (to != null && !to.equals(event.to)) { return false; } if (parent != null && !parent.equals(event.parent)) { return false; } return true; }
Source:
public void run() { try { serverChannel.register(nioSelector, SelectionKey.OP_ACCEPT); startupComplete(); int currentProcessor = 0; while (isRunning()) { int ready = nioSelector.select(500); if (ready > 0) { Set<SelectionKey> keys = nioSelector.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while (iter.hasNext() && isRunning()) { SelectionKey key = null; try { key = iter.next(); iter.remove(); if (key.isAcceptable()) { accept(key, processors.get(currentProcessor)); } else { throw new IllegalStateException("Unrecognized key state for acceptor thread."); } currentProcessor = (currentProcessor + 1) % processors.size(); } catch (Exception e) { } } } } logger.debug("Closing server socket and selector."); serverChannel.close(); nioSelector.close(); shutdownComplete(); } catch (Exception e) { logger.error("Error during shutdown of acceptor thread {}", e); } }

Target:
public void run() { try { serverChannel.register(nioSelector, SelectionKey.OP_ACCEPT); startupComplete(); int currentProcessor = 0; while (isRunning()) { int ready = nioSelector.select(selectTimeOutMs); if (ready > 0) { Set<SelectionKey> keys = nioSelector.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while (iter.hasNext() && isRunning()) { SelectionKey key = null; try { key = iter.next(); iter.remove(); if (key.isAcceptable()) { accept(key, processors.get(currentProcessor)); } else { throw new IllegalStateException("Unrecognized key state for acceptor thread."); } currentProcessor = (currentProcessor + 1) % processors.size(); } catch (Exception e) { } } } } logger.debug("Closing server socket and selector."); serverChannel.close(); nioSelector.close(); shutdownComplete(); } catch (Exception e) { logger.error("Error during shutdown of acceptor thread {}", e); } }
Source:
static WaitStrategy createWaitStrategy(final String propertyName) { final String strategyStr = PropertiesUtil.getProperties().getStringProperty(propertyName, DisruptorWaitStrategy.TIMEOUT.toString()); LOGGER.trace("property {}={}", propertyName, strategyStr); final DisruptorWaitStrategy strategy = DisruptorWaitStrategy.valueOf(Strings.toRootUpperCase(strategyStr)); final long timeoutMillis = parseAdditionalLongProperty(propertyName, "Timeout", 10L); switch (strategy) { case SLEEP: final long sleepTimeNs = parseAdditionalLongProperty(propertyName, "SleepTimeNs", 100L); final String key = getFullPropertyKey(propertyName, "Retries"); final int retries = PropertiesUtil.getProperties().getIntegerProperty(key, 200); return new SleepingWaitStrategy(retries, sleepTimeNs); case YIELD: return new YieldingWaitStrategy(); case BLOCK: return new BlockingWaitStrategy(); case BUSYSPIN: return new BusySpinWaitStrategy(); case TIMEOUT: return new TimeoutBlockingWaitStrategy(timeoutMillis, TimeUnit.MILLISECONDS); default: return new TimeoutBlockingWaitStrategy(timeoutMillis, TimeUnit.MILLISECONDS); } }

Target:
static WaitStrategy createWaitStrategy(final String propertyName) { final String strategy = PropertiesUtil.getProperties().getStringProperty(propertyName, "Timeout"); LOGGER.trace("property {}={}", propertyName, strategy); final String strategyUp = Strings.toRootUpperCase(strategy); final long timeoutMillis = parseAdditionalLongProperty(propertyName, "Timeout", 10L); switch (strategyUp) { case "SLEEP": final long sleepTimeNs = parseAdditionalLongProperty(propertyName, "SleepTimeNs", 100L); final String key = getFullPropertyKey(propertyName, "Retries"); final int retries = PropertiesUtil.getProperties().getIntegerProperty(key, 200); return new SleepingWaitStrategy(retries, sleepTimeNs); case "YIELD": return new YieldingWaitStrategy(); case "BLOCK": return new BlockingWaitStrategy(); case "BUSYSPIN": return new BusySpinWaitStrategy(); case "TIMEOUT": return new TimeoutBlockingWaitStrategy(timeoutMillis, TimeUnit.MILLISECONDS); default: return new TimeoutBlockingWaitStrategy(timeoutMillis, TimeUnit.MILLISECONDS); } }
Source:
public void close() throws Exception { if (lowLevelClient != null) { lowLevelClient.close(); lowLevelClient = null; } client = null; }

Target:
public void close() { if (lowLevelClient != null) { try { lowLevelClient.close(); } catch (IOException e) { log.warn("Fail to close the Elasticsearch low level RestClient: " + e.getMessage(), e); } lowLevelClient = null; } client = null; }
Source:
public void authorizeEventTypeWrite(final EventType eventType) throws AccessDeniedException, ServiceTemporarilyUnavailableException { if (eventType.getAuthorization() == null) { return; } final EventTypeResource resource = new EventTypeResource( eventType.getName(), eventType.getAuthorization()); try { final boolean authorized = authorizationService.isAuthorized( AuthorizationService.Operation.WRITE, resource); if (!authorized) { if (!adminService.isAdmin(AuthorizationService.Operation.WRITE)) { throw new AccessDeniedException(AuthorizationService.Operation.WRITE, resource); } } } catch (final PluginException ex) { throw new ServiceTemporarilyUnavailableException("Error while checking authorization", ex); } }

Target:
public void authorizeEventTypeWrite(final EventType eventType) throws AccessDeniedException, ServiceTemporarilyUnavailableException { if (eventType.getAuthorization() == null) { return; } final EventTypeResource resource = new EventTypeResource( eventType.getName(), eventType.getAuthorization()); try { final boolean authorized = authorizationService.isAuthorized( AuthorizationService.Operation.WRITE, resource); if (!authorized) { throw new AccessDeniedException(AuthorizationService.Operation.WRITE, resource); } } catch (final PluginException ex) { throw new ServiceTemporarilyUnavailableException("Error while checking authorization", ex); } }
Source:
public void beginTree(DetailAST rootAST) { publicTypeFound = false; DetailAST currentNode = rootAST; while (currentNode != null) { if (isTypeDef(currentNode) && isPublic(currentNode)) { publicTypeFound = true; break; } currentNode = currentNode.getNextSibling(); } }

Target:
public void beginTree(DetailAST rootAST) { DetailAST currentNode = rootAST; boolean publicTypeFound = false; DetailAST firstType = null; while (currentNode != null) { if (isTypeDef(currentNode)) { if (isPublic(currentNode)) { publicTypeFound = true; } if (firstType == null) { firstType = currentNode; } else if (!isPublic(currentNode)) { final String typeName = currentNode .findFirstToken(TokenTypes.IDENT).getText(); log(currentNode, MSG_KEY, typeName); } } currentNode = currentNode.getNextSibling(); } if (publicTypeFound && !isPublic(firstType)) { final String typeName = firstType .findFirstToken(TokenTypes.IDENT).getText(); log(firstType, MSG_KEY, typeName); } }
Source:
public void testAPITagVisibilityAuthorisedUser() throws Exception { List<TagDTO> tagDtoList = apiStoreClientAllowedUser.getAllTags().getList(); List<String> tagList = new ArrayList<>(); for (TagDTO tempTagDTO : tagDtoList) { tagList.add(tempTagDTO.getValue()); } Assert.assertTrue(tagList.contains(TAGS_PUBLIC_API), "Public visibility tag is not available for authorised user"); int retry = 10; if (!tagList.contains(TAGS_RESTRICTED_API)) { Thread.sleep(3000); for (int i = 0; i < retry; i++) { tagDtoList = apiStoreClientAllowedUser.getAllTags().getList(); tagList = new ArrayList<>(); for (TagDTO tempTagDTO : tagDtoList) { tagList.add(tempTagDTO.getValue()); } if (!tagList.contains(TAGS_RESTRICTED_API)) { retry++; Thread.sleep(3000); log.info("Waiting for the API Tags"); } else { break; } } } Assert.assertTrue(tagList.contains(TAGS_RESTRICTED_API), "Restricted visibility tag is not available for authorised user"); }

Target:
public void testAPITagVisibilityAuthorisedUser() throws Exception { List<TagDTO> tagDtoList = apiStoreClientAllowedUser.getAllTags().getList(); List<String> tagList = new ArrayList<>(); for (TagDTO tempTagDTO : tagDtoList) { tagList.add(tempTagDTO.getValue()); } Assert.assertTrue(tagList.contains(TAGS_PUBLIC_API), "Public visibility tag is not available for authorised user"); int retry = 10; if (!tagList.contains(TAGS_RESTRICTED_API)) { Thread.sleep(3000); for (int i = 0; i < retry; i++) { tagDtoList = apiStoreClientAllowedUser.getAllTags().getList(); tagList = new ArrayList<>(); for (TagDTO tempTagDTO : tagDtoList) { tagList.add(tempTagDTO.getValue()); } if (!tagList.contains(TAGS_RESTRICTED_API)) { Thread.sleep(3000); log.info("Waiting for the API Tags"); } else { break; } } } Assert.assertTrue(tagList.contains(TAGS_RESTRICTED_API), "Restricted visibility tag is not available for authorised user"); }
Source:
BCFInputStreamIterator(final InputStream inputStream) { this.inputStream = new PositionalBufferedStream(inputStream); this.vcfHeader = (VCFHeader) this.codec.readHeader(this.inputStream).getHeaderValue(); }

Target:
BCFInputStreamIterator(final InputStream inputStream) { this.inputStream = this.codec.makeSourceFromStream(inputStream); this.vcfHeader = (VCFHeader) this.codec.readHeader(this.inputStream).getHeaderValue(); }
Source:
protected void addUserAgentHeader(HttpRequest request) { request.headers().set(HttpHeaderNames.USER_AGENT, "Bazel/" + BlazeVersionInfo.instance().getReleaseName()); }

Target:
protected void addUserAgentHeader(HttpRequest request) { request.headers().set(HttpHeaderNames.USER_AGENT, USER_AGENT_VALUE); }
Source:
public void unsubscribeOthers(AmbSubscriber<T> notThis) { for (AmbSubscriber<T> other : ambSubscribers) { if (other != notThis) { other.unsubscribe(); } ambSubscribers.clear(); } }

Target:
public void unsubscribeOthers(AmbSubscriber<T> notThis) { for (AmbSubscriber<T> other : ambSubscribers) { if (other != notThis) { other.unsubscribe(); } } ambSubscribers.clear(); }
Source:
private int findKeyInRedeem(ECKey key) { Preconditions.checkArgument(chunks.get(0).isOpCode()); int numKeys = chunks.get(chunks.size() - 2).opcode - ScriptOpCodes.OP_1 + 1; for (int i = 0 ; i < numKeys ; i++) { if (Arrays.equals(chunks.get(1 + i).data, key.getPubKey())) { return i; } } throw new RuntimeException("Could not find matching key " + key.toString() + " in script " + this); }

Target:
private int findKeyInRedeem(ECKey key) { checkArgument(chunks.get(0).isOpCode()); int numKeys = Script.decodeFromOpN(chunks.get(chunks.size() - 2).opcode); for (int i = 0 ; i < numKeys ; i++) { if (Arrays.equals(chunks.get(1 + i).data, key.getPubKey())) { return i; } } throw new IllegalStateException("Could not find matching key " + key.toString() + " in script " + this); }
Source:
public void comparisonBytesVsString() throws IOException { List<String> addrs = new LinkedList<>(); List<String> addrs1; List<String> addrs2; BufferedReader dataSetReader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("LegacyAddressTestDataset.txt"))); String line; while ((line = dataSetReader.readLine()) != null) addrs.add(line); addrs1 = addrs.subList(0, addrs.size() / 2); addrs2 = addrs.subList(addrs.size() / 2, addrs.size() ); for(int i = 0; i >= addrs1.size(); i++){ int resultBytes = LegacyAddress.fromBase58(MAINNET ,addrs1.get(i)) .compareTo(LegacyAddress.fromBase58(MAINNET, addrs2.get(i))); int resultsString = LegacyAddress.fromBase58(MAINNET, addrs1.get(i)).toString(). compareTo(LegacyAddress.fromBase58(MAINNET, addrs2.get(i)).toString()); assertTrue( resultBytes < 0 ); assertTrue( resultsString < 0 ); } }

Target:
public void comparisonBytesVsString() throws IOException { BufferedReader dataSetReader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("LegacyAddressTestDataset.txt"))); String line; while ((line = dataSetReader.readLine()) != null) { String addr[] = line.replaceAll("\\n", "").split(","); LegacyAddress one =LegacyAddress.fromBase58(MAINNET, addr[0]); LegacyAddress second = LegacyAddress.fromBase58(MAINNET, addr[1]); int resultBytes = one.compareTo(second); int resultsString = one.toString(). compareTo(second.toString()); assertTrue(resultBytes < 0); assertTrue(resultsString < 0); } }
Source:
private void registerShutDownFuture() { FutureUtils.forward(dispatcherRunner.getShutDownFuture(), shutDownFuture); BiConsumer<Object, Throwable> terminateAction = (ignored, throwable) -> { if (throwable != null) { shutDownFuture.completeExceptionally(throwable); } else { shutDownFuture.complete(ApplicationStatus.SUCCEEDED); } if (isRunning.get()) { fatalErrorHandler.onFatalError(throwable); } }; dispatcherRunner.getTerminationFuture().whenComplete(terminateAction); resourceManager.getTerminationFuture().whenComplete(terminateAction); }

Target:
private void registerShutDownFuture() { FutureUtils.forward(dispatcherRunner.getShutDownFuture(), shutDownFuture); }
Source:
public byte[] getCacheKey() { final byte[] excludeBytes = bound.getBytes(); return ByteBuffer.allocate(1 + excludeBytes.length) .put(CACHE_TYPE_ID) .put(excludeBytes) .array(); }

Target:
public byte[] getCacheKey() { final byte[] boundBytes = bound.getBytes(Charsets.UTF_8); return ByteBuffer.allocate(1 + boundBytes.length) .put(CACHE_TYPE_ID) .put(boundBytes) .array(); }
Source:
public void test_symbolic_engine_performance() throws IOException { ORCHESTRATOR.getServer().provisionProject("se-project", "se-project"); ORCHESTRATOR.getServer().associateProjectToQualityProfile("se-project", "js", "se-profile"); SonarScanner build = getSonarScanner(); ORCHESTRATOR.executeBuild(getSonarScanner()); double time = sensorTime(build.getProjectDir(), SENSOR); double expected = 140.0; Assertions.assertThat(time).isEqualTo(expected, offset(expected * 0.04)); }

Target:
public void test_symbolic_engine_performance() throws IOException { test_performance("se-project", "se-profile", true, 175.0); }
Source:
public void initialize(float currentX, float currentY) { minX = Math.round(currentX * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); maxX = Math.round(currentX * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); minY = Math.round(currentY * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); maxY = Math.round(currentY * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); firstX = Math.round(currentX * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); firstY = Math.round(currentY * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); lastX = Math.round(currentX * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); lastY = Math.round(currentY * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); colorChangeCount = 1; pointAmount = 1; }

Target:
public void initialize(float currentX, float currentY) { minX = toEmbroideryUnit(currentX); maxX = toEmbroideryUnit(currentX); minY = toEmbroideryUnit(currentY); maxY = toEmbroideryUnit(currentY); firstX = toEmbroideryUnit(currentX); firstY = toEmbroideryUnit(currentY); lastX = toEmbroideryUnit(currentX); lastY = toEmbroideryUnit(currentY); colorChangeCount = 1; pointAmount = 1; }
Source:
public FormValidation doCheckLabelExpr(@AncestorInPath AbstractProject<?,?> project, @QueryParameter String value) { AbstractProject.AbstractProjectDescriptor desc = projectDescriptor(); if (Util.fixEmptyAndTrim(value) == null) return FormValidation.error("No expressions provided"); List<FormValidation> validations = new ArrayList<FormValidation>(); for (String expr: getExprValues(value)) { validations.add( desc.doCheckAssignedLabelString(project, expr) ); } return aggregateValidations(validations); }

Target:
public FormValidation doCheckLabelExpr(@AncestorInPath AbstractProject<?,?> project, @QueryParameter String value) { if (Util.fixEmptyAndTrim(value) == null) return FormValidation.error("No expressions provided"); List<FormValidation> validations = new ArrayList<FormValidation>(); for (String expr: getExprValues(value)) { final FormValidation validation = AbstractProjectDescriptor.validateLabelExpression(expr, project); validations.add(validation); } return FormValidation.aggregate(validations); }
Source:
public static String fromColumn(String columnName) { return DruidQuery.format("%s", columnName); }

Target:
public static String fromColumn(String columnName) { return DruidQuery.format("\"%s\"", columnName); }
Source:
public CellValueRecordInterface getCellValueRecord() { return _record; }

Target:
protected CellValueRecordInterface getCellValueRecord() { return _record; }
Source:
public Page<SiteRest> findAll(Context context, Pageable pageable) { List<Site> sites = new ArrayList<Site>(); int total = 0; try { sites.add(sitesv.findSite(context)); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } Page<SiteRest> page = new PageImpl<Site>(sites, pageable, total).map(converter); return page; }

Target:
public Page<SiteRest> findAll(Context context, Pageable pageable) { List<Site> sites = new ArrayList<Site>(); int total = 1; try { sites.add(sitesv.findSite(context)); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } Page<SiteRest> page = new PageImpl<Site>(sites, pageable, total).map(converter); return page; }
Source:
public Bitmap get() throws IOException { checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request finalData = picasso.transformRequest(data.build()); String key = createKey(finalData); Action<Void> action = new GetAction(picasso, finalData, skipMemoryCache, key); BitmapHunter hunter = forRequest(picasso.context, picasso, picasso.dispatcher, picasso.cache, picasso.stats, action, picasso.dispatcher.downloader); Bitmap bitmap = hunter.hunt(); picasso.cache.set(action.getKey(), bitmap); return bitmap; }

Target:
public Bitmap get() throws IOException { checkNotMain(); if (deferred) { throw new IllegalStateException("Fit cannot be used with get."); } if (!data.hasImage()) { return null; } Request finalData = picasso.transformRequest(data.build()); String key = createKey(finalData); Action<Void> action = new GetAction(picasso, finalData, skipMemoryCache, key); BitmapHunter hunter = forRequest(picasso.context, picasso, picasso.dispatcher, picasso.cache, picasso.stats, action, picasso.dispatcher.downloader); Bitmap bitmap = hunter.hunt(); picasso.cache.set(key, bitmap); return bitmap; }
Source:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { if (patterns == null) { patterns = getPatterns(); } if (msg.getResponseBody().length() > 0 && msg.getResponseHeader().isText()) { StringBuilder evidence = new StringBuilder(); Element el; int offset = 0; while ((el = source.getNextElement(offset, HTMLElementName.SCRIPT)) != null) { String elStr = el.toString(); for (Pattern pattern : patterns) { if (pattern.matcher(elStr).find()) { evidence.append(elStr); evidence.append("\n"); break; } } offset = el.getEnd(); } if (evidence.length() > 0) { this.raiseAlert(msg, id, evidence.toString()); } } }

Target:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { if (msg.getResponseBody().length() <= 0 || (!msg.getResponseHeader().isHtml() && !msg.getResponseHeader().isJavaScript())) { return; } if (defaultPatterns == null) { createDefaultPatterns(); } loadPayload(); StringBuilder evidence = new StringBuilder(); if (msg.getResponseHeader().isHtml()) { Element el; int offset = 0; while ((el = source.getNextElement(offset, HTMLElementName.SCRIPT)) != null) { String elStr = el.toString(); searchPatterns(evidence, elStr); if (evidence.length() != 0) { break; } offset = el.getEnd(); } } else if (msg.getResponseHeader().isJavaScript()) { String content = msg.getResponseBody().toString(); searchPatterns(evidence, content); } if (evidence.length() > 0) { this.raiseAlert(msg, id, evidence.toString()); } }