auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void drawLevel(Graphics g2) { g2.setColor(new Color(200, 200, 255)); g2.fillRect(3 * CELL_NUMBER + 1, 11 * CELL_NUMBER + 1, 14 * CELL_NUMBER - 1, CELL_NUMBER - 1); g2.setColor(new Color(0, 100, 20)); g2.drawString("levels", 170, 236); g2.setColor(new Color(200, 100, 255)); g2.fillRect(3 * CELL_NUMBER + 1, 12 * CELL_NUMBER + 1, 5 * CELL_NUMBER - 1, CELL_NUMBER - 1); g2.setColor(new Color(100, 100, 255)); g2.fillRect(8 * CELL_NUMBER + 1, 12 * CELL_NUMBER + 1, 4 * CELL_NUMBER - 1, CELL_NUMBER - 1); g2.setColor(new Color(50, 100, 255)); g2.fillRect(12 * CELL_NUMBER + 1, 12 * CELL_NUMBER + 1, 5 * CELL_NUMBER - 1, CELL_NUMBER - 1); addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (status == 0) { if (e.getButton() == MouseEvent.BUTTON1) { int x = e.getX(); int y = e.getY(); if (x > 3 * CELL_NUMBER & y > 12 * CELL_NUMBER & x < 8 * CELL_NUMBER & y < 13 * CELL_NUMBER) { first.start(); level = Level.first; status = 2; auto = 0; } if (x > 8 * CELL_NUMBER & y > 12 * CELL_NUMBER & x < 12 * CELL_NUMBER & y < 13 * CELL_NUMBER) { second.start(); level = Level.second; status = 2; auto = 0; } if (x > 12 * CELL_NUMBER & y > 12 * CELL_NUMBER & x < 17 * CELL_NUMBER & y < 13 * CELL_NUMBER) { third.start(); level = Level.third; status = 2; auto = 0; } } } } }); }

Target:
public void drawLevel(Graphics g2) { g2.setColor(new Color(200, 200, 255)); g2.fillRect(LEFT_SIDE * CELL_NUMBER + 1, 11 * CELL_NUMBER + 1, 14 * CELL_NUMBER - 1, CELL_NUMBER - 1); g2.setColor(new Color(0, 100, 20)); g2.drawString("levels", 170, 236); g2.setColor(new Color(200, 100, 255)); g2.fillRect(LEFT_SIDE * CELL_NUMBER + 1, FOR_DRAW * CELL_NUMBER + 1, 5 * CELL_NUMBER - 1, CELL_NUMBER - 1); g2.setColor(new Color(100, 100, 255)); g2.fillRect(8 * CELL_NUMBER + 1, FOR_DRAW * CELL_NUMBER + 1, 4 * CELL_NUMBER - 1, CELL_NUMBER - 1); g2.setColor(new Color(50, 100, 255)); g2.fillRect(FOR_DRAW * CELL_NUMBER + 1, FOR_DRAW * CELL_NUMBER + 1, 5 * CELL_NUMBER - 1, CELL_NUMBER - 1); addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (status == DISPLAYED_MENU) { if (e.getButton() == MouseEvent.BUTTON1) { int x = e.getX(); int y = e.getY(); if (x > LEFT_SIDE * CELL_NUMBER & y > FOR_DRAW * CELL_NUMBER & x < 8 * CELL_NUMBER & y < FOR_DRAW_LEVEL * CELL_NUMBER) { first.start(); level = Level.first; status = DISPLAYED_GAME; auto = false; } if (x > 8 * CELL_NUMBER & y > FOR_DRAW * CELL_NUMBER & x < FOR_DRAW * CELL_NUMBER & y < FOR_DRAW_LEVEL * CELL_NUMBER) { second.start(); level = Level.second; status = DISPLAYED_GAME; auto = false; } if (x > FOR_DRAW * CELL_NUMBER & y > FOR_DRAW * CELL_NUMBER & x < 17 * CELL_NUMBER & y < FOR_DRAW_LEVEL * CELL_NUMBER) { third.start(); level = Level.third; status = DISPLAYED_GAME; auto = false; } } } } }); }
Source:
public FilterRegistrationBean corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin("http://localhost:8888"); config.addAllowedHeader("*"); config.addAllowedMethod("*"); source.registerCorsConfiguration("/*", config); FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source)); bean.setOrder(0); return bean; }

Target:
public FilterRegistrationBean corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin("http://localhost:8052"); config.addAllowedHeader("*"); config.addAllowedMethod("*"); source.registerCorsConfiguration("/*", config); FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source)); bean.setOrder(0); return bean; }
Source:
public void getJobsBySessionSeqIdAndStatus() { List<Job> jobsList = dao.getJobsBySessionSeqIdAndStatus(ENGINE_SESSION_SEQ_ID, JobExecutionStatus.STARTED); assertTrue("Verify jobs are associated with the engine-session-seq-ID and status", jobsList.size() == NUMBER_OF_JOBS_FOR_ENGINE_SESSION_SEQ_ID_AND_STATUS); }

Target:
public void getJobsBySessionSeqIdAndStatus() { List<Job> jobsList = dao.getJobsBySessionSeqIdAndStatus(ENGINE_SESSION_SEQ_ID, JobExecutionStatus.STARTED); assertEquals("Verify jobs are associated with the engine-session-seq-ID and status", NUMBER_OF_JOBS_FOR_ENGINE_SESSION_SEQ_ID_AND_STATUS, jobsList.size()); }
Source:
public void testInt32AnnotationsRejectNonInt32() { OriginalType[] types = new OriginalType[] { DATE, TIME_MILLIS, UINT_8, UINT_16, UINT_32, INT_8, INT_16, INT_32}; for (final OriginalType logicalType : types) { PrimitiveTypeName[] nonBinary = new PrimitiveTypeName[]{ BOOLEAN, INT64, INT96, DOUBLE, FLOAT, BINARY }; for (final PrimitiveTypeName type : nonBinary) { assertThrows("Should reject non-int32 type: " + type, IllegalStateException.class, new Callable<Type>() { @Override public Type call() throws Exception { return Types.required(type).as(logicalType).named("col"); } }); } assertThrows("Should reject non-int32 type: FIXED_LEN_BYTE_ARRAY", IllegalStateException.class, new Callable<Type>() { @Override public Type call() throws Exception { return Types.required(FIXED_LEN_BYTE_ARRAY).length(1) .as(logicalType).named("col"); } }); } }

