auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void whenMixedStreamsThenPartitionsAssignedCorrectly() throws IOException, InterruptedException { final TestStreamingClient autoClient1 = new TestStreamingClient(URL, subscription.getId(), ""); autoClient1.start(); final TestStreamingClient autoClient2 = new TestStreamingClient(URL, subscription.getId(), ""); autoClient2.start(); final TestStreamingClient directClient1 = new TestStreamingClient(URL, subscription.getId(), "", Optional.empty(), Optional.of("{\"partitions\":[" + "{\"event_type\":\"" + eventType.getName() + "\",\"partition\":\"6\"}]}")); directClient1.start(); final TestStreamingClient directClient2 = new TestStreamingClient(URL, subscription.getId(), "", Optional.empty(), Optional.of("{\"partitions\":[" + "{\"event_type\":\"" + eventType.getName() + "\",\"partition\":\"7\"}]}")); directClient2.start(); Thread.sleep(1000); publishBusinessEventWithUserDefinedPartition( eventType.getName(), 16, x -> "blah" + x, x -> String.valueOf(x % 8)); waitFor(() -> assertThat(directClient1.getBatches(), hasSize(2))); checkAllEventsAreFromPartitions(directClient1, ImmutableSet.of("6")); waitFor(() -> assertThat(directClient2.getBatches(), hasSize(2))); checkAllEventsAreFromPartitions(directClient2, ImmutableSet.of("7")); waitFor(() -> assertThat(autoClient1.getBatches(), hasSize(6))); waitFor(() -> assertThat(autoClient2.getBatches(), hasSize(6))); }

Target:
public void whenMixedStreamsThenPartitionsAssignedCorrectly() throws IOException, InterruptedException { final TestStreamingClient autoClient1 = new TestStreamingClient(URL, subscription.getId(), ""); autoClient1.start(); final TestStreamingClient autoClient2 = new TestStreamingClient(URL, subscription.getId(), ""); autoClient2.start(); final TestStreamingClient directClient1 = new TestStreamingClient(URL, subscription.getId(), "", Optional.empty(), Optional.of("{\"partitions\":[" + "{\"event_type\":\"" + eventType.getName() + "\",\"partition\":\"6\"}]}")); directClient1.start(); final TestStreamingClient directClient2 = new TestStreamingClient(URL, subscription.getId(), "", Optional.empty(), Optional.of("{\"partitions\":[" + "{\"event_type\":\"" + eventType.getName() + "\",\"partition\":\"7\"}]}")); directClient2.start(); waitFor(() -> assertThat(getNumberOfAssignedStreams(subscription.getId()), is(4))); publishBusinessEventWithUserDefinedPartition( eventType.getName(), 16, x -> "blah" + x, x -> String.valueOf(x % 8)); waitFor(() -> assertThat(directClient1.getBatches(), hasSize(2))); checkAllEventsAreFromPartitions(directClient1, ImmutableSet.of("6")); waitFor(() -> assertThat(directClient2.getBatches(), hasSize(2))); checkAllEventsAreFromPartitions(directClient2, ImmutableSet.of("7")); waitFor(() -> assertThat(autoClient1.getBatches(), hasSize(6))); waitFor(() -> assertThat(autoClient2.getBatches(), hasSize(6))); }
Source:
public static Class<?> loadActualJavaType(String javaTypeName, ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext context) throws Exception { Class<?> result = ((BasicRegisteredType)type).getCache().get(ACTUAL_JAVA_TYPE); if (result!=null) return result; result = CatalogUtils.newClassLoadingContext(mgmt, type, context==null ? null : context.getLoader()).loadClass( javaTypeName ); Preconditions.checkNotNull(result, "Could not load class "+javaTypeName+"; returned null (should have thrown a different exception!)"); ((BasicRegisteredType)type).getCache().put(ACTUAL_JAVA_TYPE, result); return result; }

Target:
public static Class<?> loadActualJavaType(String javaTypeName, ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext context) { Class<?> result = ((BasicRegisteredType)type).getCache().get(ACTUAL_JAVA_TYPE); if (result!=null) return result; result = CatalogUtils.newClassLoadingContext(mgmt, type, context==null ? null : context.getLoader()).loadClass( javaTypeName ); ((BasicRegisteredType)type).getCache().put(ACTUAL_JAVA_TYPE, result); return result; }
Source:
public void init() throws FalconException { String listenerClassNames = StartupProperties.get(). getProperty("feedAlert.listeners"); for (String listenerClassName : listenerClassNames.split(",")) { listenerClassName = listenerClassName.trim(); if (listenerClassName.isEmpty()) { continue; } FeedSLAAlert listener = ReflectionUtils.getInstanceByClassName(listenerClassName); registerListener(listener); } ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); executor.scheduleWithFixedDelay(new Monitor(), 0, 20, TimeUnit.SECONDS); }

Target:
public void init() throws FalconException { String listenerClassNames = StartupProperties.get(). getProperty("feedAlert.listeners"); for (String listenerClassName : listenerClassNames.split(",")) { listenerClassName = listenerClassName.trim(); if (listenerClassName.isEmpty()) { continue; } EntitySLAListener listener = ReflectionUtils.getInstanceByClassName(listenerClassName); registerListener(listener); } String freq = StartupProperties.get().getProperty("feed.sla.statusCheck.frequency.seconds", "600"); int statusCheckFrequencySeconds = Integer.parseInt(freq); ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); executor.scheduleWithFixedDelay(new Monitor(), 0, statusCheckFrequencySeconds + 10, TimeUnit.SECONDS); }
Source:
public String toString() { return "DropwizardEmitterConfig{" + "reporters=" + reporters + ", prefix='" + prefix + '\'' + ", includeHost=" + includeHost + ", dimensionMapPath='" + dimensionMapPath + '\'' + ", alertEmitters=" + alertEmitters + ", maxGaugeCount=" + maxGaugeCount + '}'; }

