auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setStatus(ChargeStatus targetStatus, Event event) { if (isValidTransition(fromString(this.status), targetStatus, event)) { var logMessage = format("Changing charge status for externalId [%s] [%s]->[%s] [event=%s]", this.externalId, this.status, targetStatus.getValue(), event); logger.info(logMessage, getStructuredKeys()); this.status = targetStatus.getValue(); } else { var logMessage = format("Charge with state %s cannot proceed to %s [charge_external_id=%s, charge_status=%s, event=%s]", this.status, targetStatus, this.externalId, targetStatus, event); logger.warn(logMessage, getStructuredKeys()); throw new InvalidStateTransitionException(this.status, targetStatus.getValue(), event); } }

Target:
public void setStatus(ChargeStatus targetStatus, Event event) { if (isValidTransition(fromString(this.status), targetStatus, event)) { var logMessage = format("Changing charge status for externalId [%s] [%s]->[%s] [event=%s]", this.externalId, this.status, targetStatus.getValue(), event); logger.info(logMessage, getStructuredLoggingArgs()); this.status = targetStatus.getValue(); } else { var logMessage = format("Charge with state %s cannot proceed to %s [charge_external_id=%s, charge_status=%s, event=%s]", this.status, targetStatus, this.externalId, targetStatus, event); logger.warn(logMessage, getStructuredLoggingArgs()); throw new InvalidStateTransitionException(this.status, targetStatus.getValue(), event); } }
Source:
private static List<Shard> discoverShards(String regionName, String streamName, String accessKey, String secretKey, String appName) { Region region = RegionUtils.getRegion(regionName); if (region == null) { throw new IllegalArgumentException(regionName + " is not a valid AWS region."); } final AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); AmazonKinesis kinesisClient = new AmazonKinesisClient(credentials, getClientConfigWithUserAgent(appName)); kinesisClient.setRegion(region); try { DescribeStreamResult result = kinesisClient.describeStream(streamName); if (!"ACTIVE".equals(result.getStreamDescription().getStreamStatus())) { throw new IllegalArgumentException("Kinesis stream " + streamName + " is not active."); } return result.getStreamDescription().getShards(); } catch (ResourceNotFoundException e) { throw new IllegalArgumentException("Kinesis stream " + streamName + " does not exist."); } catch (Exception e) { throw new IllegalArgumentException("Error found while describing the kinesis stream " + streamName); } }

Target:
public static List<Shard> discoverShards(String regionName, String streamName, String accessKey, String secretKey, String appName) { Region region = RegionUtils.getRegion(regionName); if (region == null) { throw new IllegalArgumentException(regionName + " is not a valid AWS region."); } final AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); AmazonKinesis kinesisClient = new AmazonKinesisClient(credentials, getClientConfigWithUserAgent(appName)); kinesisClient.setRegion(region); try { DescribeStreamResult result = kinesisClient.describeStream(streamName); if (!"ACTIVE".equals(result.getStreamDescription().getStreamStatus())) { throw new IllegalArgumentException("Kinesis stream " + streamName + " is not active."); } return result.getStreamDescription().getShards(); } catch (ResourceNotFoundException e) { throw new IllegalArgumentException("Kinesis stream " + streamName + " does not exist."); } catch (Exception e) { throw new IllegalArgumentException("Error found while describing the kinesis stream " + streamName); } }
Source:
public void stop() { if (entity.getAttribute(RiakNode.RIAK_NODE_IN_CLUSTER)) leaveCluster(); String command = format("%s stop", getRiakCmd()); command = isPackageInstall ? "sudo " + command : command; ScriptHelper stopScript = newScript(STOPPING) .failOnNonZeroResultCode() .body.append(command); if (!isRiakOnPath) { Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath); log.warn("riak command not found on PATH. Altering future commands' environment variables from to {}", getShellEnvironment(), newPathVariable); stopScript.environmentVariablesReset(newPathVariable); } stopScript.execute(); }

Target:
public void stop() { leaveCluster(); String command = format("%s stop", getRiakCmd()); command = isPackageInstall ? "sudo " + command : command; ScriptHelper stopScript = newScript(ImmutableMap.of(USE_PID_FILE, false), STOPPING) .body.append(command); if (!isRiakOnPath) { Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath); log.warn("riak command not found on PATH. Altering future commands' environment variables from to {}", getShellEnvironment(), newPathVariable); stopScript.environmentVariablesReset(newPathVariable); } int result = stopScript.execute(); if (result != 0) { newScript(ImmutableMap.of(USE_PID_FILE, ""), STOPPING).execute(); } }
Source:
public boolean equals(Object obj) { if (obj != null && obj instanceof CachedSensorValue) { return this.toString().equals(obj.toString()); } return false; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CachedSensorValue)) { return false; } CachedSensorValue other = (CachedSensorValue) obj; if (sensorType != other.sensorType) { return false; } if (sensorValue == null) { if (other.sensorValue != null) { return false; } } else if (!sensorValue.equals(other.sensorValue)) { return false; } if (timestamp == null) { if (other.timestamp != null) { return false; } } else if (!timestamp.equals(other.timestamp)) { return false; } return true; }
Source:
default Spliterator<T> spliterator() { return Spliterators.spliterator(iterator(), isEmpty() ? 0 : 1, Spliterator.IMMUTABLE | Spliterator.DISTINCT | Spliterator.SIZED | Spliterator.SUBSIZED); }