Target:
public void testInt32AnnotationsRejectNonInt32() { OriginalType[] types = new OriginalType[] { DATE, TIME_MILLIS, UINT_8, UINT_16, UINT_32, INT_8, INT_16, INT_32}; for (final OriginalType logicalType : types) { PrimitiveTypeName[] nonInt32 = new PrimitiveTypeName[]{ BOOLEAN, INT64, INT96, DOUBLE, FLOAT, BINARY }; for (final PrimitiveTypeName type : nonInt32) { assertThrows("Should reject non-int32 type: " + type, IllegalStateException.class, new Callable<Type>() { @Override public Type call() throws Exception { return Types.required(type).as(logicalType).named("col"); } }); } assertThrows("Should reject non-int32 type: FIXED_LEN_BYTE_ARRAY", IllegalStateException.class, new Callable<Type>() { @Override public Type call() throws Exception { return Types.required(FIXED_LEN_BYTE_ARRAY).length(1) .as(logicalType).named("col"); } }); } }
Source:
protected FlatFileSpecificationForProcessingPreSplitLines getFlatFileSpecificationForPreSplitLines() { if (flatFileSpecification == null) { throw new IllegalStateException("The flat file specification cannot be null"); } else if (!(flatFileSpecification instanceof FlatFileSpecificationForProcessingPreSplitLines)) { throw new IllegalStateException("The given flat file specification does not support processing pre-split file lines"); } return (FlatFileSpecificationForProcessingPreSplitLines) flatFileSpecification; }

Target:
protected FlatFileSpecificationForProcessingPreSplitLines getFlatFileSpecificationForPreSplitLines() { if (flatFileSpecification == null) { throw new IllegalStateException("The flat file specification cannot be null"); } else if (!(flatFileSpecification instanceof FlatFileSpecificationForProcessingPreSplitLines)) { throw new IllegalStateException("The flat file specification of type " + flatFileSpecification.getClass().getName() + " is not an implementation of " + FlatFileSpecificationForProcessingPreSplitLines.class.getName()); } return (FlatFileSpecificationForProcessingPreSplitLines) flatFileSpecification; }
Source:
protected boolean canDoAction() { if (getDisk() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (getDiskType() == DiskStorageType.IMAGE) { if (((DiskImage) getDisk()).getImageStatus() != ImageStatus.OK) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED); } } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_IS_NOT_VM_DISK); } if (isImageLockNeeded() && getVm().isRunningOrPaused()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } if (getVdsIdInPool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_VDS_IN_POOL); } if (!validate(new StoragePoolValidator(getStoragePoolDao().get(getStoragePoolId())).isUp())) { return false; } return true; }

Target:
protected boolean canDoAction() { if (getDisk() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (getDiskType() == DiskStorageType.IMAGE) { if (((DiskImage) getDisk()).getImageStatus() != ImageStatus.OK) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED); } } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_IS_NOT_VM_DISK); } if (isImageExclusiveLockNeeded() && getVm().isRunningOrPaused()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } if (getVdsIdInPool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_VDS_IN_POOL); } if (!validate(new StoragePoolValidator(getStoragePoolDao().get(getStoragePoolId())).isUp())) { return false; } return true; }
Source:
public HostVO findOneRandomRunningHostByHypervisor(HypervisorType type) { final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class); sc.and(sc.entity().getHypervisorType(), Op.EQ, type); sc.and(sc.entity().getType(),Op.EQ, Type.Routing); sc.and(sc.entity().getStatus(), Op.EQ, Status.Up); sc.and(sc.entity().getResourceState(), Op.EQ, ResourceState.Enabled); sc.and(sc.entity().getRemoved(), Op.NULL); List<HostVO> hosts = sc.list(); if (hosts == null || hosts.isEmpty()) { return null; } else { Collections.shuffle(hosts, new Random(System.currentTimeMillis())); return hosts.get(0); } }

Target:
public HostVO findOneRandomRunningHostByHypervisor(HypervisorType type) { final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class); sc.and(sc.entity().getHypervisorType(), Op.EQ, type); sc.and(sc.entity().getType(),Op.EQ, Type.Routing); sc.and(sc.entity().getStatus(), Op.EQ, Status.Up); sc.and(sc.entity().getResourceState(), Op.EQ, ResourceState.Enabled); sc.and(sc.entity().getRemoved(), Op.NULL); List<HostVO> hosts = sc.list(); if (CollectionUtils.isEmpty(hosts)) { return null; } else { Collections.shuffle(hosts, new Random(System.currentTimeMillis())); return hosts.get(0); } }
Source:
private AccessToken validateAccessToken(String token) { AccessToken accessToken; try { accessToken = connector.validateAccessToken(new AccessToken.Builder(token).build()); } catch (ConnectionInitializationException e) { LOGGER.warn(String.format("Unable to retrieve access token from auth-server %s: %s", authServerHome, e.getMessage())); throw e; } catch (UnauthorizedException e) { LOGGER.warn("Error validating access token", e); throw new InvalidTokenException("The provided access token is not valid", e); } return accessToken; }

Target:
private AccessToken validateAccessToken(String token) { AccessToken accessToken; try { accessToken = connector.validateAccessToken(new AccessToken.Builder(token).build()); } catch (ConnectionInitializationException e) { LOGGER.warn(String.format("Unable to retrieve access token from auth-server %s: %s", authServerHome, e.getMessage())); throw e; } catch (UnauthorizedException e) { LOGGER.warn(String.format("Unable to retrieve access token from auth-server: %s", e.getMessage())); throw new InvalidTokenException("The provided access token is not valid", e); } return accessToken; }
Source:
public OutputWriter createOutputWriter() { List<String> headers = new ArrayList<String>(); for (int i = 0; i < columns.length; i++) { String columnName = getColumnHeader(i); headers.add(columnName); if (columnToBeSortedOn != null) { if (columns[i].getName().equals(columnToBeSortedOn.getName())) { indexOfColumnToBeSortedOn = i; } } } if (columnToBeSortedOn != null) { if (indexOfColumnToBeSortedOn == -1) { this.isColumnToBeSortedOnPresentInInput = false; indexOfColumnToBeSortedOn = columns.length; headers.add(columnToBeSortedOn.getName()); InputColumn<?>[] newColumns = new InputColumn<?>[columns.length + 1]; for (int i = 0; i < columns.length; i++) { newColumns[i] = columns[i]; } newColumns[columns.length] = columnToBeSortedOn; columns = newColumns; } } if (_targetFile == null) { try { initTempFile(); } catch (Exception e) { throw new RuntimeException(e); } } return CsvOutputWriterFactory.getWriter(_targetFile.getPath(), headers.toArray(new String[0]), separatorChar, quoteChar, escapeChar, includeHeader, columns); }