Target:
public String toString() { return "DropwizardEmitterConfig{" + "reporters=" + reporters + ", prefix='" + prefix + '\'' + ", includeHost=" + includeHost + ", dimensionMapPath='" + dimensionMapPath + '\'' + ", alertEmitters=" + alertEmitters + ", maxMetricsRegistrySize=" + maxMetricsRegistrySize + '}'; }
Source:
protected Collection<Integer> translateForStreamingInternal( final BroadcastStateTransformation<IN1, IN2, OUT> transformation, final Context context) { checkNotNull(transformation); checkNotNull(context); final TypeInformation<IN1> nonBroadcastTypeInfo = transformation.getNonBroadcastStream().getType(); final TypeInformation<IN2> broadcastTypeInfo = transformation.getBroadcastStream().getType(); final StreamGraph streamGraph = context.getStreamGraph(); final String slotSharingGroup = context.getSlotSharingGroup(); final int transformationId = transformation.getId(); final ExecutionConfig executionConfig = streamGraph.getExecutionConfig(); streamGraph.addCoOperator( transformationId, slotSharingGroup, transformation.getCoLocationGroupKey(), transformation.getOperatorFactory(), nonBroadcastTypeInfo, broadcastTypeInfo, transformation.getOutputType(), transformation.getName()); if (transformation.getKeySelector() != null) { final TypeSerializer<?> keySerializer = transformation.getStateKeyType().createSerializer(executionConfig); streamGraph.setTwoInputStateKey( transformationId, transformation.getKeySelector(), null, keySerializer); } final int parallelism = transformation.getParallelism() != ExecutionConfig.PARALLELISM_DEFAULT ? transformation.getParallelism() : executionConfig.getParallelism(); streamGraph.setParallelism(transformationId, parallelism); streamGraph.setMaxParallelism(transformationId, transformation.getMaxParallelism()); for (Integer inputId: context.getStreamNodeIds(transformation.getNonBroadcastStream().getTransformation())) { streamGraph.addEdge(inputId, transformationId, 1); } for (Integer inputId: context.getStreamNodeIds(transformation.getBroadcastStream().getTransformation())) { streamGraph.addEdge(inputId, transformationId, 2); } return Collections.singleton(transformationId); }

Target:
protected Collection<Integer> translateForStreamingInternal( final BroadcastStateTransformation<IN1, IN2, OUT> transformation, final Context context) { checkNotNull(transformation); checkNotNull(context); return translateInternal( transformation, transformation.getNonBroadcastStream(), transformation.getBroadcastStream(), transformation.getOperatorFactory(), transformation.getStateKeyType(), transformation.getKeySelector(), null, context); }
Source:
protected IStatus run(IProgressMonitor monitor) { projects.stream().forEach(MarkerUtils::deleteChangeSetIssuesMarkers); List<Job> jobs = new ArrayList<>(); for (IProject project : projects) { AnalyzeProjectRequest req = new AnalyzeProjectRequest(project, collectChangedFiles(project, monitor), TriggerType.CHANGESET); AnalyzeProjectJob job = new AnalyzeProjectJob(req); job.schedule(); jobs.add(job); } jobs.stream().forEach(j -> { try { j.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }); return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { projects.stream().forEach(MarkerUtils::deleteChangeSetIssuesMarkers); List<Job> jobs = new ArrayList<>(); for (IProject project : projects) { if (monitor.isCanceled()) { break; } Collection<IFile> collectChangedFiles = collectChangedFiles(project, monitor); if (!collectChangedFiles.isEmpty()) { AnalyzeProjectRequest req = new AnalyzeProjectRequest(project, collectChangedFiles, TriggerType.CHANGESET); AnalyzeProjectJob job = new AnalyzeProjectJob(req); job.schedule(); jobs.add(job); } } jobs.stream().forEach(j -> { try { j.join(); } catch (InterruptedException e) { } }); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; }
Source:
public void invalidate() { this.targetDomainName = null; }

Target:
public void invalidate() { targetDomainName = null; }
Source:
private Set<GenericItem> getItemsInColorCond(EList<ColorArray> colorList) { Set<GenericItem> items = new HashSet<GenericItem>(); if (colorList != null) { for (ColorArray color : colorList) { String itemName = color.getItem(); if (itemName != null) { try { Item item = itemUIRegistry.getItem(itemName); if (item instanceof GenericItem) { final GenericItem gItem = (GenericItem) item; items.add(gItem); } } catch (ItemNotFoundException e) { } } } } return items; }

Target:
private Set<GenericItem> getItemsInColorCond(EList<ColorArray> colorList) { Set<GenericItem> items = new HashSet<GenericItem>(); for (ColorArray color : colorList) { String itemName = color.getItem(); if (itemName != null) { try { Item item = itemUIRegistry.getItem(itemName); if (item instanceof GenericItem) { items.add((GenericItem) item); } } catch (ItemNotFoundException e) { } } } return items; }
Source:
private JButton getAddOnInfoButton() { if (addOnInfoButton == null) { addOnInfoButton = new JButton(); addOnInfoButton.setText(Constant.messages.getString("cfu.button.addons.info")); addOnInfoButton.setEnabled(false); addOnInfoButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { if (getUninstalledAddOnsTable().convertRowIndexToModel(getUninstalledAddOnsTable().getSelectedRow()) >= 0) { AddOnWrapper ao = uninstalledAddOnsModel.getAddOnWrapper(getUninstalledAddOnsTable().convertRowIndexToModel(getUninstalledAddOnsTable().getSelectedRow())); if (ao != null && ao.getAddOn().getInfo() != null) { DesktopUtils.openUrlInBrowser(ao.getAddOn().getInfo().toString()); } } } }); } return addOnInfoButton; }

