auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static ReadCountCollection removeTargetsWithTooManyZeros(final ReadCountCollection readCounts, final int maximumTargetZeros, final Logger logger) { final RealMatrix counts = readCounts.counts(); final Set<Target> targetsToKeep = IntStream.range(0, counts.getRowDimension()).boxed() .filter(i -> countZeroes(counts.getRow(i)) <= maximumTargetZeros) .map(i -> readCounts.targets().get(i)).collect(Collectors.toSet()); final int targetsToDropCount = readCounts.targets().size() - targetsToKeep.size(); if (targetsToDropCount == 0) { logger.info( String.format("No target drop due to too many zero counts; there is no target with a large number of columns with zero counts (<= %d of %d) ", maximumTargetZeros, readCounts.columnNames().size())); return readCounts; } else if (targetsToDropCount == readCounts.targets().size()) { throw new UserException.BadInput("the number of zeros per target in the input is too large resulting in all targets being dropped"); } else { logger.info( String.format("Some targets dropped, %d of %d, as they have too many zeros (> %d of %d)." , targetsToDropCount, readCounts.columnNames().size(), maximumTargetZeros, readCounts.columnNames().size())); return readCounts.subsetTargets(targetsToKeep); } }

Target:
public static ReadCountCollection removeTargetsWithTooManyZeros(final ReadCountCollection readCounts, final int maximumTargetZeros, final Logger logger) { final RealMatrix counts = readCounts.counts(); final Set<Target> targetsToKeep = IntStream.range(0, counts.getRowDimension()).boxed() .filter(i -> countZeroes(counts.getRow(i)) <= maximumTargetZeros) .map(i -> readCounts.targets().get(i)).collect(Collectors.toSet()); final int targetsToDropCount = readCounts.targets().size() - targetsToKeep.size(); if (targetsToDropCount == 0) { logger.info( String.format("There are no targets with large number of columns with zero counts (<= %d of %d) to drop", maximumTargetZeros, readCounts.columnNames().size())); return readCounts; } else if (targetsToDropCount == readCounts.targets().size()) { throw new UserException.BadInput("the number of zeros per target in the input is too large resulting " + "in all targets being dropped"); } else { final double droppedPercentage = ((double)(targetsToDropCount) / readCounts.targets().size()) * 100; logger.info(String.format("Some targets dropped (%d out of %d, %.2f%%) as they had too many zeros (> %d of %d).", targetsToDropCount, readCounts.targets().size(), droppedPercentage, maximumTargetZeros, readCounts.columnNames().size())); return readCounts.subsetTargets(targetsToKeep); } }
Source:
private static Class<?> getFirstGenericParameter(final Type type, final int nestedDepth) { int cDepth = 0; Type tType = type; for (int cDept = 0; cDept < nestedDepth; cDept++) { if (!(tType instanceof ParameterizedType)) throw new IllegalStateException(String.format("Sub type at nesting level %d of %s is expected to be generic", cDepth, type)); tType = ((ParameterizedType) tType).getActualTypeArguments()[0]; } if (tType instanceof ParameterizedType) return (Class<?>) ((ParameterizedType) tType).getRawType(); else if (tType instanceof Class) return (Class<?>) tType; throw new UnsupportedOperationException("Unsupported type " + tType); }

Target:
private static Class<?> getFirstGenericParameter(final Type type, final int nestedDepth) { int cDepth = 0; Type tType = type; for (int cDept = 0; cDept < nestedDepth; cDept++) { if (!(tType instanceof ParameterizedType)) throw new IllegalStateException(String.format("Sub type at nesting level %d of %s is expected to be generic", cDepth, type)); tType = ((ParameterizedType) tType).getActualTypeArguments()[cDept]; } if (tType instanceof ParameterizedType) return (Class<?>) ((ParameterizedType) tType).getRawType(); else if (tType instanceof Class) return (Class<?>) tType; throw new UnsupportedOperationException("Unsupported type " + tType); }
Source:
public void getPatientIdentifiers_shouldFetchAllPatientIdentifiersBelongToGivenPatient() throws Exception { Patient patientWithId2 = Context.getPatientService().getPatient(2); List<PatientIdentifier> patientIdentifiers = dao.getPatientIdentifiers(null, new ArrayList<PatientIdentifierType>(), new ArrayList<Location>(), Collections.singletonList(patientWithId2), null); Assert.assertEquals(patientWithId2.getActiveIdentifiers().size(), patientIdentifiers.size()); Assert.assertEquals("101", patientIdentifiers.get(0).getIdentifier()); Assert.assertEquals("101-6", patientIdentifiers.get(1).getIdentifier()); }

Target:
public void getPatientIdentifiers_shouldFetchAllPatientIdentifiersBelongToGivenPatient() throws Exception { Patient patientWithId2 = Context.getPatientService().getPatient(2); List<PatientIdentifier> patientIdentifiers = dao.getPatientIdentifiers(null, new ArrayList<PatientIdentifierType>(), new ArrayList<Location>(), Collections.singletonList(patientWithId2), null); MatcherAssert.assertThat(patientIdentifiers, containsInAnyOrder(hasIdentifier("101"), hasIdentifier("101-6"))); }
Source:
public void testGetSplitsCombineInTwo() throws Exception { config.set(DatasourceInputFormat.CONF_MAX_SPLIT_SIZE, "6"); List<InputSplit> splits = new DatasourceInputFormat().setSupplier(testFormatter).getSplits(context); Assert.assertEquals(2, splits.size()); Assert.assertEquals( Sets.newHashSet(segments.get(0), segments.get(2)), Sets.newHashSet((((DatasourceInputSplit) splits.get(0)).getSegments())) ); Assert.assertArrayEquals(new String[]{"s2", "s1", "s3"}, splits.get(0).getLocations()); Assert.assertEquals( Sets.newHashSet(segments.get(1)), Sets.newHashSet((((DatasourceInputSplit) splits.get(1)).getSegments())) ); System.out.println(Arrays.toString(splits.get(1).getLocations())); Assert.assertArrayEquals(new String[]{"s1", "s2"}, splits.get(1).getLocations()); }

