auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void dataStoredProperly() throws Exception { final long before = this.now(); final Comment comment = this.comment(); final long after = this.now(); MatcherAssert.assertThat( comment.number(), Matchers.greaterThan(0) ); final Comment.Smart smart = new Comment.Smart(comment); MatcherAssert.assertThat( smart.issue().number(), Matchers.greaterThan(0) ); MatcherAssert.assertThat( smart.author().login(), Matchers.equalTo("jeff") ); MatcherAssert.assertThat( smart.body(), Matchers.equalTo(COMMENT_TEXT) ); final String domain = "<LINK_0>"; final String path = "/repos/jeff/test/issues/comments/1"; MatcherAssert.assertThat( smart.url(), Matchers.equalTo(new URL(domain + path)) ); MatcherAssert.assertThat( smart.createdAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( smart.createdAt().getTime(), Matchers.lessThanOrEqualTo(after) ); MatcherAssert.assertThat( smart.updatedAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( smart.updatedAt().getTime(), Matchers.lessThanOrEqualTo(after) ); }

Target:
public void dataStoredProperly() throws Exception { final String cmt = "what's up?"; final long before = MkCommentTest.now(); final Comment comment = this.comment(cmt); final long after = MkCommentTest.now(); MatcherAssert.assertThat( comment.number(), Matchers.greaterThan(0) ); final Comment.Smart smart = new Comment.Smart(comment); MatcherAssert.assertThat( smart.issue().number(), Matchers.greaterThan(0) ); MatcherAssert.assertThat( smart.author().login(), Matchers.equalTo("jeff") ); MatcherAssert.assertThat( smart.body(), Matchers.equalTo(cmt) ); MatcherAssert.assertThat( smart.url(), Matchers.equalTo( new URL( "<LINK_0>/repos/jeff/test/issues/comments/1" ) ) ); MatcherAssert.assertThat( smart.createdAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( smart.createdAt().getTime(), Matchers.lessThanOrEqualTo(after) ); MatcherAssert.assertThat( smart.updatedAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( smart.updatedAt().getTime(), Matchers.lessThanOrEqualTo(after) ); }
Source:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = method.invoke(obj, args); if (method.getName().equals("glGetError")) { return result; } checkError(); return result; }

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = method.invoke(obj, args); if (method.equals(methodGlGetError)) { return result; } checkError(); return result; }
Source:
public ListenableFuture<Map<Cell, Value>> getAsync(TableReference tableRef, Map<Cell, Long> timestampByCell) { long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLogAsync(() -> delegate.getAsync(tableRef, timestampByCell), (logger, stopwatch) -> logger.log("Call to KVS.get at time {}, on table {}, requesting cells took ms ", LoggingArgs.startTimeMillis(startTime), LoggingArgs.tableRef(tableRef), LoggingArgs.cellCount(timestampByCell.size()), LoggingArgs.durationMillis(stopwatch)), logCellResultSize(4L)); }

Target:
public ListenableFuture<Map<Cell, Value>> getAsync(TableReference tableRef, Map<Cell, Long> timestampByCell) { long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLogAsync(() -> delegate.getAsync(tableRef, timestampByCell), (logger, stopwatch) -> logger.log("Call to KVS.getAsync", LoggingArgs.startTimeMillis(startTime), LoggingArgs.tableRef(tableRef), LoggingArgs.cellCount(timestampByCell.size()), LoggingArgs.durationMillis(stopwatch)), logCellResultSize(4L)); }
Source:
protected Void doInBackground(Void... params) { arrayList = new ArrayList<>(); InputStream is = null; Bitmap tempBitmap; String frameFolder = "frames"; AssetManager assetmanager = getResources().getAssets(); try { String str[] = assetmanager.list("frames"); for (int file = 0; file < str.length; file++) { is = assetmanager.open(frameFolder + File.separator + file + ".png"); tempBitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeStream(is), 140, 160, false); tempBitmap.compress(Bitmap.CompressFormat.JPEG, 100, new ByteArrayOutputStream()); arrayList.add(tempBitmap); } is.close(); } catch (IOException IOE) { Log.i(TAG, "getAssets: " + IOE.getMessage()); } return null; }

Target:
protected Void doInBackground(Void... params) { InputStream is = null; Bitmap tempBitmap; String frameFolder = "frames"; AssetManager assetmanager = getResources().getAssets(); try { String str[] = assetmanager.list("frames"); for (int file = 0; file < str.length; file++) { is = assetmanager.open(frameFolder + File.separator + file + ".png"); tempBitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeStream(is), 140, 160, false); tempBitmap.compress(Bitmap.CompressFormat.JPEG, 100, new ByteArrayOutputStream()); arrayList.add(tempBitmap); } is.close(); } catch (IOException IOE) { Log.i(TAG, "getAssets: " + IOE.getMessage()); } return null; }
Source:
public void shouldGetWithBinary() { expect(inner.get(keyBytes)).andReturn(valueAndTimestampBytes); inner.put(eq(keyBytes), aryEq(valueAndTimestampBytes)); expectLastCall(); init(); metered.put(key, valueAndTimestamp); final RawAndDeserializedValue<String> valueWithBinary = metered.getWithBinary(key); assertEquals(valueWithBinary.value, valueAndTimestamp); assertEquals(valueWithBinary.serializedValue, valueAndTimestampBytes); }

Target:
public void shouldGetWithBinary() { expect(inner.get(keyBytes)).andReturn(valueAndTimestampBytes); inner.put(eq(keyBytes), aryEq(valueAndTimestampBytes)); expectLastCall(); init(); final RawAndDeserializedValue<String> valueWithBinary = metered.getWithBinary(key); assertEquals(valueWithBinary.value, valueAndTimestamp); assertEquals(valueWithBinary.serializedValue, valueAndTimestampBytes); }
Source:
public static int getfd(FileDescriptor descriptor) { Field field = getFieldByReflection(descriptor.getClass(), "fd"); try { return field.getInt(descriptor); } catch (Exception e) { LOG.warn("Unable to read fd field from java.io.FileDescriptor"); } return -1; }

