auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBufferedMutatorWithNullAndEmptyValues() throws Exception { BufferedMutatorParams params = new BufferedMutatorParams(sharedTestEnv.getDefaultTableName()); try (BufferedMutator bm = getConnection().getBufferedMutator(params)) { Exception actualError = null; try { bm.mutate((List<? extends Mutation>) null); } catch (Exception ex) { actualError = ex; } assertNotNull(actualError); actualError = null; try { bm.mutate(ImmutableList.<Mutation>of()); } catch (Exception ex) { actualError = ex; } assertNull(actualError); actualError = null; try { bm.mutate(new Put(new byte[0])); } catch (Exception ex) { actualError = ex; } assertNotNull(actualError); } }

Target:
public void testBufferedMutatorWithNullAndEmptyValues() throws Exception { BufferedMutatorParams params = new BufferedMutatorParams(sharedTestEnv.getDefaultTableName()); try (BufferedMutator bm = getConnection().getBufferedMutator(params)) { Exception actualError = null; try { bm.mutate((List<? extends Mutation>) null); } catch (Exception ex) { actualError = ex; } assertNotNull(actualError); actualError = null; try { bm.mutate(ImmutableList.<Mutation>of()); } catch (Exception ex) { actualError = ex; } assertNull(actualError); actualError = null; try { bm.mutate(new Put(new byte[0])); } catch (Exception ex) { actualError = ex; } assertNotNull(actualError); actualError = null; try { byte[] rowKey = dataHelper.randomData("test-row"); bm.mutate(new Put(rowKey).addColumn(COLUMN_FAMILY, null, value)); } catch (Exception ex) { actualError = ex; } assertNull(actualError); try { byte[] rowKey = dataHelper.randomData("test-row"); bm.mutate(new Put(rowKey).addColumn(COLUMN_FAMILY, new byte[0], value)); } catch (Exception ex) { actualError = ex; } assertNull(actualError); try { byte[] rowKey = dataHelper.randomData("test-row"); bm.mutate(new Put(rowKey).addColumn(COLUMN_FAMILY, qualifier, null)); } catch (Exception ex) { actualError = ex; } assertNull(actualError); try { byte[] rowKey = dataHelper.randomData("test-row"); bm.mutate(new Put(rowKey).addColumn(COLUMN_FAMILY, qualifier, new byte[0])); } catch (Exception ex) { actualError = ex; } assertNull(actualError); } }
Source:
public void init(Context context) { this.tagToRateLimiterMap = Collections.unmodifiableMap(tagToTargetRateMap.entrySet().stream() .map(e -> { String tag = e.getKey(); int effectiveRate = e.getValue() / context.getContainerContext().getContainerModel().getTasks().keySet().size(); LOGGER.info(String.format("Effective rate limit for task %s and tag %s is %d", context.getTaskContext().getTaskModel().getTaskName(), tag, effectiveRate)); return new ImmutablePair<>(tag, com.google.common.util.concurrent.RateLimiter.create(effectiveRate)); }) .collect(Collectors.toMap(ImmutablePair::getKey, ImmutablePair::getValue)) ); initialized = true; }

