auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } final DeviceManagementMapper other = (DeviceManagementMapper) obj; if (this.ssldRepository == null) { if (other.ssldRepository != null) { return false; } } else if (!this.ssldRepository.equals(other.ssldRepository)) { return false; } return true; }

Target:
public boolean equals(final Object obj) { return super.equals(obj) && Objects.equals(this.ssldRepository, ((DeviceManagementMapper) obj).ssldRepository); }
Source:
public List<DocumentType> getSpecialDocumentTypes() { checkDirty(); return specialDocumentTypes.values().stream().collect(Collectors.toList()); }

Target:
public Set<String> getSpecialDocumentTypes() { checkDirty(); return specialDocumentTypes; }
Source:
@Override public void handleMessage(Message msg) { switch (msg.what) { case REQUEST_SUBMIT: { Request request = (Request) msg.obj; performSubmit(request); break; } case REQUEST_CANCEL: { Request request = (Request) msg.obj; performCancel(request); break; } case HUNTER_COMPLETE: { BitmapHunter hunter = (BitmapHunter) msg.obj; performComplete(hunter); break; } case HUNTER_RETRY: { BitmapHunter hunter = (BitmapHunter) msg.obj; performRetry(hunter); break; } case HUNTER_DECODE_FAILED: { BitmapHunter hunter = (BitmapHunter) msg.obj; performError(hunter); break; } case NETWORK_STATE_CHANGE: { NetworkInfo info = (NetworkInfo) msg.obj; performNetworkStateChange(info); break; } case AIRPLANE_MODE_CHANGE: { performAirplaneModeChange(msg.arg1 == 1); break; } default: throw new AssertionError("Unknown handler message received: " + msg.what); } }

Target:
@Override public void handleMessage(Message msg) { switch (msg.what) { case REQUEST_SUBMIT: { Request request = (Request) msg.obj; performSubmit(request); break; } case REQUEST_CANCEL: { Request request = (Request) msg.obj; performCancel(request); break; } case HUNTER_COMPLETE: { BitmapHunter hunter = (BitmapHunter) msg.obj; performComplete(hunter); break; } case HUNTER_RETRY: { BitmapHunter hunter = (BitmapHunter) msg.obj; performRetry(hunter); break; } case HUNTER_DECODE_FAILED: { BitmapHunter hunter = (BitmapHunter) msg.obj; performError(hunter); break; } case NETWORK_STATE_CHANGE: { NetworkInfo info = (NetworkInfo) msg.obj; performNetworkStateChange(info); break; } case AIRPLANE_MODE_CHANGE: { performAirplaneModeChange(msg.arg1 == AIRPLANE_MODE_ON); break; } default: throw new AssertionError("Unknown handler message received: " + msg.what); } }
Source:
CharSequence getTitle() { if (overriddenTitleFromExtender != null) return overriddenTitleFromExtender; return jsonPayload.optString("title", null); }

Target:
CharSequence getTitle() { if (overriddenTitleFromExtender != null) return overriddenTitleFromExtender; return jsonPayload.optString(TITLE_PAYLOAD_PARAM, null); }
Source:
public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class); List<String> supported = Arrays.asList(consumesAnnotation.value()); if(request.getContentType() == null) { logger.info("Request does not have Content-Type and parameters will be not deserialized"); stack.next(method, resourceInstance); return; } String contentType = mime(request.getContentType()); if (!supported.isEmpty() && !supported.contains(contentType)) { unsupported(String.format("Request with media type [%s]. Expecting one of %s.", contentType, supported)); return; } try { Deserializer deserializer = deserializers.deserializerFor(contentType, container); if (deserializer == null) { unsupported(String.format("Unable to handle media type [%s]: no deserializer found.", contentType)); return; } Object[] deserialized = deserializer.deserialize(request.getInputStream(), method); Object[] parameters = methodInfo.getParameters(); logger.debug("Deserialized parameters for are ", method, deserialized); for (int i = 0; i < deserialized.length; i++) { if (deserialized[i] != null) { parameters[i] = deserialized[i]; } } stack.next(method, resourceInstance); } catch (IOException e) { throw new InterceptionException(e); } }

Target:
public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class); List<String> supported = Arrays.asList(consumesAnnotation.value()); if(request.getContentType() == null) { logger.warn("Request does not have Content-Type and parameters will be not deserialized"); stack.next(method, resourceInstance); return; } String contentType = mime(request.getContentType()); if (!supported.isEmpty() && !supported.contains(contentType)) { unsupported(String.format("Request with media type [%s]. Expecting one of %s.", contentType, supported)); return; } try { Deserializer deserializer = deserializers.deserializerFor(contentType, container); if (deserializer == null) { unsupported(String.format("Unable to handle media type [%s]: no deserializer found.", contentType)); return; } Object[] deserialized = deserializer.deserialize(request.getInputStream(), method); Object[] parameters = methodInfo.getParameters(); logger.debug("Deserialized parameters for are ", method, deserialized); for (int i = 0; i < deserialized.length; i++) { if (deserialized[i] != null) { parameters[i] = deserialized[i]; } } stack.next(method, resourceInstance); } catch (IOException e) { throw new InterceptionException(e); } }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String header = ((HttpServletRequest) request).getHeader("Authorization"); String header_hive = ((HttpServletRequest) request).getHeader("HiveAuthToken"); String wireToken; if (header != null && header.startsWith(BEARER)) { wireToken = header.substring(BEARER.length()); } else if (header_hive != null) { wireToken = header_hive; } else { wireToken = request.getParameter(paramName); } if (wireToken != null && !wireToken.isEmpty()) { validateJWTtoken(wireToken, request, response, chain); } else { ((HttpServletResponse) response).sendError(HttpServletResponse.SC_UNAUTHORIZED); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String header = ((HttpServletRequest) request).getHeader("Authorization"); String wireToken; if (header != null && header.startsWith(BEARER)) { wireToken = header.substring(BEARER.length()); } else { wireToken = request.getParameter(paramName); } if (wireToken != null) { try { JWT token = new JWTToken(wireToken); if (validateToken((HttpServletRequest)request, (HttpServletResponse)response, chain, token)) { Subject subject = createSubjectFromToken(token); continueWithEstablishedSecurityContext(subject, (HttpServletRequest)request, (HttpServletResponse)response, chain); } } catch (ParseException ex) { ((HttpServletResponse) response).sendError(HttpServletResponse.SC_UNAUTHORIZED); } } else { ((HttpServletResponse) response).sendError(HttpServletResponse.SC_UNAUTHORIZED); } }
Source:
public void startTimer() { isTimerOn = true; Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() { public boolean execute() { moveProductsSideways(); return isTimerOn; } }, 7750); }