Target:
public static int getfd(FileDescriptor descriptor) { try { return field.getInt(descriptor); } catch (IllegalArgumentException | IllegalAccessException e) { log.warn("Unable to read fd field from java.io.FileDescriptor"); } return -1; }
Source:
public List<String> getValues() { List<String> values = new ArrayList<String>(); if (getTaskAttribute().getValues().size() > 1) { values = getTaskAttribute().getValues(); } else { String selectedKeywords = getAttributeMapper().getValue(getTaskAttribute()); StringTokenizer st = new StringTokenizer(selectedKeywords, ",", false); while (st.hasMoreTokens()) { String s = st.nextToken().trim(); values.add(s); } } return values; }

Target:
public List<String> getValues() { List<String> values = new ArrayList<String>(); values = getTaskAttribute().getValues(); return values; }
Source:
public void settingsPerformanceTest() throws Exception { for (int i = 0; i < TEST_TIME; i++) { for (int j = 0; j < ACTIVITIES.length; j++) { executePreformanceTest(ACTIVITIES[j], TEXTS[j], j); } } }

Target:
public void settingsPerformanceTest() throws Exception { for (int i = 0; i < TEST_TIME; i++) { for (Page page : PAGES) { executePreformanceTest(page.action, page.displayName, page.title); } } }
Source:
protected void processTuple(T tuple, boolean isStream1Data) { Spillable.SpillableListMultimap<K,T> store = isStream1Data ? stream1Data : stream2Data; K key = extractKey(tuple,isStream1Data); if (!store.put(key, tuple)) { return; } Future<List> future; if (isStream1Data) { if (isRightKeyPrimary()) { future = ((SpillableMapAsMultiMapImpl)stream2Data).getAsync(key); } else { future = ((SpillableTimeSlicedArrayListMultiMapImpl)stream2Data).getAsync(key); } } else { if (isLeftKeyPrimary()) { future = ((SpillableMapAsMultiMapImpl)stream1Data).getAsync(key); } else { future = ((SpillableTimeSlicedArrayListMultiMapImpl)stream1Data).getAsync(key); } } if (future == null) { return; } if (future.isDone()) { try { joinStream(tuple,isStream1Data, future.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } else { waitingEvents.put(new JoinEvent<>(key,tuple,isStream1Data),future); } }

Target:
protected void processTuple(T tuple, boolean isStream1Data) { Spillable.SpillableListMultimap<K,T> store = isStream1Data ? stream1Data : stream2Data; K key = extractKey(tuple,isStream1Data); if (isExpiredTuple(tuple,isStream1Data)) { return; } store.put(key, tuple); Future<List> future; if (isStream1Data) { future = getAsync(stream2Data, isRightKeyPrimary(), key); } else { future = getAsync(stream1Data, isLeftKeyPrimary(), key); } if (future == null) { return; } if (future.isDone()) { try { joinStream(tuple,isStream1Data, future.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } else { waitingEvents.put(new JoinEvent<>(key,tuple,isStream1Data),future); } }
Source:
public Iterator<Map.Entry<UK, UV>> iterator() { Map<UK, UV> userMap = stateTable.get(currentNamespace); return userMap == null ? emptyState.entrySet().iterator() : userMap.entrySet().iterator(); }

Target:
public Iterator<Map.Entry<UK, UV>> iterator() { Map<UK, UV> userMap = stateTable.get(currentNamespace); return userMap == null ? Collections.emptyIterator() : userMap.entrySet().iterator(); }
Source:
public List<Statistic> getStatistics(VdsNetworkInterface iface) { NetworkStatistics s = iface.getStatistics(); List<Statistic> datums = new ArrayList<>(); Double dataRx = RxTxCalculator.percent2bytes(iface.getSpeed(), s.getReceiveRate()); if (dataRx != null) { addDatumToStatistics(datums, setDatum(clone(DATA_RX), dataRx)); } Double dataTx = RxTxCalculator.percent2bytes(iface.getSpeed(), s.getTransmitRate()); if (dataTx != null) { addDatumToStatistics(datums, setDatum(clone(DATA_TX), dataTx)); } if (s.getReceiveDropRate() != null) { addDatumToStatistics(datums, setDatum(clone(ERRS_RX), s.getReceiveDropRate())); } if (s.getTransmitDropRate() != null) { addDatumToStatistics(datums, setDatum(clone(ERRS_TX), s.getTransmitDropRate())); } return datums; }

Target:
public List<Statistic> getStatistics(VdsNetworkInterface iface) { NetworkStatistics s = iface.getStatistics(); return asList(setDatum(clone(DATA_RX), RxTxCalculator.percent2bytes(iface.getSpeed(), s.getReceiveRate())), setDatum(clone(DATA_TX), RxTxCalculator.percent2bytes(iface.getSpeed(), s.getTransmitRate())), setDatum(clone(ERRS_RX), s.getReceiveDropRate()), setDatum(clone(ERRS_TX), s.getTransmitDropRate())); }
Source:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); long caps = 0; for (String nego : req.getServletContext().getInitParameter(CAPABILITIES_PARAMETER).trim().split("*|*")) { try { caps |= Authn.Capabilities.class.getField(nego).getInt(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { } } for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }

Target:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); long caps = 0; for (String nego : req.getServletContext().getInitParameter(CAPABILITIES_PARAMETER).trim().split("\\|")) { try { caps |= Authn.Capabilities.class.getField(nego).getInt(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { } } for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }
Source:
private String computeDefaultInternalLinkPattern() { String internalLinkPattern = wikiBaseUrl; if (!internalLinkPattern.endsWith("/")) { internalLinkPattern += "/"; } internalLinkPattern += "index.php?title={0}"; return internalLinkPattern; }

Target:
private String computeDefaultInternalLinkPattern() { String internalLinkPattern = wikiBaseUrl; if (!internalLinkPattern.endsWith("/")) { internalLinkPattern += "/"; } internalLinkPattern += "index.php/{0}"; return internalLinkPattern; }
Source:
private static void requireEnv(String varName) { assertNotNull( System.getenv(varName), String.format("Environment variable '%s' is required to perform these tests.", varName)); }

Target:
private static void requireEnv(String varName) { assertNotNull( String.format("Environment variable '%s' is required to perform these tests.", varName), System.getenv(varName)); }
Source:
public void test() throws Exception { if (myTestFile.getName().startsWith("__")) { System.out.println("debug file encountered: "+myTestFile.getName()); } IonDatagram datagram = load(myTestFile); IonReader treeReader = system().newReader(datagram); FileInputStream in = new FileInputStream(myTestFile); try { IonReader fileReader = system().newReader(in); ReaderCompare.compare(treeReader, fileReader); } finally { in.close(); } in = new FileInputStream(myTestFile); try { Iterator<IonValue> expected = datagram.iterator(); Iterator<IonValue> actual = system().iterate(in); assertIonIteratorEquals(expected, actual); } finally { in.close(); } if (! myFileIsBinary) { treeReader = system().newReader(datagram); byte[] encoded = datagram.getBytes(); IonReader binaryReader = system().newReader(encoded); ReaderCompare.compare(treeReader, binaryReader); } else { EquivsTest.roundTripEquivalence(datagram); } }

Target:
public void test() throws Exception { if (myTestFile.getName().startsWith("__")) { System.out.println("debug file encountered: "+myTestFile.getName()); } IonDatagram datagram = load(myTestFile); IonReader treeReader = system().newReader(datagram); FileInputStream in = new FileInputStream(myTestFile); try { IonReader fileReader = system().newReader(in); ReaderCompare.compare(treeReader, fileReader); } finally { in.close(); } in = new FileInputStream(myTestFile); try { Iterator<IonValue> expected = datagram.iterator(); Iterator<IonValue> actual = system().iterate(in); assertIonIteratorEquals(expected, actual); } finally { in.close(); } treeReader = system().newReader(datagram); byte[] encoded = datagram.getBytes(); IonReader binaryReader = system().newReader(encoded); ReaderCompare.compare(treeReader, binaryReader); }
Source:
public static ImmutableCollection<MapColor> getAll() { return factory.getAll(); }

Target:
public static Collection<MapColor> getAll() { return factory.getAll(); }
Source:
public Reply<?> fetchEapMethods() { List<MethodType> types = methodCatalog.findAll(); List<String> list = adaptEAPs(types); return Reply.with(list).as(Json.class).ok(); }

Target:
public Reply<?> fetchEapMethods() { List<Method> methods = methodCatalog.findAll(); List<String> dtos = adaptEapMethods(methods); return Reply.with(dtos).as(Json.class).ok(); }
Source:
protected void runImpl() throws IOException, Failure { PacketLineOut packetOut = new PacketLineOut(out); packetOut.setFlushOnEnd(true); packetOut.writeString("ACK"); packetOut.end(); try { readArguments(); if (!uploadArchiveAllowed || !projectControl.allRefsAreVisible()) { throw new Failure(4, "fatal: upload-archive not permitted on this" + "server"); } ObjectId treeId = repo.resolve(options.treeIsh); if (treeId.equals(ObjectId.zeroId())) { throw new Failure(5, "fatal: reference not found"); } String format = options.format; boolean wasFormatRegistered = registerArchiveFormat(format); try { SideBandOutputStream sidebandOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, out); new ArchiveCommand(repo) .setFormat(format) .setTree(treeId) .setPaths(options.path.toArray(new String[0])) .setPrefix(options.prefix) .setOutputStream(sidebandOut) .call(); sidebandOut.flush(); sidebandOut.close(); } catch (GitAPIException e) { throw new Failure(6, "fatal: git api exception, " + e); } finally { if (wasFormatRegistered) { unregisterArchiveFormat(format); } } } catch (Failure f) { SideBandOutputStream sidebandError = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, SideBandOutputStream.MAX_BUF, out); sidebandError.write(f.getMessage().getBytes("UTF-8")); sidebandError.flush(); sidebandError.close(); throw f; } finally { packetOut.end(); } }

Target:
protected void runImpl() throws IOException, Failure { PacketLineOut packetOut = new PacketLineOut(out); packetOut.setFlushOnEnd(true); packetOut.writeString("ACK"); packetOut.end(); try { readArguments(); ArchiveFormat f = allowedFormats.getExtensions().get("." + options.format); if (f == null) { throw new Failure(3, "fatal: upload-archive not permitted"); } ObjectId treeId = repo.resolve(options.treeIsh); if (treeId.equals(ObjectId.zeroId())) { throw new Failure(4, "fatal: reference not found"); } if (projectControl.allRefsAreVisible()) { try { ProjectControl projectControl = projectControlFactory.validateFor(project.getNameKey()); if (!canRead(repo, projectControl, treeId)) { throw new Failure(5, "fatal: cannot perform upload-archive operation"); } } catch (NoSuchProjectException e) { throw new Failure(6, "fatal: project not found"); } } if (f == ArchiveFormat.ZIP) { setupZipCompressionLevel(); } try { SideBandOutputStream sidebandOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, out); new ArchiveCommand(repo) .setFormat(f.name()) .setTree(treeId) .setPaths(options.path.toArray(new String[0])) .setPrefix(options.prefix) .setOutputStream(sidebandOut) .call(); sidebandOut.flush(); sidebandOut.close(); } catch (GitAPIException e) { throw new Failure(7, "fatal: git api exception, " + e); } finally { if (f == ArchiveFormat.ZIP) { ZipFormat.resetLevel(); } } } catch (Failure f) { SideBandOutputStream sidebandError = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, SideBandOutputStream.MAX_BUF, out); sidebandError.write(f.getMessage().getBytes(UTF_8)); sidebandError.flush(); sidebandError.close(); throw f; } finally { packetOut.end(); } }
Source:
List<String> collect() { this.metricList = new ArrayList<>(); this.keyPropertiesPerBean = new ConcurrentHashMap<>(); try { MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer(); Set<ObjectName> mBeanNames = new HashSet<>(); ObjectName synapseFilterName = new ObjectName(SYNAPSE_DOMAIN_NAME); for (ObjectInstance instance : beanServer.queryMBeans(synapseFilterName, null)) { mBeanNames.add(instance.getObjectName()); } for (ObjectName beanName : mBeanNames) { scrapeBean(beanServer, beanName); } if (this.metricList != null && !metricList.isEmpty()) { Collections.sort(metricList, new Comparator<PrometheusMetric>() { @Override public int compare(final PrometheusMetric object1, final PrometheusMetric object2) { return object1.getMetricName().compareTo(object2.getMetricName()); } }); for (int i = 1; i < metricList.size(); i++) { if (metricList.get(i).getMetricName().equals(metricList.get(i - 1).getMetricName())) { metricList.get(i).setHelp(""); metricList.get(i).setType(""); } } List<String> metrics = new ArrayList<>(); for (PrometheusMetric metric : metricList) { metrics.add(PrometheusMetric.getFormattedMetric(metric)); } return metrics; } } catch (MalformedObjectNameException e) { LOGGER.error("Error in retrieving metric data from JMX MBeans"); } return Collections.emptyList(); }