Target:
default Spliterator<T> spliterator() { return Spliterators.spliterator(iterator(), isEmpty() ? 0 : 1, Spliterator.IMMUTABLE | Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.guide_main); mPager = (ViewPager) findViewById(R.id.guide_pager); mPager.setSaveEnabled(false); mIndicator = (TitlePageIndicator) findViewById(R.id.guide_step_title_indicator); if (savedInstanceState != null) { mGuideid = savedInstanceState.getInt(GUIDEID); mFavoriting = savedInstanceState.getBoolean(FAVORITING); mIsOfflineGuide = savedInstanceState.getBoolean(IS_OFFLINE_GUIDE); if (savedInstanceState.containsKey(SAVED_GUIDE)) { mGuide = (Guide) savedInstanceState.getSerializable(SAVED_GUIDE); } if (mGuide != null) { mCurrentPage = savedInstanceState.getInt(CURRENT_PAGE); setGuide(mGuide, mCurrentPage); mIndicator.setCurrentItem(mCurrentPage); mPager.setCurrentItem(mCurrentPage); } } else { extractExtras(getIntent().getExtras()); } if (mGuide != null) { setGuide(mGuide, mCurrentPage); } else { fetchGuideFromApi(mGuideid); } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.guide_main); mPager = (ViewPager) findViewById(R.id.guide_pager); mIndicator = (TitlePageIndicator) findViewById(R.id.guide_step_title_indicator); if (savedInstanceState != null) { mGuideid = savedInstanceState.getInt(GUIDEID); mFavoriting = savedInstanceState.getBoolean(FAVORITING); mIsOfflineGuide = savedInstanceState.getBoolean(IS_OFFLINE_GUIDE); if (savedInstanceState.containsKey(SAVED_GUIDE)) { mGuide = (Guide) savedInstanceState.getSerializable(SAVED_GUIDE); } if (mGuide != null) { mCurrentPage = savedInstanceState.getInt(CURRENT_PAGE); setGuide(mGuide, mCurrentPage); mIndicator.setCurrentItem(mCurrentPage); mPager.setCurrentItem(mCurrentPage); } } else { extractExtras(getIntent().getExtras()); } if (mGuide != null) { setGuide(mGuide, mCurrentPage); } else { fetchGuideFromApi(mGuideid); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); prePostComposite.enable(); sceneReflectiveRefractive = dynamicFBOsManager.get(REFLECTIVE_REFRACTIVE_URN); WRITE_ONLY_GBUFFER.bind(); setViewportToSizeOf(WRITE_ONLY_GBUFFER); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(READ_ONLY_GBUFFER); dynamicFBOsManager.swapReadWriteBuffers(); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); prePostComposite.enable(); sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFLECTIVE_REFRACTIVE); WRITE_ONLY_GBUFFER.bind(); setViewportToSizeOf(WRITE_ONLY_GBUFFER); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(READ_ONLY_GBUFFER); displayResolutionDependentFBOs.swapReadWriteBuffers(); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); PerformanceMonitor.endActivity(); }
Source:
public void generate(ProcessResult processResult) throws IOException { new ApiCodeGenerator(filer, messager).writeApiClasses(processResult.apiClassesToGenerate, processResult.originatingElementsByGeneratedClassQualifiedName); SourceCodewriter sourceCodeWriter = new SourceCodewriter(filer, messager, processResult.originatingElementsByGeneratedClassQualifiedName); PrologCodeWriter prologCodeWriter = new PrologCodeWriter(sourceCodeWriter, "DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations.\n"); processResult.codeModel.build(prologCodeWriter, new ResourceCodeWriter(filer)); }

Target:
public void generate(ProcessResult processResult) throws IOException { ApiCodeGenerator apiCodeGenerator = new ApiCodeGenerator(filer); apiCodeGenerator.writeApiClasses(processResult.apiClassesToGenerate, processResult.originatingElements); SourceCodewriter sourceCodeWriter = new SourceCodewriter(filer, messager, processResult.originatingElements); PrologCodeWriter prologCodeWriter = new PrologCodeWriter(sourceCodeWriter, "DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations.\n"); processResult.codeModel.build(prologCodeWriter, new ResourceCodeWriter(filer)); }
Source:
private List<String> getVmsWithAttachedISO() { List<VmStatic> vms = getVmStaticDAO().getAllByStoragePoolId(getStorageDomain().getStoragePoolId()); List<String> vmNames = new ArrayList<>(); for (VmStatic vmStatic : vms) { if (isVMHasAttachedISO(vmStatic.getId())) { vmNames.add(vmStatic.getName()); } } return vmNames; }

Target:
private List<String> getVmsWithAttachedISO() { List<VmStatic> vms = getVmStaticDAO().getAllByStoragePoolId(getStorageDomain().getStoragePoolId()); List<String> vmNames = new LinkedList<>(); for (VmStatic vmStatic : vms) { if (VmDeviceUtils.isVMHasAttachedISO(vmStatic.getId())) { vmNames.add(vmStatic.getName()); } } return vmNames; }
Source:
public OzoneOutputStream createKey( String volumeName, String bucketName, String keyName, long size, ReplicationType type, ReplicationFactor factor, Map<String, String> metadata) throws IOException { HddsClientUtils.verifyResourceName(volumeName, bucketName); HddsClientUtils.checkNotNull(keyName, type, factor); String requestId = UUID.randomUUID().toString(); try{ GDPRSymmetricKey gKey = new GDPRSymmetricKey(); metadata.putAll(gKey.getKeyDetails()); }catch (Exception e) { throw new IOException(e); } OmKeyArgs keyArgs = new OmKeyArgs.Builder() .setVolumeName(volumeName) .setBucketName(bucketName) .setKeyName(keyName) .setDataSize(size) .setType(HddsProtos.ReplicationType.valueOf(type.toString())) .setFactor(HddsProtos.ReplicationFactor.valueOf(factor.getValue())) .addAllMetadata(metadata) .setAcls(getAclList()) .build(); OpenKeySession openKey = ozoneManagerClient.openKey(keyArgs); return createOutputStream(openKey, requestId, type, factor); }

Target:
public OzoneOutputStream createKey( String volumeName, String bucketName, String keyName, long size, ReplicationType type, ReplicationFactor factor, Map<String, String> metadata) throws IOException { HddsClientUtils.verifyResourceName(volumeName, bucketName); HddsClientUtils.checkNotNull(keyName, type, factor); String requestId = UUID.randomUUID().toString(); if(Boolean.valueOf(metadata.get(OzoneConsts.GDPR_FLAG))){ try{ GDPRSymmetricKey gKey = new GDPRSymmetricKey(); metadata.putAll(gKey.getKeyDetails()); }catch (Exception e) { if(e instanceof InvalidKeyException && e.getMessage().contains("Illegal key size or default parameters")) { LOG.error("Missing Unlimited Strength Policy jars. Please install " + "Java Cryptography Extension (JCE) Unlimited Strength " + "Jurisdiction Policy Files"); } throw new IOException(e); } } OmKeyArgs keyArgs = new OmKeyArgs.Builder() .setVolumeName(volumeName) .setBucketName(bucketName) .setKeyName(keyName) .setDataSize(size) .setType(HddsProtos.ReplicationType.valueOf(type.toString())) .setFactor(HddsProtos.ReplicationFactor.valueOf(factor.getValue())) .addAllMetadata(metadata) .setAcls(getAclList()) .build(); OpenKeySession openKey = ozoneManagerClient.openKey(keyArgs); return createOutputStream(openKey, requestId, type, factor); }
Source:
private void validateParameters() throws Failure { if (projectName.endsWith(".git")) { projectName = projectName.substring(0, projectName.length() - ".git".length()); } if (!isAnyIncludedIn(currentUser.getEffectiveGroups(), projectCreatorGroups)){ throw new Failure(1, "You are not a member of any required group for creating projects."); } if (ownerIds != null && !ownerIds.isEmpty()){ ownerIds = new ArrayList<AccountGroup.Id>(new HashSet<AccountGroup.Id>(ownerIds)); }else{ ownerIds = new ArrayList<AccountGroup.Id>(projectOwnerGroups); } while (branch.startsWith("/")) { branch = branch.substring(1); } if (!branch.startsWith(Constants.R_HEADS)) { branch = Constants.R_HEADS + branch; } if (!Repository.isValidRefName(branch)) { throw new Failure(1, "--branch \"" + branch + "\" is not a valid name"); } }