Target:
public void init(Context context) { this.tagToRateLimiterMap = Collections.unmodifiableMap(tagToTargetRateMap.entrySet().stream() .map(e -> { String tag = e.getKey(); int numTasksInContainer = context.getContainerContext().getContainerModel().getTasks().keySet().size(); int effectiveRate = e.getValue() / numTasksInContainer; TaskName taskName = context.getTaskContext().getTaskModel().getTaskName(); LOGGER.info(String.format("Effective rate limit for task %s and tag %s is %d", taskName, tag, effectiveRate)); return new ImmutablePair<>(tag, com.google.common.util.concurrent.RateLimiter.create(effectiveRate)); }) .collect(Collectors.toMap(ImmutablePair::getKey, ImmutablePair::getValue)) ); initialized = true; }
Source:
public void setUp() throws Exception { server = newRepo("server"); client = newRepo("client"); testProtocol = new TestProtocol<>(null, new ReceivePackFactory<Object>() { @Override public ReceivePack create(Object req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { return new ReceivePack(db); } }); uri = testProtocol.register(ctx, server); try (TestRepository<?> clientRepo = new TestRepository<>(client)) { obj1 = clientRepo.commit().noFiles().message("test commit 1") .create(); obj2 = clientRepo.commit().noFiles().message("test commit 2") .create(); } }

Target:
public void setUp() throws Exception { server = newRepo("server"); client = newRepo("client"); testProtocol = new TestProtocol<>(null, new ReceivePackFactory<Object>() { @Override public ReceivePack create(Object req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { return new ReceivePack(db); } }); uri = testProtocol.register(ctx, server); try (TestRepository<?> clientRepo = new TestRepository<>(client)) { commitObj1 = clientRepo.commit().noFiles().message("test commit 1") .create(); commitObj2 = clientRepo.commit().noFiles().message("test commit 2") .create(); } }
Source:
public void testCompareLocalWithShared() { StorageDomain sd_shared = new StorageDomain(); sd_shared.setStorageType(StorageType.NFS); StorageDomain sd_local = new StorageDomain(); sd_local.setStorageType(StorageType.LOCALFS); int comparatorReturnValue = comparator.compare(sd_local, sd_shared); assertTrue(comparatorReturnValue < 0); }

Target:
public void testCompareLocalWithShared() { storageDomain1.setStorageType(StorageType.NFS); storageDomain2.setStorageType(StorageType.LOCALFS); assertSmallerThan(storageDomain2, storageDomain1); }
Source:
private CopyResult copyFile(String srcKey, String dstKey, long size) throws IOException, InterruptedIOException { LOG.debug("copyFile -> ", srcKey, dstKey); ProgressListener progressListener = progressEvent -> { switch (progressEvent.getEventType()) { case TRANSFER_PART_COMPLETED_EVENT: incrementWriteOperations(); break; default: break; } }; return once("copyFile(" + srcKey + ", " + dstKey + ")", srcKey, () -> { ObjectMetadata srcom = getObjectMetadata(srcKey); ObjectMetadata dstom = cloneObjectMetadata(srcom); setOptionalObjectMetadata(dstom); CopyObjectRequest copyObjectRequest = new CopyObjectRequest(bucket, srcKey, bucket, dstKey); setOptionalCopyObjectRequestParameters(copyObjectRequest); copyObjectRequest.setCannedAccessControlList(cannedACL); copyObjectRequest.setNewObjectMetadata(dstom); String id = srcom.getVersionId(); if (id != null) { copyObjectRequest.setSourceVersionId(id); } else if (isNotEmpty(srcom.getETag())) { copyObjectRequest.withMatchingETagConstraint(srcom.getETag()); } Copy copy = transfers.copy(copyObjectRequest); copy.addProgressListener(progressListener); try { CopyResult r = copy.waitForCopyResult(); incrementWriteOperations(); instrumentation.filesCopied(1, size); return r; } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted copying " + srcKey + " to " + dstKey + ", cancelling"); } }); }

Target:
private CopyResult copyFile(String srcKey, String dstKey, long size) throws IOException, InterruptedIOException { LOG.debug("copyFile -> ", srcKey, dstKey); ProgressListener progressListener = progressEvent -> { switch (progressEvent.getEventType()) { case TRANSFER_PART_COMPLETED_EVENT: incrementWriteOperations(); break; default: break; } }; try { return once("copyFile(" + srcKey + ", " + dstKey + ")", srcKey, () -> { ObjectMetadata srcom = getObjectMetadata(srcKey); ObjectMetadata dstom = cloneObjectMetadata(srcom); setOptionalObjectMetadata(dstom); CopyObjectRequest copyObjectRequest = new CopyObjectRequest(bucket, srcKey, bucket, dstKey); setOptionalCopyObjectRequestParameters(copyObjectRequest); copyObjectRequest.setCannedAccessControlList(cannedACL); copyObjectRequest.setNewObjectMetadata(dstom); String id = srcom.getVersionId(); if (id != null) { copyObjectRequest.setSourceVersionId(id); } else if (isNotEmpty(srcom.getETag())) { copyObjectRequest.withMatchingETagConstraint(srcom.getETag()); } Copy copy = transfers.copy(copyObjectRequest); copy.addProgressListener(progressListener); try { CopyResult r = copy.waitForCopyResult(); incrementWriteOperations(); instrumentation.filesCopied(1, size); return r; } catch (InterruptedException e) { throw (IOException) new InterruptedIOException( "Interrupted copying " + srcKey + " to " + dstKey + ", cancelling").initCause(e); } }); } catch (RemoteFileChangedException e) { instrumentation.incrementCounter(STREAM_READ_VERSION_MISMATCHES, 1); throw e; } }
Source:
public void testIssue729() throws InterruptedException, IOException { int port = Utils.findOpenPort(); ZContext ctx = new ZContext(); Socket sub = ctx.createSocket(SocketType.SUB); Socket pub = ctx.createSocket(SocketType.PUB); sub.bind("tcp://127.0.0.1:" + port); pub.connect("tcp://127.0.0.1:" + port); boolean subscribe = sub.subscribe(""); assertTrue("SUB Socket could not subscribe", subscribe); ZPoller zPoller = new ZPoller(ctx); zPoller.register(new ZPoller.ZPollItem(sub, null, ZPoller.POLLIN)); Thread server = new Thread(new Runnable() { @Override public void run() { while (true) { pub.send("hello"); try { Thread.sleep(100); } catch (InterruptedException ignored) { } } } }); server.start(); int rc = zPoller.poll(-1); server.interrupt(); assertThat("ZPoller does not understand SUB socket signaled", rc, is(1)); boolean pollin = zPoller.pollin(sub); assertTrue(pollin); String hello = sub.recvStr(); assertThat("recieved message are not identical to what has been sent", hello, is("hello")); }

Target:
public void testIssue729() throws InterruptedException, IOException { int port = Utils.findOpenPort(); ZContext ctx = new ZContext(); Socket sub = ctx.createSocket(SocketType.SUB); Socket pub = ctx.createSocket(SocketType.PUB); sub.bind("tcp://127.0.0.1:" + port); pub.connect("tcp://127.0.0.1:" + port); boolean subscribe = sub.subscribe(""); assertTrue("SUB Socket could not subscribe", subscribe); ZPoller zPoller = new ZPoller(ctx); try { zPoller.register(new ZPoller.ZPollItem(sub, null, ZPoller.POLLIN)); Thread server = new Thread(new Runnable() { @Override public void run() { while (true) { pub.send("hello"); try { Thread.sleep(100); } catch (InterruptedException ignored) { } } } }); server.start(); int rc = zPoller.poll(-1); server.interrupt(); assertThat("ZPoller does not understand SUB socket signaled", rc, is(1)); boolean pollin = zPoller.pollin(sub); assertTrue(pollin); String hello = sub.recvStr(); assertThat("recieved message are not identical to what has been sent", hello, is("hello")); } finally { zPoller.close(); ctx.close(); } }
Source:
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { if (loggerProxy.isEnabled(marker)) { StringBuilder b = threadLocalStringBuilder.get(); for (Entry<String, Gauge> entry : gauges.entrySet()) { logGauge(b, entry.getKey(), entry.getValue()); } if (!getDisabledMetricAttributes().contains(COUNT)) { for (Entry<String, Counter> entry : counters.entrySet()) { logCounter(b, entry.getKey(), entry.getValue()); } } for (Entry<String, Histogram> entry : histograms.entrySet()) { logHistogram(b, entry.getKey(), entry.getValue()); } for (Entry<String, Meter> entry : meters.entrySet()) { logMeter(b, entry.getKey(), entry.getValue()); } for (Entry<String, Timer> entry : timers.entrySet()) { logTimer(b, entry.getKey(), entry.getValue()); } } }

Target:
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { if (loggerProxy.isEnabled(marker)) { StringBuilder b = new StringBuilder(); for (Entry<String, Gauge> entry : gauges.entrySet()) { logGauge(b, entry.getKey(), entry.getValue()); } for (Entry<String, Counter> entry : counters.entrySet()) { logCounter(b, entry.getKey(), entry.getValue()); } for (Entry<String, Histogram> entry : histograms.entrySet()) { logHistogram(b, entry.getKey(), entry.getValue()); } for (Entry<String, Meter> entry : meters.entrySet()) { logMeter(b, entry.getKey(), entry.getValue()); } for (Entry<String, Timer> entry : timers.entrySet()) { logTimer(b, entry.getKey(), entry.getValue()); } } }
Source:
public void traceRangeUpdated(TmfTraceRangeUpdatedSignal signal) { if (signal.getTrace() != fTrace) { return; } boolean drawTimeRangeHistogram = fTraceStartTime == 0; TmfTimeRange fullRange = signal.getRange(); fTraceStartTime = fullRange.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fTraceEndTime = fullRange.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime); fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime); if (drawTimeRangeHistogram) { long startTime = fTrace.getCurrentRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); long duration = fTrace.getCurrentRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue() - startTime; fCurrentTimestamp = fTrace.getCurrentTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fCurrentEventTimeControl.setValue(fCurrentTimestamp); fTimeSpanControl.setValue(duration); fFullTraceHistogram.setTimeRange(startTime, duration); fTimeRangeHistogram.setTimeRange(startTime, duration); sendTimeRangeRequest(startTime, startTime + duration); } sendFullRangeRequest(fullRange); }

Target:
public void traceRangeUpdated(TmfTraceRangeUpdatedSignal signal) { if (signal.getTrace() != fTrace) { return; } TmfTimeRange fullRange = signal.getRange(); fTraceStartTime = fullRange.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fTraceEndTime = fullRange.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime); fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime); sendFullRangeRequest(fullRange); }
Source:
public static TenantId getTenantId(Event event) { checkNotNull(event); return EventEnvelope.of(event) .getTenantId(); }