Target:
List<String> collect() { List<PrometheusMetric> metricList = new ArrayList<>(); Map<ObjectName, LinkedHashMap<String, String>> keyPropertiesPerBean = new ConcurrentHashMap<>(); try { MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer(); Set<ObjectName> mBeanNames = new HashSet<>(); ObjectName synapseFilterName = new ObjectName(SYNAPSE_DOMAIN_NAME); for (ObjectInstance instance : beanServer.queryMBeans(synapseFilterName, null)) { mBeanNames.add(instance.getObjectName()); } for (ObjectName beanName : mBeanNames) { List<PrometheusMetric> metrics = scrapeBean(beanServer, beanName, keyPropertiesPerBean); if (metrics != null && !metrics.isEmpty()) { metricList.addAll(metrics); } } if (!metricList.isEmpty()) { Collections.sort(metricList, new Comparator<PrometheusMetric>() { @Override public int compare(final PrometheusMetric object1, final PrometheusMetric object2) { return object1.getMetricName().compareTo(object2.getMetricName()); } }); for (int i = 1; i < metricList.size(); i++) { if (metricList.get(i).getMetricName().equals(metricList.get(i - 1).getMetricName())) { metricList.get(i).setHelp(""); metricList.get(i).setType(""); } } List<String> metrics = new ArrayList<>(); for (PrometheusMetric metric : metricList) { metrics.add(PrometheusMetric.formatMetric(metric)); } return metrics; } } catch (MalformedObjectNameException e) { LOGGER.error("Error in retrieving metric data from JMX MBeans: ", e); } return Collections.emptyList(); }
Source:
public void testCanReadImageInputStream() throws IOException { File rasterfile = TestData.file(GeoTiffReaderTest.class, "geo.tiff"); FileImageInputStream is = new FileImageInputStream(rasterfile); GeoTiffReader reader = new GeoTiffReader(is); GridCoverage2D gridCoverage = reader.read(null); assertTrue(gridCoverage != null && gridCoverage.getNumSampleDimensions() == 1); }