Target:
public void startTimer() { isTimerOn = true; Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() { public boolean execute() { moveProductsSideways(); return isTimerOn; } }, timerSidewaysPeriod); }
Source:
public List<Client> getClients() { init(); if (this.clients == null) { return Collections.emptyList(); } else { return this.clients; } }

Target:
public List<Client> getClients() { return this.clients; }
Source:
private void onSetOrCreateGameRule(GameRules gameRules, String key, String value) { for (WorldServer server : SpongeImpl.getServer().worldServers) { server.getGameRules().setOrCreateGameRule(key, value); } }

Target:
private void onSetOrCreateGameRule(GameRules gameRules, String key, String value) { for (WorldServer world : SpongeImpl.getServer().worldServers) { world.getGameRules().setOrCreateGameRule(key, value); } }
Source:
public void undeployVMReplica(ClaudiaData claudiaData, TierInstance tierInstance) throws InfrastructureException { log.debug("Undeploy VM replica " + tierInstance.getName() + " for region " + tierInstance.getTier().getRegion() + " and user " + tierInstance.getTier().getVdc()); try { OpenStackAccess openStackAccess = openStackRegion.getTokenAdmin(); String region = tierInstance.getTier().getRegion(); log.debug("tenantId " + openStackAccess.getTenantId()); log.debug("token " + openStackAccess.getToken()); openStackUtil.deleteServer(tierInstance.getVM().getVmid(), tierInstance.getTier().getRegion(), openStackAccess.getToken(), openStackAccess.getTenantId()); checkDeleteServerTaskStatus(tierInstance, claudiaData); log.debug("Undeployed VM replica " + tierInstance.getName() + " for region " + tierInstance.getTier().getRegion() + " and user " + tierInstance.getTier().getVdc()); if (tierInstance.getTier().getFloatingip().equals("true")) { log.debug("Delete floating ip "); openStackUtil.disAllocateFloatingIP(region, openStackAccess.getToken(), openStackAccess.getTenantId(), tierInstance.getVM().getFloatingIp()); } } catch (OpenStackException oes) { String errorMessage = "Error deleting serverId: " + tierInstance.getVM().getVmid(); log.error(errorMessage); throw new InfrastructureException(errorMessage); } }

Target:
public void undeployVMReplica(ClaudiaData claudiaData, TierInstance tierInstance) throws InfrastructureException { log.debug("Undeploy VM replica " + tierInstance.getName() + " for region " + tierInstance.getTier().getRegion() + " and user " + tierInstance.getTier().getVdc()); try { OpenStackAccess openStackAccess = openStackRegion.getTokenAdmin(); String region = tierInstance.getTier().getRegion(); String tenantAdminId = openStackAccess.getTenantId(); String tokenAdminId = openStackAccess.getToken(); log.debug("tenantId " + tenantAdminId ); log.debug("token " + tokenAdminId); openStackUtil.deleteServer(tierInstance.getVM().getVmid(), region, tokenAdminId, tenantAdminId); checkDeleteServerTaskStatus(tierInstance, claudiaData); log.debug("Undeployed VM replica " + tierInstance.getName() + " for region " + region + " and user " + tierInstance.getTier().getVdc()); if (tierInstance.getTier().getFloatingip().equals("true")) { log.debug("Delete floating ip "); openStackUtil.disAllocateFloatingIP(region, tokenAdminId, tenantAdminId, tierInstance.getVM().getFloatingIp()); } } catch (OpenStackException oes) { String errorMessage = "Error deleting serverId: " + tierInstance.getVM().getVmid(); log.error(errorMessage); throw new InfrastructureException(errorMessage); } }
Source:
public void testMemoryLeak() throws Exception { final int port = SocketUtils.findAvailableServerSocket(); TcpNioClientConnectionFactory factory = new TcpNioClientConnectionFactory("localhost", port); factory.setNioHarvestInterval(100); factory.start(); final CountDownLatch latch = new CountDownLatch(1); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { try { ServerSocket server = ServerSocketFactory.getDefault().createServerSocket(port); latch.countDown(); Socket socket = server.accept(); byte[] b = new byte[6]; readFully(socket.getInputStream(), b); } catch (Exception e) { e.printStackTrace(); } } }); assertTrue(latch.await(10000, TimeUnit.MILLISECONDS)); try { TcpConnection connection = factory.getConnection(); Map<SocketChannel, TcpNioConnection> connections = factory.getConnections(); assertEquals(1, connections.size()); connection.close(); assertTrue(!connection.isOpen()); TestUtils.getPropertyValue(factory, "selector", Selector.class).wakeup(); int n = 0; while (connections.size() > 0) { Thread.sleep(100); if (n++ > 100) { break; } } assertEquals(0, connections.size()); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e); } factory.stop(); }