Target:
private void validateParameters() throws Failure { if (projectName.endsWith(".git")) { projectName = projectName.substring(0, projectName.length() - ".git".length()); } if (!isAnyIncludedIn(currentUser.getEffectiveGroups(), projectCreatorGroups)) { throw new Failure(1, "fatal: Not permitted to create " + projectName); } if (ownerIds != null && !ownerIds.isEmpty()) { ownerIds = new ArrayList<AccountGroup.Id>(new HashSet<AccountGroup.Id>(ownerIds)); } else { ownerIds = new ArrayList<AccountGroup.Id>(projectOwnerGroups); } while (branch.startsWith("/")) { branch = branch.substring(1); } if (!branch.startsWith(Constants.R_HEADS)) { branch = Constants.R_HEADS + branch; } if (!Repository.isValidRefName(branch)) { throw new Failure(1, "--branch \"" + branch + "\" is not a valid name"); } }
Source:
public String getText(Object obj, Long key, String cachedValue) { String result = ""; if (!loading) { if (obj instanceof Artifact && getXViewer() instanceof WorldXViewer) { WorldXViewer worldXViewer = (WorldXViewer) getXViewer(); GoalArtifact parentMembersArtifact = (GoalArtifact) getParentMembersArtifact(worldXViewer); if (parentMembersArtifact != null) { if (Strings.isValid(cachedValue)) { result = cachedValue; } } else { String cachedObjectValue = multiGoalValueMap.get(((Artifact) obj).getUuid()); if (Strings.isValid(cachedObjectValue)) { result = cachedObjectValue; } } } } return result; }

Target:
public String getText(Object obj, Long key, String cachedValue) { String result = ""; if (!loading) { XViewer xViewer = getXViewer(); if (obj instanceof Artifact && xViewer instanceof WorldXViewer) { WorldXViewer worldXViewer = (WorldXViewer) xViewer; GoalArtifact parentMembersArtifact = (GoalArtifact) getParentMembersArtifact(worldXViewer); if (parentMembersArtifact != null) { if (Strings.isValid(cachedValue)) { result = cachedValue; } } else { String cachedObjectValue = multiGoalValueMap.get(((Artifact) obj).getUuid()); if (Strings.isValid(cachedObjectValue)) { result = cachedObjectValue; } } } } return result; }
Source:
static GlobalDataExchangeMode getShuffleModeAsGlobalDataExchangeMode(final Configuration configuration) { final String value = configuration.getString(ExecutionConfigOptions.TABLE_EXEC_SHUFFLE_MODE); try { return GlobalDataExchangeMode.valueOf(convertLegacyShuffleMode(value).toUpperCase()); } catch (Exception e) { throw new IllegalArgumentException( String.format("Unsupported value %s for config %s.", value, ExecutionConfigOptions.TABLE_EXEC_SHUFFLE_MODE.key())); } }