Target:
private JButton getAddOnInfoButton() { if (addOnInfoButton == null) { addOnInfoButton = new JButton(); addOnInfoButton.setText(Constant.messages.getString("cfu.button.addons.info")); addOnInfoButton.setEnabled(false); addOnInfoButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { if (getUninstalledAddOnsTable().getSelectedRow() >= 0) { AddOnWrapper ao = uninstalledAddOnsModel.getAddOnWrapper(getUninstalledAddOnsTable().convertRowIndexToModel(getUninstalledAddOnsTable().getSelectedRow())); if (ao != null && ao.getAddOn().getInfo() != null) { DesktopUtils.openUrlInBrowser(ao.getAddOn().getInfo().toString()); } } } }); } return addOnInfoButton; }
Source:
public void initShaders() { defaultShaderProgram = prepareAndStoreShaderProgramInstance("default"); defaultTexturedShaderProgram = prepareAndStoreShaderProgramInstance("defaultTextured"); prepareAndStoreShaderProgramInstance("post"); prepareAndStoreShaderProgramInstance("ssao"); prepareAndStoreShaderProgramInstance("lightShafts"); prepareAndStoreShaderProgramInstance("sobel"); prepareAndStoreShaderProgramInstance("initialPost"); prepareAndStoreShaderProgramInstance("prePostComposite"); prepareAndStoreShaderProgramInstance("highPass"); prepareAndStoreShaderProgramInstance("blur"); prepareAndStoreShaderProgramInstance("downSampler"); prepareAndStoreShaderProgramInstance("toneMapping"); prepareAndStoreShaderProgramInstance("sky"); prepareAndStoreShaderProgramInstance("chunk"); prepareAndStoreShaderProgramInstance("particle"); prepareAndStoreShaderProgramInstance("shadowMap"); prepareAndStoreShaderProgramInstance("lightBufferPass"); prepareAndStoreShaderProgramInstance("lightGeometryPass"); prepareAndStoreShaderProgramInstance("ssaoBlur"); }

Target:
public void initShaders() { defaultShaderProgram = addShaderProgram("default"); defaultTexturedShaderProgram = addShaderProgram("defaultTextured"); addShaderProgram("post"); addShaderProgram("ssao"); addShaderProgram("lightShafts"); addShaderProgram("sobel"); addShaderProgram("initialPost"); addShaderProgram("prePostComposite"); addShaderProgram("highPass"); addShaderProgram("blur"); addShaderProgram("downSampler"); addShaderProgram("toneMapping"); addShaderProgram("sky"); addShaderProgram("chunk"); addShaderProgram("particle"); addShaderProgram("shadowMap"); addShaderProgram("lightBufferPass"); addShaderProgram("lightGeometryPass"); addShaderProgram("ssaoBlur"); }
Source:
private List<ColumnNameOrIndex> populateSelectItems(List<SelectItem> selectItems, OrderBy orderBy) { Set<String> aliases = selectItems.stream() .filter(item -> item instanceof SingleColumn) .map(SingleColumn.class::cast) .map(SingleColumn::getAlias) .filter(Optional::isPresent) .map(Optional::get) .map(Identifier::getValue) .collect(toImmutableSet()); ImmutableList.Builder<ColumnNameOrIndex> orderByKeys = ImmutableList.builder(); for (int i = 0; i < orderBy.getSortItems().size(); i++) { Expression sortKey = orderBy.getSortItems().get(i).getSortKey(); if (sortKey instanceof LongLiteral) { orderByKeys.add(ColumnNameOrIndex.forIndex(toIntExact(((LongLiteral) sortKey).getValue()) - 1)); } else if (sortKey instanceof Identifier && aliases.contains(((Identifier) sortKey).getValue())) { orderByKeys.add(ColumnNameOrIndex.forName(((Identifier) sortKey).getValue())); } else { String columnName = "$$sort_key$$" + i; selectItems.add(new SingleColumn(sortKey, delimitedIdentifier(columnName))); orderByKeys.add(ColumnNameOrIndex.forName(columnName)); } } return orderByKeys.build(); }

Target:
private List<ColumnNameOrIndex> populateSelectItems(List<SelectItem> selectItems, OrderBy orderBy) { Set<String> aliases = selectItems.stream() .filter(SingleColumn.class::isInstance) .map(SingleColumn.class::cast) .map(SingleColumn::getAlias) .filter(Optional::isPresent) .map(Optional::get) .map(Identifier::getValue) .collect(toImmutableSet()); ImmutableList.Builder<ColumnNameOrIndex> orderByKeys = ImmutableList.builder(); for (int i = 0; i < orderBy.getSortItems().size(); i++) { Expression sortKey = orderBy.getSortItems().get(i).getSortKey(); if (sortKey instanceof LongLiteral) { orderByKeys.add(ColumnNameOrIndex.forIndex(toIntExact(((LongLiteral) sortKey).getValue()) - 1)); } else if (sortKey instanceof Identifier && aliases.contains(((Identifier) sortKey).getValue())) { orderByKeys.add(ColumnNameOrIndex.forName(((Identifier) sortKey).getValue())); } else { String columnName = "$$sort_key$$" + i; selectItems.add(new SingleColumn(sortKey, delimitedIdentifier(columnName))); orderByKeys.add(ColumnNameOrIndex.forName(columnName)); } } return orderByKeys.build(); }
Source:
public JSONObject changePlateIdBarcode(HttpSession session, JSONObject json) { Long plateId = json.getLong("plateId"); String idBarcode = json.getString("identificationBarcode"); try { if (!"".equals(idBarcode)) { Plate plate = requestManager.getPlateById(plateId); plate.setIdentificationBarcode(idBarcode); requestManager.savePlate(plate); } else { return JSONUtils.SimpleJSONError("New identification barcode not recognized"); } } catch (IOException e) { e.printStackTrace(); return JSONUtils.SimpleJSONError(e.getMessage()); } return JSONUtils.SimpleJSONResponse("New identification barcode successfully assigned."); }

Target:
public JSONObject changePlateIdBarcode(HttpSession session, JSONObject json) { Long plateId = json.getLong("plateId"); String idBarcode = json.getString("identificationBarcode"); try { if (!isStringEmptyOrNull(idBarcode)) { Plate<? extends List<? extends Plateable>, ? extends Plateable> plate = requestManager.getPlateById(plateId); plate.setIdentificationBarcode(idBarcode); requestManager.savePlate(plate); } else { return JSONUtils.SimpleJSONError("New identification barcode not recognized"); } } catch (IOException e) { log.debug("Could not change Plate identificationBarcode: " + e.getMessage()); e.printStackTrace(); return JSONUtils.SimpleJSONError(e.getMessage()); } return JSONUtils.SimpleJSONResponse("New identification barcode successfully assigned."); }
Source:
public void testInvalidOptionForTimestampFormat() { final Map<String, String> tableOptions = getModifyOptions( options -> options.put("json.timestamp-format.standard", "test")); thrown.expect(ValidationException.class); thrown.expect(containsCause(new ValidationException("Unsupported value test for timestamp-format.standard. Supported values are [SQL, ISO-8601]."))); testSchemaDeserializationSchema(tableOptions); }