Target:
public void testMemoryLeak() throws Exception { final int port = SocketUtils.findAvailableServerSocket(); TcpNioClientConnectionFactory factory = new TcpNioClientConnectionFactory("localhost", port); factory.setNioHarvestInterval(100); factory.start(); final CountDownLatch latch = new CountDownLatch(1); final AtomicReference<ServerSocket> serverSocket = new AtomicReference<ServerSocket>(); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { try { ServerSocket server = ServerSocketFactory.getDefault().createServerSocket(port); serverSocket.set(server); latch.countDown(); Socket socket = server.accept(); byte[] b = new byte[6]; readFully(socket.getInputStream(), b); } catch (Exception e) { e.printStackTrace(); } } }); assertTrue(latch.await(10000, TimeUnit.MILLISECONDS)); try { TcpConnection connection = factory.getConnection(); Map<SocketChannel, TcpNioConnection> connections = factory.getConnections(); assertEquals(1, connections.size()); connection.close(); assertTrue(!connection.isOpen()); TestUtils.getPropertyValue(factory, "selector", Selector.class).wakeup(); int n = 0; while (connections.size() > 0) { Thread.sleep(100); if (n++ > 100) { break; } } assertEquals(0, connections.size()); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e); } factory.stop(); serverSocket.get().close(); }
Source:
public void eventReceived(Event event) { switch (event.getEventType()) { case HistoryReferenceEventPublisher.EVENT_NOTE_SET: LOGGER.debug("NOTE SET EVENT recieved..."); int refIdAdd = Integer.valueOf( event.getParameters() .get( HistoryReferenceEventPublisher .FIELD_HISTORY_REFERENCE_ID)); addRowToNotesTable(refIdAdd); break; case HistoryReferenceEventPublisher.EVENT_REMOVED: LOGGER.debug("NOTE REMOVE EVENT recieved... {}", event.getParameters().toString()); int refIdDelete = Integer.valueOf( event.getParameters() .get( HistoryReferenceEventPublisher .FIELD_HISTORY_REFERENCE_ID)); deleteRowFromNotes(refIdDelete); break; default: } }

Target:
public void eventReceived(Event event) { switch (event.getEventType()) { case HistoryReferenceEventPublisher.EVENT_NOTE_SET: LOGGER.debug("NOTE SET EVENT received..."); int refIdAdd = Integer.valueOf( event.getParameters() .get( HistoryReferenceEventPublisher .FIELD_HISTORY_REFERENCE_ID)); addRowToNotesTable(refIdAdd); break; case HistoryReferenceEventPublisher.EVENT_REMOVED: LOGGER.debug("NOTE REMOVE EVENT received... {}", event.getParameters().toString()); int refIdDelete = Integer.valueOf( event.getParameters() .get( HistoryReferenceEventPublisher .FIELD_HISTORY_REFERENCE_ID)); deleteRowFromNotes(refIdDelete); break; default: } }
Source:
protected void updateTab(CTabItem cti, MPart part, String attName, Object newValue) { if (UIEvents.UILabel.LABEL.equals(attName)) { String newName = (String) newValue; cti.setText(getLabel(part, newName)); } else if (UIEvents.UILabel.ICONURI.equals(attName)) { cti.setImage(getImage(part)); } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) { String newTTip = (String) newValue; cti.setToolTipText(newTTip); } else if (UIEvents.Dirtyable.DIRTY.equals(attName)) { Boolean dirtyState = (Boolean) newValue; String text = cti.getText(); boolean hasAsterisk = text.length() > 0 && text.charAt(0) == '*'; if (dirtyState.booleanValue()) { if (!hasAsterisk) { cti.setText('*' + text); } } else if (hasAsterisk) { cti.setText(text.substring(1)); } } else if (UIEvents.UILifeCycle.BUSY.equals(attName)) { setCSSInfo(part, cti); reapplyStyles(cti); } }