Target:
public OutputWriter createOutputWriter() { List<String> headers = new ArrayList<String>(); for (int i = 0; i < columns.length; i++) { String columnName = getColumnHeader(i); headers.add(columnName); if (columnToBeSortedOn != null) { if (columns[i].equals(columnToBeSortedOn)) { indexOfColumnToBeSortedOn = i; } } } if (columnToBeSortedOn != null) { if (indexOfColumnToBeSortedOn == -1) { this.isColumnToBeSortedOnPresentInInput = false; indexOfColumnToBeSortedOn = columns.length; headers.add(columnToBeSortedOn.getName()); InputColumn<?>[] newColumns = new InputColumn<?>[columns.length + 1]; for (int i = 0; i < columns.length; i++) { newColumns[i] = columns[i]; } newColumns[columns.length] = columnToBeSortedOn; columns = newColumns; } } if (_targetFile == null) { try { initTempFile(); } catch (Exception e) { throw new RuntimeException(e); } } return CsvOutputWriterFactory.getWriter(_targetFile.getPath(), headers.toArray(new String[0]), separatorChar, quoteChar, escapeChar, includeHeader, columns); }
Source:
public void memberRemoved(MemberEvent event) { ILock hazelcastLock = Globals.getDefaultBaseServiceLocator().getService(HazelcastCore.class).getInstance().getLock("EJB-TIMER-LOCK"); hazelcastLock.lock(); try { Collection<HZTimer> allTimers = pkCache.values(); Collection<HZTimer> removedTimers = new HashSet<>(); for (HZTimer timer : allTimers) { if (timer.getMemberName().equals(event.getServer())) { removedTimers.add(timer); } } if (!removedTimers.isEmpty()) { logger.log(Level.INFO, "==> Restoring Timers ... "); Collection<HZTimer> restored = _restoreTimers(removedTimers); for (HZTimer timer : restored) { pkCache.putAsync(timer.getKey().getTimerId(), timer); } logger.log(Level.INFO, "<== ... Timers Restored."); } } finally { hazelcastLock.unlock(); } }

Target:
public void memberRemoved(MemberEvent event) { ILock hazelcastLock = hazelcast.getLock("EJB-TIMER-LOCK"); hazelcastLock.lock(); try { Collection<HZTimer> allTimers = pkCache.values(); Collection<HZTimer> removedTimers = new HashSet<>(); for (HZTimer timer : allTimers) { if (timer.getMemberName().equals(event.getServer())) { removedTimers.add(timer); } } if (!removedTimers.isEmpty()) { logger.log(Level.INFO, "==> Restoring Timers ... "); Collection<HZTimer> restored = _restoreTimers(removedTimers); for (HZTimer timer : restored) { pkCache.put(timer.getKey().getTimerId(), timer); } logger.log(Level.INFO, "<== ... Timers Restored."); } } finally { hazelcastLock.unlock(); } }
Source:
private void display() throws Failure { final PrintWriter stdout = toPrintWriter(out); try { for (final Project p : db.projects().all()) { if (p.getNameKey().equals(wildProject)) { continue; } final ProjectState e = projectCache.get(p.getNameKey()); if (e != null && e.controlFor(currentUser).isVisible()) { if (showBranch != null) { ObjectId id = getObjectIdForBranch(p.getNameKey(), showBranch); if (id != null) { stdout.print(id.name() + " "); stdout.print(p.getName()); stdout.println(); } } } } catch (OrmException e) { throw new Failure(1, "fatal: database error", e); } finally { stdout.flush(); } } }

Target:
private void display() throws Failure { final PrintWriter stdout = toPrintWriter(out); try { for (final Project p : db.projects().all()) { if (p.getNameKey().equals(wildProject)) { continue; } final ProjectState e = projectCache.get(p.getNameKey()); if (e != null && e.controlFor(currentUser).isVisible()) { if (showBranch != null) { ObjectId id = getObjectIdForBranch(p.getNameKey(), showBranch); if (id != null) { stdout.print(id.name() + " "); stdout.print(p.getName()); stdout.println(); } } else { stdout.print(p.getName()); stdout.println(); } } } } catch (OrmException e) { throw new Failure(1, "fatal: database error", e); } finally { stdout.flush(); } }
Source:
protected int doWork() { if (EXPECT_ALL_READ_GROUPS_TO_MATCH) EXPECT_ALL_GROUPS_TO_MATCH = EXPECT_ALL_READ_GROUPS_TO_MATCH; if (CROSSCHECK_LIBRARIES) { CROSSCHECK_BY = CrosscheckMetric.DataType.LIBRARY; } else if (CROSSCHECK_SAMPLES) { CROSSCHECK_BY = CrosscheckMetric.DataType.SAMPLE; } else { CROSSCHECK_BY = CrosscheckMetric.DataType.READGROUP; MATRIX_OUTPUT = OUTPUT; OUTPUT = new File("/dev/null"); } return super.doWork(); }

Target:
protected int doWork() { if (EXPECT_ALL_READ_GROUPS_TO_MATCH) { EXPECT_ALL_GROUPS_TO_MATCH = EXPECT_ALL_READ_GROUPS_TO_MATCH; } if (CROSSCHECK_LIBRARIES) { CROSSCHECK_BY = CrosscheckMetric.DataType.LIBRARY; } else if (CROSSCHECK_SAMPLES) { CROSSCHECK_BY = CrosscheckMetric.DataType.SAMPLE; } else { CROSSCHECK_BY = CrosscheckMetric.DataType.READGROUP; MATRIX_OUTPUT = OUTPUT; OUTPUT = new File("/dev/null"); } return super.doWork(); }
Source:
public RunResult runTests(Path path) { ProcessRunner runner = new ProcessRunner(getTestCommand(), path); try { runner.call(); } catch (Exception e) { log.error(CANNOT_RUN_TESTS_MESSAGE, e); } try { return new RTestResultParser(path).parse(); } catch (IOException e) { log.error(CANNOT_PARSE_TEST_RESULTS_MESSAGE, e); } return null; }

Target:
public RunResult runTests(Path path) { ProcessRunner runner = new ProcessRunner(getTestCommand(), path); try { runner.call(); } catch (Exception e) { log.error(CANNOT_RUN_TESTS_MESSAGE, e); return getGenericErrorRunResult(e); } try { return new RTestResultParser(path).parse(); } catch (IOException e) { log.error(CANNOT_PARSE_TEST_RESULTS_MESSAGE, e); return getGenericErrorRunResult(e); } }
Source:
public TmfSimpleTimestamp(final ITmfTimestamp timestamp) { super(timestamp.getValue(), 0, 0); }

Target:
public TmfSimpleTimestamp(final ITmfTimestamp timestamp) { super(timestamp.normalize(0, ITmfTimestamp.SECOND_SCALE).getValue(), 0, 0); }
Source:
public void readWithWrongPayloadFormat() throws Exception{ KryoMessageConverter kryoMessageConverter = new KryoMessageConverter(null,true); Message message = MessageBuilder.withPayload("foo").setHeader(MessageHeaders.CONTENT_TYPE,KryoMessageConverter.KRYO_MIME_TYPE+";type=java.lang.String").build(); Object result = kryoMessageConverter.fromMessage(message,String.class); }