Target:
public void testCanReadImageInputStream() throws IOException { File rasterfile = TestData.file(GeoTiffReaderTest.class, "geo.tiff"); GeoTiffReader reader = null; try(FileImageInputStream is = new FileImageInputStream(rasterfile)) { reader = new GeoTiffReader(is); GridCoverage2D gridCoverage = reader.read(null); assertTrue(gridCoverage != null && gridCoverage.getNumSampleDimensions() == 1); gridCoverage.dispose(true); } finally { if(reader != null) { reader.dispose(); } } }
Source:
private void parseDelete(final ReceiveCommand cmd) { RefControl ctl = projectControl.controlForRef(cmd.getRefName()); String refName = cmd.getRefName(); if (refName.startsWith("refs/changes/")) { errors.put(Error.DELETE_CHANGES, refName); reject(cmd, "cannot delete changes"); } else if (ctl.canDelete()) { batch.addCommand(cmd); } else { if (GitRepositoryManager.REF_CONFIG.equals(refName)) { reject(cmd, "cannot delete project configuration"); } else { errors.put(Error.DELETE, ctl.getRefName()); reject(cmd, "cannot delete references"); } } }

Target:
private void parseDelete(final ReceiveCommand cmd) { RefControl ctl = projectControl.controlForRef(cmd.getRefName()); String refName = cmd.getRefName(); if (refName.startsWith("refs/changes/")) { errors.put(Error.DELETE_CHANGES, refName); reject(cmd, "cannot delete changes"); } else if (ctl.canDelete()) { batch.addCommand(cmd); } else { if (GitRepositoryManager.REF_CONFIG.equals(ctl.getRefName())) { reject(cmd, "cannot delete project configuration"); } else { errors.put(Error.DELETE, ctl.getRefName()); reject(cmd, "cannot delete references"); } } }
Source:
private GitModelObject[] createChildren() { FileModelFactory fileModelFactory = new FileModelFactory() { @Override public GitModelBlob createFileModel(GitModelObjectContainer parent, Repository repository, Change change, IPath fullPath) { return new GitModelBlob(parent, repository, change, fullPath); } @Override public boolean isWorkingTree() { return false; } }; TreeModelFactory treeModelFactory = GitModelTree::new; return TreeBuilder.build(this, repo, commit.getChildren(), fileModelFactory, treeModelFactory); }

Target:
private GitModelObject[] createChildren() { FileModelFactory fileModelFactory = new FileModelFactory() { @Override public GitModelBlob createFileModel(GitModelObjectContainer parent, Repository repository, Change change, IPath fullPath) { return new GitModelBlob(parent, repository, change, fullPath); } @Override public boolean isWorkingTree() { return false; } }; return TreeBuilder.build(this, repo, commit.getChildren(), fileModelFactory, GitModelTree::new); }
Source:
DependencyPresenceOnStartupVerifier dependencyPresenceOnStartupVerifier() { return new DefaultDependencyPresenceOnStartupVerifier(); }