Target:
static GlobalDataExchangeMode getShuffleModeAsGlobalDataExchangeMode(final Configuration configuration) { final String value = configuration.getString(ExecutionConfigOptions.TABLE_EXEC_SHUFFLE_MODE); try { return GlobalDataExchangeMode.valueOf(convertLegacyShuffleMode(value).toUpperCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException( String.format("Unsupported value %s for config %s.", value, ExecutionConfigOptions.TABLE_EXEC_SHUFFLE_MODE.key())); } }
Source:
public TreeMultimap<Integer, TSnePoint> getTsnePlotWithClustersAndExpression(String experimentAccession, int k, String geneId) { TreeMultimap<Integer, TSnePoint> clusters = this.getTSnePlotWithClusters(experimentAccession, k); Map<String, Double> expression = geneExpressionDao.fetchGeneExpression(experimentAccession, geneId); TreeMultimap<Integer, TSnePoint> clusterPointsWithExpression = TreeMultimap.create(); clusters.entries().forEach( entry -> clusterPointsWithExpression.put( entry.getKey(), TSnePoint.create( entry.getValue().x(), entry.getValue().y(), expression.get(entry.getValue().name()), entry.getValue().name() ) ) ); return clusterPointsWithExpression; }

Target:
public TreeMultimap<Integer, TSnePoint> getTsnePlotWithClustersAndExpression(String experimentAccession, int k, String geneId) { TreeMultimap<Integer, TSnePoint> clusters = getTSnePlotWithClusters(experimentAccession, k); Map<String, Double> expression = geneExpressionDao.fetchGeneExpression(experimentAccession, geneId); TreeMultimap<Integer, TSnePoint> clusterPointsWithExpression = TreeMultimap.create(Comparator.<Integer> naturalOrder(), TSnePoint.getNameComparator()); clusters.entries().forEach( entry -> clusterPointsWithExpression.put( entry.getKey(), TSnePoint.create( entry.getValue().x(), entry.getValue().y(), expression.get(entry.getValue().name()), entry.getValue().name() ) ) ); return clusterPointsWithExpression; }
Source:
public static void writeDouble(double value, ByteBuffer buffer) { buffer.putLong(Double.doubleToRawLongBits(value)); }

Target:
public static void writeDouble(double value, ByteBuffer buffer) { buffer.putDouble(value); }
Source:
static void registerOperations(ManagementResourceRegistration registry, ResourceDescriptionResolver resourceDescriptionResolver) { registry.registerOperationHandler(new SimpleOperationDefinitionBuilder(MIGRATE, resourceDescriptionResolver) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .build(), WebMigrateOperation.MIGRATE_INSTANCE); registry.registerOperationHandler(new SimpleOperationDefinitionBuilder(DESCRIBE_MIGRATION, resourceDescriptionResolver) .setReplyType(ModelType.LIST).setReplyValueType(ModelType.OBJECT) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .build(), WebMigrateOperation.DESCRIBE_MIGRATION_INSTANCE); }

Target:
static void registerOperations(ManagementResourceRegistration registry, ResourceDescriptionResolver resourceDescriptionResolver) { registry.registerOperationHandler(new SimpleOperationDefinitionBuilder(MIGRATE, resourceDescriptionResolver) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .setReplyParameters(MIGRATION_WARNINGS_ATTR, MIGRATION_ERROR_ATTR) .build(), WebMigrateOperation.MIGRATE_INSTANCE); registry.registerOperationHandler(new SimpleOperationDefinitionBuilder(DESCRIBE_MIGRATION, resourceDescriptionResolver) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .setReplyParameters(MIGRATION_WARNINGS_ATTR) .build(), WebMigrateOperation.DESCRIBE_MIGRATION_INSTANCE); }
Source:
public void threadGroupNotLeaked() throws Throwable { Set<ThreadGroup> groupsBeforeSet = new HashSet<ThreadGroup>(); ThreadGroup[] groupsBefore = new ThreadGroup[256]; for (int i = 0; i < currentThread().getThreadGroup().enumerate(groupsBefore); ++i) { groupsBeforeSet.add(groupsBefore[i]); } evaluateWithWaitDuration(0); ThreadGroup[] groups = new ThreadGroup[256]; for (int i = 0; i < currentThread().getThreadGroup().enumerate(groups); ++i) { if(!groupsBeforeSet.contains(groups[i]) && "FailOnTimeoutGroup".equals(groups[i].getName())) { fail("A 'FailOnTimeoutGroup' thread group remains referenced after the test execution."); } } }

Target:
public void threadGroupNotLeaked() throws Throwable { Collection<ThreadGroup> groupsBeforeSet = subGroupsOfCurrentThread(); evaluateWithWaitDuration(0); for (ThreadGroup group: subGroupsOfCurrentThread()) { if (!groupsBeforeSet.contains(group) && "FailOnTimeoutGroup".equals(group.getName())) { fail("A 'FailOnTimeoutGroup' thread group remains referenced after the test execution."); } } }
Source:
private static Pair<RowSignature, Long> analysisToRowSignature(final SegmentAnalysis analysis) { final RowSignature.Builder rowSignatureBuilder = RowSignature.builder(); for (Map.Entry<String, ColumnAnalysis> entry : analysis.getColumns().entrySet()) { if (entry.getValue().isError()) { continue; } ValueType valueType; try { valueType = ValueType.valueOf(StringUtils.toUpperCase(entry.getValue().getType())); } catch (IllegalArgumentException e) { valueType = ValueType.COMPLEX; } rowSignatureBuilder.add(entry.getKey(), valueType); } return Pair.of(rowSignatureBuilder.build(), analysis.getNumRows()); }

Target:
private static RowSignature analysisToRowSignature(final SegmentAnalysis analysis) { final RowSignature.Builder rowSignatureBuilder = RowSignature.builder(); for (Map.Entry<String, ColumnAnalysis> entry : analysis.getColumns().entrySet()) { if (entry.getValue().isError()) { continue; } ValueType valueType; try { valueType = ValueType.valueOf(StringUtils.toUpperCase(entry.getValue().getType())); } catch (IllegalArgumentException e) { valueType = ValueType.COMPLEX; } rowSignatureBuilder.add(entry.getKey(), valueType); } return rowSignatureBuilder.build(); }
Source:
public void testParseStoreOK() throws IOException, ProtocolException, ImapAsyncClientException { final ImapResponseMapper mapper = new ImapResponseMapper(); final IMAPResponse[] content = new IMAPResponse[1]; content[0] = new IMAPResponse("A042 OK STATUS success"); final StoreResult storeResult = mapper.readValue(content, StoreResult.class); Assert.assertNotNull(storeResult, "store result mismatched."); Assert.assertEquals(storeResult.getIMAPResponses().size(), 1, "getIMAPResponses() mismatched."); Assert.assertTrue(storeResult.getIMAPResponses().get(0).isOK(), "getIMAPResponses() mismatched."); }

Target:
public void testParseStoreOK() throws IOException, ProtocolException, ImapAsyncClientException { final ImapResponseMapper mapper = new ImapResponseMapper(); final IMAPResponse[] content = new IMAPResponse[1]; content[0] = new IMAPResponse("A042 OK Store success"); final StoreResult storeResult = mapper.readValue(content, StoreResult.class); Assert.assertNotNull(storeResult, "store result mismatched."); Assert.assertEquals(storeResult.getFetchResponses().size(), 0, "getFetchResponses() mismatched."); }
Source:
private static List<URL> extractCPFromProperty() { String classpath = System.getProperty("java.class.path"); List<URL> classpathURLs = new ArrayList<>(); for (String path : classpath.split(":")) { classpathURLs.add(mapToURL(path)); } return classpathURLs; }

Target:
private static List<URL> extractCPFromProperty() { List<URL> classpathURLs = new ArrayList<>(); String classpath = System.getProperty("java.class.path"); if (Objects.nonNull(classpath)) { for (String path : classpath.split(File.pathSeparator)) { classpathURLs.add(mapToURL(path)); } } return classpathURLs; }
Source:
public HdfsSplitInfo decode(final byte[] bytes) { final ByteArrayInputStream bais = new ByteArrayInputStream(bytes); try (DataInputStream dais = new DataInputStream(bais)) { final String inputPath = dais.readUTF(); final String inputFormatClassName = dais.readUTF(); final ExternalConstructor<JobConf> jobConfExternalConstructor = new JobConfExternalConstructor(inputFormatClassName, inputPath); final FileSplit inputSplit = ReflectionUtils.newInstance(FileSplit.class, jobConfExternalConstructor.newInstance()); inputSplit.readFields(dais); return new HdfsSplitInfo(inputPath, inputSplit, inputFormatClassName); } catch (final IOException e) { throw new RuntimeException("Could not de-serialize JobConf", e); } }

Target:
public HdfsSplitInfo decode(final byte[] bytes) { final ByteArrayInputStream bais = new ByteArrayInputStream(bytes); try (DataInputStream dais = new DataInputStream(bais)) { final String inputPath = dais.readUTF(); final String inputFormatClassName = dais.readUTF(); final JobConf jobConf; try { final Tang tang = Tang.Factory.getTang(); jobConf = tang.newInjector( tang.newConfigurationBuilder() .bindNamedParameter(JobConfExternalConstructor.InputFormatClass.class, inputFormatClassName) .bindNamedParameter(JobConfExternalConstructor.InputPath.class, inputPath) .bindConstructor(JobConf.class, JobConfExternalConstructor.class) .build()) .getInstance(JobConf.class); } catch (final InjectionException e) { throw new RuntimeException("Exception while injecting JobConf", e); } final FileSplit inputSplit = ReflectionUtils.newInstance(FileSplit.class, jobConf); inputSplit.readFields(dais); return HdfsSplitInfo.newBuilder() .setInputPath(inputPath) .setInputSplit(inputSplit) .setInputFormatClassName(inputFormatClassName) .build(); } catch (final IOException e) { throw new RuntimeException("Could not de-serialize JobConf", e); } }
Source:
public static void validateNDKVersion(File ndkHomeDir) throws MojoExecutionException { final File ndkVersionFile = new File(ndkHomeDir, "RELEASE.TXT"); if (!ndkVersionFile.exists()) { throw new MojoExecutionException("Could not locate RELEASE.TXT in the Android NDK base directory '" + ndkHomeDir.getAbsolutePath() + "'. Please verify your setup"); } try { String versionStr = FileUtils.readFileToString(ndkVersionFile); validateNDKVersion(NDK_REQUIRED_VERSION, versionStr); } catch (Exception e) { throw new MojoExecutionException("Error while extracting NDK version from: " + ndkVersionFile); } }

Target:
public static void validateNDKVersion(File ndkHomeDir) throws MojoExecutionException { final File ndkVersionFile = new File(ndkHomeDir, "RELEASE.TXT"); if (!ndkVersionFile.exists()) { throw new MojoExecutionException("Could not locate RELEASE.TXT in the Android NDK base directory '" + ndkHomeDir.getAbsolutePath() + "'. Please verify your setup! " + AndroidNdk.PROPER_NDK_HOME_DIRECTORY_MESSAGE); } try { String versionStr = FileUtils.readFileToString(ndkVersionFile); validateNDKVersion(NDK_REQUIRED_VERSION, versionStr); } catch (Exception e) { throw new MojoExecutionException("Error while extracting NDK version from '" + ndkVersionFile.getAbsolutePath() + "'. Please verify your setup! " + AndroidNdk.PROPER_NDK_HOME_DIRECTORY_MESSAGE); } }
Source:
public Response subscribeForBotDetectionAlerts(BotDetectionAlertSubscriptionDTO body, MessageContext messageContext) throws APIManagementException { String email = body.getEmail(); if (StringUtils.isBlank(email)) { String propertyName = AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD; throw new APIManagementException(propertyName + " property value of payload cannot be blank", ExceptionCodes.from(ExceptionCodes.BLANK_PROPERTY_VALUE, propertyName)); } try { APIAdminImpl apiAdmin = new APIAdminImpl(); BotDetectionData alertSubscription = apiAdmin.getBotDetectionAlertSubscription(AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD, email); if (alertSubscription != null) { RestApiUtil.handleResourceAlreadyExistsError( "Email: " + email + " has already been subscribed for bot detection alerts", log); } apiAdmin.addBotDataEmailConfiguration(email); BotDetectionData newAlertSubscription = apiAdmin.getBotDetectionAlertSubscription(AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD, email); BotDetectionAlertSubscriptionDTO alertSubscriptionDTO = BotDetectionMappingUtil.fromAlertSubscriptionToDTO(newAlertSubscription); return Response.ok(alertSubscriptionDTO).build(); } catch (APIManagementException | SQLException e) { String errorMessage = "Error when subscribing for bot detection alerts with email: " + email; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }

Target:
public Response subscribeForBotDetectionAlerts(BotDetectionAlertSubscriptionDTO body, MessageContext messageContext) throws APIManagementException { String email = body.getEmail(); if (StringUtils.isBlank(email)) { String propertyName = AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD; throw new APIManagementException(propertyName + " property value of payload cannot be blank", ExceptionCodes.from(ExceptionCodes.BLANK_PROPERTY_VALUE, propertyName)); } APIAdmin apiAdmin = new APIAdminImpl(); BotDetectionData alertSubscription = apiAdmin.getBotDetectionAlertSubscription(AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD, email); if (alertSubscription != null) { RestApiUtil.handleResourceAlreadyExistsError( "Email: " + email + " has already been subscribed for bot detection alerts", log); } apiAdmin.addBotDetectionAlertSubscription(email); BotDetectionData newAlertSubscription = apiAdmin.getBotDetectionAlertSubscription(AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD, email); BotDetectionAlertSubscriptionDTO alertSubscriptionDTO = BotDetectionMappingUtil.fromAlertSubscriptionToDTO(newAlertSubscription); return Response.ok(alertSubscriptionDTO).build(); }
Source:
public static boolean hasPictureId(byte[] buf, int off, int len) { if (!isValid(buf, off)) return false; if ((buf[off] & X_BIT) == 0 || (buf[off+1] & I_BIT) == 0) return false; return true; }

Target:
public static boolean hasPictureId(byte[] buf, int off, int len) { return isValid(buf, off, len) && (buf[off] & X_BIT) != 0 && (buf[off+1] & I_BIT) != 0; }
Source:
private void checkForChangedCCZ() { alreadyCheckedForAppFilesChange = true; Intent i = new Intent(this, UpdateActivity.class); startActivityForResult(i, UPDATE_CONSUMER_APP); }

Target:
private void checkForChangedCCZ() { alreadyCheckedForAppFilesChange = true; Intent i = new Intent(this, UpdateActivity.class); startActivity(i); }
Source:
public void mercury_topbar_wikiaLogoRedirectsToFandomPage() { TopBar topBar = new ArticlePage() .open(MercurySubpages.MAIN_PAGE) .getTopBar(); Assertion.assertTrue(topBar.isLogoVisible()); topBar.clickWikiaLogo(); Assertion.assertTrue(topBar.getCurrentUrl().contains("www.wikia.com/fandom")); }

Target:
public void mercury_topbar_wikiaLogoRedirectsToFandomPage() { TopBar topBar = new ArticlePage() .open(MercurySubpages.MAIN_PAGE) .getTopBar(); topBar.clickWikiaLogo(); Assertion.assertTrue(topBar.getCurrentUrl().contains("www.wikia.com/fandom")); }
Source:
static List<String> getExecutableNames() { List<String> executableNames = new ArrayList<String>(); switch (Platform.getCurrent()) { case MAC: case UNIX: case LINUX: { Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getUnixImageName(), ProcessNames.CHROMEDRIVER.getUnixImageName()); break; } default: { Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getWindowsImageName(), ProcessNames.CHROMEDRIVER.getWindowsImageName(), ProcessNames.IEDRIVER.getWindowsImageName(), ProcessNames.EDGEDRIVER.getWindowsImageName()); break; } } return executableNames; }