Target:
public void readWithWrongPayloadFormat() throws Exception{ KryoMessageConverter kryoMessageConverter = new KryoMessageConverter(null,true); Message message = MessageBuilder.withPayload("foo").setHeader(MessageHeaders.CONTENT_TYPE,KryoMessageConverter.KRYO_MIME_TYPE+";type=java.lang.String").build(); kryoMessageConverter.fromMessage(message,String.class); }
Source:
public void run() { Future<?> future = null; try { attemptCounter.increment(); future = executor.submit(task); threadPoolLevelGauge.set((long) executor.getActiveCount()); future.get(timeoutMillis, TimeUnit.MILLISECONDS); delay.set(timeoutMillis); threadPoolLevelGauge.set((long) executor.getActiveCount()); } catch (TimeoutException e) { logger.warn("task supervisor timed out", e); timeoutCounter.increment(); long currentDelay = delay.get(); long newDelay = Math.min(maxDelay, currentDelay * 2); delay.compareAndSet(currentDelay, newDelay); } catch (RejectedExecutionException e) { if (executor.isShutdown() || scheduler.isShutdown()) { logger.warn("task supervisor shutting down, reject the task", e); } else { logger.warn("task supervisor rejected the task", e); } rejectedCounter.increment(); } catch (Throwable e) { if (executor.isShutdown() || scheduler.isShutdown()) { logger.warn("task supervisor shutting down, can't accept the task"); } else { logger.warn("task supervisor threw an exception", e); } throwableCounter.increment(); } finally { if (future != null) { future.cancel(true); } if (!scheduler.isShutdown()) { scheduler.schedule(this, delay.get(), TimeUnit.MILLISECONDS); } } }

Target:
public void run() { Future<?> future = null; try { future = executor.submit(task); threadPoolLevelGauge.set((long) executor.getActiveCount()); future.get(timeoutMillis, TimeUnit.MILLISECONDS); delay.set(timeoutMillis); threadPoolLevelGauge.set((long) executor.getActiveCount()); successCounter.increment(); } catch (TimeoutException e) { logger.warn("task supervisor timed out", e); timeoutCounter.increment(); long currentDelay = delay.get(); long newDelay = Math.min(maxDelay, currentDelay * 2); delay.compareAndSet(currentDelay, newDelay); } catch (RejectedExecutionException e) { if (executor.isShutdown() || scheduler.isShutdown()) { logger.warn("task supervisor shutting down, reject the task", e); } else { logger.warn("task supervisor rejected the task", e); } rejectedCounter.increment(); } catch (Throwable e) { if (executor.isShutdown() || scheduler.isShutdown()) { logger.warn("task supervisor shutting down, can't accept the task"); } else { logger.warn("task supervisor threw an exception", e); } throwableCounter.increment(); } finally { if (future != null) { future.cancel(true); } if (!scheduler.isShutdown()) { scheduler.schedule(this, delay.get(), TimeUnit.MILLISECONDS); } } }
Source:
public String toString() { try { if (diff == null) { log.error("Diff null"); return "--Diff null--"; } String diffString = ""; try { diffString = diff.toString(); } catch (Exception e) { log.error("Error when printing diff result: " + e.getMessage()); e.printStackTrace(); diffString = "wrong diff"; } String resultString = "\n----For Diff:" + diffString + "\n: number instances found: " + instances.size(); for (ChangePatternInstance instance : instances) { resultString += "\n" + instance.toString(); } log.info(resultString += "\n----"); } catch (Exception e) { e.printStackTrace(); } log.info("--Diff ex--"); return "--Diff ex--"; }

Target:
public String toString() { try { if (diff == null) { log.error("Diff null"); return "--Diff null--"; } String diffString = ""; try { diffString = diff.toString(); } catch (Exception e) { log.error("Error when printing diff result: " + e.getMessage()); e.printStackTrace(); diffString = "wrong diff"; } String resultString = "\n----For Diff:" + diffString + "\n: number instances found: " + instances.size(); for (ChangePatternInstance instance : instances) { resultString += "\n" + instance.toString(); } return resultString += "\n----"; } catch (Exception e) { e.printStackTrace(); } return "--Diff ex--"; }
Source:
public Pipeline processPipeline(Pipeline inputPipeline) { Trigger inputTrigger = inputPipeline.getTrigger(); if (inputTrigger == null) { return inputPipeline; } else { Trigger augmentedTrigger = addBuildInfo(inputTrigger); return inputPipeline.withTrigger(augmentedTrigger); } }

Target:
public Pipeline processPipeline(Pipeline inputPipeline) { Trigger inputTrigger = inputPipeline.getTrigger(); if (inputTrigger == null) { return inputPipeline; } Trigger augmentedTrigger = addBuildInfo(inputTrigger); return inputPipeline.withTrigger(augmentedTrigger); }
Source:
private static DescribeGroupsResponseData prepareDescribeGroupsResponseData(String groupId, List<String> groupInstances, List<TopicPartition> topicPartitions) { final ByteBuffer memberAssignment = ConsumerProtocol.serializeAssignment(new ConsumerPartitionAssignor.Assignment(topicPartitions)); byte[] memberAssignmentBytes = new byte[memberAssignment.remaining()]; List<DescribedGroupMember> describedGroupMembers = groupInstances.stream().map(groupInstance -> DescribeGroupsResponse.groupMember("0", groupInstance, "clientId0", "clientHost", memberAssignmentBytes, null)).collect(Collectors.toList()); DescribeGroupsResponseData data = new DescribeGroupsResponseData(); data.groups().add(DescribeGroupsResponse.groupMetadata( groupId, Errors.NONE, "", ConsumerProtocol.PROTOCOL_TYPE, "", describedGroupMembers, Collections.emptySet())); return data; }

Target:
private static DescribeGroupsResponseData prepareDescribeGroupsResponseData(String groupId, List<String> groupInstances, List<TopicPartition> topicPartitions) { final ByteBuffer memberAssignment = ConsumerProtocol.serializeAssignment(new ConsumerPartitionAssignor.Assignment(topicPartitions)); List<DescribedGroupMember> describedGroupMembers = groupInstances.stream().map(groupInstance -> DescribeGroupsResponse.groupMember(JoinGroupRequest.UNKNOWN_MEMBER_ID, groupInstance, "clientId0", "clientHost", new byte[memberAssignment.remaining()], null)).collect(Collectors.toList()); DescribeGroupsResponseData data = new DescribeGroupsResponseData(); data.groups().add(DescribeGroupsResponse.groupMetadata( groupId, Errors.NONE, "", ConsumerProtocol.PROTOCOL_TYPE, "", describedGroupMembers, Collections.emptySet())); return data; }
Source:
public static Version fromString(final String value) throws IllegalArgumentException { if (SIGNATURE_V1.value.equals(value)) { return SIGNATURE_V1; } else if (SIGNATURE_V2.value.equals(value)) { return SIGNATURE_V2; } else { throw new IllegalArgumentException("Invalid signature version"); } }