Target:
public static TenantId getTenantId(Event event) { checkNotNull(event); ActorContext actorContext = getActorContext(event); return actorContext.getTenantId(); }
Source:
String getPinotPredicate(TupleDomain<ColumnHandle> constraintSummary) { ImmutableList.Builder<String> pinotFilterBuilder = ImmutableList.builder(); Map<ColumnHandle, Domain> columnHandleDomainMap = constraintSummary.getDomains().get(); for (ColumnHandle k : columnHandleDomainMap.keySet()) { Domain domain = columnHandleDomainMap.get(k); String columnPredicate = getColumnPredicate(domain, ((PinotColumnHandle) k).getColumnName()); if (!columnPredicate.isEmpty()) { pinotFilterBuilder.add("(" + columnPredicate + ")"); } } return Joiner.on(" AND ").join(pinotFilterBuilder.build()); }

Target:
static String getPinotPredicate(TupleDomain<ColumnHandle> constraintSummary) { ImmutableList.Builder<String> pinotFilterBuilder = ImmutableList.builder(); Map<ColumnHandle, Domain> columnHandleDomainMap = constraintSummary.getDomains().get(); for (ColumnHandle k : columnHandleDomainMap.keySet()) { Domain domain = columnHandleDomainMap.get(k); String columnPredicate = getColumnPredicate(domain, ((PinotColumnHandle) k).getColumnName()); if (!columnPredicate.isEmpty()) { pinotFilterBuilder.add("(" + columnPredicate + ")"); } } return Joiner.on(" AND ").join(pinotFilterBuilder.build()); }
Source:
public IStatus run(IProgressMonitor monitor) { final StringBuilder sb = new StringBuilder(); monitor.beginTask(Messages.CopyToClipboardJob_Name, (int) (fEnd - fStart + 1)); if (fColumns != null) { boolean needTab = false; for (TmfEventTableColumn column : fColumns) { if (needTab) { sb.append('\t'); } sb.append(column.getHeaderName()); needTab = true; } sb.append('\n'); } copy(sb, monitor); Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (sb.length() == 0) { return; } Clipboard clipboard = new Clipboard(Display.getDefault()); clipboard.setContents(new Object[] { sb.toString() }, new Transfer[] { TextTransfer.getInstance() }); } }); monitor.done(); return Status.OK_STATUS; }

Target:
public IStatus run(IProgressMonitor monitor) { final StringBuilder sb = new StringBuilder(); monitor.beginTask(Messages.CopyToClipboardJob_Name, (int) (fEndRank - fStartRank + 1)); boolean needTab = false; for (TmfEventTableColumn column : fColumns) { if (needTab) { sb.append('\t'); } sb.append(column.getHeaderName()); needTab = true; } sb.append(LINE_SEPARATOR); copy(sb, monitor); Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (sb.length() == 0) { return; } Clipboard clipboard = new Clipboard(Display.getDefault()); clipboard.setContents(new Object[] { sb.toString() }, new Transfer[] { TextTransfer.getInstance() }); } }); monitor.done(); return Status.OK_STATUS; }
Source:
public static SignedCertificateTimestamp decode(InputStream input, Origin origin) throws SerializationException { int version = Serialization.readNumber(input, CTConstants.VERSION_LENGTH); if (version != CTConstants.SCT_VERSION_V1) { throw new SerializationException("Unsupported SCT version " + version); } return new SignedCertificateTimestamp( version, Serialization.readFixedBytes(input, CTConstants.LOGID_LENGTH), Serialization.readLong(input, CTConstants.TIMESTAMP_LENGTH), Serialization.readVariableBytes(input, CTConstants.EXTENSIONS_LENGTH_BYTES), DigitallySigned.decode(input), origin ); }

Target:
public static SignedCertificateTimestamp decode(InputStream input, Origin origin) throws SerializationException { int version = Serialization.readNumber(input, CTConstants.VERSION_LENGTH); if (version != Version.V1.ordinal()) { throw new SerializationException("Unsupported SCT version " + version); } return new SignedCertificateTimestamp( Version.V1, Serialization.readFixedBytes(input, CTConstants.LOGID_LENGTH), Serialization.readLong(input, CTConstants.TIMESTAMP_LENGTH), Serialization.readVariableBytes(input, CTConstants.EXTENSIONS_LENGTH_BYTES), DigitallySigned.decode(input), origin ); }
Source:
protected boolean runSafe() { TrackerStatus status = activeSegments.get(segmentId); TrackerStatus[] newStatus = status.split(); int newSegmentId = newStatus[1].getSegment().getSegmentId(); tokenStore.initializeSegment(newStatus[1].getTrackingToken(), getName(), newSegmentId); activeSegments.put(segmentId, newStatus[0]); return true; }

Target:
protected boolean runSafe() { logger.info("Processing split instruction for segment in processor [{}]", segmentId, getName()); TrackerStatus status = activeSegments.get(segmentId); TrackerStatus[] newStatus = status.split(); int newSegmentId = newStatus[1].getSegment().getSegmentId(); tokenStore.initializeSegment(newStatus[1].getTrackingToken(), getName(), newSegmentId); activeSegments.put(segmentId, newStatus[0]); return true; }
Source:
public int deduceIdealSplitWeight(final IntervalList intervalList, final int nCount) { final int splitWidth = super.deduceIdealSplitWeight(intervalList, nCount); final int widestIntervalLength = intervalList.getIntervals().stream() .map(Interval::length) .max(Comparator.comparing(Integer::valueOf)) .orElse(1); return Math.max(widestIntervalLength, splitWidth); }