Target:
public void testInvalidOptionForTimestampFormat() { final Map<String, String> tableOptions = getModifyOptions( options -> options.put("json.timestamp-format.standard", "test")); thrown.expect(ValidationException.class); thrown.expect(containsCause(new ValidationException("Unsupported value 'test' for timestamp-format.standard. Supported values are [SQL, ISO-8601]."))); testSchemaDeserializationSchema(tableOptions); }
Source:
protected String getQuery(Query queryName, Supplier<String> queryProvider) { String query = this.queryCache.get(queryName); if (query == null) { query = StringUtils.replace(queryProvider.get(), "%PREFIX%", this.tablePrefix); this.queryCache.put(queryName, query); } return query; }

Target:
protected String getQuery(Query queryName, Supplier<String> queryProvider) { return this.queryCache.computeIfAbsent(queryName, k -> StringUtils.replace(queryProvider.get(), "%PREFIX%", this.tablePrefix)); }
Source:
protected void setParam() { if("".equals(this.getExtraValue("type"))) { this.typeList = Arrays.asList(this.getExtraValue("type").trim().split("\\s*,\\s*")); } else { this.typeList = new ArrayList<String>(); this.typeList.add("all"); this.setExtraValue("type", String.join(",", this.typeList)); } }

Target:
protected void setParam() { if(!"".equals(this.getExtraValue("type"))) { this.typeList = Arrays.asList(this.getExtraValue("type").trim().split("\\s*,\\s*")); } else { this.typeList = new ArrayList<String>(); this.typeList.add("all"); this.setExtraValue("type", String.join(",", this.typeList)); } }
Source:
protected static Atomix.Builder buildAtomix(Node.Type type, int id, List<Integer> nodeIds, List<Integer> bootstrapIds) { Node localNode = Node.builder(String.valueOf(id)) .withType(type) .withAddress("localhost", BASE_PORT + id) .build(); Collection<Node> nodes = Stream.concat( nodeIds.stream() .map(nodeId -> Node.builder(String.valueOf(nodeId)) .withType(Node.Type.CORE) .withAddress("localhost", BASE_PORT + nodeId) .build()), bootstrapIds.stream() .filter(nodeId -> !nodeIds.contains(nodeId)) .map(nodeId -> Node.builder(String.valueOf(nodeId)) .withType(Node.Type.DATA) .withAddress("localhost", BASE_PORT + nodeId) .build())) .collect(Collectors.toList()); Atomix.Builder builder = Atomix.builder() .withClusterName("test") .withDataDirectory(new File("target/test-logs/" + id)) .withLocalNode(localNode) .withNodes(nodes) .addPartitionGroup(PrimaryBackupPartitionGroup.builder("data") .withNumPartitions(3) .build()); if (!nodeIds.isEmpty()) { builder.addPartitionGroup(RaftPartitionGroup.builder("core") .withPartitionSize(3) .withNumPartitions(3) .withDataDirectory(new File("target/test-logs/core/")) .build()); } return builder; }

Target:
protected static Atomix.Builder buildAtomix(Node.Type type, int id, List<Integer> nodeIds, List<Integer> bootstrapIds) { Node localNode = Node.builder(String.valueOf(id)) .withType(type) .withAddress("localhost", nodeIds.contains(id) ? BASE_PORT + id : findAvailablePort(BASE_PORT + id)) .build(); Collection<Node> nodes = Stream.concat( nodeIds.stream() .map(nodeId -> Node.builder(String.valueOf(nodeId)) .withType(Node.Type.CORE) .withAddress("localhost", BASE_PORT + nodeId) .build()), bootstrapIds.stream() .filter(nodeId -> !nodeIds.contains(nodeId)) .map(nodeId -> Node.builder(String.valueOf(nodeId)) .withType(Node.Type.DATA) .withAddress("localhost", findAvailablePort(BASE_PORT + nodeId)) .build())) .collect(Collectors.toList()); Atomix.Builder builder = Atomix.builder() .withClusterName("test") .withDataDirectory(new File("target/test-logs/" + id)) .withLocalNode(localNode) .withNodes(nodes) .addPartitionGroup(PrimaryBackupPartitionGroup.builder("data") .withNumPartitions(3) .build()); if (!nodeIds.isEmpty()) { builder.addPartitionGroup(RaftPartitionGroup.builder("core") .withPartitionSize(3) .withNumPartitions(3) .withDataDirectory(new File("target/test-logs/core/")) .build()); } return builder; }
Source:
@Test public void overrideEverything() { TypeElement classElement = getElement(Everything.class); ExecutableElement methodElement = getOnlyElement(methodsIn(classElement.getEnclosedElements())); ExecutableType type = (ExecutableType) compilation.getTypes().asMemberOf((DeclaredType) classElement.asType(), methodElement); MethodSpec method = MethodSpec.overriding(methodElement, type).build(); assertThat(method.toString()).isEqualTo("" + "@java.lang.Override\n" + "@java.lang.Deprecated\n" + "protected <T extends java.lang.Runnable & java.io.Closeable> " + "java.lang.Runnable everything(" + "@com.squareup.javapoet.MethodSpecTest.Nullable java.lang.String arg0, " + "java.util.List<? extends T> arg1) " + "throws java.io.IOException, java.lang.SecurityException {\n" + "}\n"); }