Target:
public static Version fromString(final String value) { if (SIGNATURE_V1.value.equals(value)) { return SIGNATURE_V1; } else if (SIGNATURE_V2.value.equals(value)) { return SIGNATURE_V2; } else { throw new IllegalArgumentException("Invalid signature version"); } }
Source:
public void copyToRealm() { Date date = new Date(); Dog dog = new Dog(); dog.setName("Fido"); RealmList<Dog> list = new RealmList<Dog>(); list.add(dog); AllTypes allTypes = new AllTypes(); allTypes.setColumnString("String"); allTypes.setColumnLong(1L); allTypes.setColumnFloat(1f); allTypes.setColumnDouble(1d); allTypes.setColumnBoolean(true); allTypes.setColumnDate(date); allTypes.setColumnBinary(new byte[]{1, 2, 3}); allTypes.setColumnRealmObject(dog); allTypes.setColumnRealmList(list); realm.beginTransaction(); AllTypes realmTypes = realm.copyToRealm(allTypes); realm.commitTransaction(); assertNotSame(allTypes, realmTypes); assertEquals(allTypes.getColumnString(), realmTypes.getColumnString()); assertEquals(allTypes.getColumnLong(), realmTypes.getColumnLong()); assertEquals(allTypes.getColumnFloat(), realmTypes.getColumnFloat(), 0); assertEquals(allTypes.getColumnDouble(), realmTypes.getColumnDouble(), 0); assertEquals(allTypes.isColumnBoolean(), realmTypes.isColumnBoolean()); assertEquals(allTypes.getColumnDate(), realmTypes.getColumnDate()); assertArrayEquals(allTypes.getColumnBinary(), realmTypes.getColumnBinary()); assertEquals(allTypes.getColumnRealmObject().getName(), dog.getName()); assertEquals(list.size(), realmTypes.getColumnRealmList().size()); assertEquals(list.get(0).getName(), realmTypes.getColumnRealmList().get(0).getName()); }

Target:
public void copyToRealm() { Date date = new Date(); Dog dog = new Dog(); dog.setName("Fido"); RealmList<Dog> list = new RealmList<Dog>(); list.add(dog); AllTypes allTypes = new AllTypes(); allTypes.setColumnString("String"); allTypes.setColumnLong(1L); allTypes.setColumnFloat(1F); allTypes.setColumnDouble(1D); allTypes.setColumnBoolean(true); allTypes.setColumnDate(date); allTypes.setColumnBinary(new byte[] {1, 2, 3}); allTypes.setColumnRealmObject(dog); allTypes.setColumnRealmList(list); realm.beginTransaction(); AllTypes realmTypes = realm.copyToRealm(allTypes); realm.commitTransaction(); assertNotSame(allTypes, realmTypes); assertEquals(allTypes.getColumnString(), realmTypes.getColumnString()); assertEquals(allTypes.getColumnLong(), realmTypes.getColumnLong()); assertEquals(allTypes.getColumnFloat(), realmTypes.getColumnFloat(), 0); assertEquals(allTypes.getColumnDouble(), realmTypes.getColumnDouble(), 0); assertEquals(allTypes.isColumnBoolean(), realmTypes.isColumnBoolean()); assertEquals(allTypes.getColumnDate(), realmTypes.getColumnDate()); assertArrayEquals(allTypes.getColumnBinary(), realmTypes.getColumnBinary()); assertEquals(allTypes.getColumnRealmObject().getName(), dog.getName()); assertEquals(list.size(), realmTypes.getColumnRealmList().size()); assertEquals(list.get(0).getName(), realmTypes.getColumnRealmList().get(0).getName()); }
Source:
public Builder withOutputFileset(String fileset){ this.outputFilesets.add(fileset); return this; }

Target:
public Builder withOutputFileset(String fileset){ if (fileset!=null && !fileset.isEmpty()){ this.outputFilesets.add(fileset); } return this; }
Source:
private boolean shouldUpdateOnWriteCommand(WriteCommand command) { return configuration.transaction().transactionMode() == TransactionMode.NON_TRANSACTIONAL && !command.hasFlag(Flag.CACHE_MODE_LOCAL); }

Target:
private boolean shouldUpdateOnWriteCommand(WriteCommand command) { return nonTransactional && !command.hasFlag(Flag.CACHE_MODE_LOCAL); }
Source:
void setRangeHighlight(boolean highlight) { if (fromTo != null) { if (highlight && rangeHighlightMarker == null) { rangeHighlightMarker = cm.markText( fromTo.getFrom(), fromTo.getTo(), Configuration.create() .set("className", Resources.I.diffTableStyle().rangeHighlight())); } else if (!highlight && rangeHighlightMarker != null) { rangeHighlightMarker.clear(); rangeHighlightMarker = null; } } }

Target:
void setRangeHighlight(boolean highlight) { if (fromTo != null) { if (highlight && rangeHighlightMarker == null) { rangeHighlightMarker = group.getCm().markText( fromTo.getFrom(), fromTo.getTo(), Configuration.create() .set("className", Resources.I.diffTableStyle().rangeHighlight())); } else if (!highlight && rangeHighlightMarker != null) { rangeHighlightMarker.clear(); rangeHighlightMarker = null; } } }
Source:
public static synchronized List<Integer> getAlleles(final int PLindex, final int ploidy) { if ( PLindex < 0) { throw new IllegalStateException("The PL index " + PLindex + " cannot be negative"); } if (ploidy <= 0) { throw new IllegalStateException("The ploidy must be greater than zero"); } if ( ploidy == 2 ) { final GenotypeLikelihoodsAllelePair pair = getAllelePair(PLindex); return Arrays.asList(pair.alleleIndex1, pair.alleleIndex2); } else { final PLIndexAllelesList plIndexAllelesList = anyploidPloidyToPLIndexAllelesList.computeIfAbsent(ploidy, k -> new PLIndexAllelesList(ploidy)); return plIndexAllelesList.getAlleles(PLindex); } }

Target:
public static synchronized List<Integer> getAlleles(final int PLindex, final int ploidy) { if ( PLindex < 0) { throw new IllegalStateException("The PL index " + PLindex + " cannot be negative"); } if (ploidy <= 0) { throw new IllegalStateException("The ploidy " + ploidy +" must be greater than zero"); } if ( ploidy == 2 ) { final GenotypeLikelihoodsAllelePair pair = getAllelePair(PLindex); return Arrays.asList(pair.alleleIndex1, pair.alleleIndex2); } else { final PLIndexAllelesList plIndexAllelesList = anyploidPloidyToPLIndexAllelesList.computeIfAbsent(ploidy, k -> new PLIndexAllelesList(ploidy)); return plIndexAllelesList.getAlleles(PLindex); } }
Source:
private Deque<NetworkClient.InFlightRequest> requestQueue(String node) { Deque<NetworkClient.InFlightRequest> reqs = requests.get(node); if (reqs == null || reqs.isEmpty()) { throw new IllegalStateException("There are no in-flight requests for node " + node); } return reqs; }