Target:
static List<String> getExecutableNames() { List<String> executableNames = new ArrayList<String>(); switch (Platform.getCurrent()) { case WINDOWS: { Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getWindowsImageName(), ProcessNames.CHROMEDRIVER.getWindowsImageName(), ProcessNames.IEDRIVER.getWindowsImageName(), ProcessNames.EDGEDRIVER.getWindowsImageName()); break; } default: { Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getUnixImageName(), ProcessNames.CHROMEDRIVER.getUnixImageName()); break; } } return executableNames; }
Source:
public IndexedInts getRow() { final long timestamp = selector.get(); if (index < 0) { currentTimestamp = timestamp; currentValue = extractionFn.apply(timestamp); ++index; timeValues.put(index, currentValue); } else if (timestamp != currentTimestamp) { if (descending && timestamp > currentTimestamp || !descending && timestamp < currentTimestamp) { throw new IllegalStateException("cannot re-use time dimension selector for multiple scans"); } currentTimestamp = timestamp; final String value = extractionFn.apply(timestamp); if (!value.equals(currentValue)) { currentValue = value; ++index; timeValues.put(index, currentValue); } } final int dimensionValueIndex = index; return new IndexedInts() { @Override public int size() { return 1; } @Override public int get(int i) { return dimensionValueIndex; } @Override public Iterator<Integer> iterator() { return Iterators.singletonIterator(dimensionValueIndex); } @Override public void fill(int index, int[] toFill) { throw new UnsupportedOperationException("fill not supported"); } @Override public void close() throws IOException { } }; }