Target:
@Test public void overrideEverything() { TypeElement classElement = getElement(Everything.class); ExecutableElement methodElement = getOnlyElement(methodsIn(classElement.getEnclosedElements())); MethodSpec method = MethodSpec.overriding(methodElement).build(); assertThat(method.toString()).isEqualTo("" + "@java.lang.Override\n" + "protected <T extends java.lang.Runnable & java.io.Closeable> " + "java.lang.Runnable everything(java.lang.String arg0, java.util.List<? extends T> arg1) " + "throws java.io.IOException, java.lang.SecurityException {\n" + "}\n"); }
Source:
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) throws Exception { if (request.headers().contains(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET, true)) { ctx.fireChannelRead(request.retain()); return; } if (!sendResource(request, ctx)) { FullHttpResponse notFound = new DefaultFullHttpResponse(request.protocolVersion(), NOT_FOUND); notFound.headers().set(CONTENT_TYPE, TEXT_PLAIN); String payload = "Requested resource " + request.uri() + " not found"; notFound.content() .writeBytes(ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(payload), CharsetUtil.UTF_8)); HttpUtil.setContentLength(notFound, notFound.content().readableBytes()); sendResponse(notFound, ctx, true); } }

Target:
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) { if (request.headers().contains(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET, true)) { ctx.fireChannelRead(request.retain()); return; } if (request.decoderResult().isFailure()) { FullHttpResponse badRequest = new DefaultFullHttpResponse(request.protocolVersion(), BAD_REQUEST); sendResponse(badRequest, ctx, true); return; } if (!sendResource(request, ctx)) { FullHttpResponse notFound = new DefaultFullHttpResponse(request.protocolVersion(), NOT_FOUND); notFound.headers().set(CONTENT_TYPE, TEXT_PLAIN); String payload = "Requested resource " + request.uri() + " not found"; notFound.content().writeCharSequence(payload, CharsetUtil.UTF_8); HttpUtil.setContentLength(notFound, notFound.content().readableBytes()); sendResponse(notFound, ctx, true); } }
Source:
public void getAllDrugs_shouldReturnAListOfAllDrugs() throws Exception { int resultWhenTrue = 4; int resultWhenFalse = 2; List<Drug> allDrugs = conceptService.getAllDrugs(); assertEquals(resultWhenTrue, allDrugs.size()); allDrugs = conceptService.getAllDrugs(false); assertEquals(resultWhenFalse, allDrugs.size()); }

Target:
public void getAllDrugs_shouldReturnAListOfAllDrugs() throws Exception { int resultWhenTrue = 4; List<Drug> allDrugs = conceptService.getAllDrugs(); assertEquals(resultWhenTrue, allDrugs.size()); }
Source:
public Mono<Long> count() { final ResolvedView resolvedView = determineView(); ViewQuery query = ViewQuery.from(resolvedView.getDesignDocument(), resolvedView.getViewName()); query.reduce(true); query.stale(operations.getDefaultConsistency().viewConsistency()); return mapMono(operations .queryView(query) .flatMap(AsyncViewResult::rows) .map(asyncViewRow -> Long.valueOf(asyncViewRow.value().toString())) .switchIfEmpty(Observable.just(Long.valueOf(0L))).toSingle()); }

Target:
public Mono<Long> count() { final ResolvedView resolvedView = determineView(); ViewQuery query = ViewQuery.from(resolvedView.getDesignDocument(), resolvedView.getViewName()); query.reduce(true); query.stale(operations.getDefaultConsistency().viewConsistency()); return mapMono(operations .queryView(query) .flatMap(AsyncViewResult::rows) .map(asyncViewRow -> Long.valueOf(asyncViewRow.value().toString())) .switchIfEmpty(Observable.just(0L)).toSingle()); }
Source:
public ChunkResponder sendChunkStart(HttpResponseStatus status, @Nullable Multimap<String, String> headers) { Preconditions.checkArgument(responded.compareAndSet(false, true), "Response has been already sent"); Preconditions.checkArgument((status.getCode() >= 200 && status.getCode() < 210) , "Http Chunk Failure"); HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status); setCustomHeaders(response, headers); response.setChunked(true); response.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED); boolean keepAlive = setResponseKeepAlive(response); channel.write(response); return new ChannelChunkResponder(channel, keepAlive); }

Target:
public ChunkResponder sendChunkStart(HttpResponseStatus status, @Nullable Multimap<String, String> headers) { Preconditions.checkArgument(responded.compareAndSet(false, true), "Response has been already sent"); Preconditions.checkArgument((status.getCode() >= 200 && status.getCode() < 210) , "Http Chunk Failure"); HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status); setCustomHeaders(response, headers); response.setChunked(true); response.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED); boolean responseKeepAlive = setResponseKeepAlive(response); channel.write(response); return new ChannelChunkResponder(channel, responseKeepAlive); }
Source:
public Map<Long, String> auditUnsafe(long record) { return super.audit(record); }

Target:
public Map<Long, String> auditUnsafe(long record) { transportLock.readLock().lock(); try { return super.audit(record); } finally { transportLock.readLock().unlock(); } }
Source:
protected Map<String, Object> initProperties() { return BEANS.all(IRestApplicationPropertiesContributor.class).stream() .flatMap(c -> c.contribute().entrySet().stream()) .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); }

Target:
protected Map<String, Object> initProperties() { return BEANS.all(IRestApplicationPropertiesContributor.class).stream().flatMap(contributor -> { Map<String, Object> properties = contributor.contribute(); LOG.info("Contributed properties by {}", properties.size(), contributor.getClass()); return properties.entrySet().stream(); }).collect(StreamUtility.toMap(Entry::getKey, Entry::getValue, StreamUtility.ignoringMerger())); }
Source:
public PrimitiveLongReadableDiffSets indexUpdatesForSuffixOrContains( SchemaIndexDescriptor descriptor, IndexQuery query ) { descriptor.schema().getPropertyId(); if ( indexUpdates == null ) { return PrimitiveLongReadableDiffSets.EMPTY; } Map<ValueTuple, PrimitiveLongDiffSets> updates = indexUpdates.get( descriptor.schema() ); if ( updates == null ) { return PrimitiveLongReadableDiffSets.EMPTY; } PrimitiveLongDiffSets diffs = new PrimitiveLongDiffSets(); for ( Map.Entry<ValueTuple,PrimitiveLongDiffSets> entry : updates.entrySet() ) { if ( query.acceptsValue( entry.getKey().getOnlyValue() ) ) { PrimitiveLongDiffSets diffsets = entry.getValue(); diffs.addAll( diffsets.getAdded().iterator() ); diffs.removeAll( diffsets.getRemoved().iterator() ); } } return diffs; }