Target:
private Deque<NetworkClient.InFlightRequest> requestQueue(String node) { Deque<NetworkClient.InFlightRequest> reqs = requests.get(node); if (reqs == null || reqs.isEmpty()) throw new IllegalStateException("There are no in-flight requests for node " + node); return reqs; }
Source:
public static boolean isLightEmitting(final Material material) { switch (material) { case GLOWSTONE: case TORCH: case SEA_LANTERN: case BEACON: case REDSTONE_LAMP: case REDSTONE_TORCH: case MAGMA_BLOCK: case LAVA: case JACK_O_LANTERN: case CRYING_OBSIDIAN: case SHROOMLIGHT: case CAMPFIRE: case SOUL_CAMPFIRE: case SOUL_TORCH: case LANTERN: case CONDUIT: case RESPAWN_ANCHOR: case BROWN_MUSHROOM: case BREWING_STAND: case ENDER_CHEST: case END_PORTAL_FRAME: case END_ROD: return true; default: return false; } }

Target:
public static boolean isLightEmitting(final Material material) { switch (material) { case GLOWSTONE: case TORCH: case SEA_LANTERN: case BEACON: case REDSTONE_LAMP: case REDSTONE_TORCH: case MAGMA_BLOCK: case LAVA: case JACK_O_LANTERN: case CRYING_OBSIDIAN: case SHROOMLIGHT: case CAMPFIRE: case SOUL_CAMPFIRE: case SOUL_TORCH: case LANTERN: case SOUL_LANTERN: case CONDUIT: case RESPAWN_ANCHOR: case BROWN_MUSHROOM: case BREWING_STAND: case ENDER_CHEST: case END_PORTAL_FRAME: case END_ROD: return true; default: return false; } }
Source:
public long[] updateGlobalPTSSyncData(String streamName, long baseSystemTime, long basePTS, String type) { long[] newSyncData = {baseSystemTime, basePTS}; try { String entryId = Utils.getEntryIdFromStreamName(streamName); synchronized (this.mapLiveEntryToBaseSystemTime) { if (!this.mapLiveEntryToBaseSystemTime.containsKey(entryId)) { this.mapLiveEntryToBaseSystemTime.put(entryId, newSyncData); logger.warn("PTS_SYNC: (" + streamName + ") [" + type + "] first PTS sync data for entry [" + entryId + "] initializing global PTS sync data to [basePTS:"+ basePTS + ", baseSystemTime" + baseSystemTime +"]"); } else { long[] globalSyncData = this.mapLiveEntryToBaseSystemTime.get(entryId); long clockDiff = baseSystemTime - globalSyncData[GLOBAL_SYSTEM_TIME_INDEX]; long ptsDiff = basePTS - globalSyncData[GLOBAL_BASE_PTS_INDEX]; long ptsMisalignment = clockDiff - ptsDiff; if (Math.abs(ptsMisalignment) > maxAllowedPTSDriftMillisec) { logger.warn("PTS_SYNC: (" + streamName + ") [" + type + "] found PTS jump, PTS misalignment [" + ptsMisalignment + "] milliseconds, replacing global PTS sync data from [basePTS:"+ globalSyncData[GLOBAL_BASE_PTS_INDEX] + ", baseSystemTime" + globalSyncData[GLOBAL_SYSTEM_TIME_INDEX] +"] to [basePTS:" + basePTS + ", baseSystemTime:" + baseSystemTime +"]"); this.mapLiveEntryToBaseSystemTime.put(entryId, newSyncData); } } } } catch (Exception e) { logger.error("PTS_SYNC: (" + streamName + ") fail to sync PTS base timestamp for live entry." + e.toString()); } return newSyncData; }

Target:
public long[] updateGlobalPTSSyncData(String streamName, long baseSystemTime, long basePTS, String type) { long[] newSyncData = {baseSystemTime, basePTS}; try { String entryId = Utils.getEntryIdFromStreamName(streamName); synchronized (this.mapLiveEntryToBaseSystemTime) { if (!this.mapLiveEntryToBaseSystemTime.containsKey(entryId)) { this.mapLiveEntryToBaseSystemTime.put(entryId, newSyncData); logger.warn("PTS_SYNC: (" + streamName + ") [" + type + "] first PTS sync data for entry [" + entryId + "] initializing global PTS sync data to [basePTS:"+ basePTS + ", baseSystemTime" + baseSystemTime +"]"); } else { long[] globalSyncData = this.mapLiveEntryToBaseSystemTime.get(entryId); long clockDiff = baseSystemTime - globalSyncData[GLOBAL_SYSTEM_TIME_INDEX]; long ptsDiff = basePTS - globalSyncData[GLOBAL_BASE_PTS_INDEX]; long ptsMisalignment = clockDiff - ptsDiff; if (Math.abs(ptsMisalignment) > maxAllowedPTSDriftMillisec) { logger.warn("PTS_SYNC: (" + streamName + ") [" + type + "] found PTS jump, PTS misalignment [" + ptsMisalignment + "] milliseconds, replacing global PTS sync data from [basePTS:"+ globalSyncData[GLOBAL_BASE_PTS_INDEX] + ", baseSystemTime" + globalSyncData[GLOBAL_SYSTEM_TIME_INDEX] +"] to [basePTS:" + basePTS + ", baseSystemTime:" + baseSystemTime +"]"); this.mapLiveEntryToBaseSystemTime.put(entryId, newSyncData); } else { newSyncData = globalSyncData; } } } } catch (Exception e) { logger.error("PTS_SYNC: (" + streamName + ") fail to sync PTS base timestamp for live entry." + e.toString()); } return newSyncData; }
Source:
private void constructCacheMapFromMatrixCollection( @Nonnull final IntegerCopyNumberTransitionMatrixCollection transitionMatrixCollection) { transitionMatrixCollection.assertCompleteness(); for (final String sexGenotype : transitionMatrixCollection.getSexGenotypes()) { for (final String contig : transitionMatrixCollection.getContigs()) { sexGenotypeAndContigToTransitionMatrixCacheMap.put(SexGenotypeContigPairKey.of(sexGenotype, contig), new IntegerCopyNumberTransitionProbabilityCache(transitionMatrixCollection.get(sexGenotype, contig))); } } }