Target:
protected void updateTab(CTabItem cti, MPart part, String attName, Object newValue) { if (UIEvents.UILabel.LABEL.equals(attName)) { String newName = (String) newValue; cti.setText(getLabel(part, newName)); } else if (UIEvents.UILabel.ICONURI.equals(attName)) { cti.setImage(getImage(part)); } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) { String newTTip = (String) newValue; cti.setToolTipText(newTTip); } else if (UIEvents.Dirtyable.DIRTY.equals(attName)) { Boolean dirtyState = (Boolean) newValue; String text = cti.getText(); boolean hasAsterisk = text.length() > 0 && text.charAt(0) == '*'; if (dirtyState.booleanValue()) { if (!hasAsterisk) { cti.setText('*' + text); } } else if (hasAsterisk) { cti.setText(text.substring(1)); } } }
Source:
public BaseResultIterators(QueryPlan plan, Integer perScanLimit, ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { super(plan.getContext(), plan.getTableRef(), plan.getGroupBy(), plan.getOrderBy(), plan.getStatement().getHint(), plan.getLimit()); this.plan = plan; this.scanGrouper = scanGrouper; StatementContext context = plan.getContext(); this.scan = scan == null ? context.getScan() : scan; this.mutationState = new MutationState(context.getConnection().getMutationState()); TableRef tableRef = plan.getTableRef(); PTable table = tableRef.getTable(); physicalTableName = table.getPhysicalName().getBytes(); tableStats = useStats() ? new MetaDataClient(context.getConnection()).getTableStats(table) : PTableStats.EMPTY_STATS; scanId = UUID.randomUUID().toString(); initializeScan(plan, perScanLimit, scan); this.scans = getParallelScans(); List<KeyRange> splitRanges = Lists.newArrayListWithExpectedSize(scans.size() * ESTIMATED_GUIDEPOSTS_PER_REGION); for (List<Scan> scanList : scans) { for (Scan aScan : scanList) { splitRanges.add(KeyRange.getKeyRange(aScan.getStartRow(), aScan.getStopRow())); } } this.splits = ImmutableList.copyOf(splitRanges); this.allFutures = Lists.newArrayListWithExpectedSize(1); }

Target:
public BaseResultIterators(QueryPlan plan, Integer perScanLimit, ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { super(plan.getContext(), plan.getTableRef(), plan.getGroupBy(), plan.getOrderBy(), plan.getStatement().getHint(), plan.getLimit()); this.plan = plan; this.scanGrouper = scanGrouper; StatementContext context = plan.getContext(); this.scan = scan; this.mutationState = new MutationState(context.getConnection().getMutationState()); TableRef tableRef = plan.getTableRef(); PTable table = tableRef.getTable(); physicalTableName = table.getPhysicalName().getBytes(); tableStats = useStats() ? new MetaDataClient(context.getConnection()).getTableStats(table) : PTableStats.EMPTY_STATS; scanId = UUID.randomUUID().toString(); initializeScan(plan, perScanLimit, scan); this.scans = getParallelScans(); List<KeyRange> splitRanges = Lists.newArrayListWithExpectedSize(scans.size() * ESTIMATED_GUIDEPOSTS_PER_REGION); for (List<Scan> scanList : scans) { for (Scan aScan : scanList) { splitRanges.add(KeyRange.getKeyRange(aScan.getStartRow(), aScan.getStopRow())); } } this.splits = ImmutableList.copyOf(splitRanges); this.allFutures = Lists.newArrayListWithExpectedSize(1); }
Source:
public static AbstractParallelWorker newWorker(XmlSuite.ParallelMode mode) { if (XmlSuite.ParallelMode.INSTANCES.equals(mode)) { return new InstanceBasedParallelParallelWorker(); } return new ClassBasedParallelParallelWorker(); }

Target:
public static AbstractParallelWorker newWorker(XmlSuite.ParallelMode mode) { if (XmlSuite.ParallelMode.INSTANCES.equals(mode)) { return new InstanceBasedParallelParallelWorker(); } return new ClassBasedParallelWorker(); }
Source:
protected ImmutableValue<Boolean> constructImmutableValue(Boolean value) { return ImmutableSpongeValue.cachedOf(Keys.IS_ADULT, false, value); }

Target:
protected ImmutableValue<Boolean> constructImmutableValue(Boolean value) { return ImmutableSpongeValue.cachedOf(Keys.IS_ADULT, true, value); }
Source:
public void getAllDocumentIds() throws Exception { Assert.assertTrue(datastore.getAllDocumentIds().isEmpty()); createTwoDocuments(); Assert.assertEquals(2, datastore.getAllDocumentIds().size()); }

Target:
public void getAllDocumentIds() throws Exception { Assert.assertTrue(datastore.getAllDocumentIds().isEmpty()); MutableDocumentRevision rev = new MutableDocumentRevision(); rev.docId = "document-one"; rev.body = bodyOne; datastore.createDocumentFromRevision(rev); rev.docId = "document-two"; rev.body = bodyTwo; datastore.createDocumentFromRevision(rev); Assert.assertThat(datastore.getAllDocumentIds(), containsInAnyOrder("document-one", "document-two")); }
Source:
private Pair<Integer,Integer> getWidthHeight(int widthMeasureSpec, int heightMeasureSpec, double imageScaleFactor) { double maxWidth = mMaxWidth; double maxHeight = mMaxHeight; if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST) { maxWidth = Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth) * imageScaleFactor; } if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { maxHeight = Math.min(MeasureSpec.getSize(heightMeasureSpec), mMaxHeight) * imageScaleFactor; } Drawable drawable = getDrawable(); float dWidth = dipToPixels(getContext(), drawable.getIntrinsicWidth()); float dHeight = dipToPixels(getContext(), drawable.getIntrinsicHeight()); float ratio = (dWidth) / dHeight; double width = (int) Math.min(Math.max(dWidth, getSuggestedMinimumWidth()), maxWidth); double height = (int) (width / ratio); height = Math.min(Math.max(height, getSuggestedMinimumHeight()), maxHeight); width = (int) (height * ratio); if (width > maxWidth) { width = maxWidth; height = (int) (width / ratio); } return new Pair<Integer, Integer>(new Double(width).intValue(), new Double(height).intValue()); }

Target:
private Pair<Integer,Integer> getWidthHeight(int widthMeasureSpec, int heightMeasureSpec, double imageScaleFactor) { double maxWidth = mMaxWidth; double maxHeight = mMaxHeight; if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST) { maxWidth = Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth) * imageScaleFactor; } if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { maxHeight = Math.min(MeasureSpec.getSize(heightMeasureSpec), mMaxHeight) * imageScaleFactor; } Drawable drawable = getDrawable(); float dWidth = dipToPixels(getContext(), drawable.getIntrinsicWidth()); float dHeight = dipToPixels(getContext(), drawable.getIntrinsicHeight()); float ratio = (dWidth) / dHeight; double width = Math.min(Math.max(dWidth, getSuggestedMinimumWidth()), maxWidth); double height = width / ratio; height = Math.min(Math.max(height, getSuggestedMinimumHeight()), maxHeight); width = height * ratio; if (width > maxWidth) { width = maxWidth; height = width / ratio; } return new Pair<Integer, Integer>(new Double(width).intValue(), new Double(height).intValue()); }
Source:
public Set<DistributionModuleGroup> getModuleGroups() throws Exception { Set<DistributionModuleGroup> moduleGroups = new HashSet<>(); Set<DistributionModuleGroup> moduleGroupsFromSuper = super.getModuleGroups(); if (moduleGroupsFromSuper != null && !moduleGroupsFromSuper.isEmpty()) { moduleGroups.addAll(moduleGroupsFromSuper); } DynamicPluginAdapter pluginAdapter = getPluginAdapter(); String hdfsRuntimeId = pluginAdapter .getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.HDFS_MODULE_GROUP.getModuleName()); String mrRuntimeId = pluginAdapter .getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.MAPREDUCE_MODULE_GROUP.getModuleName()); checkRuntimeId(hdfsRuntimeId); checkRuntimeId(mrRuntimeId); if (StringUtils.isNotBlank(hdfsRuntimeId)) { moduleGroups.add(new DistributionModuleGroup(hdfsRuntimeId)); } if (StringUtils.isNotBlank(mrRuntimeId)) { moduleGroups.add(new DistributionModuleGroup(mrRuntimeId)); } return moduleGroups; }