Target:
public PrimitiveLongReadableDiffSets indexUpdatesForSuffixOrContains( SchemaIndexDescriptor descriptor, IndexQuery query ) { assert descriptor.schema().getPropertyIds().length == 1 : "Suffix and contains queries are only supported for single property queries"; if ( indexUpdates == null ) { return PrimitiveLongReadableDiffSets.EMPTY; } Map<ValueTuple, PrimitiveLongDiffSets> updates = indexUpdates.get( descriptor.schema() ); if ( updates == null ) { return PrimitiveLongReadableDiffSets.EMPTY; } PrimitiveLongDiffSets diffs = new PrimitiveLongDiffSets(); for ( Map.Entry<ValueTuple,PrimitiveLongDiffSets> entry : updates.entrySet() ) { if ( query.acceptsValue( entry.getKey().getOnlyValue() ) ) { PrimitiveLongDiffSets diffsets = entry.getValue(); diffs.addAll( diffsets.getAdded().iterator() ); diffs.removeAll( diffsets.getRemoved().iterator() ); } } return diffs; }
Source:
static public Expectation<List<OperationResult>> multiOp( final OvsdbClient client, DatabaseSchema dbs, final List<Table.OvsdbOperation> ops) { final Expectation<List<OperationResult>> result = new Expectation<>(); TransactionBuilder transaction = client.transactBuilder(dbs); for (Table.OvsdbOperation op: ops) { transaction.add(op.op); } FutureCallback<List<OperationResult>> cb = new FutureCallback<List<OperationResult>>() { @Override public void onSuccess(List<OperationResult> rlist) { OvsdbOpException exc = null; Integer idx = 0; for (OperationResult r: rlist) { if (exc == null &&r.getError() != null && !r.getError().trim().isEmpty()) { exc = new OvsdbOpException(client, idx, (idx >= ops.size())? null: ops.get(idx).op, r); } idx++; } if (exc != null) result.failure(exc); else result.success(rlist); } @Override public void onFailure(@Nonnull Throwable exc) { result.failure(new OvsdbException(client, exc)); } }; Futures.addCallback(transaction.execute(), cb, callingThreadExecutor); return result; }

Target:
static public Expectation<List<OperationResult>> multiOp( final OvsdbClient client, DatabaseSchema dbs, final List<Table.OvsdbOperation> ops) { final Expectation<List<OperationResult>> result = new Expectation<>(); TransactionBuilder transaction = client.transactBuilder(dbs); for (Table.OvsdbOperation op: ops) { transaction.add(op.op); } FutureCallback<List<OperationResult>> cb = new FutureCallback<List<OperationResult>>() { @Override public void onSuccess(List<OperationResult> rlist) { OvsdbOpException exc = null; Integer idx = 0; for (OperationResult r: rlist) { if (exc == null && opResultHasError(r)) { exc = new OvsdbOpException(client, ops, idx, r); } idx++; } if (exc != null) result.failure(exc); else result.success(rlist); } @Override public void onFailure(@Nonnull Throwable exc) { result.failure(new OvsdbException(client, exc)); } }; Futures.addCallback(transaction.execute(), cb, callingThreadExecutor); return result; }
Source:
public void run() { connectionTimeout = config.getConnectionTimeout(); poolElf.setValidationTimeout(config.getValidationTimeout()); leakTask.updateLeakDetectionThreshold(config.getLeakDetectionThreshold()); final long now = clockSource.currentTime(); final long idleTimeout = config.getIdleTimeout(); if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); previous = now; softEvictConnections(); fillPool(); return; } previous = now; if (idleTimeout > 0L) { logPoolState("Before cleanup\t"); final List<PoolBagEntry> bag = connectionBag.values(STATE_NOT_IN_USE); final int bagSize = bag.size(); int removable = bagSize - config.getMinimumIdle(); for (int i = 0; i < bagSize; i++) { if (removable <= 0) { break; } final PoolBagEntry bagEntry = bag.get(i); if (clockSource.elapsedMillis(bagEntry.lastAccess, now) > idleTimeout) { if (connectionBag.reserve(bagEntry)) { closeConnection(bagEntry, "(connection passed idleTimeout)"); removable--; } } } logPoolState("After cleanup\t"); } fillPool(); }

Target:
public void run() { connectionTimeout = config.getConnectionTimeout(); leakTask.updateLeakDetectionThreshold(config.getLeakDetectionThreshold()); final long now = clockSource.currentTime(); final long idleTimeout = config.getIdleTimeout(); if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); previous = now; softEvictConnections(); fillPool(); return; } previous = now; if (idleTimeout > 0L) { logPoolState("Before cleanup\t"); final List<PoolEntry> notInUseList = connectionBag.values(STATE_NOT_IN_USE); int removable = notInUseList.size() - config.getMinimumIdle(); for (PoolEntry poolEntry : notInUseList) { if (removable <= 0) { break; } if (clockSource.elapsedMillis(poolEntry.lastAccess, now) > idleTimeout) { if (connectionBag.reserve(poolEntry)) { closeConnection(poolEntry, "(connection passed idleTimeout)"); removable--; } } } logPoolState("After cleanup\t"); } fillPool(); }
Source:
@Override public void run() { ExecutorService heartbeat = null; try { setStopped( false ); setFinished( false ); setInitialized( true ); variables.initializeVariablesFrom( parentJob ); setInternalKettleVariables( variables ); copyParametersFrom( jobMeta ); activateParameters(); fireJobStartListeners(); heartbeat = startHeartbeat( getHeartbeatIntervalInSeconds() ); result = execute(); } catch ( Throwable je ) { log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", je.getMessage() ), je ); result = new Result(); result.setNrErrors( 1L ); result.setResult( false ); addErrors( 1 ); emergencyWriteJobTracker( result ); setActive( false ); setFinished( true ); setStopped( false ); } finally { try { shutdownHeartbeat( heartbeat ); ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobFinish.id, this ); jobMeta.disposeEmbeddedMetastoreProvider(); log.logDebug( "EmbeddedMetastore objects has been disposed." ); fireJobFinishListeners(); KettleVFS.freeUnusedResources(); } catch ( KettleException e ) { result.setNrErrors( 1 ); result.setResult( false ); log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", e.getMessage() ), e ); emergencyWriteJobTracker( result ); } } }