Target:
private static Map<SexGenotypeContigPairKey, IntegerCopyNumberTransitionProbabilityCache> constructCacheMapFromMatrixCollection( @Nonnull final IntegerCopyNumberTransitionMatrixCollection transitionMatrixCollection) { transitionMatrixCollection.assertCompleteness(); final Map<SexGenotypeContigPairKey, IntegerCopyNumberTransitionProbabilityCache> cacheMap = new HashMap<>(); for (final String sexGenotype : transitionMatrixCollection.getSexGenotypes()) { for (final String contig : transitionMatrixCollection.getContigs()) { cacheMap.put(SexGenotypeContigPairKey.of(sexGenotype, contig), new IntegerCopyNumberTransitionProbabilityCache(transitionMatrixCollection.get(sexGenotype, contig))); } } return cacheMap; }
Source:
public void assumeNotNullSingleNullThrowsException() { try { assumeNotNull(null); fail("should throw AssumptionViolatedException"); } catch (AssumptionViolatedException e) { } }

Target:
public void assumeNotNullSingleNullThrowsException() { try { assumeNotNull((Object[]) null); fail("should throw AssumptionViolatedException"); } catch (AssumptionViolatedException e) { } }
Source:
public void testProjectWithCustomField() throws IOException, JSONException { String json = MyIOUtils.getResourceAsString("redmine_projectWithCustomField.json"); Project project = RedmineJSONParser.parseProject(RedmineJSONParser .getResponseSingleObject(json, "project")); Assert.assertEquals(project.getCustomFields().size(), 2); Assert.assertNotNull(project.getCustomFieldById(1)); String expectedCustomeFieldValue = "Should have a value"; Assert.assertEquals(expectedCustomeFieldValue, project.getCustomFieldById(1).getValue()); Assert.assertEquals("", project.getCustomFieldById(6).getValue()); }

Target:
public void testProjectWithCustomField() throws IOException, JSONException { String json = MyIOUtils.getResourceAsString("redmine_projectWithCustomField.json"); Project project = RedmineJSONParser.parseProject(RedmineJSONParser .getResponseSingleObject(json, "project")); Assert.assertEquals(project.getCustomFields().size(), 2); String expectedCustomeFieldValue = "Should have a value"; Assert.assertEquals(expectedCustomeFieldValue, project.getCustomFieldById(1).getValue()); Assert.assertEquals("", project.getCustomFieldById(6).getValue()); }
Source:
public Jep getJEPInstance() { long threadId = Thread.currentThread().getId(); Jep jep = jepInstances.get(threadId); if (jep == null) { jep = this.createJEPInstance(); jepInstances.put(threadId, jep); } try { jep.isValidThread(); } catch (JepException e) { LOGGER.warn("JEP instance no longer usable, creating new instance", e); jep = this.createJEPInstance(); jepInstances.put(threadId, jep); } return jep; }

Target:
public Jep getJEPInstance() { long threadId = Thread.currentThread().getId(); Jep jep = jepInstances.get(threadId); if (jep == null) { LOGGER.info("Creating JEP instance for thread " + threadId); jep = this.createJEPInstance(); jepInstances.put(threadId, jep); } try { jep.isValidThread(); } catch (JepException e) { LOGGER.warn("JEP instance no longer usable, creating new instance", e); jep = this.createJEPInstance(); jepInstances.put(threadId, jep); } return jep; }
Source:
void escapeMinimal() { String escapedText = XMLUtils.minimalEscape("a < a' && a' < a\" => a < a\""); assertFalse(escapedText.contains("<"), "Failed to escape <"); assertFalse(escapedText.contains("&&"), "Failed to escape &"); assertTrue(escapedText.contains(">"), "Failed to keep >"); assertTrue(escapedText.contains("'"), "Failed to keep '"); assertTrue(escapedText.contains("\""), "Failed to keep \""); }

Target:
void escapeMinimal() { String actual = XMLUtils.minimalEscape("a < a' && a' < a\" => a < a\""); assertEquals("a &#60; a' &#38;&#38; a' &#60; a\" => a &#60; a\"", actual); }
Source:
public void createPartControl(final Composite parent) { fParentComposite = parent; IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); contributeNewActionToMenu(menuManager); menuManager.add(new Separator()); if (this instanceof ITmfTimeAligned) { contributeAlignViewsActionToToolbar(); fControlListener = new ControlAdapter() { @Override public void controlResized(ControlEvent e) { TIME_ALIGNMENT_SYNCHRONIZER.handleViewResized(TmfView.this); } }; parent.addControlListener(fControlListener); getSite().getPage().addPartListener(new IPartListener() { @Override public void partOpened(IWorkbenchPart part) { } @Override public void partDeactivated(IWorkbenchPart part) { } @Override public void partClosed(IWorkbenchPart part) { if (part == TmfView.this && fControlListener != null && !fParentComposite.isDisposed()) { fParentComposite.removeControlListener(fControlListener); fControlListener = null; getSite().getPage().removePartListener(this); TIME_ALIGNMENT_SYNCHRONIZER.handleViewClosed(TmfView.this); } } @Override public void partBroughtToTop(IWorkbenchPart part) { } @Override public void partActivated(IWorkbenchPart part) { } }); } }

Target:
public void createPartControl(final Composite parent) { fParentComposite = parent; if (this instanceof ITmfAllowMultiple) { contributeNewViewActionToMenu(); } if (this instanceof ITmfTimeAligned) { contributeAlignViewsActionToToolbar(); fControlListener = new ControlAdapter() { @Override public void controlResized(ControlEvent e) { e.display.asyncExec(() -> { TIME_ALIGNMENT_SYNCHRONIZER.handleViewResized(TmfView.this); }); } }; parent.addControlListener(fControlListener); getSite().getPage().addPartListener(new IPartListener() { @Override public void partOpened(IWorkbenchPart part) { } @Override public void partDeactivated(IWorkbenchPart part) { } @Override public void partClosed(IWorkbenchPart part) { if (part == TmfView.this && fControlListener != null && !fParentComposite.isDisposed()) { fParentComposite.removeControlListener(fControlListener); fControlListener = null; getSite().getPage().removePartListener(this); TIME_ALIGNMENT_SYNCHRONIZER.handleViewClosed(TmfView.this); } } @Override public void partBroughtToTop(IWorkbenchPart part) { } @Override public void partActivated(IWorkbenchPart part) { } }); } }
Source:
protected void logException(RuntimeException ex) { if (ex.getMessage() == null || !ex.getMessage().contains("Policy reset")) { log.error("Command '{}' execution failed: {}", this, ex.getMessage()); log.debug("Exception", ex); } }