Target:
public IndexedInts getRow() { final long timestamp = selector.get(); if (index < 0) { currentTimestamp = timestamp; currentValue = extractionFn.apply(timestamp); ++index; timeValues.put(index, currentValue); } else if (timestamp != currentTimestamp) { if (descending ? timestamp > currentTimestamp : timestamp < currentTimestamp) { throw new IllegalStateException("cannot re-use time dimension selector for multiple scans"); } currentTimestamp = timestamp; final String value = extractionFn.apply(timestamp); if (!value.equals(currentValue)) { currentValue = value; ++index; timeValues.put(index, currentValue); } } final int dimensionValueIndex = index; return new IndexedInts() { @Override public int size() { return 1; } @Override public int get(int i) { return dimensionValueIndex; } @Override public Iterator<Integer> iterator() { return Iterators.singletonIterator(dimensionValueIndex); } @Override public void fill(int index, int[] toFill) { throw new UnsupportedOperationException("fill not supported"); } @Override public void close() throws IOException { } }; }
Source:
public void testSetGlobalTargetTaskThreadPoolSizeIllegalArgument() { ClusterConfig testConfig = new ClusterConfig("testId"); testConfig.setGlobalTargetTaskThreadPoolSize(0); }

Target:
public void testSetGlobalTargetTaskThreadPoolSizeIllegalArgument() { ClusterConfig testConfig = new ClusterConfig("testId"); testConfig.setGlobalTargetTaskThreadPoolSize(-1); }
Source:
private DetailedLink findUsage(RSDL rsdl, UriInfo uriInfo, String httpMethod) { for (DetailedLink link : rsdl.getLinks().getLinks()) { if (isMatch(link, uriInfo, httpMethod)) { return link; } } return null; }

Target:
private DetailedLink findUsage(RSDL rsdl, UriInfo uriInfo, String httpMethod) { DetailedLink link = null; for (DetailedLink currentLink : rsdl.getLinks().getLinks()) { if (isMatch(currentLink, uriInfo, httpMethod)) { link = currentLink; break; } } assert (link != null) : "Corresponding link not found (this should not happen)"; return link; }
Source:
public NtpDiscovery() { super(SUPPORTED_THING_TYPES_UIDS, 10); }

Target:
public NtpDiscovery() throws IllegalArgumentException { super(SUPPORTED_THING_TYPES_UIDS, 10); }
Source:
protected void setAttrs(Comment model, PreparedStatement stmt, boolean setNull) throws SQLException { int index = 1; if (setNull && model.getContent() == null) { stmt.setNull(index, java.sql.Types.CHAR); ++index; } else if (model.getContent() != null) { stmt.setString(index, model.getContent()); ++index; } { stmt.setInt(index, model.getCommenterId()); ++index; } { stmt.setLong(index, model.getCommentedOnId()); ++index; } { stmt.setTimestamp(index, new Timestamp(model.getCreatedAt())); ++index; } stmt.setLong(index, model.getId()); }

Target:
protected void setAttrs(Comment model, PreparedStatement stmt, boolean setNull) throws SQLException { int index = 1; if (setNull && model.getContent() == null) { stmt.setNull(index++, java.sql.Types.CHAR); } else if (model.getContent() != null) { stmt.setString(index++, model.getContent()); } { stmt.setInt(index++, model.getCommenterId()); } { stmt.setLong(index++, model.getCommentedOnId()); } { stmt.setTimestamp(index++, new Timestamp(model.getCreatedAt())); } stmt.setLong(index, model.getId()); }
Source:
private static Number readNumber(JsonReader reader) throws IOException { String str = reader.nextString(); try { return Integer.parseInt(str); } catch (NumberFormatException e) { try { return Double.parseDouble(str); } catch (NumberFormatException ex) { try { return Long.parseLong(str); } catch (NumberFormatException exception) { throw new IOException(exception); } } } }