Target:
public int deduceIdealSplitWeight(final IntervalList intervalList, final int nCount) { final int splitWidth = super.deduceIdealSplitWeight(intervalList, nCount); final int widestIntervalLength = intervalList.getIntervals().stream() .mapToInt(Interval::length) .max() .orElse(1); return Math.max(widestIntervalLength, splitWidth); }
Source:
private float[] calculateHighData(byte[] valueByte) { logger.debug("Received High Data value: {}", byteArrayToHexString(valueByte)); float[] highData = new float[10]; if (sensorFusion[0] == 0x00) { int Ax = shortSignedAtOffset(valueByte, 0); int Ay = shortSignedAtOffset(valueByte, 2); int Az = shortSignedAtOffset(valueByte, 4); int Gx = shortSignedAtOffset(valueByte, 6); int Gy = shortSignedAtOffset(valueByte, 8); int Gz = shortSignedAtOffset(valueByte, 10); highData[0] = Ax; highData[1] = Ay; highData[2] = Az; highData[3] = Gx; highData[4] = Gy; highData[5] = Gz; highData[6] = 0; highData[7] = 0; highData[8] = 0; highData[9] = 0; } else { float dataM = fromByteArrayToFloat(splitBytesArray(valueByte, 0)); float dataX = fromByteArrayToFloat(splitBytesArray(valueByte, 4)); float dataY = fromByteArrayToFloat(splitBytesArray(valueByte, 8)); float dataZ = fromByteArrayToFloat(splitBytesArray(valueByte, 12)); highData[0] = 0; highData[1] = 0; highData[2] = 0; highData[3] = 0; highData[4] = 0; highData[5] = 0; highData[6] = dataM; highData[7] = dataX; highData[8] = dataY; highData[9] = dataZ; } return highData; }

Target:
private float[] calculateHighData(byte[] valueByte) { logger.debug("Received High Data value: {}", byteArrayToHexString(valueByte)); float[] highData = new float[10]; if (sensorFusion[0] == 0x00) { int ax = shortSignedAtOffset(valueByte, 0); int ay = shortSignedAtOffset(valueByte, 2); int az = shortSignedAtOffset(valueByte, 4); int gx = shortSignedAtOffset(valueByte, 6); int gy = shortSignedAtOffset(valueByte, 8); int gz = shortSignedAtOffset(valueByte, 10); highData[0] = ax; highData[1] = ay; highData[2] = az; highData[3] = gx; highData[4] = gy; highData[5] = gz; highData[6] = 0; highData[7] = 0; highData[8] = 0; highData[9] = 0; } else { float dataM = fromByteArrayToFloat(splitBytesArray(valueByte, 0)); float dataX = fromByteArrayToFloat(splitBytesArray(valueByte, 4)); float dataY = fromByteArrayToFloat(splitBytesArray(valueByte, 8)); float dataZ = fromByteArrayToFloat(splitBytesArray(valueByte, 12)); highData[0] = 0; highData[1] = 0; highData[2] = 0; highData[3] = 0; highData[4] = 0; highData[5] = 0; highData[6] = dataM; highData[7] = dataX; highData[8] = dataY; highData[9] = dataZ; } return highData; }
Source:
public void testMoveFromServerInMaintenance() { mockDruidServer(druidServer1, "1", "normal", 30L, 100L, segments); mockDruidServer(druidServer2, "2", "normal", 0L, 100L, Collections.emptyMap()); replay(druidServer3); replay(druidServer4); mockCoordinator(coordinator); ServerHolder holder2 = new ServerHolder(druidServer2, peon2, false); BalancerStrategy strategy = EasyMock.createMock(BalancerStrategy.class); EasyMock.expect(strategy.pickSegmentToMove(anyObject())).andReturn(new BalancerSegmentHolder(druidServer1, segment1)).once(); EasyMock.expect(strategy.findNewSegmentHomeBalancer(anyObject(), anyObject())).andReturn(holder2).once(); replay(strategy); DruidCoordinatorRuntimeParams params = defaultRuntimeParamsBuilder( ImmutableList.of(druidServer1, druidServer2), ImmutableList.of(peon1, peon2), ImmutableList.of(true, false) ) .withDynamicConfigs( CoordinatorDynamicConfig.builder().withMaxSegmentsToMove( 1 ).build() ) .withBalancerStrategy(strategy) .build(); params = new DruidCoordinatorBalancerTester(coordinator).run(params); Assert.assertEquals(1, params.getCoordinatorStats().getTieredStat("movedCount", "normal")); Assert.assertEquals(0, peon1.getNumberOfSegmentsInQueue()); Assert.assertEquals(1, peon2.getNumberOfSegmentsInQueue()); }

Target:
public void testMoveFromServerInMaintenance() { mockDruidServer(druidServer1, "1", "normal", 30L, 100L, segments); mockDruidServer(druidServer2, "2", "normal", 0L, 100L, Collections.emptyList()); replay(druidServer3); replay(druidServer4); mockCoordinator(coordinator); ServerHolder holder2 = new ServerHolder(druidServer2, peon2, false); BalancerStrategy strategy = EasyMock.createMock(BalancerStrategy.class); EasyMock.expect(strategy.pickSegmentToMove(anyObject())) .andReturn(new BalancerSegmentHolder(druidServer1, segment1)) .once(); EasyMock.expect(strategy.findNewSegmentHomeBalancer(anyObject(), anyObject())).andReturn(holder2).once(); replay(strategy); DruidCoordinatorRuntimeParams params = defaultRuntimeParamsBuilder( ImmutableList.of(druidServer1, druidServer2), ImmutableList.of(peon1, peon2), ImmutableList.of(true, false) ) .withDynamicConfigs(CoordinatorDynamicConfig.builder().withMaxSegmentsToMove(1).build()) .withBalancerStrategy(strategy) .build(); params = new DruidCoordinatorBalancerTester(coordinator).run(params); Assert.assertEquals(1, params.getCoordinatorStats().getTieredStat("movedCount", "normal")); Assert.assertEquals(0, peon1.getNumberOfSegmentsInQueue()); Assert.assertEquals(1, peon2.getNumberOfSegmentsInQueue()); }
Source:
private ProbeBuilderImpl withMetricTag(String metricName) { return withTag("metric", prefixedMetricName(metricName), true); }