Target:
public DependencyPresenceOnStartupVerifier dependencyPresenceOnStartupVerifier() { return new DefaultDependencyPresenceOnStartupVerifier(); }
Source:
protected void deregister() { if ((getChartViewer().getControl() != null) && !getChartViewer().getControl().isDisposed()) { Composite plotArea = (Composite) getChart().getPlotArea(); if (this instanceof MouseListener) { plotArea.removeMouseListener((MouseListener) this); } if (this instanceof MouseMoveListener) { plotArea.removeMouseMoveListener((MouseMoveListener) this); } if (this instanceof MouseWheelListener) { plotArea.removeMouseWheelListener((MouseWheelListener) this); } if (this instanceof MouseTrackListener) { plotArea.removeMouseTrackListener((MouseTrackListener) this); } if (this instanceof PaintListener) { plotArea.removePaintListener((PaintListener) this); } if (this instanceof ICustomPaintListener) { ((IPlotArea) plotArea).removeCustomPaintListener((ICustomPaintListener) this); } TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler(); if(tooltipHandler != null) { tooltipHandler.deactivateHoverHelp(plotArea); } } }

Target:
protected void deregister() { IPlotArea plotArea = getChart().getPlotArea(); if (plotArea == null) { return; } Control control = plotArea.getControl(); if (!control.isDisposed()) { if (this instanceof MouseListener) { control.removeMouseListener((MouseListener) this); } if (this instanceof MouseMoveListener) { control.removeMouseMoveListener((MouseMoveListener) this); } if (this instanceof MouseWheelListener) { control.removeMouseWheelListener((MouseWheelListener) this); } if (this instanceof MouseTrackListener) { control.removeMouseTrackListener((MouseTrackListener) this); } if (this instanceof PaintListener) { control.removePaintListener((PaintListener) this); } if (this instanceof ICustomPaintListener) { plotArea.removeCustomPaintListener((ICustomPaintListener) this); } TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler(); if(tooltipHandler != null) { tooltipHandler.deactivateHoverHelp(control); } } }
Source:
private static boolean isJavaArchive(Path path) { PathMatcher archiveMatcher = FileSystems.getDefault().getPathMatcher("glob:**.{ear,war,jar}"); return archiveMatcher.matches(path); }

Target:
private static boolean isJavaArchive(Path path) { Set<String> archiveExtensions = ZipUtil.getZipExtensions(); StringBuffer syntaxAndPattern = new StringBuffer("glob:**.{"); boolean first = true; for(String extension: archiveExtensions) { if(first) { first = false; } else { syntaxAndPattern.append(","); } syntaxAndPattern.append(extension); } syntaxAndPattern.append("}"); PathMatcher archiveMatcher = FileSystems.getDefault().getPathMatcher(syntaxAndPattern.toString()); return archiveMatcher.matches(path); }
Source:
public void createAndRegisterResources() { registerPaxosResource(); registerExceptionMappers(); leadershipCreator.registerLeaderElectionService(); registerTimeLockResourcesForClients(); ClockSkewMonitorCreator.create(install, registrar).registerClockServices(); }

Target:
public void createAndRegisterResources() { registerPaxosResource(); registerExceptionMappers(); leadershipCreator.registerLeaderElectionService(); registrar.accept(new TimeLockResource(this::createInvalidatingTimeLockServices, Observables.blockingMostRecent( runtime.map(conf -> conf.maxNumberOfClients())))); ClockSkewMonitorCreator.create(install, registrar).registerClockServices(); }
Source:
private synchronized KeyPair readKeyPair() throws GeneralSecurityException, IOException { if (!doesKeyPairExist()) { throw new KeyStoreException("KeyPair entry does not exist."); } Logger.v(TAG, "Reading Key entry"); final KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); try { final KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry)keyStore.getEntry( KEY_STORE_CERT_ALIAS, null); return new KeyPair(entry.getCertificate().getPublicKey(), entry.getPrivateKey()); } catch (final RuntimeException e) { ClientAnalytics.logEvent(new AndroidKeyStoreFailureEvent( new InstrumentationPropertiesBuilder(e))); throw new KeyStoreException(e); } }

Target:
private synchronized KeyPair readKeyPair() throws GeneralSecurityException, IOException { if (!doesKeyPairExist()) { throw new KeyStoreException("KeyPair entry does not exist."); } Logger.v(TAG, "Reading Key entry"); final KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); final KeyStore.PrivateKeyEntry entry; try { entry = (KeyStore.PrivateKeyEntry)keyStore.getEntry( KEY_STORE_CERT_ALIAS, null); } catch (final RuntimeException e) { ClientAnalytics.logEvent(new AndroidKeyStoreFailureEvent( new InstrumentationPropertiesBuilder(e))); throw new KeyStoreException(e); } return new KeyPair(entry.getCertificate().getPublicKey(), entry.getPrivateKey()); }
Source:
public void testEnrollmentNoConfig() { JsonObject configBase = new JsonObject(); JsonObject discoveryConfig = new JsonObject(); configBase.add(DISCOVERY, discoveryConfig); JsonObject courseDiscoveryConfig = new JsonObject(); discoveryConfig.add(COURSE_DISCOVERY, courseDiscoveryConfig); Config config = new Config(configBase); assertFalse(config.getDiscoveryConfig().getCourseDiscoveryConfig().isDiscoveryEnabled()); assertFalse(config.getDiscoveryConfig().getCourseDiscoveryConfig().isWebviewDiscoveryEnabled()); assertNull(config.getDiscoveryConfig().getCourseDiscoveryConfig().getBaseUrl()); assertNull(config.getDiscoveryConfig().getCourseDiscoveryConfig().getInfoUrlTemplate()); }