Target:
private static Number readNumber(JsonReader reader) throws IOException { String str = reader.nextString(); if (str.contains(".")) { return Double.parseDouble(str); } else { int limit = str.charAt(0) == '-' ? 11 : 10; if (str.length() < limit) { return Integer.parseInt(str); } else if (str.length() > limit) { return Long.parseLong(str); } else { try { return Integer.parseInt(str); } catch (NumberFormatException e) { return Long.parseLong(str); } } } }
Source:
public HdfsDataSegmentKiller(final Configuration config, final HdfsDataSegmentPusherConfig pusherConfig) { this.config = config; this.storageDirectory = new Path(HdfsDataSegmentUtil.getFullyQualifiedHdfsPath(pusherConfig.getStorageDirectory(), config)); }

Target:
public HdfsDataSegmentKiller(final Configuration config, final HdfsDataSegmentPusherConfig pusherConfig) { this.config = config; this.storageDirectory = new Path(pusherConfig.getStorageDirectory()); }
Source:
private List<ResourceTraversal> createTraversalForContainer(GitModelObject child) { GitModelObject[] containerChildren = child.getChildren(); List<ResourceTraversal> result = new ArrayList<ResourceTraversal>(); for (GitModelObject aChild : containerChildren) { if(aChild.isContainer()) { result.addAll(createTraversalForContainer(aChild)); } else { result.add(createTraversalForFile(aChild)); } } return result; }

Target:
private List<ResourceTraversal> createTraversalForContainer(GitModelObject child) { GitModelObject[] containerChildren = child.getChildren(); List<ResourceTraversal> result = new ArrayList<ResourceTraversal>(); for (GitModelObject aChild : containerChildren) { if(aChild.isContainer()) result.addAll(createTraversalForContainer(aChild)); else result.add(createTraversalForFile(aChild)); } return result; }
Source:
public void closeEditors() { IFile file = getBookmarksFile(); FileEditorInput input = new FileEditorInput(file); IWorkbench wb = PlatformUI.getWorkbench(); for (IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) { for (IWorkbenchPage wbPage : wbWindow.getPages()) { for (IEditorReference editorReference : wbPage.getEditorReferences()) { try { if (editorReference.getEditorInput().equals(input)) { wbPage.closeEditor(editorReference.getEditor(false), false); } } catch (PartInitException e) { e.printStackTrace(); } } } } }

Target:
public void closeEditors() { IFile file = getBookmarksFile(); FileEditorInput input = new FileEditorInput(file); IWorkbench wb = PlatformUI.getWorkbench(); for (IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) { for (IWorkbenchPage wbPage : wbWindow.getPages()) { for (IEditorReference editorReference : wbPage.getEditorReferences()) { try { if (editorReference.getEditorInput().equals(input)) { wbPage.closeEditor(editorReference.getEditor(false), false); } } catch (PartInitException e) { Activator.getDefault().logError("Error closing editor for experiment " + getName(), e); } } } } }
Source:
private JacksonIdValue( @JsonProperty("entity-type") String entityType, @JsonProperty("id") String id) { this.entityType = entityType; this.id = id; contents = new HashMap<>(); }

Target:
private JacksonIdValue( @JsonProperty("entity-type") String entityType, @JsonProperty("id") String id) { Validate.notNull(id); this.entityType = entityType; this.id = id; contents = new HashMap<>(); }
Source:
public List<List<Map<String, Object>>> accumulate(List<List<Map<String, Object>>> accumulatedValue, InputT1 input) { if (firstTimeStream) { createGetters(input.getClass(),1); firstTimeStream = false; } try { return accumulateWithIndex(0, accumulatedValue, input); } catch (NoSuchFieldException e) { throw Throwables.propagate(e); } }

Target:
public List<List<Map<String, Object>>> accumulate(List<List<Map<String, Object>>> accumulatedValue, InputT1 input) { if (gettersStream1 == null) { gettersStream1 = createGetters(input.getClass()); } try { return accumulateWithIndex(0, accumulatedValue, input); } catch (NoSuchFieldException e) { throw Throwables.propagate(e); } }
Source:
public void testLowercaseNamesQuery() throws Exception { snowflakeReader.properties.convertColumnsAndTableToUppercase.setValue(false); Statement statementMock = Mockito.mock(Statement.class); Connection connectionMock = Mockito.mock(Connection.class); ResultSet resultSetMock = Mockito.mock(ResultSet.class); Mockito.when(resultSetMock.next()).thenReturn(true); Mockito.when(resultSetMock.getMetaData()).thenReturn(Mockito.mock(ResultSetMetaData.class)); Mockito.when(resultSetMock.getMetaData().getColumnCount()).thenReturn(2); Mockito.when(resultSetMock.getString(0)).thenReturn("row1field", "row1column"); Mockito.when((snowflakeSourceMock).createConnection(runtimeContainerMock)).thenReturn(connectionMock); Mockito.when(connectionMock.createStatement()).thenReturn(statementMock); Mockito.when(statementMock.executeQuery(TEST_LOWERCASE_NAMES_QUERY)).thenReturn(resultSetMock); snowflakeReader.start(); snowflakeReader.getCurrent(); }

Target:
public void testLowercaseNamesQuery() throws Exception { snowflakeReader.properties.convertColumnsAndTableToUppercase.setValue(false); Statement statementMock = Mockito.mock(Statement.class); Connection connectionMock = Mockito.mock(Connection.class); ResultSet resultSetMock = Mockito.mock(ResultSet.class); Mockito.when(resultSetMock.next()).thenReturn(true); Mockito.when(resultSetMock.getMetaData()).thenReturn(Mockito.mock(ResultSetMetaData.class)); Mockito.when(resultSetMock.getMetaData().getColumnCount()).thenReturn(2); Mockito.when(resultSetMock.getString(0)).thenReturn("row1field", "row1column"); Mockito.when((snowflakeSourceMock).createConnection(runtimeContainerMock)).thenReturn(connectionMock); Mockito.when(connectionMock.createStatement()).thenReturn(statementMock); Mockito.when(statementMock.executeQuery(TEST_LOWERCASE_NAMES_QUERY)).thenReturn(resultSetMock); snowflakeReader.start(); snowflakeReader.getCurrent(); Assert.assertEquals(1, snowflakeReader.getReturnValues().get("totalRecordCount")); }
Source:
private synchronized PrepPipeline createOrFindPreparer(DatabasePreparer preparer) throws IOException, SQLException { PrepPipeline result = CLUSTERS.get(preparer); if (result != null) { return result; } result = new PrepPipeline(EmbeddedPostgres.start()); try (Connection c = result.getPg().getTemplateDatabase().getConnection()) { preparer.prepare(c); } result.start(); CLUSTERS.put(preparer, result); return result; }