Target:
public void testGetSplitsCombineInTwo() throws Exception { config.set(DatasourceInputFormat.CONF_MAX_SPLIT_SIZE, "6"); List<InputSplit> splits = new DatasourceInputFormat().setSupplier(testFormatter).getSplits(context); Assert.assertEquals(2, splits.size()); Assert.assertEquals( Sets.newHashSet(segments.get(0), segments.get(2)), Sets.newHashSet((((DatasourceInputSplit) splits.get(0)).getSegments())) ); Assert.assertArrayEquals(new String[]{"s2", "s1", "s3"}, splits.get(0).getLocations()); Assert.assertEquals( Sets.newHashSet(segments.get(1)), Sets.newHashSet((((DatasourceInputSplit) splits.get(1)).getSegments())) ); Assert.assertArrayEquals(new String[]{"s1", "s2"}, splits.get(1).getLocations()); }
Source:
public void aRelayStatus(final Map<String, String> settings) { final Ssld ssld = this.ssldRepository.findByDeviceIdentification( getString(settings, Keys.KEY_DEVICE_IDENTIFICATION, Defaults.DEFAULT_DEVICE_IDENTIFICATION)); final List<DeviceOutputSetting> dosList = new ArrayList<>(); dosList.add(new DeviceOutputSetting(1, 1, RelayType.TARIFF, "test-relay")); dosList.add(new DeviceOutputSetting(2, 2, RelayType.LIGHT, "test-relay")); ssld.updateOutputSettings(dosList); this.relayStatusRepository.save(new RelayStatus(ssld, 1, false, DateTime.now().toDate())); this.relayStatusRepository.save(new RelayStatus(ssld, 2, true, DateTime.now().toDate())); }

Target:
public void aRelayStatus(final Map<String, String> settings) throws Exception { final Ssld ssld = this.ssldRepository.findByDeviceIdentification( getString(settings, Keys.KEY_DEVICE_IDENTIFICATION, Defaults.DEFAULT_DEVICE_IDENTIFICATION)); final String[] deviceOutputSettings = getString(settings, Keys.DEVICE_OUTPUT_SETTINGS, Defaults.DEVICE_OUTPUT_SETTINGS).replaceAll(" ", "").split(Keys.SEPARATOR_SEMICOLON), relayStatuses = getString(settings, Keys.RELAY_STATUSES, Defaults.RELAY_STATUSES).replaceAll(" ", "") .split(Keys.SEPARATOR_SEMICOLON); final List<DeviceOutputSetting> dosList = new ArrayList<>(); for (final String dos : deviceOutputSettings) { final String[] deviceOutputSetting = dos.split(Keys.SEPARATOR_COMMA); dosList.add(new DeviceOutputSetting(Integer.parseInt(deviceOutputSetting[0]), Integer.parseInt(deviceOutputSetting[1]), RelayType.valueOf(deviceOutputSetting[2]), deviceOutputSetting[3])); } ssld.updateOutputSettings(dosList); for (final String rs : relayStatuses) { final String[] relayStatus = rs.split(Keys.SEPARATOR_COMMA); this.relayStatusRepository.save(new RelayStatus(ssld, Integer.parseInt(relayStatus[0]), Boolean.parseBoolean(relayStatus[1]), getDateTime2(relayStatus[2], DateTime.now()).toDate())); } }
Source:
private boolean fetchJobResult(TDJobOperator job) { Optional<ArrayValue> firstRow = job.getResult(ite -> ite.hasNext() ? Optional.of(ite.next()) : Optional.absent()); if (!firstRow.isPresent()) { return false; } ArrayValue row = firstRow.get(); if (row.size() < 1) { throw new TaskExecutionException("Got empty row in result of query", ConfigElement.empty()); } Value firstCol = row.get(0); return !firstCol.isNilValue() && !(firstCol.isBooleanValue() && !firstCol.asBooleanValue().getBoolean()); }

Target:
private boolean fetchJobResult(TDJobOperator job) { Optional<ArrayValue> firstRow = job.getResult(ite -> ite.hasNext() ? Optional.of(ite.next()) : Optional.absent()); if (!firstRow.isPresent()) { return false; } ArrayValue row = firstRow.get(); if (row.size() < 1) { throw new TaskExecutionException("Got empty row in result of query", ConfigElement.empty()); } Value firstCol = row.get(0); return isTruthy(firstCol); }
Source:
public boolean setDebugSession(String sessionId) { boolean changed = true; if (m_sessionState != null && ! m_sessionState.getSessionID().equals(sessionId)) { disposeLoadMeterTimer(); m_sessionState.removeServiceEventListener(fEventListener); m_sessionState.dispose(); m_sessionState = null; changed = true; } if (m_sessionState == null && sessionId != null) { m_sessionState = new DSFSessionState(sessionId); m_sessionState.addServiceEventListener(fEventListener); initializeLoadMeterTimer(); changed = true; } if (changed) update(); return changed; }

Target:
public boolean setDebugSession(String sessionId) { boolean changed = true; if (m_sessionState != null && ! m_sessionState.getSessionID().equals(sessionId)) { disposeLoadMeterTimer(); m_cpuContextsCache = null; m_coreContextsCache = null; m_sessionState.removeServiceEventListener(fEventListener); m_sessionState.dispose(); m_sessionState = null; changed = true; } if (m_sessionState == null && sessionId != null) { m_sessionState = new DSFSessionState(sessionId); m_sessionState.addServiceEventListener(fEventListener); initializeLoadMeterTimer(); changed = true; } if (changed) update(); return changed; }
Source:
public boolean hasPermission( Authentication authentication, Object targetDomainObject, Object permission) { if (authorizationServiceFacade == null) { authorizationServiceFacade = AuthorizationServiceFacade.instance(); } final IAuthorizationPrincipal principal = getAuthorizationPrincipal(authentication); String targetId = null; if (targetDomainObject instanceof String) { targetId = (String) targetDomainObject; } else if (targetDomainObject instanceof JsonEntityBean) { targetId = ((JsonEntityBean) targetDomainObject).getTargetString(); } AuthorizableActivity activity = null; if (permission instanceof AuthorizableActivity) { activity = (AuthorizableActivity) permission; } else if (permission instanceof String) { String activityName = (String) permission; activity = getViewActivity(activityName, (JsonEntityBean) targetDomainObject); } else { throw new RuntimeException( "Unable to determine permission target id for type " + targetDomainObject.getClass()); } logger.warn(String.format("BEACH TEST: in hasPermissions for owner=[%s],activity=[%s],targetId=[%s]", activity.getOwnerFname(), activity.getActivityFname(), targetId)); if (activity != null) { final boolean hasPermission = principal.hasPermission( activity.getOwnerFname(), activity.getActivityFname(), targetId); return hasPermission; } else { return false; } }