Target:
@Override public void run() { ExecutorService heartbeat = null; try { setStopped( false ); setFinished( false ); setInitialized( true ); variables.initializeVariablesFrom( parentJob ); setInternalKettleVariables( variables ); copyParametersFrom( jobMeta ); activateParameters(); fireJobStartListeners(); heartbeat = startHeartbeat( getHeartbeatIntervalInSeconds() ); result = execute(); } catch ( Throwable je ) { log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", je.getMessage() ), je ); result = new Result(); result.setNrErrors( 1L ); result.setResult( false ); addErrors( 1 ); emergencyWriteJobTracker( result ); setActive( false ); setFinished( true ); setStopped( false ); } finally { try { shutdownHeartbeat( heartbeat ); ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobFinish.id, this ); jobMeta.disposeEmbeddedMetastoreProvider(); log.logDebug( BaseMessages.getString( PKG, "Job.Log.DisposeEmbeddedMetastore" ) ); fireJobFinishListeners(); KettleVFS.freeUnusedResources(); } catch ( KettleException e ) { result.setNrErrors( 1 ); result.setResult( false ); log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", e.getMessage() ), e ); emergencyWriteJobTracker( result ); } } }
Source:
public FieldPose(XYPair point, ContiguousHeading heading) { m = degreesToSlope(heading.getValue()); this.fieldPosition = point; this.heading = heading; if ((point.x == 0) || (Math.abs(m) < 0.01)) { b = point.y; } else { b = point.y / (point.x * m); } }

Target:
public FieldPose(XYPair point, ContiguousHeading heading) { m = degreesToSlope(heading.getValue()); this.fieldPosition = point.clone(); this.heading = heading.clone(); if ((point.x == 0) || (Math.abs(m) < 0.01)) { b = point.y; } else { b = point.y - (point.x * m); } }
Source:
public void setup() { factory = ResteasyProviderFactory.newInstance(); ResteasyProviderFactory.setInstance(factory); }

Target:
public void setup() { factory = ResteasyProviderFactory.newInstance(); ResteasyProviderFactory.setInstance(factory); RegisterBuiltin.register(factory); }
Source:
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateDocument(partitionKey, dataFieldValue)); } else { obs = cosmosAsyncContainer.createItem(generateDocument(partitionKey, dataFieldValue), new CosmosItemRequestOptions()); } concurrencyControlSemaphore.acquire(); if (configuration.getOperationType() == Configuration.Operation.WriteThroughput) { obs.subscribeOn(Schedulers.parallel()).subscribe(baseSubscriber); } else { LatencySubscriber<CosmosAsyncItemResponse> latencySubscriber = new LatencySubscriber<>(baseSubscriber); latencySubscriber.context = latency.time(); obs.subscribeOn(Schedulers.parallel()).subscribe(latencySubscriber); } }

Target:
protected void performWorkload(BaseSubscriber<CosmosAsyncItemResponse> baseSubscriber, long i) throws InterruptedException { String partitionKey = uuid + i; Mono<CosmosAsyncItemResponse<PojoizedJson>> obs; if (configuration.isDisablePassingPartitionKeyAsOptionOnWrite()) { obs = cosmosAsyncContainer.createItem(generateDocument(partitionKey, dataFieldValue)); } else { obs = cosmosAsyncContainer.createItem(generateDocument(partitionKey, dataFieldValue), new PartitionKey(partitionKey), new CosmosItemRequestOptions()); } concurrencyControlSemaphore.acquire(); if (configuration.getOperationType() == Configuration.Operation.WriteThroughput) { obs.subscribeOn(Schedulers.parallel()).subscribe(baseSubscriber); } else { LatencySubscriber<CosmosAsyncItemResponse> latencySubscriber = new LatencySubscriber<>(baseSubscriber); latencySubscriber.context = latency.time(); obs.subscribeOn(Schedulers.parallel()).subscribe(latencySubscriber); } }
Source:
static DownloadType fromString(final String type) { if (type.equalsIgnoreCase(MAP_SKIN.name())) { return MAP_SKIN; } else if (type.equalsIgnoreCase(MAP_TOOL.name())) { return MAP_TOOL; } else { return MAP; } }

Target:
private static DownloadType fromString(final String type) { if (type.equalsIgnoreCase(MAP_SKIN.name())) { return MAP_SKIN; } else if (type.equalsIgnoreCase(MAP_TOOL.name())) { return MAP_TOOL; } else { return MAP; } }
Source:
protected List<QuestionDto> parseQuestions(String response) throws Exception { final ObjectMapper JSON_RESPONSE_PARSER = new ObjectMapper(); List<QuestionDto> dtoList = new ArrayList<QuestionDto>(); final JsonNode questionListNode = JSON_RESPONSE_PARSER.readTree(response).get("dtoList"); final List<QuestionDto> qList = JSON_RESPONSE_PARSER.readValue( questionListNode, new TypeReference<List<QuestionDto>>() { }); dtoList.addAll(qList); return dtoList; }

Target:
protected List<QuestionDto> parseQuestions(String response) throws Exception { final ObjectMapper JSON_RESPONSE_PARSER = new ObjectMapper(); final JsonNode questionListNode = JSON_RESPONSE_PARSER.readTree(response).get("dtoList"); final List<QuestionDto> qList = JSON_RESPONSE_PARSER.readValue( questionListNode, new TypeReference<List<QuestionDto>>() { }); return qList; }
Source:
public CompletableFuture<CacheEntry<K, V>> getCacheEntryAsync(Object key) { return asyncGet(key); }

Target:
public CompletableFuture<CacheEntry<K, V>> getCacheEntryAsync(Object key) { int segment = keyPartitioner.getSegment(key); InternalCacheEntry<K, V> ice = internalPeekCacheEntry(key, segment); if (ice == null) { return CompletableFutures.completedNull(); } if (ice.canExpire()) { CompletionStage<Boolean> stage = expirationManager.handlePossibleExpiration(ice, segment, false); if (CompletionStages.isCompletedSuccessfully(stage)) { if (CompletionStages.join(stage)) { return CompletableFutures.completedNull(); } return CompletableFuture.completedFuture(ice); } else { return stage.thenApply(expired -> { if (expired == Boolean.TRUE) { return null; } return (CacheEntry<K, V>) ice; }).toCompletableFuture(); } } return CompletableFuture.completedFuture(ice); }
Source:
public HmRqTextBody(final String expected) { this(Matchers.containsString(expected)); }