Target:
public void testEnrollmentNoConfig() { JsonObject configBase = new JsonObject(); Config config = new Config(configBase); assertNotNull(config.getDiscoveryConfig()); assertNull(config.getDiscoveryConfig().getCourseDiscoveryConfig()); assertNull(config.getDiscoveryConfig().getProgramDiscoveryConfig()); }
Source:
protected RelNode visitChild(RelNode parent, int i, RelNode child) { RelNode child2 = child.accept(this); if (child2 != child) { final List<RelNode> newInputs = new ArrayList<>(parent.getInputs()); newInputs.set(i, child2); return parent.copy(parent.getTraitSet(), newInputs); } return parent; }

Target:
@Override protected RelNode visitChild(RelNode parent, int i, RelNode child) { stack.push(parent); try { return super.visitChild(parent, i, child); } finally { stack.pop(); } }
Source:
public AmbrySecurityServiceTest() throws InstantiationException { this.securityService = new AmbrySecurityServiceFactory().getSecurityService(new VerifiableProperties(new Properties())); }

Target:
public AmbrySecurityServiceTest() throws InstantiationException { securityService = new AmbrySecurityServiceFactory() .getSecurityService(new VerifiableProperties(new Properties()), new MetricRegistry()); }
Source:
private void expireSession(RaftSession session) { log.debug("Expiring session due to heartbeat failure: {}", session); appendAndCompact(new CloseSessionEntry(raft.getTerm(), System.currentTimeMillis(), session.sessionId().id(), true)) .whenCompleteAsync((entry, error) -> { log.trace("Appended {}", entry); appender.appendEntries(entry.index()).whenComplete((commitIndex, commitError) -> { raft.checkThread(); if (isRunning() && commitError == null) { raft.getStateMachine().<Long>apply(entry.index()); } }); }, raft.getThreadContext()); }

Target:
private void expireSession(RaftSession session) { log.debug("Expiring session: {}", session); appendAndCompact(new CloseSessionEntry(raft.getTerm(), System.currentTimeMillis(), session.sessionId().id(), true)) .whenCompleteAsync((entry, error) -> { log.trace("Appended {}", entry); appender.appendEntries(entry.index()).whenComplete((commitIndex, commitError) -> { raft.checkThread(); if (isRunning() && commitError == null) { raft.getStateMachine().<Long>apply(entry.index()); } }); }, raft.getThreadContext()); }
Source:
public Builder<C> configure(OperationContext context, ModelNode model) throws OperationFailedException { this.moduleName = MODULE.resolveModelAttribute(context, model).asString(); Map<String, String> map = new HashMap<>(); for (Property property : ModelNodes.optionalPropertyList(PROPERTIES.resolveModelAttribute(context, model)).orElse(Collections.emptyList())) { if (map.put(property.getName(), property.getValue().asString()) != null) { throw new IllegalStateException("Duplicate key"); } } this.properties = map; this.statisticsEnabled = STATISTICS_ENABLED.resolveModelAttribute(context, model).asBooleanOrNull(); return this; }

Target:
public Builder<C> configure(OperationContext context, ModelNode model) throws OperationFailedException { this.moduleName = MODULE.resolveModelAttribute(context, model).asString(); Map<String, String> map = new HashMap<>(); for (Property property : ModelNodes.optionalPropertyList(PROPERTIES.resolveModelAttribute(context, model)).orElse(Collections.emptyList())) { map.put(property.getName(), property.getValue().asString()); } this.properties = map; this.statisticsEnabled = STATISTICS_ENABLED.resolveModelAttribute(context, model).asBooleanOrNull(); return this; }
Source:
public Issue createIssue(String user, String repository, Issue issue) throws IOException { Assert.isNotNull(user, "User cannot be null"); Assert.isNotNull(repository, "Repository cannot be null"); StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS); uri.append('/').append(user).append('/').append(repository); uri.append(IGitHubConstants.SEGMENT_ISSUES).append( IGitHubConstants.SUFFIX_JSON); Map<String, String> params = issue == null ? null : createIssueMap(issue); return this.client.post(uri.toString(), params, Issue.class); }

Target:
public Issue createIssue(String user, String repository, Issue issue) throws IOException { Assert.isNotNull(user, "User cannot be null"); Assert.isNotNull(repository, "Repository cannot be null"); StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS); uri.append('/').append(user).append('/').append(repository); uri.append(IGitHubConstants.SEGMENT_ISSUES).append( IGitHubConstants.SUFFIX_JSON); Map<String, String> params = issue !=null ? createIssueMap(issue) : null; return this.client.post(uri.toString(), params, Issue.class); }
Source:
public boolean testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, null)); return true; } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }

Target:
public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, null)); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }
Source:
public void fireEvents(TaskType taskType, long delay, Object entity) throws InterruptedException { final String WaitForLaunch = "WaitForLaunch".intern(); final String PoweringUp = "Powering up".intern(); final String Up = "Up".intern(); final String PoweredDown = "Powering down".intern(); final String logMsg = "VM %s set to %s state.".intern(); switch (taskType){ case START_VM: VM vm = (VM) entity; vm.setStatus(VM.VMStatus.WaitForLaunch); sendNotification(WaitForLaunch, vm.getId()); log.info(String.format(logMsg, vm.getImageId(), WaitForLaunch)); TimeUnit.MILLISECONDS.sleep(delay); vm.setStatus(VM.VMStatus.PoweringUp); sendNotification(PoweringUp, vm.getId()); log.info(String.format(logMsg, vm.getImageId(), PoweringUp)); break; case START_VM_AS_UP: vm = (VM) entity; TimeUnit.MILLISECONDS.sleep(delay); vm.setStatus(VM.VMStatus.Up); sendNotification(Up, vm.getId()); VdsmManager.getInstance().updateHost(vm.getHost()); log.info(String.format(logMsg, vm.getImageId(), Up)); break; case SHUTDOWN_VM: vm = (VM) entity; TimeUnit.MILLISECONDS.sleep(delay); vm.setStatus(VM.VMStatus.PoweredDown); vm.getHost().getRunningVMs().remove(vm.getId()); sendNotification(PoweredDown, vm.getId()); VdsmManager.getInstance().updateHost(vm.getHost()); log.info(String.format(logMsg, vm.getImageId(), PoweredDown)); break; default: log.error("Unhandled status detected."); break; } }