Target:
public boolean hasPermission( Authentication authentication, Object targetDomainObject, Object permission) { if (authorizationServiceFacade == null) { authorizationServiceFacade = AuthorizationServiceFacade.instance(); } final IAuthorizationPrincipal principal = getAuthorizationPrincipal(authentication); String targetId = null; if (targetDomainObject instanceof String) { targetId = (String) targetDomainObject; } else if (targetDomainObject instanceof JsonEntityBean) { targetId = ((JsonEntityBean) targetDomainObject).getTargetString(); } AuthorizableActivity activity = null; if (permission instanceof AuthorizableActivity) { activity = (AuthorizableActivity) permission; } else if (permission instanceof String) { String activityName = (String) permission; activity = getViewActivity(activityName, (JsonEntityBean) targetDomainObject); } else { throw new RuntimeException( "Unable to determine permission target id for type " + targetDomainObject.getClass()); } if (this.logger.isTraceEnabled()) { logger.trace( String.format( "In hasPermission() - owner=[%s], activity=[%s], targetId=[%s] ", activity.getOwnerFname(), activity.getActivityFname(), targetId)); } if (activity != null) { final boolean hasPermission = principal.hasPermission( activity.getOwnerFname(), activity.getActivityFname(), targetId); return hasPermission; } else { return false; } }
Source:
private void registerClientResources(Bundle clientBundle) { Hashtable<String, Object> properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/VAADIN/static/client*"); servletClientRegistration.compareAndSet(null, clientBundle.getBundleContext().registerService(Servlet.class, new ResourceServlet(clientBundle, "/META-INF/resources/VAADIN/static/client"), properties)); }

Target:
private void registerClientResources(Bundle clientBundle) { Hashtable<String, Object> properties = new Hashtable<>(); properties.put("osgi.http.whiteboard.servlet.pattern", "/VAADIN/static/client/*"); servletClientRegistration.compareAndSet(null, clientBundle.getBundleContext().registerService(Servlet.class, new ResourceServlet(clientBundle, "/META-INF/resources/VAADIN/static/client"), properties)); }
Source:
private boolean reduceSharedPools(Pool pool) { newConsumed = pool.getConsumed(); long over = pool.getConsumed() - pool.getQuantity(); for (Pool sPool : sharedPools.get(pool)) { if (over > 0) { long excessCount = sPool.getQuantity() - sPool.getConsumed(); long newQuantity = 0; if (excessCount > 0) { Entitlement shareEnt = sPool.getSourceEntitlement(); if (over >= excessCount) { newQuantity = sPool.getQuantity() - excessCount; over = over - excessCount; newConsumed -= excessCount; } else { newQuantity = shareEnt.getQuantity() - over; newConsumed -= over; over = 0L; } addEntitlementToAdjust(shareEnt, newQuantity); } } } return over > 0; }

Target:
private void reduceSharedPools(Pool pool) { long over = pool.getConsumed() - pool.getQuantity(); long newConsumed = poolNewConsumed.get(pool); for (Pool sPool : sharedPools.get(pool)) { if (over > 0) { long excessCount = sPool.getQuantity() - sPool.getConsumed(); long newQuantity; if (excessCount > 0) { Entitlement shareEnt = sPool.getSourceEntitlement(); if (over >= excessCount) { newQuantity = sPool.getQuantity() - excessCount; over = over - excessCount; newConsumed -= excessCount; } else { newQuantity = shareEnt.getQuantity() - over; newConsumed -= over; over = 0L; } addEntitlementToAdjust(shareEnt, newQuantity); } } } poolNewConsumed.put(pool, newConsumed); }
Source:
private String getGitReviewBranchName() { String branchName = null; String gitReviewFilePath = StringUtils.join( new String[]{ProjectManager.getInstance().getOpenProjects()[0].getBasePath(), GITREVIEW_FILENAME}, File.separator); File gitReviewFile = new File(gitReviewFilePath); if (gitReviewFile.exists() && gitReviewFile.isFile()) { try { FileInputStream fileInputStream = new FileInputStream(gitReviewFilePath); Properties properties = new Properties(); properties.load(fileInputStream); branchName = properties.getProperty("defaultbranch"); fileInputStream.close(); } catch (IOException e) { } } return branchName; }

Target:
private Optional<String> getGitReviewBranchName() { Optional<String> branchName = Optional.absent(); DataContext dataContext = DataManager.getInstance().getDataContextFromFocus().getResult(); Optional<Project> openedProject = Optional.fromNullable(CommonDataKeys.PROJECT.getData(dataContext)); if (openedProject.isPresent()) { String gitReviewFilePath = Joiner.on(File.separator).join( openedProject.get().getBasePath(), GITREVIEW_FILENAME); File gitReviewFile = new File(gitReviewFilePath); if (gitReviewFile.exists() && gitReviewFile.isFile()) { FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(gitReviewFilePath); Properties properties = new Properties(); properties.load(fileInputStream); branchName = Optional.fromNullable(properties.getProperty("defaultbranch")); } catch (IOException e) { } finally { if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e) { } } } } } return branchName; }
Source:
public void checkOutputSpecs(JobContext jobContext) { View<E> target = load(jobContext); Configuration conf = Hadoop.JobContext.getConfiguration.invoke(jobContext); switch (conf.getEnum(KITE_WRITE_MODE, WriteMode.DEFAULT)) { case APPEND: break; case OVERWRITE: if (!target.isEmpty()) { target.deleteAll(); } break; default: case DEFAULT: boolean isReady = false; if(target instanceof ReadiableView) { isReady = ((ReadiableView)target).isReady(); } if (!target.isEmpty() || isReady) { throw new DatasetException( "View is not empty or has been signaled as ready: " + target); } break; } }