Target:
public HmRqTextBody(final String expected) { this(Matchers.equalTo(expected)); }
Source:
public VisualEditorPageObject selectInfoboxTemplate(int i) { WebElement element = infoboxTemplatesList.get(i); wait.forElementClickable(element); element.click(); return this; }

Target:
public VisualEditorPageObject selectInfoboxTemplate(int i) { WebElement template = infoboxTemplatesList.get(i); wait.forElementClickable(template); template.click(); return this; }
Source:
public void join() { Assert.assertEquals("foo,bar,baz", StringHelper.join(",", new String[]{"foo", "bar", "baz"})); Assert.assertEquals("foobarbaz", StringHelper.join(null, new String[]{"foo", "bar", "baz"})); Assert.assertEquals("foo,,bar", StringHelper.join(",", new String[]{"foo", null, "bar"})); Assert.assertNull(StringHelper.join(null, null)); }

Target:
public void join() { assertEquals("foo,bar,baz", StringHelper.join(",", new String[]{"foo", "bar", "baz"})); assertEquals("foobarbaz", StringHelper.join(null, new String[]{"foo", "bar", "baz"})); assertEquals("foo,,bar", StringHelper.join(",", new String[]{"foo", null, "bar"})); assertNull(StringHelper.join(null, null)); }
Source:
public void setUp() { when(model.listHosts()).thenReturn(hosts); final HostStatus.Builder statusBuilder = HostStatus.newBuilder() .setStatus(HostStatus.Status.UP) .setJobs(emptyMap()) .setStatuses(emptyMap()); int i = 1; for (final String host : hosts) { final Map<String, String> labels = new HashMap<>(); labels.put("site", "foo"); labels.put("index", String.valueOf(i++)); final HostStatus hostStatus = statusBuilder .setLabels(labels) .build(); when(model.getHostStatus(host)).thenReturn(hostStatus); when(model.getHostLabels(host)).thenReturn(labels); } }

Target:
public void setUp() { when(model.listHosts()).thenReturn(hosts); final HostStatus.Builder statusBuilder = HostStatus.newBuilder() .setStatus(HostStatus.Status.UP) .setJobs(emptyMap()) .setStatuses(emptyMap()); int i = 1; for (final String host : hosts) { final Map<String, String> labels = new HashMap<>(); labels.put("site", "foo"); labels.put("index", String.valueOf(i++)); final HostStatus hostStatus = statusBuilder .setLabels(labels) .build(); when(model.getHostLabels(host)).thenReturn(labels); } }
Source:
public void globalVerify() throws Exception { IList<MapReduceCounter> results = targetInstance.getList(basename); MapReduceCounter total = new MapReduceCounter(); for (MapReduceCounter i : results) { total.add(i); } log.info(basename + ": " + total + " from " + results.size() + " worker Threads"); }

Target:
public void globalVerify() throws Exception { IList<Counter> results = targetInstance.getList(baseName); Counter total = new Counter(); for (Counter i : results) { total.add(i); } log.info(baseName + ": " + total + " from " + results.size() + " worker Threads"); }
Source:
private String getInstanceClass( final Tuple resultset, final int i, final Loadable persister, final Serializable id, final SessionImplementor session) throws HibernateException { if ( persister.hasSubclasses() ) { final String result = getInstanceClassFromDiscriminator( resultset, persister ); if ( result == null ) { throw new WrongClassException( "Discriminator: " + discriminatorValue( resultset, persister ), id, persister.getEntityName() ); } return result; } return persister.getEntityName(); }

Target:
private String getInstanceClass( final Tuple resultset, final int i, final Loadable persister, final Serializable id, final SessionImplementor session) throws HibernateException { String discriminatorColumnName = persister.getDiscriminatorColumnName(); if ( discriminatorColumnName == null ) { return persister.getEntityName(); } else { Object value = resultset.get( discriminatorColumnName ); return persister.getSubclassForDiscriminatorValue( value ); } }
Source:
public Artifact adapt(Attribute<?> attribute, Id identity) throws OseeCoreException { Artifact resultArtifact = AtsClientService.get().getArtifact(identity.getId()); if (resultArtifact == null) { int uuid = identity.getId() <= 0 ? 0 : identity.getId().intValue(); if (uuid > 0) { resultArtifact = ArtifactQuery.getArtifactFromId(uuid, AtsClientService.get().getAtsBranch()); } } return resultArtifact; }

Target:
public Artifact adapt(Attribute<?> attribute, Id identity) throws OseeCoreException { Artifact resultArtifact = AtsClientService.get().getArtifact(identity.getId()); if (resultArtifact == null) { if (identity.isValid()) { resultArtifact = ArtifactQuery.getArtifactFromId(identity.getId(), AtsClientService.get().getAtsBranch()); } } return resultArtifact; }
Source:
public void stop() { if (!eventReceived) { log.warn("Events did not received."); } try { thriftDataReceiver.stop(); log.info("Test Server Stopped."); } catch (Throwable t) { t.printStackTrace(); } }

Target:
public void stop() { if (!eventReceived) { log.warn("Events did not received."); } thriftDataReceiver.stop(); log.info("Test Server Stopped."); }
Source:
private Object lookUp(Class<?> type) { if (type==Jenkins.class || type==Hudson.class) return Jenkins.getInstance(); Jenkins j = Jenkins.getInstance(); if (j!=null) { Injector i = j.getInjector(); if (i!=null) return i.getInstance(type); } throw new IllegalArgumentException("Unable to inject "+type); }

Target:
private Object lookUp(Class<?> type) { Jenkins j = Jenkins.getInstance(); assert j != null : "This method is only invoked after the Jenkins singleton instance has been set"; if (type==Jenkins.class || type==Hudson.class) return j; Injector i = j.getInjector(); if (i!=null) return i.getInstance(type); throw new IllegalArgumentException("Unable to inject "+type); }