Target:
public void fireEvents(TaskType taskType, long delay, Object entity) throws InterruptedException { final String WaitForLaunch = "WaitForLaunch".intern(); final String PoweringUp = "Powering up".intern(); final String Up = "Up".intern(); final String PoweredDown = "Powering down".intern(); switch (taskType){ case START_VM: vmUpdateStatus((VM) entity, VM.VMStatus.WaitForLaunch, delay, WaitForLaunch, false); vmUpdateStatus((VM) entity, VM.VMStatus.PoweringUp, delay, PoweringUp, false); break; case START_VM_AS_UP: vmUpdateStatus((VM) entity, VM.VMStatus.Up, delay, Up, true); break; case SHUTDOWN_VM: vmUpdateStatus((VM) entity, VM.VMStatus.PoweredDown, delay, PoweredDown, true); break; default: log.error("Unhandled status detected."); break; } }
Source:
private void refresh() { Account[] accounts = Preferences.getPreferences(this).getAccounts(); BaseAccount[] allAccounts = new BaseAccount[accounts.length + 2]; BaseAccount integratedInboxAccount = new SearchAccount(this, true, null, null); integratedInboxAccount.setDescription(getString(R.string.integrated_inbox_title)); integratedInboxAccount.setEmail(getString(R.string.integrated_inbox_detail)); BaseAccount unreadAccount = new SearchAccount(this, false, null, null); unreadAccount.setDescription(getString(R.string.search_all_messages_title)); unreadAccount.setEmail(getString(R.string.search_all_messages_detail)); allAccounts[0] = integratedInboxAccount; allAccounts[1] = unreadAccount; for (int i=0; i<accounts.length; i++) { allAccounts[i+2] = accounts[i]; } mAdapter = new AccountsAdapter(allAccounts); getListView().setAdapter(mAdapter); }

Target:
private void refresh() { Account[] accounts = Preferences.getPreferences(this).getAccounts(); List<BaseAccount> allAccounts = new ArrayList<BaseAccount>(); if (!K9.isHideSpecialAccounts()) { BaseAccount integratedInboxAccount = new SearchAccount(this, true, null, null); integratedInboxAccount.setDescription( getString(R.string.integrated_inbox_title)); integratedInboxAccount.setEmail( getString(R.string.integrated_inbox_detail)); BaseAccount unreadAccount = new SearchAccount(this, false, null, null); unreadAccount.setDescription( getString(R.string.search_all_messages_title)); unreadAccount.setEmail( getString(R.string.search_all_messages_detail)); allAccounts.add(integratedInboxAccount); allAccounts.add(unreadAccount); } for (int i = 0; i < accounts.length; i++) { allAccounts.add(accounts[i]); } mAdapter = new AccountsAdapter(allAccounts); getListView().setAdapter(mAdapter); }
Source:
public static ScanInfo getScanInfoForFlushesAndCompactions(Configuration conf, ScanInfo oldScanInfo, final Store store, ScanType type) { long ttl = ScanInfoUtil.getTimeToLiveForCompactions(store.getFamily(), oldScanInfo); KeepDeletedCells keepDeletedCells = getKeepDeletedCells(store, type); int minVersions = getMinVersions(oldScanInfo, store); return new ScanInfo(conf,store.getFamily().getName(), minVersions, Integer.MAX_VALUE, ttl, keepDeletedCells, oldScanInfo.getTimeToPurgeDeletes(), oldScanInfo.getComparator()); }

Target:
public static ScanInfo getScanInfoForFlushesAndCompactions(Configuration conf, ScanInfo oldScanInfo, final Store store, ScanType type) { long ttl = getTimeToLiveForCompactions(store.getFamily(), oldScanInfo); KeepDeletedCells keepDeletedCells = getKeepDeletedCells(store, type); int minVersions = getMinVersions(oldScanInfo, store); return new ScanInfo(conf,store.getFamily().getName(), minVersions, Integer.MAX_VALUE, ttl, keepDeletedCells, oldScanInfo.getTimeToPurgeDeletes(), oldScanInfo.getComparator()); }
Source:
public boolean isConstantExpression(IASTNode point) { return fArg1.isConstantExpression(point) && fArg2.isConstantExpression(point) && (getOverload(point) == null || getOverload(point).isConstexpr()); }

Target:
public boolean isConstantExpression(IASTNode point) { return fArg1.isConstantExpression(point) && fArg2.isConstantExpression(point) && isConstexprFuncOrNull(getOverload(point)); }
Source:
public AccountRetrievalService() { super("AccountRetrievalService"); }

Target:
public AccountRetrievalService() { super(serviceName); }
Source:
public static String getCurrentLoggedUsername() { String username = SecurityContextHolder.getContext().getAuthentication().getName(); System.out.println(" + + + + LOGGED USERNAME: " + username); return username; }

Target:
public static String getCurrentLoggedUsername() { String username = SecurityContextHolder.getContext().getAuthentication().getName(); return username; }
Source:
public void addFileSystemBind(final String hostPath, final String containerPath, final BindMode mode, final SelinuxContext selinuxContext) { final MountableFile mountableFile = MountableFile.forHostPath(hostPath); binds.add(new Bind(mountableFile.getUnixFilesystemPath(), new Volume(containerPath), mode.accessMode, selinuxContext.selContext)); }