Target:
public void checkOutputSpecs(JobContext jobContext) { View<E> target = load(jobContext); Configuration conf = Hadoop.JobContext.getConfiguration.invoke(jobContext); switch (conf.getEnum(KITE_WRITE_MODE, WriteMode.DEFAULT)) { case APPEND: break; case OVERWRITE: if (!target.isEmpty()) { target.deleteAll(); } break; default: case DEFAULT: boolean isReady = false; if (target instanceof Signalable) { isReady = ((Signalable)target).isReady(); } if (isReady || !target.isEmpty()) { throw new DatasetException( "View is not empty or has been signaled as ready: " + target); } break; } }
Source:
@Override public RecordWriter<K,VariantContextWritable> getRecordWriter( TaskAttemptContext ctx) throws IOException { Configuration conf = ctx.getConfiguration(); boolean isCompressed = getCompressOutput(ctx); CompressionCodec codec = null; String extension = ""; if (isCompressed) { Class<? extends CompressionCodec> codecClass = getOutputCompressorClass(ctx, GzipCodec.class); codec = ReflectionUtils.newInstance(codecClass, conf); extension = codec.getDefaultExtension(); } Path file = getDefaultWorkFile(ctx, extension); if (!isCompressed) { return getRecordWriter(ctx, file); } else { FileSystem fs = file.getFileSystem(conf); return getRecordWriter(ctx, codec.createOutputStream(fs.create(file))); } }

Target:
@Override public RecordWriter<K,VariantContextWritable> getRecordWriter( TaskAttemptContext ctx) throws IOException { Configuration conf = ctx.getConfiguration(); boolean isCompressed = getCompressOutput(ctx); CompressionCodec codec = null; String extension = ""; if (isCompressed) { Class<? extends CompressionCodec> codecClass = getOutputCompressorClass(ctx, BGZFCodec.class); codec = ReflectionUtils.newInstance(codecClass, conf); extension = codec.getDefaultExtension(); } Path file = getDefaultWorkFile(ctx, extension); if (!isCompressed) { return getRecordWriter(ctx, file); } else { FileSystem fs = file.getFileSystem(conf); return getRecordWriter(ctx, codec.createOutputStream(fs.create(file))); } }
Source:
public List<Identity> getAllowedIdentities() { return null; }

Target:
public List<Identity> getAllowedIdentities() { return new ArrayList<>(); }
Source:
private URI getRedirectUrl(String domainName) throws EWSHttpException, XMLStreamException, IOException, ServiceLocalException, URISyntaxException { String url = String.format(AutodiscoverLegacyHttpUrl, "autodiscover." + domainName); traceMessage(TraceFlags.AutodiscoverConfiguration, String.format("Trying to get Autodiscover redirection URL from %s.", url)); HttpWebRequest request = null; try { request = new HttpClientWebRequest(httpClient, httpContext); if(getWebProxy() != null ){ request.setProxy(getWebProxy()); } try { request.setUrl(URI.create(url).toURL()); } catch (MalformedURLException e) { String strErr = String.format("Incorrect format : %s", url); throw new ServiceLocalException(strErr); } request.setRequestMethod("GET"); request.setAllowAutoRedirect(false); request.setAllowAuthentication(false); prepareCredentials(request); request.prepareConnection(); try { request.executeRequest(); } catch (IOException e) { traceMessage(TraceFlags.AutodiscoverConfiguration, "No Autodiscover redirection URL was returned."); return null; } OutParam<URI> outParam = new OutParam<URI>(); if (tryGetRedirectionResponse(request, outParam)) { return outParam.getParam(); } } finally { if (request != null) { try { request.close(); } catch (Exception e) { } } } traceMessage(TraceFlags.AutodiscoverConfiguration, "No Autodiscover redirection URL was returned."); return null; }

Target:
private URI getRedirectUrl(String domainName) throws EWSHttpException, XMLStreamException, IOException, ServiceLocalException, URISyntaxException { String url = String.format(AutodiscoverLegacyHttpUrl, "autodiscover." + domainName); traceMessage(TraceFlags.AutodiscoverConfiguration, String.format("Trying to get Autodiscover redirection URL from %s.", url)); HttpWebRequest request = null; try { request = new HttpClientWebRequest(httpClient, httpContext); request.setProxy(getWebProxy()); try { request.setUrl(URI.create(url).toURL()); } catch (MalformedURLException e) { String strErr = String.format("Incorrect format : %s", url); throw new ServiceLocalException(strErr); } request.setRequestMethod("GET"); request.setAllowAutoRedirect(false); request.setAllowAuthentication(false); prepareCredentials(request); request.prepareConnection(); try { request.executeRequest(); } catch (IOException e) { traceMessage(TraceFlags.AutodiscoverConfiguration, "No Autodiscover redirection URL was returned."); return null; } OutParam<URI> outParam = new OutParam<URI>(); if (tryGetRedirectionResponse(request, outParam)) { return outParam.getParam(); } } finally { if (request != null) { try { request.close(); } catch (Exception e) { } } } traceMessage(TraceFlags.AutodiscoverConfiguration, "No Autodiscover redirection URL was returned."); return null; }
Source:
IkeNotifyPayload(boolean isCritical, byte[] payloadBody) throws IkeException { super(PAYLOAD_TYPE_NOTIFY, isCritical); ByteBuffer inputBuffer = ByteBuffer.wrap(payloadBody); protocolId = Byte.toUnsignedInt(inputBuffer.get()); spiSize = inputBuffer.get(); notifyType = Short.toUnsignedInt(inputBuffer.getShort()); if (spiSize == SPI_LEN_IPSEC) { if (protocolId != PROTOCOL_ID_AH && protocolId != PROTOCOL_ID_ESP) { throw new InvalidSyntaxException( "Expected Procotol ID AH(2) or ESP(3): Protocol ID is " + protocolId); } if (notifyType != NOTIFY_TYPE_INVALID_SELECTORS && notifyType != NOTIFY_TYPE_CHILD_SA_NOT_FOUND && notifyType != NOTIFY_TYPE_REKEY_SA) { throw new InvalidSyntaxException( "Expected Child SA concerned Notify Type: Notify Type is " + notifyType); } spi = inputBuffer.getInt(); } else if (spiSize == SPI_LEN_NOT_INCLUDED) { if (protocolId != PROTOCOL_ID_CURRENT_IKE_SA) { throw new InvalidSyntaxException( "Expected Procotol ID for current IKE(0): Protocol ID is " + protocolId); } if (notifyType == NOTIFY_TYPE_INVALID_SELECTORS || notifyType == NOTIFY_TYPE_CHILD_SA_NOT_FOUND) { throw new InvalidSyntaxException( "Expected IKE SA concerned Notify Type: Notify Type is " + notifyType); } spi = 0; } else { throw new InvalidSyntaxException("Invalid SPI Size: " + spiSize); } notifyData = new byte[payloadBody.length - NOTIFY_HEADER_LEN]; inputBuffer.get(notifyData); }