Target:
private synchronized PrepPipeline createOrFindPreparer(DatabasePreparer preparer) throws IOException, SQLException { PrepPipeline result = CLUSTERS.get(preparer); if (result != null) { return result; } final EmbeddedPostgres pg = EmbeddedPostgres.start(); preparer.prepare(pg.getTemplateDatabase()); result = new PrepPipeline(pg).start(); CLUSTERS.put(preparer, result); return result; }
Source:
protected void waitUntil(BooleanSupplier supplier, long timeout) { if (!waitUntilNoFail(supplier, timeout)) { throw new IllegalStateException("Timed out"); } }

Target:
protected boolean waitUntil(BooleanSupplier supplier, long timeout) { long start = System.currentTimeMillis(); while (true) { if (supplier.getAsBoolean()) { return true; } try { Thread.sleep(10); } catch (InterruptedException ignore) { } long now = System.currentTimeMillis(); if (now - start > timeout) { return false; } } }
Source:
public void getConceptIdForUnits_shouldReturnConcept_idForDrug_order_quantity_units() throws Exception { Database1_9To1_10UpgradeTest.createOrderEntryUpgradeFileWithTestData("mg=5401" + "\n" + "drug order quantity units=5403" + "\n" + "ounces=5402"); Integer conceptId = UpgradeUtil.getConceptIdForUnits("drug order quantity units"); Assert.assertThat(conceptId, Is.is(5403)); }

Target:
public void getConceptIdForUnits_shouldReturnConcept_idForDrug_order_quantity_units() throws Exception { Database1_9To1_10UpgradeTest.createOrderEntryUpgradeFileWithTestData("mg=5401" + "\n" + "drug_order_quantity_units=5403" + "\n" + "ounces=5402"); Integer conceptId = UpgradeUtil.getConceptIdForUnits("drug_order_quantity_units"); Assert.assertThat(conceptId, Is.is(5403)); }
Source:
public Object extract(final Jar jar, final Locale locale) { Objects.requireNonNull(jar, "jar"); Objects.requireNonNull(locale, "locale"); ChecksumDTO checksumDTO = new ChecksumDTO(); checksumDTO.md5 = calcChecksum(jar, "MD5"); checksumDTO.sha1 = calcChecksum(jar, "SHA-1"); checksumDTO.sha256 = calcChecksum(jar, "SHA-256"); if (checksumDTO.md5 == null && checksumDTO.sha1 == null && checksumDTO.sha256 == null) { return null; } return checksumDTO; }

Target:
public ChecksumDTO extract(final Jar jar, final Locale locale) { Objects.requireNonNull(jar, "jar"); Objects.requireNonNull(locale, "locale"); ChecksumDTO checksumDTO = new ChecksumDTO(); checksumDTO.md5 = calcChecksum(jar, "MD5"); checksumDTO.sha1 = calcChecksum(jar, "SHA-1"); checksumDTO.sha256 = calcChecksum(jar, "SHA-256"); if (checksumDTO.md5 == null && checksumDTO.sha1 == null && checksumDTO.sha256 == null) { return null; } return checksumDTO; }
Source:
public List<ByteString> parseNextBlock(boolean skipIfStartingOnBoundary) throws IOException { LOG.debug("BlockReader: none left to read, skipping to sync point"); long skipped = skipToNextSyncPoint(); if (skipped <= -1) { LOG.debug("BlockReader: SYNC point eof"); return null; } int blockSize = readInt(); LOG.debug("BlockReader: found sync point, next block has size " + blockSize); if (blockSize < 0) { LOG.debug("ProtobufReader: reading size after sync point eof"); return null; } byte[] byteArray; if(lastBlock.length >= blockSize) { byteArray = lastBlock; } else { lastBlock = new byte[blockSize*2]; byteArray = lastBlock; } IOUtils.readFully(in_, byteArray, 0, blockSize); if (skipIfStartingOnBoundary && skipped == Protobufs.KNOWN_GOOD_POSITION_MARKER.length) { return parseNextBlock(false); } SerializedBlock block = SerializedBlock.parseFrom(byteArray, blockSize); curBlobs_ = block.getProtoBlobs(); numLeftToReadThisBlock_ = curBlobs_.size(); LOG.debug("ProtobufReader: number in next block is " + numLeftToReadThisBlock_); return curBlobs_; }

Target:
public List<ByteString> parseNextBlock(boolean skipIfStartingOnBoundary) throws IOException { LOG.debug("BlockReader: none left to read, skipping to sync point"); long skipped = skipToNextSyncPoint(); if (skipped <= -1) { LOG.debug("BlockReader: SYNC point eof"); return null; } int blockSize = readInt(); LOG.debug("BlockReader: found sync point, next block has size " + blockSize); if (blockSize < 0) { LOG.debug("ProtobufReader: reading size after sync point eof"); return null; } if (skipIfStartingOnBoundary && skipped == Protobufs.KNOWN_GOOD_POSITION_MARKER.length) { in_.skip(blockSize); return parseNextBlock(false); } SerializedBlock block = SerializedBlock.parseFrom(new BoundedInputStream(in_, blockSize)); curBlobs_ = block.getProtoBlobs(); numLeftToReadThisBlock_ = curBlobs_.size(); LOG.debug("ProtobufReader: number in next block is " + numLeftToReadThisBlock_); return curBlobs_; }
Source:
public AdminEmailAttributes getAdminEmailBySubject(String subject) { AdminEmail matched = getAdminEmailEntityBySubject(subject); if (matched == null) { return null; } return new AdminEmailAttributes(matched); }

Target:
public AdminEmailAttributes getAdminEmailBySubject(String subject) { AdminEmail matchedEmail = getAdminEmailEntityBySubject(subject); if (matchedEmail == null) { return null; } return new AdminEmailAttributes(matchedEmail); }