Target:
private ProbeBuilderImpl withMetricTag(String metricName) { return withTag("metric", metricNamePrefix != null ? metricNamePrefix + '.' + metricName : metricName); }
Source:
public static void fireOnCreated(@Nonnull Node node) { for (NodeListener nl: all()) { nl.onCreated(node); } }

Target:
public static void fireOnCreated(@Nonnull Node node) { for (NodeListener nl: all()) { try { nl.onCreated(node); } catch (Throwable ex) { LOGGER.log(Level.WARNING, "Listener invocation failed", ex); } } }
Source:
protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); try { final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } } catch (Exception e) { LOGGER.warning("There was an issue while parsing node with name " + originalName + " - A fallback will be used for it"); } return joinPrefixWithIndexedSuffix(originalName); }

Target:
protected String composeUniqueNodeName(final String name) { final String originalName = Optional.ofNullable(name).orElse(""); final MatchResult nameSuffixMatcher = NAME_SUFFIX_REGEX.exec(originalName); if (nameSuffixMatcher != null) { return buildNameWithIncrementedSuffixIndex(originalName, nameSuffixMatcher); } return joinPrefixWithIndexedSuffix(originalName); }
Source:
public void endWindow() { try { if (currentWindowId > windowManager.getLargestRecoveryWindow()) { if (currentWindowRecoveryState == null) { currentWindowRecoveryState = new MutablePair<Integer, Integer>(); } MutablePair<Integer, Integer> windowBoundaryPair = new MutablePair<>(lowerBound, lastEmittedRecord); currentWindowRecoveryState = windowBoundaryPair; windowManager.save(currentWindowRecoveryState, operatorId, currentWindowId); } } catch (IOException e) { throw new RuntimeException("saving recovery", e); } currentWindowRecoveryState = new MutablePair<>(); }

Target:
public void endWindow() { try { if (currentWindowId > windowManager.getLargestRecoveryWindow()) { currentWindowRecoveryState = new MutablePair<>(lowerBound, lastEmittedRow); windowManager.save(currentWindowRecoveryState, operatorId, currentWindowId); } } catch (IOException e) { throw new RuntimeException("saving recovery", e); } if (threadException != null) { store.disconnect(); DTThrowable.rethrow(threadException.get()); } }
Source:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vmName", "description", "domain", "os", "osType", "creationDate", "numOfMonitors", "allowConsoleReconnect", "usbPolicy", "autoSuspend", "autoStartup", "dedicatedVmForVds", "defaultDisplayType", "priority", "defaultBootSequence", "initrdUrl", "kernelUrl", "kernelParams", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled","deleteProtected","dbGeneration", "images", "interfaces", "useHostCpuFlags", "quotaDefault", "vncKeyboardLayout" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vdsGroupId", "timeZone", "stateless", "niceLevel", "memSizeMb", "numOfSockets", "cpuPerSocket", "isoPath", "userDefinedProperties", "predefinedProperties", "customProperties" })); }

Target:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vmName", "description", "domain", "os", "osType", "creationDate", "allowConsoleReconnect", "usbPolicy", "autoSuspend", "autoStartup", "dedicatedVmForVds", "priority", "defaultBootSequence", "initrdUrl", "kernelUrl", "kernelParams", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled","deleteProtected","dbGeneration", "images", "interfaces", "useHostCpuFlags", "quotaDefault", "tunnelMigration" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vdsGroupId", "timeZone", "stateless", "niceLevel", "memSizeMb", "numOfSockets", "cpuPerSocket", "isoPath", "userDefinedProperties", "predefinedProperties", "customProperties", "defaultDisplayType", "numOfMonitors", "vncKeyboardLayout" })); }
Source:
private List<TriggerEventRequest> buildCohortQueryTriggers(String configName) { List<TriggerEventRequest> triggers = new ArrayList<>(); List<EventParameterRequest> parameterRequests = new ArrayList<>(); parameterRequests.add(new EventParameterRequest(DisplayNames.PERSON_UUID, Keys.PATIENT_UUID)); parameterRequests.add(new EventParameterRequest(DisplayNames.PATIENT_DISPLAY, Keys.PATIENT_DISPLAY)); parameterRequests.add(new EventParameterRequest(DisplayNames.COHORTQUERY_UUID, Keys.COHORT_QUERY_UUID)); String displayName = DisplayNameHelper.buildDisplayName(DisplayNames.COHORT_REPORTMEMBER, configName); triggers.add(new TriggerEventRequest(displayName, EventKeys.BASE_SUBJECT + "Cohort.ReportMember", null, parameterRequests)); return triggers; }

Target:
private List<TriggerEventRequest> buildCohortQueryTriggers(String configName) { List<TriggerEventRequest> triggers = new ArrayList<>(); List<EventParameterRequest> parameterRequests = new ArrayList<>(); parameterRequests.add(new EventParameterRequest(DisplayNames.PERSON_UUID, Keys.PATIENT_UUID)); parameterRequests.add(new EventParameterRequest(DisplayNames.PATIENT_DISPLAY, Keys.PATIENT_DISPLAY)); parameterRequests.add(new EventParameterRequest(DisplayNames.COHORTQUERY_UUID, Keys.COHORT_QUERY_UUID)); String displayName = DisplayNameHelper.buildDisplayName(DisplayNames.COHORT_REPORTMEMBER, configName); triggers.add(new TriggerEventRequest(displayName, EventSubjects.GET_COHORT_QUERY_MEMBER_EVENT, null, parameterRequests)); return triggers; }
Source:
public <E extends Throwable> void expectErrorWithMessage(Class<E> expected, List<String> requiredMessagePartAlternatives) throws Exception { expectErrorWithMessage(expected, requiredMessagePartAlternatives, env.defaultTimeoutMillis(), env.defaultPollTimeoutMillis); }

Target:
public <E extends Throwable> void expectErrorWithMessage(Class<E> expected, List<String> requiredMessagePartAlternatives) throws Exception { expectErrorWithMessage(expected, requiredMessagePartAlternatives, env.defaultTimeoutMillis(), env.defaultPollTimeoutMillis()); }
Source:
public TaskStatus run(final TaskToolbox toolbox) throws Exception { if (indexTaskSpecs == null) { indexTaskSpecs = createIngestionSchema( toolbox, segmentProvider, dimensionsSpec, keepSegmentGranularity, tuningConfig, jsonMapper ).stream() .map(spec -> new IndexTask( getId(), getGroupId(), getTaskResource(), getDataSource(), spec, getContext(), authorizerMapper, chatHandlerProvider, rowIngestionMetersFactory )) .collect(Collectors.toList()); } if (indexTaskSpecs.isEmpty()) { log.warn("Interval[%s] has no segments, nothing to do.", interval); return TaskStatus.failure(getId()); } else { log.info("Generated [%d] compaction task specs: ", indexTaskSpecs.size()); for (IndexTask eachSpec : indexTaskSpecs) { final String json = jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(eachSpec); log.info("Running indexSpec: " + json); final TaskStatus eachResult = eachSpec.run(toolbox); if (!eachResult.isSuccess()) { log.warn("Running indexSpec failed. Trying to the next indexSpec."); } } return TaskStatus.success(getId()); } }