Target:
IkeNotifyPayload(boolean isCritical, byte[] payloadBody) throws IkeException { super(PAYLOAD_TYPE_NOTIFY, isCritical); ByteBuffer inputBuffer = ByteBuffer.wrap(payloadBody); protocolId = Byte.toUnsignedInt(inputBuffer.get()); spiSize = inputBuffer.get(); notifyType = Short.toUnsignedInt(inputBuffer.getShort()); if (spiSize == SPI_LEN_IPSEC) { if (protocolId != PROTOCOL_ID_AH && protocolId != PROTOCOL_ID_ESP) { throw new InvalidSyntaxException( "Expected Procotol ID AH(2) or ESP(3): Protocol ID is " + protocolId); } if (!CHILD_CONCERNED_NOTIFY_TYPES.contains(notifyType)) { throw new InvalidSyntaxException( "Expected Child SA concerned Notify Type: Notify Type is " + notifyType); } spi = inputBuffer.getInt(); } else if (spiSize == SPI_LEN_NOT_INCLUDED) { if (protocolId != PROTOCOL_ID_CURRENT_IKE_SA) { throw new InvalidSyntaxException( "Expected Procotol ID for current IKE(0): Protocol ID is " + protocolId); } if (notifyType == NOTIFY_TYPE_INVALID_SELECTORS || notifyType == NOTIFY_TYPE_CHILD_SA_NOT_FOUND) { throw new InvalidSyntaxException( "Expected IKE SA concerned Notify Type: Notify Type is " + notifyType); } spi = 0; } else { throw new InvalidSyntaxException("Invalid SPI Size: " + spiSize); } notifyData = new byte[payloadBody.length - NOTIFY_HEADER_LEN]; inputBuffer.get(notifyData); }
Source:
ColumnManagementView getConditionsPanel() { if (conditionsPanel == null) { conditionsPanel = new ColumnManagementView(getPresenter()); } return conditionsPanel; }

Target:
ColumnManagementView getConditionsPanel() { conditionsPanel = Optional.ofNullable(conditionsPanel).orElse(new ColumnManagementView(getPresenter())); return conditionsPanel; }
Source:
public void testTrigonometricIdentities() throws Throwable { Random random = new Random(); double theta = 90 * random.nextDouble(); String sinExpression = "(" + "sin-degrees" + " " + theta + ")"; Object sinResult = scheme.eval(sinExpression); String cosExpression = "(" + "cos-degrees" + " " + theta + ")"; Object cosResult = scheme.eval(cosExpression); String tanExpression = "(" + "tan-degrees" + " " + theta + ")"; Object tanResult = scheme.eval(tanExpression); double sin = Double.parseDouble(String.valueOf(sinResult)); double cos = Double.parseDouble(String.valueOf(cosResult)); double tan = Double.parseDouble(String.valueOf(tanResult)); assertEquals(tan * cos, sin, DELTA); }

Target:
public void testTrigonometricIdentities() throws Throwable { Random random = new Random(); double theta = 90 * random.nextDouble(); String sinExpression = "(" + "sin-degrees" + " " + theta + ")"; Object sinResult = scheme.eval(sinExpression); String cosExpression = "(" + "cos-degrees" + " " + theta + ")"; Object cosResult = scheme.eval(cosExpression); String tanExpression = "(" + "tan-degrees" + " " + theta + ")"; Object tanResult = scheme.eval(tanExpression); String cosComplementExpression = "(" + "cos-degrees" + " " + (90 - theta) + ")"; Object cosComplementResult = scheme.eval(cosComplementExpression); double sin = Double.parseDouble(String.valueOf(sinResult)); double cos = Double.parseDouble(String.valueOf(cosResult)); double tan = Double.parseDouble(String.valueOf(tanResult)); double cosComplement = Double.parseDouble(String.valueOf(cosComplementResult)); assertEquals(sin, cosComplement, DELTA); assertEquals((Math.pow(sin,2) + Math.pow(cos,2)), 1, DELTA); assertEquals(tan * cos, sin, DELTA); }
Source:
protected ITimeGraphState createTimeGraphState(ITmfStateInterval interval) { ITmfStateSystem stateSystem = getAnalysisModule().getStateSystem(); long startTime = interval.getStartTime(); long duration = interval.getEndTime() - startTime + 1; Integer threadQuark = getThreadQuarkOnCpuAtTime(startTime, interval.getAttribute()); if (threadQuark != null && stateSystem != null) { try { Object value = stateSystem.querySingleState(startTime, threadQuark).getValue(); if (value != null && value instanceof Integer) { if ((int) value !=0) { return new TimeGraphState(startTime, duration, (int) value, value.toString()); } return new TimeGraphState(startTime, duration, (int) value, ""); } } catch (StateSystemDisposedException e) { } } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }

Target:
protected ITimeGraphState createTimeGraphState(ITmfStateInterval interval) { ITmfStateSystem stateSystem = getAnalysisModule().getStateSystem(); long startTime = interval.getStartTime(); long duration = interval.getEndTime() - startTime + 1; try { if (stateSystem != null) { Integer threadQuark = stateSystem.getQuarkRelative(interval.getAttribute(), Attributes.CURRENT_THREAD); Object value = stateSystem.querySingleState(startTime, threadQuark).getValue(); if (value != null && value instanceof Integer) { if ((int) value != 0) { return new TimeGraphState(startTime, duration, (int) value, value.toString()); } return new TimeGraphState(startTime, duration, (int) value, ""); } } } catch (StateSystemDisposedException | AttributeNotFoundException e) { } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }
Source:
public SELF isEqualTo(String stringTemplate, Object ... args){ String expected = String.format(stringTemplate, args); this.comparables.assertEqual(info, actual, expected); return super.isEqualTo(expected); }

Target:
public SELF isEqualTo(String stringTemplate, Object ... args){ String expected = String.format(stringTemplate, args); return super.isEqualTo(expected); }
Source:
public void shouldNotSetRemovalTime_HistoricProcessInstancePermissionsDisabled() { testRule.getProcessEngineConfiguration() .setEnableHistoricInstancePermissions(false); String processInstanceId = testRule.process().userTask().deploy().start(); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); authorization.setResourceId(processInstanceId); authorization.setUserId("foo"); authorizationService.saveAuthorization(authorization); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); testRule.syncExec( historyService.setRemovalTimeToHistoricProcessInstances() .absoluteRemovalTime(REMOVAL_TIME) .byQuery(query) .executeAsync() ); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime()).isNull(); testRule.clearAuthorization(); }