Target:
public void addFileSystemBind(final String hostPath, final String containerPath, final BindMode mode, final SelinuxContext selinuxContext) { if (SystemUtils.IS_OS_WINDOWS && hostPath.startsWith("/")) { binds.add(new Bind(hostPath, new Volume(containerPath), mode.accessMode, selinuxContext.selContext)); } else { final MountableFile mountableFile = MountableFile.forHostPath(hostPath); binds.add(new Bind(mountableFile.getResolvedPath(), new Volume(containerPath), mode.accessMode, selinuxContext.selContext)); } }
Source:
private void updatePropeties() { if (getEntity() == null) { return; } GlusterVolumeEntity entity = (GlusterVolumeEntity) getEntity(); setName(entity.getName()); setVolumeId(entity.getId() != null ? entity.getId().toString() : null); setVolumeType(entity.getVolumeType() != null ? entity.getVolumeType().toString() : null); setReplicaCount(entity.getReplicaCount() != null ? Integer.toString(entity.getReplicaCount()) : null); setStripeCount(entity.getStripeCount() != null ? Integer.toString(entity.getStripeCount()) : null); setNumOfBricks(entity.getBricks() != null ? Integer.toString(entity.getBricks().size()) : null); setTransportTypes(entity.getTransportTypes()); setVolumeFreeCapacity((entity.getAdvancedDetails() != null && entity.getAdvancedDetails().getCapacityInfo() != null) ?entity.getAdvancedDetails().getCapacityInfo().getFreeSize(): null); setVolumeTotalCapacity((entity.getAdvancedDetails() != null && entity.getAdvancedDetails().getCapacityInfo() != null) ? entity.getAdvancedDetails().getCapacityInfo().getTotalSize() : null); setVolumeUsedCapacity((entity.getAdvancedDetails() != null && entity.getAdvancedDetails().getCapacityInfo() != null) ?entity.getAdvancedDetails().getCapacityInfo().getUsedSize(): null); }

Target:
private void updatePropeties() { if (getEntity() == null) { return; } GlusterVolumeEntity entity = (GlusterVolumeEntity) getEntity(); setName(entity.getName()); setVolumeId(entity.getId() != null ? entity.getId().toString() : null); setVolumeType(entity.getVolumeType() != null ? entity.getVolumeType().toString() : null); setReplicaCount(entity.getReplicaCount() != null ? Integer.toString(entity.getReplicaCount()) : null); setStripeCount(entity.getStripeCount() != null ? Integer.toString(entity.getStripeCount()) : null); setNumOfBricks(entity.getBricks() != null ? Integer.toString(entity.getBricks().size()) : null); setTransportTypes(entity.getTransportTypes()); if(entity.getAdvancedDetails() != null && entity.getAdvancedDetails().getCapacityInfo() != null) { setVolumeFreeCapacity(entity.getAdvancedDetails().getCapacityInfo().getFreeSize()); setVolumeTotalCapacity(entity.getAdvancedDetails().getCapacityInfo().getTotalSize()); setVolumeUsedCapacity(entity.getAdvancedDetails().getCapacityInfo().getUsedSize()); } else { setVolumeFreeCapacity(null); setVolumeTotalCapacity(null); setVolumeUsedCapacity(null); } }
Source:
private boolean isHavingPredicate(final FilterPredicate filterPredicate) { String entityName = filterPredicate.getEntityType().getName(); String fieldName = filterPredicate.getField(); try { return getEntityDictionary().getFieldAnnotations(entityName, fieldName).stream() .map(Annotation::annotationType) .map(annotation -> annotation.getAnnotation(MetricAggregation.class)) .anyMatch(Objects::nonNull); } catch (NoSuchFieldException exception) { String message = String.format("Field '%s' not found in entity '%s'", entityName, fieldName); log.error(message, exception); throw new IllegalStateException(message, exception); } }

Target:
private boolean isHavingPredicate(final FilterPredicate filterPredicate) { Class entityClass = filterPredicate.getEntityType(); String fieldName = filterPredicate.getField(); return getSchema().isMetricField(fieldName, entityClass); }
Source:
protected void sendDmxData() { if (this.thing.getStatus().equals(ThingStatus.ONLINE)) { boolean needsSending = false; long now = System.currentTimeMillis(); universe.calculateBuffer(now); if ((universe.getLastBufferChanged() > lastSend) || refreshAlways) { needsSending = true; repeatCounter = 0; } else if (now - lastSend > 800) { needsSending = true; } else if (repeatCounter < 3) { needsSending = true; repeatCounter++; } if (needsSending) { packetTemplate.setPayload(universe.getBuffer(), universe.getBufferSize()); packetTemplate.setSequence(sequenceNo); DatagramPacket sendPacket = new DatagramPacket(packetTemplate.getRawPacket(), packetTemplate.getPacketLength()); for (IpNode receiverNode : receiverNodes) { sendPacket.setAddress(receiverNode.getAddress()); sendPacket.setPort(receiverNode.getPort()); logger.trace("sending packet with length to {}", packetTemplate.getPacketLength(), receiverNode.toString()); try { socket.send(sendPacket); } catch (IOException e) { logger.debug("Could not send to in {}: ", receiverNode, this.thing.getUID(), e); closeConnection(ThingStatusDetail.COMMUNICATION_ERROR, "could not send DMX data"); } } lastSend = now; sequenceNo = (sequenceNo + 1) % 256; } } else { openConnection(); } }

Target:
protected void sendDmxData() { if (this.thing.getStatus().equals(ThingStatus.ONLINE)) { boolean needsSending = false; long now = System.currentTimeMillis(); universe.calculateBuffer(now); if ((universe.getLastBufferChanged() > lastSend) || refreshAlways) { needsSending = true; repeatCounter = 0; } else if (now - lastSend > 800) { needsSending = true; } else if (repeatCounter < 3) { needsSending = true; repeatCounter++; } if (needsSending) { packetTemplate.setPayload(universe.getBuffer(), universe.getBufferSize()); packetTemplate.setSequence(sequenceNo); DatagramPacket sendPacket = new DatagramPacket(packetTemplate.getRawPacket(), packetTemplate.getPacketLength()); for (IpNode receiverNode : receiverNodes) { sendPacket.setAddress(receiverNode.getAddress()); sendPacket.setPort(receiverNode.getPort()); logger.trace("sending packet with length to {}", packetTemplate.getPacketLength(), receiverNode.toString()); try { socket.send(sendPacket); } catch (IOException e) { logger.debug("Could not send to in {}: {}", receiverNode, this.thing.getUID(), e.getMessage()); closeConnection(ThingStatusDetail.COMMUNICATION_ERROR, "could not send DMX data"); } } lastSend = now; sequenceNo = (sequenceNo + 1) % 256; } } else { openConnection(); } }