Target:
public TaskStatus run(final TaskToolbox toolbox) throws Exception { if (indexTaskSpecs == null) { indexTaskSpecs = createIngestionSchema( toolbox, segmentProvider, dimensionsSpec, keepSegmentGranularity, tuningConfig, jsonMapper ).stream() .map(spec -> new IndexTask( getId(), getGroupId(), getTaskResource(), getDataSource(), spec, getContext(), authorizerMapper, chatHandlerProvider, rowIngestionMetersFactory )) .collect(Collectors.toList()); } if (indexTaskSpecs.isEmpty()) { log.warn("Interval[%s] has no segments, nothing to do.", interval); return TaskStatus.failure(getId()); } else { log.info("Generated [%d] compaction task specs", indexTaskSpecs.size()); for (IndexTask eachSpec : indexTaskSpecs) { final String json = jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(eachSpec); log.info("Running indexSpec: " + json); try { final TaskStatus eachResult = eachSpec.run(toolbox); if (!eachResult.isSuccess()) { log.warn("Failed to run indexSpec: [%s].\nTrying the next indexSpec.", json); } } catch (Exception e) { log.warn(e, "Failed to run indexSpec: [%s].\nTrying the next indexSpec.", json); } } return TaskStatus.success(getId()); } }
Source:
public void reportJobCompletion(String pluginId, String elasticAgentId, JobIdentifier jobIdentifier) { VersionedElasticAgentExtension elasticAgentExtension = getVersionedElasticAgentExtension(pluginId); if (elasticAgentExtension.getExtensionVersion() != VERSION_NOT_SUPPORTING_JOB_COMPLETION_REQUEST) { elasticAgentExtension.jobCompletion(pluginId, elasticAgentId, jobIdentifier); } }

Target:
public void reportJobCompletion(String pluginId, String elasticAgentId, JobIdentifier jobIdentifier) { VersionedElasticAgentExtension elasticAgentExtension = getVersionedElasticAgentExtension(pluginId); elasticAgentExtension.jobCompletion(pluginId, elasticAgentId, jobIdentifier); }
Source:
void thread2() { int[] vs1; synchronized (lock) { vs1 = values; state = 1; } int s; do { synchronized (lock) { s = state; } } while (s != 2); int[] vs2; synchronized (lock) { vs2 = values; } int v1 = vs1[0]; int v2 = vs2[0]; System.out.println("b17689750TestMonitor failed: " + v1 + ", " + v2); }

Target:
void thread2() { int[] vs1; synchronized (lock) { vs1 = values; state = 1; } int s; do { synchronized (lock) { s = state; } } while (s != 2); int[] vs2 = values; int v1 = vs1[0]; int v2 = vs2[0]; System.out.println("b17689750TestMonitor failed: " + v1 + ", " + v2); }
Source:
private void validate(ClientDescriptor clientDescriptor, ValidateStoreManager message) throws ClusterException { validateClientConnected(clientDescriptor); UUID clientId = clientStateMap.get(clientDescriptor).getClientIdentifier(); if (clientId != null) { throw new LifecycleException("Client : " + clientDescriptor + " is already being tracked with Client Id : " + clientId); } if (getTrackedClients().contains(message.getClientId())) { throw new InvalidClientIdException("Client ID : " + message.getClientId() + " is already being tracked."); } ehcacheStateService.validate(message.getConfiguration()); management.clientValidated(clientDescriptor, this.clientStateMap.get(clientDescriptor)); }

Target:
private void validate(ClientDescriptor clientDescriptor, ValidateStoreManager message) throws ClusterException { validateClientConnected(clientDescriptor); ClientState clientState = clientStateMap.get(clientDescriptor); UUID clientId = clientState.getClientIdentifier(); if (clientId != null) { throw new LifecycleException("Client : " + clientDescriptor + " is already being tracked with Client Id : " + clientId); } if (getTrackedClients().contains(message.getClientId())) { throw new InvalidClientIdException("Client ID : " + message.getClientId() + " is already being tracked."); } ehcacheStateService.validate(message.getConfiguration()); clientState.attach(message.getClientId()); management.clientValidated(clientDescriptor, clientState); }
Source:
public void setup() { String tpch = "tpch"; session = testSessionBuilder() .setCatalog(tpch) .setSchema("sf1000") .setSystemProperty("iterative_optimizer_enabled", iterativeOptimizerEnabled) .build(); queryRunner = new LocalQueryRunner(session); queryRunner.createCatalog(tpch, new TpchConnectorFactory(4), ImmutableMap.of("tpch.column-naming", "standard")); queries = IntStream.rangeClosed(1, 22) .boxed() .filter(i -> i != 15) .map(i -> readResource(String.format("/io/airlift/tpch/queries/q%d.sql", i))) .collect(toImmutableList()); }

Target:
public void setup() { String tpch = "tpch"; session = testSessionBuilder() .setCatalog(tpch) .setSchema("sf1") .setSystemProperty("iterative_optimizer_enabled", iterativeOptimizerEnabled) .build(); queryRunner = new LocalQueryRunner(session); queryRunner.createCatalog(tpch, new TpchConnectorFactory(4), ImmutableMap.of("tpch.column-naming", "standard")); queries = IntStream.rangeClosed(1, 22) .boxed() .filter(i -> i != 15) .map(i -> readResource(String.format("/io/airlift/tpch/queries/q%d.sql", i))) .collect(toImmutableList()); }
Source:
public static synchronized void writeToOneWire(String pvDevicePropertyPath, String pvValue) { int lvAttempt = 1; while (lvAttempt <= cvRetry) { try { logger.debug("Trying to write '{}' to '{}', write attempt={}", new Object[] { pvValue, pvDevicePropertyPath, lvAttempt }); if (checkIfDeviceExists(pvDevicePropertyPath)) { OneWireConnection.getConnection().write(pvDevicePropertyPath, pvValue); return; } else { logger.info("There is no device for path {}, write attempt={}", new Object[] { pvDevicePropertyPath, lvAttempt }); } } catch (OwfsException oe) { logger.error("Writing to path attempt threw an exception", pvValue, pvDevicePropertyPath, lvAttempt, oe); reconnect(); } catch (IOException ioe) { logger.error("Couldn't establish network connection while write attempt to '{}'" + " ip:port={}:{}", lvAttempt, pvDevicePropertyPath, cvIp, cvPort, ioe); reconnect(); } finally { lvAttempt++; } } }