Target:
public void shouldNotSetRemovalTime_HistoricProcessInstancePermissionsDisabled() { testRule.getProcessEngineConfiguration() .setEnableHistoricInstancePermissions(false); String processInstanceId = testRule.process().userTask().deploy().start(); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); authorization.setResourceId(processInstanceId); authorization.setUserId("foo"); authorizationService.saveAuthorization(authorization); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); testRule.syncExec( historyService.setRemovalTimeToHistoricProcessInstances() .absoluteRemovalTime(REMOVAL_TIME) .byQuery(query) .executeAsync() ); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime()).isNull(); }
Source:
private int getAveRtts(List<Integer> rtt) { double sum = 0; for (Integer i : rtt) { sum += i; } return (int) sum / rtt.size(); }

Target:
private static int getAveRtts(List<Integer> rtt) { double sum = 0; for (Integer i : rtt) { sum += i; } return (int) sum / rtt.size(); }
Source:
private void addAnnotationToStore(CFStore store, AnnotationMirror anno, Node node) { for (Node internal : splitAssignments(node)) { Receiver rec = FlowExpressions.internalReprOf(analysis.getTypeFactory(), internal); CFValue currentValueFromStore; if (CFAbstractStore.canInsertReceiver(rec)) { currentValueFromStore = store.getValue(rec); } else { currentValueFromStore = null; } AnnotationMirror currentAnno = (currentValueFromStore == null ? atypefactory.UNKNOWNVAL : getValueAnnotation(currentValueFromStore)); AnnotationMirror newAnno = hierarchy.greatestLowerBound(anno, currentAnno); store.insertValue(rec, newAnno); if (node instanceof FieldAccessNode) { refineArrayAtLengthAccess((FieldAccessNode) internal, store); } else if (node instanceof MethodInvocationNode) { MethodInvocationNode miNode = (MethodInvocationNode) node; if (atypefactory .getMethodIdentifier() .isStringLengthMethod(miNode.getTarget().getMethod())) { refineStringAtLengthInvocation(miNode, store); } else if (atypefactory .getMethodIdentifier() .isArrayGetLengthMethod(miNode.getTarget().getMethod())) { refineArrayAtGetLengthInvocation(miNode, store); } } } }

Target:
private void addAnnotationToStore(CFStore store, AnnotationMirror anno, Node node) { for (Node internal : splitAssignments(node)) { JavaExpression je = JavaExpression.fromNode(analysis.getTypeFactory(), internal); CFValue currentValueFromStore; if (CFAbstractStore.canInsertJavaExpression(je)) { currentValueFromStore = store.getValue(je); } else { currentValueFromStore = null; } AnnotationMirror currentAnno = (currentValueFromStore == null ? atypeFactory.UNKNOWNVAL : getValueAnnotation(currentValueFromStore)); AnnotationMirror newAnno = hierarchy.greatestLowerBound(anno, currentAnno); store.insertValue(je, newAnno); if (node instanceof FieldAccessNode) { refineArrayAtLengthAccess((FieldAccessNode) internal, store); } else if (node instanceof MethodInvocationNode) { MethodInvocationNode miNode = (MethodInvocationNode) node; refineAtLengthInvocation(miNode, store); } } }
Source:
public void shouldRespond_412_WhenSecondRefundRequestAmountAvailableMismatches() { Long refundAmount = 50L; ValidatableResponse validatableResponse = postRefundFor(defaultTestCharge.getExternalChargeId(), refundAmount, defaultTestCharge.getAmount()); String refundId = assertRefundResponseWith(refundAmount, validatableResponse, ACCEPTED.getStatusCode()); validatableResponse = postRefundFor(defaultTestCharge.getExternalChargeId(), refundAmount, defaultTestCharge.getAmount()); validatableResponse.statusCode(PRECONDITION_FAILED.getStatusCode()); List<Map<String, Object>> refundsFoundByChargeId = databaseTestHelper.getRefundsByChargeId(defaultTestCharge.getChargeId()); assertThat(refundsFoundByChargeId.size(), is(1)); assertThat(refundsFoundByChargeId, hasItems(aRefundMatching(refundId, is(notNullValue()), defaultTestCharge.getChargeId(), refundAmount, "REFUNDED"))); assertRefundsHistoryInDBForSuccessfulOrPartialRefund(defaultTestCharge); }

Target:
public void shouldRespond_412_WhenSecondRefundRequestAmountAvailableMismatches() { Long refundAmount = 50L; ValidatableResponse validatableResponse = postRefundFor(defaultTestCharge.getExternalChargeId(), refundAmount, defaultTestCharge.getAmount()); String refundId = assertRefundResponseWith(refundAmount, validatableResponse, ACCEPTED.getStatusCode()); validatableResponse = postRefundFor(defaultTestCharge.getExternalChargeId(), refundAmount, defaultTestCharge.getAmount()); validatableResponse.statusCode(PRECONDITION_FAILED.getStatusCode()); List<Map<String, Object>> refundsFoundByChargeId = databaseTestHelper.getRefundsByChargeId(defaultTestCharge.getChargeId()); assertThat(refundsFoundByChargeId.size(), is(1)); assertThat(refundsFoundByChargeId, hasItems(aRefundMatching(refundId, is(notNullValue()), defaultTestCharge.getChargeId(), refundAmount, "REFUNDED"))); assertRefundsHistoryInOrderInDBForSuccessfulOrPartialRefund(defaultTestCharge); }
Source:
public void testUpdateTemplateTagInfo(){ assertEquals(0, templateResponse.getTags().size()); _templateJoinDaoImpl.updateTemplateTagInformation(template, templateResponse); assertEquals(1, templateResponse.getTags().size()); }