Target:
private void logException(RuntimeException ex) { if (ex.getMessage() == null || !ex.getMessage().contains("Policy reset")) { log.error("Command '{}' execution failed: {}", this, ex.getMessage()); log.debug("Exception", ex); } }
Source:
protected boolean isURL() { final boolean debug = false; char nc = peek(1); switch (nc) { case ' ': case '\t': case '\r': case '\n': case '"': case '\'': return false; } State cs = this.getCurrent(); UrlValidation syntaxvalid = new UrlValidation(); int where; if ((where = syntaxvalid.isValid(text, cs.start)) != -1) { String ss = new String(text, cs.start, where - cs.start); try { if (new URI(ss) != null) { this.current = cs.start + (ss.length() - 1); this.pop(this.current + 1); if (debug) logger.info("Good : " + ss); return true; } } catch (URISyntaxException e) { if (debug) logger.info("Invalid : " + ss); return false; } } else { if (debug) { int len = Math.min(100, text.length - cs.start); String ss = new String(text, cs.start, len); logger.info("Not even close : " + ss); } } return false; }

Target:
protected boolean isURL() { final boolean debug = false; char nc = peek(1); switch (nc) { case ' ': case '\t': case '\r': case '\n': case '"': case '\'': return false; } State cs = this.getCurrent(); UrlValidation syntaxvalid = new UrlValidation(); int where; if ((where = syntaxvalid.isValid(text, cs.start)) != -1) { String ss = new String(text, cs.start, where - cs.start); try { if (new URI(ss) != null) { this.current = cs.start + (ss.length() - 1); this.pop(this.current + 1); if (debug) System.err.println("Good : " + ss); return true; } } catch (URISyntaxException e) { if (debug) System.err.println("Invalid : " + ss); return false; } } else { if (debug) { int len = Math.min(100, text.length - cs.start); String ss = new String(text, cs.start, len); System.err.println("Not even close : " + ss); } } return false; }
Source:
public void setUserPages(UserPages userPages) { this.userPages = userPages; userPagesNull = false; }

Target:
public void setUserPages(UserPages userPages) { this.userPages = userPages; if (userPages == null) { userPagesNull = true; } else { userPagesNull = false; } }
Source:
public static Object[][] parameters() { return new Object[][]{ new Object[]{false, true, Arrays.asList(cancel(20), checkpoint(10))}, new Object[]{false, true, Arrays.asList(cancel(10), checkpoint(10))}, new Object[]{true, true, Arrays.asList(cancel(10), checkpoint(20))}, new Object[]{true, true, Arrays.asList(checkpoint(10), cancel(10))}, new Object[]{true, true, Arrays.asList(checkpoint(10), cancel(20))}, }; }

Target:
public static Object[][] parameters() { return new Object[][]{ new Object[]{false, true, Arrays.asList(cancel(10), cancel(20)), 1, 0}, new Object[]{false, true, Arrays.asList(cancel(20), cancel(10)), 1, 0}, new Object[]{false, true, Arrays.asList(cancel(10), checkpoint(10)), 1, 0}, new Object[]{true, true, Arrays.asList(cancel(10), checkpoint(20)), 1, 0}, new Object[]{false, true, Arrays.asList(cancel(20), checkpoint(10)), 1, 0}, new Object[]{true, false, Arrays.asList(checkpoint(10), checkpoint(10)), 1, 0}, new Object[]{true, false, Arrays.asList(checkpoint(10), checkpoint(20)), 1, 0}, new Object[]{true, true, Arrays.asList(checkpoint(10), checkpoint(20)), 2, 0}, new Object[]{true, false, Arrays.asList(checkpoint(20), checkpoint(10)), 1, 0}, new Object[]{true, true, Arrays.asList(checkpoint(10), cancel(10)), 1, 0}, new Object[]{true, true, Arrays.asList(checkpoint(10), cancel(20)), 1, 0}, new Object[]{true, true, Arrays.asList(checkpoint(20), cancel(10)), 1, 0}, }; }
Source:
public void handleRequests(Request request) throws InterruptedException { try { DataInputStream stream = new DataInputStream(request.getInputStream()); RequestResponseType type = RequestResponseType.values()[stream.readShort()]; switch (type) { case PutRequest: handlePutRequest(request); break; case GetRequest: handleGetRequest(request); break; case DeleteRequest: handleDeleteRequest(request); break; case TTLRequest: handleTTLRequest(request); break; default: throw new UnsupportedOperationException("Request type not supported"); } } catch (Exception e) { requestResponseChannel.closeConnection(request); } }

Target:
public void handleRequests(Request request) throws InterruptedException { try { DataInputStream stream = new DataInputStream(request.getInputStream()); RequestResponseType type = RequestResponseType.values()[stream.readShort()]; switch (type) { case PutRequest: handlePutRequest(request); break; case GetRequest: handleGetRequest(request); break; case DeleteRequest: handleDeleteRequest(request); break; case TTLRequest: handleTTLRequest(request); break; default: throw new UnsupportedOperationException("Request type not supported"); } } catch (Exception e) { logger.error("Error while handling request {}. Closing connection", e); requestResponseChannel.closeConnection(request); } }
Source:
public String[] getMechanismNames(final Map<String, ?> props) { return new String[] {SaslMechanismInformation.Names.OAUTHBEARER,}; }

Target:
public String[] getMechanismNames(final Map<String, ?> props) { if ("true".equals(props.get(WildFlySasl.MECHANISM_QUERY_ALL))) { return new String[] {SaslMechanismInformation.Names.OAUTHBEARER}; } if ("true".equals(props.get(Sasl.POLICY_NOPLAINTEXT)) || "true".equals(props.get(Sasl.POLICY_NOACTIVE)) || "true".equals(props.get(Sasl.POLICY_NODICTIONARY))) { return new String[] {}; } return new String[] {SaslMechanismInformation.Names.OAUTHBEARER}; }
Source:
public boolean shouldVendorBeSentToPaymentWorks(VendorDetail vendorDetail) { boolean sendToPaymentWorks = vendorDetail.isActiveIndicator() && !(StringUtils.equals(vendorDetail.getVendorHeader().getVendorOwnershipCategoryCode(), "US") || StringUtils.equals(vendorDetail.getVendorHeader().getVendorOwnershipCategoryCode(), "NU") || StringUtils.equals(vendorDetail.getVendorHeader().getVendorOwnershipCategoryCode(), "SE") || StringUtils.equals(vendorDetail.getVendorHeader().getVendorOwnershipCategoryCode(), "UE") || StringUtils.equals(vendorDetail.getVendorHeader().getVendorOwnershipCategoryCode(), "AE")); LOG.debug("shouldVendorBeSentToPaymentWorks1, sendToPaymentWorks: " + sendToPaymentWorks); return sendToPaymentWorks; }

Target:
public boolean shouldVendorBeSentToPaymentWorks(VendorDetail vendorDetail) { boolean sendToPaymentWorks = vendorDetail.isActiveIndicator() && isVendorTypeSendableToPaymentWorks(vendorDetail.getVendorHeader().getVendorTypeCode()); LOG.debug("shouldVendorBeSentToPaymentWorks1, sendToPaymentWorks: " + sendToPaymentWorks); return sendToPaymentWorks; }