Target:
public static synchronized void writeToOneWire(String pvDevicePropertyPath, String pvValue) { int lvAttempt = 1; while (lvAttempt <= cvRetry) { try { logger.debug("Trying to write '{}' to '{}', write attempt={}", pvValue, pvDevicePropertyPath, lvAttempt); if (checkIfDeviceExists(pvDevicePropertyPath)) { OneWireConnection.getConnection().write(pvDevicePropertyPath, pvValue); return; } else { logger.info("There is no device for path {}, write attempt={}", pvDevicePropertyPath, lvAttempt); } } catch (OwfsException oe) { logger.error("Writing to path attempt threw an exception", pvValue, pvDevicePropertyPath, lvAttempt, oe); reconnect(); } catch (IOException ioe) { logger.error("Couldn't establish network connection while write attempt to '{}'" + " ip:port={}:{}", lvAttempt, pvDevicePropertyPath, cvIp, cvPort, ioe); reconnect(); } finally { lvAttempt++; } } }
Source:
private Color getBgColor() { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); Color bg = colorRegistry.get(INFORMATION_BACKGROUND_COLOR); if (bg == null) { bg = JFaceColors.getInformationViewerForegroundColor(this.getDisplay()); } return bg; }

Target:
private Color getBgColor() { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); Color bg = colorRegistry.get(INFORMATION_BACKGROUND_COLOR); if (bg == null) { bg = getInformationViewerBackgroundColor(this.getDisplay()); } return bg; }
Source:
public boolean setInitialDelay(DebugContext context, IProgressMonitor monitor) throws CoreException { monitor.subTask(NLS.bind("Setting liveness probe initial delay to {0}", INITIAL_DELAY)); IProbe probe = getLivenessProbe(dc); if (probe == null) { return false; } int initialDelay = probe.getInitialDelaySeconds(); if (initialDelay >= INITIAL_DELAY) { OpenShiftServerUtils.setLivenessProbeInitialDelay(initialDelay, context.getServer()); return false; } probe.setInitialDelaySeconds(INITIAL_DELAY); return true; }

Target:
public boolean setInitialDelay(DebugContext context, IProgressMonitor monitor) throws CoreException { monitor.subTask(NLS.bind("Setting liveness probe initial delay to {0}", INITIAL_DELAY)); IProbe probe = getLivenessProbe(dc); if (probe == null) { return false; } int initialDelay = probe.getInitialDelaySeconds(); if (initialDelay >= INITIAL_DELAY) { return false; } OpenShiftServerUtils.setLivenessProbeInitialDelay(initialDelay, context.getServer()); probe.setInitialDelaySeconds(INITIAL_DELAY); return true; }
Source:
public void testStop() throws Exception { CountDownLatch latch = new CountDownLatch(1); DummyServlet servlet = new DummyServlet(Optional.of(latch)); createAndStartServer(servlet); try (HttpClient client = new JettyHttpClient()) { URI uri = URI.create(httpServerInfo.getHttpUri().toASCIIString()); Request request = prepareGet().setUri(uri).build(); HttpResponseFuture<?> future = client.executeAsync(request, createStatusResponseHandler()); while (servlet.getRequestsReceived() == 0) { Thread.sleep(100); } server.stop(); latch.countDown(); try { future.get(5, SECONDS); fail("expected exception"); } catch (ExecutionException e) { assertInstanceOf(e.getCause(), UncheckedIOException.class); } } }

Target:
public void testStop() throws Exception { CountDownLatch requestActive = new CountDownLatch(1); DummyServlet servlet = new DummyServlet(requestActive); createAndStartServer(servlet); try (HttpClient client = new JettyHttpClient()) { URI uri = URI.create(httpServerInfo.getHttpUri().toASCIIString() + "/?sleep=50000"); Request request = prepareGet().setUri(uri).build(); HttpResponseFuture<?> future = client.executeAsync(request, createStatusResponseHandler()); requestActive.await(); server.stop(); server.join(); try { future.get(5, SECONDS); throw new AssertionError("expected request to fail", servlet.getException()); } catch (ExecutionException e) { assertInstanceOf(e.getCause(), UncheckedIOException.class); } } }
Source:
public T remove(final int index) { try { return this.origin.remove(index); } catch (final IndexOutOfBoundsException ex) { throw new IllegalArgumentException(this.message, ex); } }

Target:
public T remove(final int index) { try { return this.origin.remove(index); } catch (final IndexOutOfBoundsException ex) { throw this.wrapException(ex); } }
Source:
private String convertToMegaBytes(long bytes) { int oneKiloByte = 1024; return String.valueOf(bytes / oneKiloByte / oneKiloByte) + " MB"; }

Target:
private String convertToMegaBytes(long bytes) { final int ONE_KILO_BYTE = 1024; return String.valueOf(bytes / ONE_KILO_BYTE / ONE_KILO_BYTE) + " MB"; }
Source:
protected DMNModel retrieveDMNModel(DMNRuntime dmnRuntime) { if(namespace != null && modelName != null) { return Optional .ofNullable(dmnRuntime.getModel(namespace, modelName)) .orElseThrow(() -> new IllegalStateException("Cannot find a DMN model with namespace=" + namespace + " and modelName=" + modelName)); } else if(resourcePath != null) { return dmnRuntime.getModels().stream() .filter(model -> Objects.equals(resourcePath, model.getResource().getSourcePath())) .findFirst() .orElseThrow(() -> new IllegalStateException("Cannot find a DMN model with resource=" + resourcePath)); } throw new IllegalStateException("This should not happen"); }