Target:
public void testUpdateTemplateTagInfo(){ testUpdateTagInformation(_templateJoinDaoImpl, template, templateResponse); }
Source:
public void testRetryLogic(int numOfRetries) throws Exception { AzureBlobFileSystem fs = this.getFileSystem(); Configuration config = new Configuration(this.getRawConfiguration()); String accountName = config.get("fs.azure.abfs.account.name"); config.set("fs.azure.account.auth.type." + accountName, "Custom"); config.set("fs.azure.account.oauth.provider.type." + accountName, "org.apache.hadoop.fs" + ".azurebfs.oauth2.RetryTestTokenProvider"); config.set("fs.azure.io.retry.max.retries", Integer.toString(numOfRetries)); config.set("fs.azure.createRemoteFileSystemDuringInitialization", "false"); fs = (AzureBlobFileSystem) FileSystem.newInstance(fs.getUri(), config); RetryTestTokenProvider.ResetStatusToFirstTokenFetch(); try { fs.getFileStatus(new Path("/")); } catch (Exception ex) { } Assert.assertTrue( "Number of token fetch retries (" + RetryTestTokenProvider.reTryCount + ") done, does not match with max " + "retry count configured (" + numOfRetries + ")", RetryTestTokenProvider.reTryCount == numOfRetries); }

Target:
public void testRetryLogic(int numOfRetries) throws Exception { AzureBlobFileSystem fs = this.getFileSystem(); Configuration config = new Configuration(this.getRawConfiguration()); String accountName = config.get("fs.azure.abfs.account.name"); config.set("fs.azure.account.auth.type." + accountName, "Custom"); config.set("fs.azure.account.oauth.provider.type." + accountName, "org.apache.hadoop.fs" + ".azurebfs.oauth2.RetryTestTokenProvider"); config.set("fs.azure.io.retry.max.retries", Integer.toString(numOfRetries)); config.set("fs.azure.createRemoteFileSystemDuringInitialization", "false"); final AzureBlobFileSystem fs1 = (AzureBlobFileSystem) FileSystem.newInstance(fs.getUri(), config); RetryTestTokenProvider.ResetStatusToFirstTokenFetch(); intercept(Exception.class, ()-> { fs1.getFileStatus(new Path("/")); }); Assert.assertTrue( "Number of token fetch retries (" + RetryTestTokenProvider.reTryCount + ") done, does not match with max " + "retry count configured (" + numOfRetries + ")", RetryTestTokenProvider.reTryCount == numOfRetries); }
Source:
private void sessionTimeout(HttpServletRequest request, HttpServletResponse response, WebApp wapp, String dtid, boolean compress) throws ServletException, IOException { final String sid = request.getHeader("ZK-SID"); if (sid != null) { try { Integer.parseInt(sid); } catch (NumberFormatException e) { responseError(request, response, null); return; } response.setHeader("ZK-SID", sid); } final AuWriter out = AuWriters.newInstance(); out.setCompress(compress); out.open(request, response); if (!getAuDecoder(wapp).isIgnorable(request, wapp)) { final String deviceType = getDeviceType(request); URIInfo ui = wapp != null ? wapp.getConfiguration().getTimeoutURI(deviceType) : null; String uri = ui != null ? ui.uri : null; out.write(new AuConfirmClose(null)); final AuResponse resp; if (uri != null) { if (uri.length() != 0) uri = Encodes.encodeURL(getServletContext(), request, response, uri); resp = new AuSendRedirect(uri, null); } else { String msg = wapp.getConfiguration().getTimeoutMessage(deviceType); dtid = XMLs.encodeText(dtid); if (msg != null && msg.startsWith("label:")) { final String key; msg = Labels.getLabel(key = msg.substring(6), new Object[] { dtid }); if (msg == null) log.warn("Label not found, " + key); } if (msg == null) msg = Messages.get(MZk.UPDATE_OBSOLETE_PAGE, dtid); resp = new AuObsolete(dtid, msg); } out.write(resp); } out.close(request, response); }

Target:
private void sessionTimeout(HttpServletRequest request, HttpServletResponse response, WebApp wapp, String dtid, boolean compress) throws ServletException, IOException { final String sid = request.getHeader("ZK-SID"); if (sid != null) { try { Integer.parseInt(sid); } catch (NumberFormatException e) { log.warn("", e); responseError(request, response, "Illegal request"); return; } response.setHeader("ZK-SID", sid); } final AuWriter out = AuWriters.newInstance(); out.setCompress(compress); out.open(request, response); if (!getAuDecoder(wapp).isIgnorable(request, wapp)) { final String deviceType = getDeviceType(request); URIInfo ui = wapp != null ? wapp.getConfiguration().getTimeoutURI(deviceType) : null; String uri = ui != null ? ui.uri : null; out.write(new AuConfirmClose(null)); final AuResponse resp; if (uri != null) { if (uri.length() != 0) uri = Encodes.encodeURL(getServletContext(), request, response, uri); resp = new AuSendRedirect(uri, null); } else { String msg = wapp.getConfiguration().getTimeoutMessage(deviceType); dtid = XMLs.encodeText(dtid); if (msg != null && msg.startsWith("label:")) { final String key; msg = Labels.getLabel(key = msg.substring(6), new Object[] { dtid }); if (msg == null) log.warn("Label not found, " + key); } if (msg == null) msg = Messages.get(MZk.UPDATE_OBSOLETE_PAGE, dtid); resp = new AuObsolete(dtid, msg); } out.write(resp); } out.close(request, response); }
Source:
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { HPCCJDBCUtils.traceoutln(TraceLevel.VERBOSE, "HPCCResultSet updateShort( " + columnIndex + " )" ); throw new UnsupportedOperationException("EclResultSet: Not supported yet."); }

Target:
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { HPCCJDBCUtils.traceoutln(Level.FINEST, "HPCCResultSet updateShort( " + columnIndex + " )" ); throw new UnsupportedOperationException("HPCCResultSet: updateShort Not supported yet."); }
Source:
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { NetRCEntry cc = netrc.entry(uri.getHost()); if (cc == null) return false; for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) { ((CredentialItem.Username) i).setValue(cc.login); continue; } if (i instanceof CredentialItem.Password) { ((CredentialItem.Password) i).setValue(cc.password); continue; } if (i instanceof CredentialItem.StringType) { if (i.getPromptText().equals("Password: ")) { ((CredentialItem.StringType) i).setValue(new String( cc.password)); continue; } } throw new UnsupportedCredentialItem(uri, i.getClass().getName() + ":" + i.getPromptText()); } return true; }