Target:
public Set<DistributionModuleGroup> getModuleGroups() throws Exception { Set<DistributionModuleGroup> moduleGroups = new HashSet<>(); Set<DistributionModuleGroup> moduleGroupsFromSuper = super.getModuleGroups(); if (moduleGroupsFromSuper != null && !moduleGroupsFromSuper.isEmpty()) { moduleGroups.addAll(moduleGroupsFromSuper); } DynamicPluginAdapter pluginAdapter = getPluginAdapter(); String hdfsRuntimeId = pluginAdapter .getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.HDFS_MODULE_GROUP.getModuleName()); checkRuntimeId(hdfsRuntimeId); if (StringUtils.isNotBlank(hdfsRuntimeId)) { moduleGroups.add(new DistributionModuleGroup(hdfsRuntimeId)); } return moduleGroups; }
Source:
synchronized void unmark() { Preconditions.checkState(referenceCount >= 0, "Reference count can not go below zero!"); referenceCount--; }

Target:
synchronized void unmark() { Preconditions.checkState(referenceCount > 0, "Reference count can not go below zero!"); referenceCount--; }
Source:
public InputStream writeObject(final VelocityResourceKey key) throws DotStateException, DotDataException, DotSecurityException { long language = new Long(key.language); ContentletVersionInfo info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, language); if (info == null && language != defualtLang && APILocator.getLanguageAPI().canDefaultContentToDefaultLanguage()) { info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, defualtLang); } if (info == null || key.mode.showLive && info.getLiveInode() == null) { throw new ResourceNotFoundException("cannot find content for: " + key); } Contentlet contentlet = (key.mode.showLive) ? APILocator.getContentletAPI().find(info.getLiveInode(), APILocator.systemUser(), false) : APILocator.getContentletAPI().find(info.getWorkingInode(), APILocator.systemUser(), false); Logger.debug(this, "DotResourceLoader:\tWriting out contentlet inode = " + contentlet.getInode()); if (null == contentlet) { throw new ResourceNotFoundException("cannot find content for: " + key); } return buildVelocity(contentlet, key.mode, key.path); }

Target:
public InputStream writeObject(final VelocityResourceKey key) throws DotStateException, DotDataException, DotSecurityException { long language = new Long(key.language); ContentletVersionInfo info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, language); if (info == null && language != defaultLang && APILocator.getLanguageAPI().canDefaultContentToDefaultLanguage()) { info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, defaultLang); } if (info == null || key.mode.showLive && info.getLiveInode() == null) { throw new ResourceNotFoundException("cannot find content for: " + key); } Contentlet contentlet = (key.mode.showLive) ? APILocator.getContentletAPI().find(info.getLiveInode(), APILocator.systemUser(), false) : APILocator.getContentletAPI().find(info.getWorkingInode(), APILocator.systemUser(), false); Logger.debug(this, "DotResourceLoader:\tWriting out contentlet inode = " + contentlet.getInode()); if (null == contentlet) { throw new ResourceNotFoundException("cannot find content for: " + key); } return buildVelocity(contentlet, key.mode, key.path); }
Source:
public long interval() { return interval; }