Target:
protected DMNModel retrieveDMNModel(DMNRuntime dmnRuntime) { if(namespace != null && modelName != null) { return Optional .ofNullable(dmnRuntime.getModel(namespace, modelName)) .orElseThrow(() -> new IllegalStateException("Cannot find a DMN model with namespace=" + namespace + " and modelName=" + modelName)); } else if(resourcePath != null) { return dmnRuntime.getModels().stream() .filter(model -> Objects.equals(resourcePath, model.getResource().getSourcePath())) .findFirst() .orElseThrow(() -> new IllegalStateException("Cannot find a DMN model with resource=" + resourcePath)); } throw new IllegalStateException("Both resourcePath and namespace+modelName are not set, this should not happen"); }
Source:
private static RelNode toIndexJoin(VoltPhysicalJoin join, RelNode outerScan, RelNode innerChild, String indexName) { return new VoltPhysicalNestLoopIndexJoin( join.getCluster(), join.getTraitSet(), outerScan, innerChild, join.getCondition(), join.getVariablesSet(), join.getJoinType(), join.isSemiJoinDone(), ImmutableList.copyOf(join.getSystemFieldList()), join.getSplitCount(), indexName); }

Target:
private static RelNode toIndexJoin(VoltPhysicalJoin join, RelNode outerScan, RelNode innerChild, String indexName) { return new VoltPhysicalNestLoopIndexJoin( join.getCluster(), join.getTraitSet(), outerScan, innerChild, join.getCondition(), join.getVariablesSet(), join.getJoinType(), join.isSemiJoinDone(), ImmutableList.copyOf(join.getSystemFieldList()), indexName); }
Source:
public Object getPropertyValue(Object id) { if (sfName.equals(id)) { return getName(); } if (sfPath.equals(id)) { return getPath().toString(); } if (sfLocation.equals(id)) { return getLocation().toString(); } if (sfExperimentType.equals(id)) { if (getTraceType() != null) { IConfigurationElement ce = sfTraceTypeAttributes.get(getTraceType()); return (ce != null) ? (getCategory(ce) + ':' + ce.getAttribute(TmfTraceType.NAME_ATTR)) : new String(); } } return null; }

Target:
public Object getPropertyValue(Object id) { if (sfName.equals(id)) { return getName(); } if (sfPath.equals(id)) { return getPath().toString(); } if (sfLocation.equals(id)) { return getLocation().toString(); } if (sfExperimentType.equals(id)) { if (getTraceType() != null) { IConfigurationElement ce = sfTraceTypeAttributes.get(getTraceType()); if (ce == null) { return ""; } String categoryId = ce.getAttribute(TmfTraceType.CATEGORY_ATTR); if (categoryId != null) { IConfigurationElement category = sfTraceCategories.get(categoryId); if (category != null) { return category.getAttribute(TmfTraceType.NAME_ATTR) + ':' + ce.getAttribute(TmfTraceType.NAME_ATTR); } } return ce.getAttribute(TmfTraceType.NAME_ATTR); } } return null; }
Source:
if (!IgniteSystemProperties.getBoolean(IGNITE_JETTY_LOG_NO_OVERRIDE)) { Properties p = new Properties(); System.setProperty("org.eclipse.jetty.LEVEL", "WARN"); System.setProperty("org.eclipse.jetty.util.log.LEVEL", "OFF"); System.setProperty("org.eclipse.jetty.util.component.LEVEL", "OFF"); try { Class<?> logCls = Class.forName("org.apache.log4j.Logger"); String ctgrJetty = "org.eclipse.jetty"; String ctgrJettyUtil = "org.eclipse.jetty.util.log"; String ctgrJettyUtilComp = "org.eclipse.jetty.util.component"; Object logJetty = logCls.getMethod("getLogger", String.class).invoke(logCls, ctgrJetty); Object logJettyUtil = logCls.getMethod("getLogger", String.class).invoke(logCls, ctgrJettyUtil); Object logJettyUtilComp = logCls.getMethod("getLogger", String.class).invoke(logCls, ctgrJettyUtilComp); Class<?> lvlCls = Class.forName("org.apache.log4j.Level"); Object warnLvl = lvlCls.getField("WARN").get(null); Object errLvl = lvlCls.getField("ERROR").get(null); logJetty.getClass().getMethod("setLevel", lvlCls).invoke(logJetty, warnLvl); logJettyUtil.getClass().getMethod("setLevel", lvlCls).invoke(logJetty, errLvl); logJettyUtilComp.getClass().getMethod("setLevel", lvlCls).invoke(logJetty, errLvl); } catch (Exception ignored) { } }

Target:
if (!IgniteSystemProperties.getBoolean(IGNITE_JETTY_LOG_NO_OVERRIDE)) { System.setProperty("org.eclipse.jetty.LEVEL", "WARN"); System.setProperty("org.eclipse.jetty.util.log.LEVEL", "OFF"); System.setProperty("org.eclipse.jetty.util.component.LEVEL", "OFF"); try { Class<?> logCls = Class.forName("org.apache.log4j.Logger"); String ctgrJetty = "org.eclipse.jetty"; String ctgrJettyUtil = "org.eclipse.jetty.util.log"; String ctgrJettyUtilComp = "org.eclipse.jetty.util.component"; Object logJetty = logCls.getMethod("getLogger", String.class).invoke(logCls, ctgrJetty); Object logJettyUtil = logCls.getMethod("getLogger", String.class).invoke(logCls, ctgrJettyUtil); Object logJettyUtilComp = logCls.getMethod("getLogger", String.class).invoke(logCls, ctgrJettyUtilComp); Class<?> lvlCls = Class.forName("org.apache.log4j.Level"); Object warnLvl = lvlCls.getField("WARN").get(null); Object errLvl = lvlCls.getField("ERROR").get(null); logJetty.getClass().getMethod("setLevel", lvlCls).invoke(logJetty, warnLvl); logJettyUtil.getClass().getMethod("setLevel", lvlCls).invoke(logJetty, errLvl); logJettyUtilComp.getClass().getMethod("setLevel", lvlCls).invoke(logJetty, errLvl); } catch (Exception ignored) { } }
Source:
protected void reportTracedLeak(String resourceType, String records) { leaked.set(true); super.reportTracedLeak(resourceType, records); }

Target:
protected synchronized void reportTracedLeak(String resourceType, String records) { leaks.add(records); }
Source:
public void onLocationNotFound(String id) { if (createLocationFailures.keySet().contains(id)) { } else { String errmsg = "location '"+id+"' not found"; locationNotFoundFailures.put(id, new IllegalStateException(errmsg)); onErrorImpl(errmsg); } }

Target:
public void onLocationNotFound(String id) { if (creationFailedLocations.contains(id)) { } else { String errmsg = "location '"+id+"' not found"; exceptions.add(new IllegalStateException(errmsg)); onErrorImpl(errmsg); } }