Target:
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { NetRCEntry cc = netrc.getEntry(uri.getHost()); if (cc == null) return false; for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) { ((CredentialItem.Username) i).setValue(cc.login); continue; } if (i instanceof CredentialItem.Password) { ((CredentialItem.Password) i).setValue(cc.password); continue; } if (i instanceof CredentialItem.StringType) { if (i.getPromptText().equals("Password: ")) { ((CredentialItem.StringType) i).setValue(new String( cc.password)); continue; } } throw new UnsupportedCredentialItem(uri, i.getClass().getName() + ":" + i.getPromptText()); } return true; }
Source:
public Control getParent() { return fParent; }

Target:
protected Control getParent() { return fParent; }
Source:
public KafkaCollector(Properties props, String jobName, String topicName) throws IOException { super(props, jobName, topicName); this.topicAndHour = props.getProperty(TOPIC_AND_HOUR); this.fs = FileSystem.get(job.getConfiguration()); this.inputPaths = getInputPaths(); this.tmpPath = new Path(job.getConfiguration().get(TMP_PATH)); this.outputPath = new Path(job.getConfiguration().get(DEST_PATH)); addInputAndOutputPathsToFileInputFormat(); }

Target:
public KafkaCollector(Properties props, String jobName, String topicName) throws IOException { super(props, jobName, topicName); this.topicAndHour = props.getProperty(TOPIC_AND_HOUR); }
Source:
private void enforceTimeLimits() { for (T query : queries.values()) { if (query.isDone()) { continue; } Duration queryMaxRunTime = SystemSessionProperties.getQueryMaxRunTime(query.getSession()); Duration queryMaxExecutionTime = SystemSessionProperties.getQueryMaxExecutionTime(query.getSession()); Optional<DateTime> executionStartTime = query.getExecutionStartTime(); DateTime createTime = query.getCreateTime(); if (executionStartTime.isPresent() && executionStartTime.get().plus(queryMaxExecutionTime.toMillis()).isBeforeNow()) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded the maximum execution time limit of " + queryMaxExecutionTime)); } if (createTime.plus(queryMaxRunTime.toMillis()).isBeforeNow()) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded maximum time limit of " + queryMaxRunTime)); } } }

Target:
private void enforceTimeLimits() { for (T query : queries.values()) { if (query.isDone()) { continue; } Duration queryMaxRunTime = getQueryMaxRunTime(query.getSession()); Duration queryMaxExecutionTime = getQueryMaxExecutionTime(query.getSession()); Optional<DateTime> executionStartTime = query.getExecutionStartTime(); DateTime createTime = query.getCreateTime(); if (executionStartTime.isPresent() && executionStartTime.get().plus(queryMaxExecutionTime.toMillis()).isBeforeNow()) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded the maximum execution time limit of " + queryMaxExecutionTime)); } if (createTime.plus(queryMaxRunTime.toMillis()).isBeforeNow()) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded maximum time limit of " + queryMaxRunTime)); } } }
Source:
private boolean requiresTagsForField(String obj, String fieldName, boolean useTagsInFrom) { if (!useTagsInFrom) { return false; } Boolean result = requiresFullTable.containsKey(obj + "-" + fieldName); if (result != null && result) { return true; } return false; }

Target:
private boolean requiresTagsForField(String obj, String fieldName, boolean useTagsInFrom) { if (useTagsInFrom) { return requiresFullTable.containsKey(obj + "-" + fieldName); } return false; }
Source:
public void start() { if (plannerConfig.isMetadataSegmentCacheEnable()) { scheduledExec = Execs.scheduledSingleThreaded("MetadataSegmentView-Cache--%d"); scheduledExec.schedule(new PollTask(), 0, TimeUnit.MILLISECONDS); } }

Target:
public void start() { if (!lifecycleLock.canStart()) { throw new ISE("can't start."); } try { if (isCacheEnabled) { scheduledExec.schedule(new PollTask(), pollPeriodInMS, TimeUnit.MILLISECONDS); } lifecycleLock.started(); log.info("MetadataSegmentView Started."); } finally { lifecycleLock.exitStart(); } }
Source:
public void should_diff_with_empty_table() { try { DataTable emptyTable = DataTable.create(Collections.emptyList()); table().diff(emptyTable); } catch (IndexOutOfBoundsException e) { String expected = "" + "Tables were not identical:\n" + " - | Aslak | aslak@email.com | 123 |\n" + " - | Joe | joe@email.com | 234 |\n" + " - | Bryan | bryan@email.org | 456 |\n" + " - | Ni | ni@email.com | 654 |\n"; assertEquals(expected, e.getMessage()); throw e; } }

Target:
public void should_diff_with_empty_table() { try { DataTable emptyTable = DataTable.create(Collections.emptyList()); table().diff(emptyTable); } catch (TableDiffException e) { String expected = "" + "Tables were not identical:\n" + " - | Aslak | aslak@email.com | 123 |\n" + " - | Joe | joe@email.com | 234 |\n" + " - | Bryan | bryan@email.org | 456 |\n" + " - | Ni | ni@email.com | 654 |\n"; assertEquals(expected, e.getMessage()); throw e; } }
Source:
public void testStringWithoutTrailingZero() { assertEquals("0", NumberFormats.stringWithoutTrailingZero(String.valueOf(0))); assertEquals("8", NumberFormats.stringWithoutTrailingZero(String.valueOf(8))); assertEquals("-120", NumberFormats.stringWithoutTrailingZero(String.valueOf(-120))); assertEquals("0", NumberFormats.stringWithoutTrailingZero(String.valueOf(0.0))); assertEquals("0.5", NumberFormats.stringWithoutTrailingZero(String.valueOf(0.5))); assertEquals("0.7", NumberFormats.stringWithoutTrailingZero(String.valueOf(0.70))); assertEquals("0.103", NumberFormats.stringWithoutTrailingZero(String.valueOf(0.1030))); assertEquals("15.05", NumberFormats.stringWithoutTrailingZero(String.valueOf(15.050))); assertEquals(stringContainsDot, NumberFormats.stringWithoutTrailingZero(stringContainsDot)); assertEquals(stringValue, NumberFormats.stringWithoutTrailingZero(stringValue)); }

Target:
public void testStringWithoutTrailingZero() { assertEquals(stringWithoutTrailingZero, name); }
Source:
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { addListenerInternal(listener, DataConversion.IDENTITY_KEY, DataConversion.IDENTITY_KEY, filter, converter, classLoader); }

Target:
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { addListenerInternal(listener, DataConversion.IDENTITY_KEY, DataConversion.IDENTITY_VALUE, filter, converter, classLoader); }