Target:
public Duration interval() { return interval; }
Source:
public Observable<PersistentResource> export(AsyncQuery query) { Observable<PersistentResource> results = Observable.empty(); UUID requestId = UUID.fromString(query.getRequestId()); try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { elide.getTransactionRegistry().addRunningTransaction(requestId, tx); EntityProjection projection = null; RequestScope requestScope = null; if (query.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { projection = graphQLParser.parse(query); requestScope = new GraphQLRequestScope("", tx, user, apiVersion, elide.getElideSettings(), null, requestId, null); } else { throw new InvalidValueException("QueryType not supported"); } if (projection != null) { results = PersistentResource.loadRecords(projection, Collections.emptyList(), requestScope); } tx.preCommit(requestScope); requestScope.runQueuedPreSecurityTriggers(); requestScope.getPermissionExecutor().executeCommitChecks(); tx.flush(requestScope); requestScope.runQueuedPreCommitTriggers(); elide.getAuditLogger().commit(); tx.commit(requestScope); requestScope.runQueuedPostCommitTriggers(); } catch (IOException e) { log.error("IOException during TableExport", e); throw new TransactionException(e); } finally { elide.getTransactionRegistry().removeRunningTransaction(requestId); elide.getAuditLogger().clear(); } return results; }

Target:
public Observable<PersistentResource> export(AsyncQuery query) { Observable<PersistentResource> results = Observable.empty(); UUID requestId = UUID.fromString(query.getRequestId()); try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { elide.getTransactionRegistry().addRunningTransaction(requestId, tx); EntityProjection projection = null; RequestScope requestScope = null; if (query.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { projection = graphQLParser.parse(query); requestScope = new GraphQLRequestScope("", tx, user, apiVersion, elide.getElideSettings(), null, requestId, Collections.emptyMap()); } else { throw new InvalidValueException("QueryType not supported"); } if (projection != null) { results = PersistentResource.loadRecords(projection, Collections.emptyList(), requestScope); } tx.preCommit(requestScope); requestScope.runQueuedPreSecurityTriggers(); requestScope.getPermissionExecutor().executeCommitChecks(); tx.flush(requestScope); requestScope.runQueuedPreCommitTriggers(); elide.getAuditLogger().commit(); tx.commit(requestScope); requestScope.runQueuedPostCommitTriggers(); } catch (IOException e) { log.error("IOException during TableExport", e); throw new TransactionException(e); } finally { elide.getTransactionRegistry().removeRunningTransaction(requestId); elide.getAuditLogger().clear(); } return results; }
Source:
public void close() { for (SegmentHandle fh : writeChannels.values()) { fh.close(); } for (FileChannel channel : channelsToSync) { try { channel.force(true); } catch (IOException e) { log.debug("Can't force updates in the channel {}", e.getMessage()); } finally { IOUtils.closeQuietly(channel); } } writeChannels = new ConcurrentHashMap<>(); channelsToSync.clear(); }

Target:
public void close() { segmentSupervisor.close(); }
Source:
default List<ITestNGMethod> getSkipCausedBy() { return Lists.newArrayList(); }

Target:
default List<ITestNGMethod> getSkipCausedBy() { return Collections.emptyList(); }
Source:
public long getEstimatedSizeInBytes() { long hashMemorySizeInBytes = groupByHash == null ? 0 : groupByHash.getEstimatedSize(); return INSTANCE_SIZE + memorySizeInBytes + hashMemorySizeInBytes + groupedRows.sizeOf() + pageReferences.sizeOf() + emptyPageReferenceSlots.getEstimatedSizeInBytes(); }

Target:
public long getEstimatedSizeInBytes() { return INSTANCE_SIZE + memorySizeInBytes + groupByHash.getEstimatedSize() + groupedRows.sizeOf() + pageReferences.sizeOf() + emptyPageReferenceSlots.getEstimatedSizeInBytes(); }
Source:
public DefaultRefreshTokenResultFactory(Application application) { Assert.notNull(application, "Application argument cannot be null."); this.application = application; }

Target:
public DefaultRefreshTokenResultFactory(Application application) { Assert.notNull(application, "application argument cannot be null."); this.application = application; }
Source:
protected final long doWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen) throws IOException { if (data.hasMemoryAddress()) { long memoryAddress = data.memoryAddress(); if (remoteAddress == null) { return socket.writeAddress(memoryAddress, data.readerIndex(), data.writerIndex()); } else { return socket.sendToAddress(memoryAddress, data.readerIndex(), data.writerIndex(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } else if (data.nioBufferCount() > 1) { IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray(); array.add(data, data.readerIndex(), data.readableBytes()); int cnt = array.count(); assert cnt != 0; if (remoteAddress == null) { return socket.writevAddresses(array.memoryAddress(0), cnt); } else { return socket.sendToAddresses(array.memoryAddress(0), cnt, remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } else { ByteBuffer nioData = data.internalNioBuffer(data.readerIndex(), data.readableBytes()); if (remoteAddress == null) { return socket.write(nioData, nioData.position(), nioData.limit()); } else { return socket.sendTo(nioData, nioData.position(), nioData.limit(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } }

Target:
protected final long doWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen) throws IOException { assert !(fastOpen && remoteAddress == null) : "fastOpen requires a remote address"; if (data.hasMemoryAddress()) { long memoryAddress = data.memoryAddress(); if (remoteAddress == null) { return socket.writeAddress(memoryAddress, data.readerIndex(), data.writerIndex()); } else { return socket.sendToAddress(memoryAddress, data.readerIndex(), data.writerIndex(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } else if (data.nioBufferCount() > 1) { IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray(); array.add(data, data.readerIndex(), data.readableBytes()); int cnt = array.count(); assert cnt != 0; if (remoteAddress == null) { return socket.writevAddresses(array.memoryAddress(0), cnt); } else { return socket.sendToAddresses(array.memoryAddress(0), cnt, remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } else { ByteBuffer nioData = data.internalNioBuffer(data.readerIndex(), data.readableBytes()); if (remoteAddress == null) { return socket.write(nioData, nioData.position(), nioData.limit()); } else { return socket.sendTo(nioData, nioData.position(), nioData.limit(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } }
Source:
public LdapUser getAdUser() { return adUser; }

Target:
public LdapUser getAdUser() { return ldapUser; }
Source:
public static boolean isValidFirmwareUpdate(final Pair<Integer, List<SyncResponse.FileDownload>> fw_files, final Integer currentFirmwareVersion) { final Integer firmwareVersion = fw_files.getKey(); if (firmwareVersion == -1) { LOGGER.error("Failed to retrieve S3 file list."); return false; } if (firmwareVersion.equals(currentFirmwareVersion)) { LOGGER.warn("Versions match: {}, current version = {}", firmwareVersion, currentFirmwareVersion); return false; } return true; }

Target:
public static boolean isValidFirmwareUpdate(final Pair<Integer, List<SyncResponse.FileDownload>> fw_files, final Integer currentFirmwareVersion) { final Integer firmwareVersion = fw_files.getKey(); if (firmwareVersion == -1) { LOGGER.error("Failed to retrieve S3 file list."); return false; } if (firmwareVersion.equals(currentFirmwareVersion)) { LOGGER.info("Versions match: {}, current version = {}", firmwareVersion, currentFirmwareVersion); return false; } return true; }
Source:
public List<Partition> getPartitionsByNames(String catName, String db_name, String tbl_name, List<String> part_names, boolean getColStats) throws TException { checkDbAndTableFilters(catName, db_name, tbl_name); List<Partition> parts = client.get_partitions_by_names(prependCatalogToDbName(catName, db_name, conf), tbl_name, part_names, getColStats); return deepCopyPartitions(FilterUtils.filterPartitionsIfEnabled(isClientFilterEnabled, filterHook, parts)); }

Target:
public List<Partition> getPartitionsByNames(String catName, String db_name, String tbl_name, List<String> part_names, boolean getColStats) throws TException { checkDbAndTableFilters(catName, db_name, tbl_name); GetPartitionsByNamesRequest gpbnr = new GetPartitionsByNamesRequest(prependCatalogToDbName(catName, db_name, conf), tbl_name); gpbnr.setNames(part_names); gpbnr.setGet_col_stats(getColStats); List<Partition> parts = client.get_partitions_by_names_req(gpbnr).getPartitions(); return deepCopyPartitions(FilterUtils.filterPartitionsIfEnabled(isClientFilterEnabled, filterHook, parts)); }
Source:
public void execute(JobExecutionContext context) throws JobExecutionException { Logger.debug(this, "Running CalendarReminderThread - " + new Date()); try { run(); } catch (Exception e) { Logger.warn(this, e.toString()); } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.warn(this, e.getMessage(), e); } } }

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { Logger.debug(this, "Running CalendarReminderThread - " + new Date()); try { run(); } catch (Exception e) { Logger.warn(this, e.toString()); } }
Source:
public static Document parseInputStream( final InputStream instream ) throws ParserConfigurationException, SAXException, IOException { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setFeature( XMLConstants.FEATURE_SECURE_PROCESSING, true ); dbf.setFeature( "<LINK_0>", true ); final DocumentBuilder db = dbf.newDocumentBuilder(); return db.parse( new InputSource( instream ) ); }

Target:
public static Document parseInputStream( final InputStream instream ) throws ParserConfigurationException, SAXException, IOException { final DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory(); final DocumentBuilder db = dbf.newDocumentBuilder(); return db.parse( new InputSource( instream ) ); }
Source:
private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { if (!isShuttingDown) { runnable.run(); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } else { LOG.debug("Action: completed successfully.", actionName); } } } catch (Throwable throwable) { LOG.error("Execution of action: failed.", actionName, throwable); doCleanUpOnTaskException(throwable); } }; }

Target:
private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { if (!isShuttingDown) { runnable.run(); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } else { LOG.info("Action: completed successfully.", actionName); } } } catch (Throwable throwable) { LOG.error("Execution of action: failed.", actionName, throwable); doCleanUpOnTaskException(throwable); } }; }
Source:
private @CheckForNull Launcher getLauncher() { final Executor e = Executor.currentExecutor(); final Jenkins jenkins = Jenkins.getInstance(); Computer computer = null; if (e != null) { computer = e.getOwner(); } else if (jenkins != null ) { computer = jenkins.toComputer(); } if (computer != null) { final Node node = computer.getNode(); if (node != null) { return node.createLauncher(listener); } } return null; }

Target:
private @CheckForNull Launcher getLauncher() throws IOException, InterruptedException { if (this.launcher != null) { return launcher; } Computer computer = null; if (repository != null) { computer = repository.toComputer(); } else { final Executor e = Executor.currentExecutor(); final Jenkins jenkins = Jenkins.getInstance(); if (e != null) { computer = e.getOwner(); } else if (jenkins != null) { computer = jenkins.toComputer(); } } if (computer != null) { final Node node = computer.getNode(); if (node != null) { return node.createLauncher(listener).decorateByEnv(computer.buildEnvironment(listener)); } } return null; }
Source:
public void updateConfig(EntityConfigUpdateCommand command, Username currentUser) { LOGGER.info("Config update for entity request by is in queue - {}", currentUser, command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update for entity request by is being processed", currentUser); if (!command.canContinue(cachedConfigService.currentConfig())) { throw new ConfigUpdateCheckFailedException(); } cachedConfigService.writeEntityWithLock(command, currentUser); } catch (Exception e) { LOGGER.info("Config update for entity failed", e); } finally { LOGGER.info("Entity update for request by is completed", currentUser); } } }

Target:
public void updateConfig(EntityConfigUpdateCommand command, Username currentUser) { LOGGER.info("Config update for entity request by is in queue - {}", currentUser, command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update for entity request by is being processed", currentUser); if (!command.canContinue(cachedConfigService.currentConfig())) { throw new ConfigUpdateCheckFailedException(); } cachedConfigService.writeEntityWithLock(command, currentUser); } catch (Exception e) { LOGGER.error("Config update for entity failed", e); throw e; } finally { LOGGER.info("Entity update for request by is completed", currentUser); } } }
Source:
private DatastreamTask getOrCreateDatastreamTask(List<DatastreamTask> reuseTasksPerDg, DatastreamGroup dg) { if (reuseTasksPerDg.size() > 0) { return reuseTasksPerDg.remove(0); } return new DatastreamTaskImpl(dg.getDatastreams()); }

Target:
private DatastreamTask getOrCreateDatastreamTask(List<DatastreamTask> reuseTasksPerDg, DatastreamGroup dg) { return (!reuseTasksPerDg.isEmpty()) ? reuseTasksPerDg.remove(reuseTasksPerDg.size() - 1) : new DatastreamTaskImpl(dg.getDatastreams()); }
Source:
public <E extends Throwable> void expectErrorWithMessage(Class<E> expected, String requiredMessagePart) throws Exception { expectErrorWithMessage(expected, Collections.singletonList(requiredMessagePart), env.defaultTimeoutMillis(), env.defaultPollTimeoutMillis); }

Target:
public <E extends Throwable> void expectErrorWithMessage(Class<E> expected, String requiredMessagePart) throws Exception { expectErrorWithMessage(expected, Collections.singletonList(requiredMessagePart), env.defaultTimeoutMillis(), env.defaultPollTimeoutMillis()); }
Source:
public void tearDown() { try { if ( !em.getTransaction().isActive() ) { em.getTransaction().begin(); } Family found = em.find( Family.class, family.getName() ); if ( found != null ) { em.remove( found ); } em.getTransaction().commit(); } finally { em.close(); } }

Target:
public void tearDown() { try { em.getTransaction().begin(); Family found = em.find( Family.class, family.getName() ); if ( found != null ) { em.remove( found ); } em.getTransaction().commit(); } finally { em.close(); } }
Source:
public void cleanup() { module.close(); }

Target:
public void cleanup() { if (module != null) { module.close(); } }
Source:
protected void buildSubTree(TreeNode parentNode, Conflict conflict, Match match) { SetView<Diff> setView = Sets.intersection(Sets.newLinkedHashSet(match.getDifferences()), Sets .newHashSet(conflict.getDifferences())); for (Diff diff : setView) { if (!isParentPseudoConflictFromOtherSide(diff, parentNode.getData())) { TreeNode wrap = wrap(diff); parentNode.getChildren().add(wrap); if (isContainment(diff)) { final Match diffMatch = diff.getMatch().getComparison().getMatch( ((ReferenceChange)diff).getValue()); buildSubTree(wrap, conflict, diffMatch); } } } for (Match subMatch : match.getSubmatches()) { if (!isMatchOfConflictContainmentDiff(conflict, subMatch)) { buildSubTree(parentNode, conflict, subMatch); } } }

Target:
protected void buildSubTree(TreeNode parentNode, Conflict conflict, Match match) { SetView<Diff> setView = Sets.intersection(Sets.newLinkedHashSet(match.getDifferences()), Sets .newHashSet(conflict.getDifferences())); for (Diff diff : setView) { if (!isParentPseudoConflictFromOtherSide(diff, parentNode.getData())) { TreeNode wrap = wrap(diff); parentNode.getChildren().add(wrap); if (isContainment(diff)) { final Match diffMatch = ComparisonUtil.getComparison(diff).getMatch( ((ReferenceChange)diff).getValue()); buildSubTree(wrap, conflict, diffMatch); } } } for (Match subMatch : match.getSubmatches()) { if (!isMatchOfConflictContainmentDiff(conflict, subMatch)) { buildSubTree(parentNode, conflict, subMatch); } } }
Source:
protected final SignalReactor provideSignalReactor(short signalID) { SignalReactor signalReactor = null; if (isActive()) { switch (signalID) { case SIGNAL_REMOTE_EXCEPTION: signalReactor = new RemoteExceptionIndication(this); break; case SIGNAL_MONITOR_CANCELED: signalReactor = new MonitorCanceledIndication(this); break; case SIGNAL_MONITOR_PROGRESS: signalReactor = new MonitorProgressIndication(this); break; case SIGNAL_SET_TIMEOUT: signalReactor = new SetTimeoutIndication(this); break; default: signalReactor = createSignalReactor(signalID); if (signalReactor == null) { throw new IllegalArgumentException("Invalid signalID " + signalID); } } } return signalReactor; }

Target:
protected final SignalReactor provideSignalReactor(short signalID) { if (!isActive()) { return null; } switch (signalID) { case SIGNAL_REMOTE_EXCEPTION: return new RemoteExceptionIndication(this); case SIGNAL_MONITOR_CANCELED: return new MonitorCanceledIndication(this); case SIGNAL_MONITOR_PROGRESS: return new MonitorProgressIndication(this); case SIGNAL_SET_TIMEOUT: return new SetTimeoutIndication(this); default: SignalReactor signal = createSignalReactor(signalID); if (signal == null) { throw new IllegalArgumentException("Invalid signalID " + signalID); } return signal; } }
Source:
public void setStringValueFromFlag() throws Exception { final String certificateFileNameKey = "CertificateFileName"; ConfigKey originalAuthenticationMethod = config.getEngineConfigLogic().fetchConfigKey(certificateFileNameKey, "general"); final String certificateFileNameNewValue = "/certs/"; final String version = "general"; setKeyAndValidate(certificateFileNameKey, certificateFileNameNewValue, version); restoreOriginalValue(certificateFileNameKey, originalAuthenticationMethod); }

Target:
public void setStringValueFromFlag() throws Exception { final String certificateFileNameKey = "CertificateFileName"; ConfigKey originalAuthenticationMethod = config.getEngineConfigLogic().fetchConfigKey(certificateFileNameKey, "general"); final String certificateFileNameNewValue = "/certs/"; setKeyAndValidate(certificateFileNameKey, certificateFileNameNewValue, "general"); restoreOriginalValue(certificateFileNameKey, originalAuthenticationMethod); }
Source:
protected boolean considerEvent(ITmfEvent event) { if (!(event instanceof CtfTmfEvent)) { return false; } Object tid = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), LinuxTidAspect.class, event); if (!(tid instanceof Number)) { return false; } return true; }

Target:
protected boolean considerEvent(ITmfEvent event) { if (!(event instanceof CtfTmfEvent)) { return false; } Object tid = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), LinuxTidAspect.class, event); if (!(tid instanceof Integer)) { return false; } return true; }
Source:
public FloatValue withNewChildren(NodeChildrenContainer newChildren) { if (!newChildren.isEmpty()) { throw new IllegalArgumentException("Cannot pass non-empty newChildren to Node that doesn't hold children"); } return this; }

Target:
public FloatValue withNewChildren(NodeChildrenContainer newChildren) { assertNewChildrenAreEmpty(newChildren); return this; }