auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static @NonNull String buildCompatibilityTraceTypeId(@NonNull String traceTypeId) { if (traceTypeId.startsWith(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX)) { return NonNullUtils.checkNotNull(traceTypeId.replace(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX, CUSTOM_TXT_TRACE_TYPE_PREFIX)); } int index = traceTypeId.lastIndexOf(SEPARATOR); if ((index != -1) && (traceTypeId.startsWith(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX))) { String definitionName = index < traceTypeId.length() ? traceTypeId.substring(index + 1) : ""; if (traceTypeId.contains(CustomTxtTrace.class.getSimpleName() + SEPARATOR) && traceTypeId.indexOf(SEPARATOR) == index) { return buildTraceTypeId(CustomTxtTraceDefinition.CUSTOM_TXT_CATEGORY, definitionName); } return NonNullUtils.checkNotNull(traceTypeId.replace(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX, CUSTOM_TXT_TRACE_TYPE_PREFIX)); } return traceTypeId; }

Target:
public static @NonNull String buildCompatibilityTraceTypeId(@NonNull String traceTypeId) { if (traceTypeId.startsWith(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX)) { return CUSTOM_TXT_TRACE_TYPE_PREFIX + traceTypeId.substring(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX.length()); } int index = traceTypeId.lastIndexOf(SEPARATOR); if ((index != -1) && (traceTypeId.startsWith(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX))) { String definitionName = index < traceTypeId.length() ? traceTypeId.substring(index + 1) : ""; if (traceTypeId.contains(CustomTxtTrace.class.getSimpleName() + SEPARATOR) && traceTypeId.indexOf(SEPARATOR) == index) { return buildTraceTypeId(CustomTxtTraceDefinition.CUSTOM_TXT_CATEGORY, definitionName); } return CUSTOM_TXT_TRACE_TYPE_PREFIX + traceTypeId.substring(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX.length()); } return traceTypeId; }
Source:
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws GoraException { try { super.initialize(keyClass, persistentClass, properties); IgniteMappingBuilder builder = new IgniteMappingBuilder(this); builder.readMappingFile(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE)); igniteMapping = builder.getIgniteMapping(); igniteParameters = IgniteParameters.load(properties, conf); connection = acquiereConnection(); LOG.info("Ignite store was successfully initialized"); } catch (ClassNotFoundException | SQLException ex) { LOG.error("Error while initializing Ignite store", ex); throw new GoraException(ex); } }

Target:
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws GoraException { try { super.initialize(keyClass, persistentClass, properties); IgniteMappingBuilder<K, T> builder = new IgniteMappingBuilder<K, T>(this); builder.readMappingFile(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE)); igniteMapping = builder.getIgniteMapping(); igniteParameters = IgniteParameters.load(properties); connection = acquireConnection(); LOG.info("Ignite store was successfully initialized"); if (!schemaExists()) { createSchema(); } } catch (ClassNotFoundException | SQLException ex) { LOG.error("Error while initializing Ignite store", ex); throw new GoraException(ex); } }
Source:
private List<String> getColumnsMetadata(String parent, JsonNode propertiesNode) throws IOException { List<String> metadata = new ArrayList(); Iterator<Map.Entry<String, JsonNode>> iterator = propertiesNode.fields(); while (iterator.hasNext()) { Map.Entry<String, JsonNode> entry = iterator.next(); String key = entry.getKey(); JsonNode value = entry.getValue(); String childKey = parent == null || parent.isEmpty() ? key : parent.concat(".").concat(key); if (value.isObject()) { metadata.addAll(getColumnsMetadata(childKey, value)); continue; } if (!value.isArray()) { metadata.add(childKey.concat(":").concat(value.textValue())); } } return metadata; }

Target:
private List<String> getColumnsMetadata(String parent, JsonNode propertiesNode) { List<String> metadata = new ArrayList<>(); Iterator<Entry<String, JsonNode>> iterator = propertiesNode.fields(); while (iterator.hasNext()) { Entry<String, JsonNode> entry = iterator.next(); String key = entry.getKey(); JsonNode value = entry.getValue(); String childKey = null; if (parent == null || parent.isEmpty()) { childKey = key; } else { childKey = parent.concat(".").concat(key); } if (value.isObject()) { metadata.addAll(getColumnsMetadata(childKey, value)); continue; } if (!value.isArray()) { metadata.add(childKey.concat(":").concat(value.textValue())); } } return metadata; }
Source:
@Override public <I extends Indexer> I createIndexer(boolean direct) { BytePointer ptr = arrayData(); int size = arraySize(); int dims = dims(); int depth = depth(); int elemSize = CV_ELEM_SIZE1(depth); long[] sizes = new long[dims+1]; long[] strides = new long[dims+1]; for (int i=0; i<dims; i++) { sizes[i] = size(i); int step = step(i); if (step%elemSize != 0) throw new UnsupportedOperationException("Step is not a multiple of element size"); strides[i] = step/elemSize; } sizes[dims] = arrayChannels(); strides[dims] = 1; switch (depth) { case CV_8U: return (I)UByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case CV_8S: return (I)ByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case CV_16U: return (I)UShortIndexer.create(new ShortPointer(ptr).capacity(size/2), sizes, strides, direct).indexable(this); case CV_16S: return (I)ShortIndexer.create(new ShortPointer(ptr).capacity(size/2), sizes, strides, direct).indexable(this); case CV_32S: return (I)IntIndexer.create(new IntPointer(ptr).capacity(size/4), sizes, strides, direct).indexable(this); case CV_32F: return (I)FloatIndexer.create(new FloatPointer(ptr).capacity(size/4), sizes, strides, direct).indexable(this); case CV_64F: return (I)DoubleIndexer.create(new DoublePointer(ptr).capacity(size/8), sizes, strides, direct).indexable(this); default: assert false; } return null; }

Target:
@Override public <I extends Indexer> I createIndexer(boolean direct) { BytePointer ptr = arrayData(); int size = arraySize(); int dims = dims(); int depth = depth(); long elemSize = elemSize1(); long[] sizes = new long[dims+1]; long[] strides = new long[dims+1]; for (int i=0; i<dims; i++) { sizes[i] = size(i); int step = step(i); if (step%elemSize != 0) { throw new UnsupportedOperationException("Step is not a multiple of element size"); } strides[i] = step/elemSize; } sizes[dims] = arrayChannels(); strides[dims] = 1; switch (depth) { case CV_8U: return (I)UByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case CV_8S: return (I)ByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case CV_16U: return (I)UShortIndexer.create(new ShortPointer(ptr).capacity(size/2), sizes, strides, direct).indexable(this); case CV_16S: return (I)ShortIndexer.create(new ShortPointer(ptr).capacity(size/2), sizes, strides, direct).indexable(this); case CV_32S: return (I)IntIndexer.create(new IntPointer(ptr).capacity(size/4), sizes, strides, direct).indexable(this); case CV_32F: return (I)FloatIndexer.create(new FloatPointer(ptr).capacity(size/4), sizes, strides, direct).indexable(this); case CV_64F: return (I)DoubleIndexer.create(new DoublePointer(ptr).capacity(size/8), sizes, strides, direct).indexable(this); default: assert false; } return null; }
Source:
public Optional<DecorrelationResult> visitEnforceSingleRow(EnforceSingleRowNode node, Void context) { Optional<DecorrelationResult> childDecorrelationResultOptional = lookup.resolve(node.getSource()).accept(this, null); if (!childDecorrelationResultOptional.isPresent() || !childDecorrelationResultOptional.get().atMostSingleRow) { return Optional.empty(); } return childDecorrelationResultOptional; }

Target:
public Optional<DecorrelationResult> visitEnforceSingleRow(EnforceSingleRowNode node, Void context) { Optional<DecorrelationResult> childDecorrelationResultOptional = lookup.resolve(node.getSource()).accept(this, null); return childDecorrelationResultOptional.filter(result -> result.atMostSingleRow); }
Source:
public PrivateEncryptedChannel getPrivateEncryptedChannel(String channelName) throws IllegalArgumentException{ if (!channelName.startsWith("private-encrypted")) { throw new IllegalArgumentException("Encrypted private channels must begin with 'private-encrypted-'"); } else { return (PrivateEncryptedChannel) findChannelInChannelMap(channelName); } }

Target:
public PrivateEncryptedChannel getPrivateEncryptedChannel(String channelName) throws IllegalArgumentException{ if (!channelName.startsWith("private-encrypted-")) { throw new IllegalArgumentException("Encrypted private channels must begin with 'private-encrypted-'"); } else { return (PrivateEncryptedChannel) findChannelInChannelMap(channelName); } }
Source:
public void getMeasurementJsonError() { final CountDownLatch signal = new CountDownLatch(1); new OkHttpClient().newCall(new Request.Builder().url(NON_PARSABLE_URL).build()).enqueue(new GetMeasurementCallback() { @Override public void onSuccess(String json) { Assert.fail(); signal.countDown(); } @Override public void onError(String msg) { signal.countDown(); } }); try { signal.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(); } }

Target:
public void getMeasurementJsonError() { final CountDownLatch signal = new CountDownLatch(1); a.getOkHttpClient().newCall(new Request.Builder().url(NON_EXISTING_MEASUREMENT_URL).build()).enqueue(new GetMeasurementJsonCallback() { @Override public void onSuccess(String json) { Assert.fail(); signal.countDown(); } @Override public void onError(String msg) { signal.countDown(); } }); try { signal.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(); } }
Source:
public SpatialRuleLookup build(Collection<SpatialRule> rules, JsonFeatureCollection jsonFeatureCollection, BBox bounds, double resolution, boolean exact) { for (SpatialRule spatialRule : rules) { for (JsonFeature jsonFeature : jsonFeatureCollection.getFeatures()) { if (spatialRule.getUniqueName().equals(jsonFeature.getProperty("ISO_A3"))) { Geometry geometry = jsonFeature.getGeometry(); if (!geometry.isPolygon()) continue; spatialRule.setBorders(geometry.asPolygon().getPolygons()); break; } } } BBox polygonBounds = BBox.createInverse(false); for (SpatialRule spatialRule : rules) { if (!spatialRule.getBorders().isEmpty()) { for (Polygon polygon : spatialRule.getBorders()) { polygonBounds.update(polygon.getMinLat(), polygon.getMinLon()); polygonBounds.update(polygon.getMaxLat(), polygon.getMaxLon()); } } } if (polygonBounds.minLon == Double.MAX_VALUE) { throw new IllegalStateException("No SpatialRules defined or Polygons defined"); } BBox calculatedBounds = polygonBounds.calculateIntersection(bounds); if (calculatedBounds == null) return null; SpatialRuleLookup spatialRuleLookup = new SpatialRuleLookupArray(calculatedBounds, resolution, exact); for (SpatialRule spatialRule : rules) { spatialRuleLookup.addRule(spatialRule); } return spatialRuleLookup; }

Target:
public SpatialRuleLookup build(Collection<SpatialRule> rules, JsonFeatureCollection jsonFeatureCollection, BBox bounds, double resolution, boolean exact) { for (SpatialRule spatialRule : rules) { for (JsonFeature jsonFeature : jsonFeatureCollection.getFeatures()) { if (spatialRule.getId().equals(jsonFeature.getProperty("ISO_A3"))) { Geometry geometry = jsonFeature.getGeometry(); if (!geometry.isPolygon()) continue; spatialRule.setBorders(geometry.asPolygon().getPolygons()); break; } } } BBox polygonBounds = BBox.createInverse(false); for (SpatialRule spatialRule : rules) { if (!spatialRule.getBorders().isEmpty()) { for (Polygon polygon : spatialRule.getBorders()) { polygonBounds.update(polygon.getMinLat(), polygon.getMinLon()); polygonBounds.update(polygon.getMaxLat(), polygon.getMaxLon()); } } } if (!polygonBounds.isValid()) { throw new IllegalStateException("No SpatialRules defined or Polygons defined"); } BBox calculatedBounds = polygonBounds.calculateIntersection(bounds); if (calculatedBounds == null) return null; SpatialRuleLookup spatialRuleLookup = new SpatialRuleLookupArray(calculatedBounds, resolution, exact); for (SpatialRule spatialRule : rules) { spatialRuleLookup.addRule(spatialRule); } return spatialRuleLookup; }
Source:
public void testMultiTxSuspendResume() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { final List<Transaction> clientTxs = new ArrayList<>(); for (int i = 0; i < 10; i++) { Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); cache.put(i, i); tx.suspend(); clientTxs.add(tx); } GridTestUtils.runMultiThreaded(new CI1Exc<Integer>() { @Override public void applyx(Integer idx) throws Exception { Transaction tx = clientTxs.get(idx); assertEquals(SUSPENDED, tx.state()); tx.resume(); assertEquals(ACTIVE, tx.state()); tx.commit(); } }, 10, "th-suspend"); for (int i = 0; i < 10; i++) assertEquals(i, (int)cache.get(i)); cache.removeAll(); } } }); }

Target:
public void testMultiTxSuspendResume() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { final List<Transaction> clientTxs = new ArrayList<>(); for (int i = 0; i < 10; i++) { Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); cache.put(i, i); tx.suspend(); clientTxs.add(tx); } GridTestUtils.runMultiThreaded(new CI1<Integer>() { @Override public void apply (Integer idx) { Transaction tx = clientTxs.get(idx); assertEquals(SUSPENDED, tx.state()); tx.resume(); assertEquals(ACTIVE, tx.state()); tx.commit(); } }, 10, "th-suspend"); for (int i = 0; i < 10; i++) assertEquals(i, (int)cache.get(i)); cache.removeAll(); } } }); }
Source:
public String digest(String value) throws Exception { return saltValue(value, digestSource.digest(new String(keySource.getKey()))); }

Target:
public String digest(String value) throws Exception { return saltValue(value, keySource.getKey()); }
Source:
private void addEmbeddedProject(HalResource halResource, Project project) { Project minimalFilledProject = new Project(project.getName()); minimalFilledProject.setType(null); minimalFilledProject.setProjectType(null); HalResource<Project> halProject = new HalResource<>(minimalFilledProject); try { Link projectLink = linkTo(ProjectController.class).slash("api" + ProjectController.PROJECTS_URL + "/" + project.getId()).withSelfRel(); halProject.add(projectLink); } catch (Exception e) { log.error("cannot create embedded project with id: " + project.getId()); } halResource.addEmbeddedResource("sw360:projects", halProject); }

Target:
private void addEmbeddedProject(HalResource halResource, Project project) { Project minimalFilledProject = new Project(project.getName()); minimalFilledProject.setType(null); minimalFilledProject.setProjectType(null); HalResource<Project> halProject = new HalResource<>(minimalFilledProject); Link projectLink = linkTo(ProjectController.class).slash("api" + ProjectController.PROJECTS_URL + "/" + project.getId()).withSelfRel(); halProject.add(projectLink); halResource.addEmbeddedResource("sw360:projects", halProject); }
Source:
public void testGetPileup() { final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(1, 1, 1000); final Locatable loc = new SimpleInterval("chr1", 10, 10); final int readLength = 3; final GATKRead read1 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 1, readLength); read1.setBases(Utils.dupBytes((byte) 'A', readLength)); read1.setBaseQualities(Utils.dupBytes((byte) 30, readLength)); read1.setCigar("3M"); final GATKRead read2 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 10, readLength); read2.setBases(Utils.dupBytes((byte) 'A', readLength)); read2.setBaseQualities(Utils.dupBytes((byte) 30, readLength)); read2.setCigar("3M"); final GATKRead read3 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 7, readLength); read3.setBases(Utils.dupBytes((byte) 'C', readLength)); read3.setBaseQualities(Utils.dupBytes((byte) 20, readLength)); read3.setCigar("1M1D2M"); final GATKRead read4 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 7, readLength); read4.setBases(Utils.dupBytes((byte) 'C', readLength)); read4.setBaseQualities(Utils.dupBytes((byte) 20, readLength)); read4.setCigar("1M5D2M"); final ReadPileup pileup = GATKProtectedVariantContextUtils.getPileup(loc, Arrays.asList(read1, read2, read3, read4)); final int[] counts = pileup.getBaseCounts(); Assert.assertEquals(counts, new int[]{1, 1, 0, 0}); }

Target:
public void testGetPileup() { final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(1, 1, 1000); final Locatable loc = new SimpleInterval("chr1", 10, 10); final int readLength = 3; final GATKRead read1 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 1, readLength); read1.setBases(Utils.dupBytes((byte) 'A', readLength)); read1.setBaseQualities(Utils.dupBytes((byte) 30, readLength)); read1.setCigar("3M"); final GATKRead read2 = ArtificialReadUtils.createArtificialRead(header, "read2", 0, 10, readLength); read2.setBases(Utils.dupBytes((byte) 'A', readLength)); read2.setBaseQualities(Utils.dupBytes((byte) 30, readLength)); read2.setCigar("3M"); final GATKRead read3 = ArtificialReadUtils.createArtificialRead(header, "read3", 0, 7, readLength); read3.setBases(Utils.dupBytes((byte) 'C', readLength)); read3.setBaseQualities(Utils.dupBytes((byte) 20, readLength)); read3.setCigar("1M1D2M"); final GATKRead read4 = ArtificialReadUtils.createArtificialRead(header, "read4", 0, 7, readLength); read4.setBases(Utils.dupBytes((byte) 'C', readLength)); read4.setBaseQualities(Utils.dupBytes((byte) 20, readLength)); read4.setCigar("1M5D2M"); final ReadPileup pileup = GATKProtectedVariantContextUtils.getPileup(loc, Arrays.asList(read1, read2, read3, read4)); final int[] counts = pileup.getBaseCounts(); Assert.assertEquals(counts, new int[]{1, 1, 0, 0}); }
Source:
private void cleanup() { if (runIdGenerator.isPresent()) { runIdGenerator.get().close(); } if (coordinationUtils.isPresent()) { coordinationUtils.get().close(); } }

Target:
private void cleanup() { runIdGenerator.ifPresent(RunIdGenerator::close); coordinationUtils.ifPresent(CoordinationUtils::close); }
Source:
public void loadXMLConfig() { if (deviceID == null) { logger.info("Device ID was null, reading from openhab.cfg"); deviceID = deviceIDFromConfig; } try { logger.debug("Loading XML-Config for device ID: {}",deviceID); logger.info("Using Config for device ID: {}",deviceID); URL mapping = FrameworkUtil.getBundle(ResolVBUSBinding.class).getEntry("xml/mapping.cfg"); if (mapping == null) { config = null; logger.error("Unable to load mapping.xml"); return; } InputStream in = mapping.openStream(); Properties prop = new Properties(); prop.load(in); deviceIDFile = prop.getProperty(deviceID); logger.debug("Using file: for configuration",deviceIDFile); } catch (IOException e1) { e1.printStackTrace(); } URL entry = FrameworkUtil.getBundle(ResolVBUSConfig.class).getEntry("xml/"+deviceIDFile); if (entry == null) { config = null; logger.error("Unable to load {}",deviceIDFile); return; } XStream xstream = new XStream(new StaxDriver()); xstream.alias("vbusSpecification",ResolVBUSConfig.class); xstream.alias("device",ResolVBUSDevice.class); xstream.alias("field",ResolVBUSField.class); xstream.alias("packet",ResolVBUSPacket.class); xstream.alias("value", ResolVBUSValue.class); xstream.processAnnotations(ResolVBUSConfig.class); try { InputStream x = entry.openStream(); config = (ResolVBUSConfig) xstream.fromXML(x); } catch (IOException e) { logger.error("Couldn't read XML Config: ",e.getMessage()); } }

Target:
public void loadXMLConfig() { if (deviceID == null) { logger.info("Device ID was null, reading from openhab.cfg"); deviceID = deviceIDFromConfig; } try { logger.debug("Loading XML-Config for device ID: {}",deviceID); URL mapping = FrameworkUtil.getBundle(ResolVBUSBinding.class).getEntry("xml/mapping.cfg"); if (mapping == null) { config = null; logger.error("Unable to load mapping.cfg"); return; } InputStream in = mapping.openStream(); Properties prop = new Properties(); prop.load(in); deviceIDFile = prop.getProperty(deviceID); logger.debug("Using file: for configuration",deviceIDFile); } catch (IOException e) { logger.debug(e.getMessage()); } URL entry = FrameworkUtil.getBundle(ResolVBUSConfig.class).getEntry("xml/"+deviceIDFile); if (entry == null) { config = null; logger.error("Unable to load {}",deviceIDFile); return; } XStream xstream = new XStream(new StaxDriver()); xstream.alias("vbusSpecification",ResolVBUSConfig.class); xstream.alias("device",ResolVBUSDevice.class); xstream.alias("field",ResolVBUSField.class); xstream.alias("packet",ResolVBUSPacket.class); xstream.alias("value", ResolVBUSValue.class); xstream.processAnnotations(ResolVBUSConfig.class); try { InputStream x = entry.openStream(); config = (ResolVBUSConfig) xstream.fromXML(x); } catch (IOException e) { logger.error("Couldn't read XML Config: ",e.getMessage()); } }
Source:
public MatchResult matcher(HttpServletRequest request) { if (!matches(request)) { return MatchResult.notMatch(); } if (this.matcher == null) { return MatchResult.match(); } String url = getRequestPath(request); return MatchResult.match(this.matcher.extractUriTemplateVariables(url)); }

Target:
public MatchResult matcher(HttpServletRequest request) { if (this.matcher == null || !matches(request)) { return MatchResult.notMatch(); } String url = getRequestPath(request); return MatchResult.match(this.matcher.extractUriTemplateVariables(url)); }
Source:
public void makeUnDiscoverablePatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(eperson.getEmail(), password); String tokenAdmin = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/discoverable", "false"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.discoverable", Matchers.is(true))); }

Target:
public void makeUnDiscoverablePatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(eperson.getEmail(), password); String tokenAdmin = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/discoverable", false); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.discoverable", Matchers.is(true))); }
Source:
private void initializeTrackablesAction() { for (final TrackableLog trackable : trackables) { if (trackableState == null) { if (Settings.isTrackableAutoVisit()) { trackable.action = LogTypeTrackable.VISITED; } } else { final Integer tbStateId = trackableState.getInt(trackable.trackCode); if (tbStateId > 0) { trackable.action = LogTypeTrackable.getById(tbStateId); } else { if (Settings.isTrackableAutoVisit()) { trackable.action = LogTypeTrackable.VISITED; } } } } }

Target:
private void initializeTrackablesAction() { for (final TrackableLog trackable : trackables) { if (trackableState != null) { final int tbStateId = trackableState.getInt(trackable.trackCode); if (tbStateId > 0) { trackable.action = LogTypeTrackable.getById(tbStateId); continue; } } if (Settings.isTrackableAutoVisit()) { trackable.action = LogTypeTrackable.VISITED; } } }
Source:
public void preparePartitionsTobeRegistered(String streamName) throws InterruptedException { if (!isStreamHCatEnabled(streamName)) { LOG.info("Hcat is not enabled for " + streamName + " stream"); return; } String tableName = getTableName(streamName); HCatClient hcatClient = getHCatClient(); if (hcatClient == null) { LOG.info("Didn't get any hcat client from pool hence not adding partitions"); return; } try { long lastAddedTime = lastAddedPartitionMap.get(tableName); if (lastAddedTime == EMPTY_PARTITION_LIST) { LOG.info("there are no partitions in "+ tableName +" table. "); return; } else if (lastAddedTime == FAILED_GET_PARTITIONS) { try { findLastPartition(hcatClient, streamName); lastAddedTime = lastAddedPartitionMap.get(tableName); if (lastAddedTime == EMPTY_PARTITION_LIST) { LOG.info("there are no partitions in "+ tableName +" table. "); return; } } catch (HCatException e) { LOG.error("Got exception while trying to get the last added partition ", e); return; } } findDiffBetweenLastAddedAndFirstPath(lastAddedTime, streamName, tableName); } finally { addToPool(hcatClient); } }

Target:
private void preparePartitionsTobeRegistered(String streamName) throws InterruptedException { if (!isStreamHCatEnabled(streamName)) { LOG.info("Hcat is not enabled for " + streamName + " stream"); return; } String tableName = getTableName(streamName); HCatClient hcatClient = getHCatClient(); if (hcatClient == null) { LOG.warn("Didn't get any hcat client from pool hence not adding partitions"); ConduitMetrics.updateSWGuage(getServiceType(), FAILED_TO_GET_HCAT_CLIENT_COUNT, streamName, 1); return; } try { long lastAddedTime = lastAddedPartitionMap.get(tableName); if (lastAddedTime == EMPTY_PARTITION_LIST) { LOG.info("there are no partitions in "+ tableName +" table. "); return; } else if (lastAddedTime == FAILED_GET_PARTITIONS) { try { findLastPartition(hcatClient, streamName); lastAddedTime = lastAddedPartitionMap.get(tableName); if (lastAddedTime == EMPTY_PARTITION_LIST) { LOG.info("there are no partitions in "+ tableName +" table. "); return; } } catch (HCatException e) { LOG.error("Got exception while trying to get the last added partition ", e); return; } } findDiffBetweenLastAddedAndFirstPath(lastAddedTime, streamName, tableName); } finally { addToPool(hcatClient); } }
Source:
private static Map<String, String> load() { Map<String, String> outputClasses = Maps.newHashMap(); Set<Class> restOutputClasses = ClassUtil.findClasses(AbstractStreamingOutput.class, "org.apache.tajo.ws.rs.resources.outputs"); for (Class eachClass : restOutputClasses) { if (eachClass.isInterface() || Modifier.isAbstract(eachClass.getModifiers())) { continue; } AbstractStreamingOutput streamingOutput = null; try { streamingOutput = (AbstractStreamingOutput) eachClass.getDeclaredConstructor( new Class[]{NonForwardQueryResultScanner.class, Integer.class, Integer.class}).newInstance(null, 0, 0); } catch (Exception e) { LOG.warn(eachClass + " cannot instantiate Function class because of " + e.getMessage(), e); continue; } String className = streamingOutput.getClass().getCanonicalName(); String headerType = streamingOutput.getClass().getAnnotation(RestReturnType.class).headerType(); String description = streamingOutput.getClass().getAnnotation(RestReturnType.class).description(); if (StringUtils.isNotEmpty(headerType)) { outputClasses.put(headerType, className); } } return outputClasses; }

Target:
private static Map<String, String> load() { Map<String, String> outputClasses = Maps.newHashMap(); Set<Class> restOutputClasses = ClassUtil.findClasses(AbstractStreamingOutput.class, "org.apache.tajo.ws.rs.resources.outputs"); for (Class eachClass : restOutputClasses) { if (eachClass.isInterface() || Modifier.isAbstract(eachClass.getModifiers())) { continue; } AbstractStreamingOutput streamingOutput = null; try { streamingOutput = (AbstractStreamingOutput) eachClass.getDeclaredConstructor( new Class[]{NonForwardQueryResultScanner.class, Integer.class, Integer.class}).newInstance(null, 0, 0); } catch (Exception e) { LOG.warn(eachClass + " cannot instantiate Function class because of " + e.getMessage(), e); continue; } String className = streamingOutput.getClass().getCanonicalName(); String headerType = streamingOutput.getClass().getAnnotation(RestReturnType.class).mimeType(); if (StringUtils.isNotEmpty(headerType)) { outputClasses.put(headerType, className); } } return outputClasses; }
Source:
public SipMessage.Builder<T> withRecordRouteHeaders(final List<RecordRouteHeader> recordRoutes) { if (recordRoutes != null && !recordRoutes.isEmpty()) { this.recordRouteHeaders = ensureList(this.recordRouteHeaders); this.recordRouteHeaders.clear(); for (final RecordRouteHeader rr : recordRoutes) { this.recordRouteHeaders.add(rr); recordRouteHeader = rr; } } return this; }

Target:
public SipMessage.Builder<T> withRecordRouteHeaders(final List<RecordRouteHeader> recordRoutes) { if (recordRoutes != null && !recordRoutes.isEmpty()) { this.recordRouteHeaders = ensureList(this.recordRouteHeaders); this.recordRouteHeaders.clear(); recordRouteHeader = recordRoutes.get(0); this.recordRouteHeaders.addAll(recordRoutes); } return this; }
Source:
private Throwable runMultiPreparerSetup(IMultiTargetPreparer preparer, ITestLogger logger) { if (preparer.isDisabled()) { return null; } CLog.d("Running setup Multi preparer: %s", preparer.getClass().getSimpleName()); try { if (preparer instanceof ITestLoggerReceiver) { ((ITestLoggerReceiver) preparer).setTestLogger(logger); } if (preparer instanceof IInvocationContextReceiver) { ((IInvocationContextReceiver) preparer) .setInvocationContext(mModuleInvocationContext); } preparer.setUp(mModuleInvocationContext); return null; } catch (BuildError | TargetSetupError | DeviceNotAvailableException | RuntimeException | AssertionError e) { CLog.e("Unexpected Exception from preparer: %s", preparer.getClass().getName()); CLog.e(e); return e; } }

Target:
private Throwable runMultiPreparerSetup(IMultiTargetPreparer preparer, ITestLogger logger) { if (preparer.isDisabled()) { return null; } CLog.d("Running setup multi preparer: %s", preparer.getClass().getSimpleName()); try { if (preparer instanceof ITestLoggerReceiver) { ((ITestLoggerReceiver) preparer).setTestLogger(logger); } if (preparer instanceof IInvocationContextReceiver) { ((IInvocationContextReceiver) preparer) .setInvocationContext(mModuleInvocationContext); } preparer.setUp(mModuleInvocationContext); return null; } catch (BuildError | TargetSetupError | DeviceNotAvailableException | RuntimeException | AssertionError e) { CLog.e("Unexpected Exception from preparer: %s", preparer.getClass().getName()); CLog.e(e); return e; } }
Source:
public void addToOrderBook(Order order) { if (order.getClass() == BuyOrder.class) { ArrayList<Order> newOrders = buyOrders.get(order.getStockSymbol()); if (newOrders == null) { newOrders = new ArrayList<Order>(); newOrders.add(order); buyOrders.put(order.getStockSymbol(), newOrders); } else { newOrders.add(order); buyOrders.put(order.getStockSymbol(), newOrders); } } else { ArrayList<Order> newOrders = sellOrders.get(order.getStockSymbol()); if (newOrders == null) { newOrders = new ArrayList<Order>(); newOrders.add(order); sellOrders.put(order.getStockSymbol(), newOrders); } else { newOrders.add(order); sellOrders.put(order.getStockSymbol(), newOrders); } } }

Target:
public void addToOrderBook(Order order) { if (order.getClass() == BuyOrder.class) { addNewOrders(order,buyOrders); } else { addNewOrders(order,sellOrders); } }
Source:
public FolderListing getFolderListing( final Path path ) { final List<FolderItem> folderItems = new ArrayList<FolderItem>(); org.uberfire.java.nio.file.Path nioPath = Paths.convert( path ); while ( !Files.exists( nioPath ) ) { nioPath = nioPath.getParent(); } final Path basePath = Paths.convert( nioPath ); final DirectoryStream<org.uberfire.java.nio.file.Path> nioPaths = ioService.newDirectoryStream( nioPath, dotFileFilter ); for ( org.uberfire.java.nio.file.Path np : nioPaths ) { if ( Files.isRegularFile( np ) ) { final org.uberfire.backend.vfs.Path p = Paths.convert( np ); final String lockedBy = Paths.readLockedBy( p ); final FolderItem folderItem = new FolderItem( p, p.getFileName(), FolderItemType.FILE, false, lockedBy, metadataService.getMetadata( p ).getTags() ); folderItems.add( folderItem ); } else if ( Files.isDirectory( np ) ) { final org.uberfire.backend.vfs.Path p = Paths.convert( np ); boolean lockedItems = !lockService.retrieveLockInfos( Paths.convert( np ), true ).isEmpty(); final FolderItem folderItem = new FolderItem( p, p.getFileName(), FolderItemType.FOLDER, lockedItems, null, null); folderItems.add( folderItem ); } } Collections.sort( folderItems, Sorters.ITEM_SORTER ); return new FolderListing( toFolderItem( nioPath ), folderItems, getPathSegments( basePath ) ); }

Target:
public FolderListing getFolderListing( final Path path ) { final List<FolderItem> folderItems = new ArrayList<FolderItem>(); org.uberfire.java.nio.file.Path nioPath = Paths.convert( path ); while ( !Files.exists( nioPath ) ) { nioPath = nioPath.getParent(); } final Path basePath = Paths.convert( nioPath ); final DirectoryStream<org.uberfire.java.nio.file.Path> nioPaths = ioService.newDirectoryStream( nioPath, dotFileFilter ); for ( org.uberfire.java.nio.file.Path np : nioPaths ) { if ( Files.isRegularFile( np ) ) { final org.uberfire.backend.vfs.Path p = Paths.convert( np ); final String lockedBy = Paths.readLockedBy( p ); final FolderItem folderItem = new FolderItem( p, p.getFileName(), FolderItemType.FILE, false, lockedBy, metadataService.getMetadata( p ).getTags() ); folderItems.add( folderItem ); } else if ( Files.isDirectory( np ) ) { final org.uberfire.backend.vfs.Path p = Paths.convert( np ); boolean lockedItems = !lockService.retrieveLockInfos( Paths.convert( np ), true ).isEmpty(); final FolderItem folderItem = new FolderItem( p, p.getFileName(), FolderItemType.FOLDER, lockedItems, null, new ArrayList<String>( )); folderItems.add( folderItem ); } } Collections.sort( folderItems, Sorters.ITEM_SORTER ); return new FolderListing( toFolderItem( nioPath ), folderItems, getPathSegments( basePath ) ); }
Source:
public static void runCleanupTask(Runnable task) { try { task.run(); } catch (Throwable t) { log.error("Failed to cleanup pre-commit condition", t); } }

Target:
public static void runCleanupTask(Runnable task) { try { task.run(); } catch (Exception t) { log.error("Failed to cleanup pre-commit condition", t); } }
Source:
@Override public String getProcName() { return getClass().getSimpleName() + " region=" + region.getEncodedName() + (targetServer != null? ", server=" + targetServer: ""); }

Target:
@Override public String getProcName() { return getClass().getSimpleName() + " " + region.getEncodedName(); }
Source:
public BitmapDrawable getDrawable(final String url) { if (StringUtils.isBlank(url) || isCounter(url)) { return new BitmapDrawable(resources, getTransparent1x1Image()); } final boolean shared = url.contains("/images/icons/icon_"); final String pseudoGeocode = shared ? "shared" : geocode; Bitmap imagePre = loadImageFromStorage(url, pseudoGeocode, shared); if (imagePre == null) { final String absoluteURL = makeAbsoluteURL(url); if (absoluteURL != null) { try { final File file = LocalStorage.getStorageFile(pseudoGeocode, url, true, true); final HttpResponse httpResponse = Network.getRequest(absoluteURL, null, file); if (httpResponse != null) { final int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode == 200) { LocalStorage.saveEntityToFile(httpResponse, file); } else if (statusCode == 304) { file.setLastModified(System.currentTimeMillis()); } } } catch (Exception e) { Log.e("HtmlImage.getDrawable (downloading from web)", e); } } } if (onlySave) { return null; } if (imagePre == null) { imagePre = loadImageFromStorage(url, pseudoGeocode, shared); } if (imagePre == null) { Log.d("HtmlImage.getDrawable: Failed to obtain image"); if (returnErrorImage) { imagePre = BitmapFactory.decodeResource(resources, R.drawable.image_not_loaded); } else { imagePre = getTransparent1x1Image(); } } final BitmapDrawable image = ImageHelper.scaleBitmapToFitDisplay(imagePre); return image; }

Target:
public BitmapDrawable getDrawable(final String url) { if (StringUtils.isBlank(url) || isCounter(url)) { return new BitmapDrawable(resources, getTransparent1x1Image()); } final boolean shared = url.contains("/images/icons/icon_"); final String pseudoGeocode = shared ? "shared" : geocode; Bitmap imagePre = loadImageFromStorage(url, pseudoGeocode, shared); if (imagePre == null) { final String absoluteURL = makeAbsoluteURL(url); if (absoluteURL != null) { try { final File file = LocalStorage.getStorageFile(pseudoGeocode, url, true, true); final HttpResponse httpResponse = Network.getRequest(absoluteURL, null, file); if (httpResponse != null) { final int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode == 200) { LocalStorage.saveEntityToFile(httpResponse, file); } else if (statusCode == 304) { file.setLastModified(System.currentTimeMillis()); } } } catch (Exception e) { Log.e("HtmlImage.getDrawable (downloading from web)", e); } } } if (onlySave) { return null; } if (imagePre == null) { imagePre = loadImageFromStorage(url, pseudoGeocode, shared); } if (imagePre == null) { Log.d("HtmlImage.getDrawable: Failed to obtain image"); if (returnErrorImage) { imagePre = BitmapFactory.decodeResource(resources, R.drawable.image_not_loaded); } else { imagePre = getTransparent1x1Image(); } } return ImageHelper.scaleBitmapToFitDisplay(imagePre); }
Source:
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException { RefactoringStatus status = new RefactoringStatus(); if (document == null) { return status; } try { CompletableFuture<List<LanguageServer>> serverList = LanguageServiceAccessor.getLanguageServers(document, LSPRenameProcessor::isPrepareRenameProvider) ; for (LanguageServer serverToTry : serverList.get()) { if (languageServer.equals(serverToTry)) { TextDocumentIdentifier identifier = new TextDocumentIdentifier(LSPEclipseUtils.toUri(document).toString()); TextDocumentPositionParams params = new TextDocumentPositionParams(); params.setTextDocument(identifier); params.setPosition(LSPEclipseUtils.toPosition(offset, document)); prepareRenameResult = languageServer.getTextDocumentService().prepareRename(params).get(1000, TimeUnit.MILLISECONDS); if (prepareRenameResult == null) { status.addFatalError(Messages.rename_invalidated); } } } } catch (Exception e) { handleError(e, status); return new RefactoringStatus(); } return status; }

Target:
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException { RefactoringStatus status = new RefactoringStatus(); if (document == null) { return status; } try { CompletableFuture<List<LanguageServer>> serverList = LanguageServiceAccessor.getLanguageServers(document, LSPRenameProcessor::isPrepareRenameProvider) ; for (LanguageServer serverToTry : serverList.get(500, TimeUnit.MILLISECONDS)) { if (languageServer.equals(serverToTry)) { TextDocumentIdentifier identifier = new TextDocumentIdentifier(LSPEclipseUtils.toUri(document).toString()); TextDocumentPositionParams params = new TextDocumentPositionParams(); params.setTextDocument(identifier); params.setPosition(LSPEclipseUtils.toPosition(offset, document)); prepareRenameResult = languageServer.getTextDocumentService().prepareRename(params).get(1000, TimeUnit.MILLISECONDS); if (prepareRenameResult == null) { status.addFatalError(Messages.rename_invalidated); } } } } catch (Exception e) { handleError(e, status); return new RefactoringStatus(); } return status; }
Source:
public void check(OperationResult result) { HealthStateType type = HealthStateType.general(HealthStateScope.forPipeline(pipelineName)); if (triggerMonitor.isAlreadyTriggered(pipelineName) || pipelineScheduleQueue.hasForcedBuildCause(new CaseInsensitiveString(pipelineName))) { result.conflict("Failed to trigger pipeline: " + pipelineName, "Pipeline already triggered", HealthStateType.general(HealthStateScope.forPipeline(pipelineName))); } else { result.success(type); } }

Target:
public void check(OperationResult result) { String pipelineNameString = CaseInsensitiveString.str(pipelineName); HealthStateType type = HealthStateType.general(HealthStateScope.forPipeline(pipelineNameString)); if (triggerMonitor.isAlreadyTriggered(pipelineName) || pipelineScheduleQueue.hasForcedBuildCause(pipelineName)) { result.conflict("Failed to trigger pipeline: " + pipelineName, "Pipeline already triggered", HealthStateType.general(HealthStateScope.forPipeline(pipelineNameString))); } else { result.success(type); } }
Source:
Default(Builder builder) { this.clock = builder.clock; this.errorParser = builder.errorParser; this.propagationFactory = builder.propagationFactory; this.stringPropagation = builder.propagationFactory.create(Propagation.KeyFactory.STRING); this.currentTraceContext = builder.currentTraceContext; this.sampler = builder.sampler; this.noop = new AtomicBoolean(); FinishedSpanHandler zipkinHandler = builder.spanReporter != Reporter.NOOP ? new ZipkinFinishedSpanHandler(builder.spanReporter, errorParser, builder.localServiceName, builder.localIp, builder.localPort) : FinishedSpanHandler.NOOP; FinishedSpanHandler finishedSpanHandler = zipkinReportingFinishedSpanHandler(builder.finishedSpanHandlers, zipkinHandler, noop); ArrayList<FinishedSpanHandler> orphanedSpanHandlers = new ArrayList<>(); for (FinishedSpanHandler handler : builder.finishedSpanHandlers) { if (handler.supportsOrphans()) orphanedSpanHandlers.add(handler); } FinishedSpanHandler orphanedSpanHandler = finishedSpanHandler; if (!builder.finishedSpanHandlers.equals(orphanedSpanHandlers)) { orphanedSpanHandler = zipkinReportingFinishedSpanHandler(orphanedSpanHandlers, zipkinHandler, noop); } this.tracer = new Tracer( builder.clock, builder.propagationFactory, finishedSpanHandler, new PendingSpans(clock, orphanedSpanHandler, noop), builder.sampler, builder.currentTraceContext, builder.traceId128Bit || propagationFactory.requires128BitTraceId(), builder.supportsJoin && propagationFactory.supportsJoin(), finishedSpanHandler.alwaysSampleLocal(), noop ); maybeSetCurrent(); }

Target:
Default(Builder builder) { this.clock = builder.clock; this.errorParser = builder.errorParser; this.propagationFactory = builder.propagationFactory; this.stringPropagation = builder.propagationFactory.create(Propagation.KeyFactory.STRING); this.currentTraceContext = builder.currentTraceContext; this.sampler = builder.sampler; this.noop = new AtomicBoolean(); FinishedSpanHandler zipkinHandler = builder.spanReporter != Reporter.NOOP ? new ZipkinFinishedSpanHandler(builder.spanReporter, errorParser, builder.localServiceName, builder.localIp, builder.localPort) : FinishedSpanHandler.NOOP; FinishedSpanHandler finishedSpanHandler = zipkinReportingFinishedSpanHandler(builder.finishedSpanHandlers, zipkinHandler, noop); ArrayList<FinishedSpanHandler> orphanedSpanHandlers = new ArrayList<>(); for (FinishedSpanHandler handler : builder.finishedSpanHandlers) { if (handler.supportsOrphans()) orphanedSpanHandlers.add(handler); } FinishedSpanHandler orphanedSpanHandler = finishedSpanHandler; boolean allHandlersSupportOrphans = builder.finishedSpanHandlers.equals(orphanedSpanHandlers); if (!allHandlersSupportOrphans) { orphanedSpanHandler = zipkinReportingFinishedSpanHandler(orphanedSpanHandlers, zipkinHandler, noop); } this.tracer = new Tracer( builder.clock, builder.propagationFactory, finishedSpanHandler, new PendingSpans(clock, orphanedSpanHandler, noop), builder.sampler, builder.currentTraceContext, builder.traceId128Bit || propagationFactory.requires128BitTraceId(), builder.supportsJoin && propagationFactory.supportsJoin(), finishedSpanHandler.alwaysSampleLocal(), noop ); maybeSetCurrent(); }
Source:
public void reportIssue(PomCheck check, int line, String message, List<Location> secondary) { AnalyzerMessage analyzerMessage = new AnalyzerMessage(check, getFile(), line, message, 0); for (Location location : secondary) { AnalyzerMessage secondaryLocation; if (location.onLine()) { secondaryLocation = new AnalyzerMessage(check, getFile(), location.line, location.msg, 0); } else { secondaryLocation = new AnalyzerMessage(check, getFile(), location.tree.startLocation().line(), location.msg, 0); } analyzerMessage.flows.add(Collections.singletonList(secondaryLocation)); } getMessages().add(analyzerMessage); }

Target:
public void reportIssue(PomCheck check, int line, String message, List<Location> secondary) { AnalyzerMessage analyzerMessage = new AnalyzerMessage(check, getFile(), line, message, 0); for (Location location : secondary) { AnalyzerMessage secondaryLocation = new AnalyzerMessage(check, getFile(), location.startLine(), location.msg, 0); analyzerMessage.flows.add(Collections.singletonList(secondaryLocation)); } getMessages().add(analyzerMessage); }
Source:
public FileDiff(final Repository repo, final RevCommit c, final DiffEntry entry) { repository = repo; diffEntry = entry; commit = c; base = null; }

Target:
public FileDiff(final Repository repo, final RevCommit c, final DiffEntry entry) { this(repo, c, null, entry); }
Source:
public boolean isAcceptableReplacement(Part part, boolean refit) { Part newPart = getNewPart(); newPart.setUnit(unit); if(part instanceof EquipmentPart) { EquipmentPart eqpart = (EquipmentPart)part; EquipmentType et = eqpart.getType(); return type.equals(et) && getTonnage() == part.getTonnage() && size == eqpart.getSize() && part.getStickerPrice().equals(newPart.getStickerPrice()); } return false; }

Target:
public boolean isAcceptableReplacement(Part part, boolean refit) { Part newPart = getNewPart(); newPart.setUnit(unit); if(part instanceof EquipmentPart) { EquipmentPart eqpart = (EquipmentPart)part; EquipmentType et = eqpart.getType(); return (type.equals(et) && getTonnage() == part.getTonnage()) && (size == eqpart.getSize()) && part.getStickerPrice().equals(newPart.getStickerPrice()); } return false; }
Source:
public int getClusterSize(String clusterId, String zoneId) { Cluster cluster = Preconditions.checkNotNull( getCluster(clusterId, zoneId), "Cluster " + clusterId + " was not found"); return cluster.getServeNodes(); }

Target:
public int getClusterSize(String clusterId, String zoneId) { String message = String.format("Cluster %s/%s was not found.", clusterId, zoneId); Cluster cluster = Preconditions.checkNotNull(getCluster(clusterId, zoneId), message); return cluster.getServeNodes(); }
Source:
public static CharSeq of(char... characters) { Objects.requireNonNull(characters, "characters is null"); final char[] chrs = new char[characters.length]; System.arraycopy(characters, 0, chrs, 0, characters.length); return characters.length == 0 ? empty() : new CharSeq(new String(chrs)); }

Target:
public static CharSeq of(char... characters) { Objects.requireNonNull(characters, "characters is null"); if (characters.length == 0) { return empty(); } else { final char[] chrs = new char[characters.length]; System.arraycopy(characters, 0, chrs, 0, characters.length); return new CharSeq(new String(chrs)); } }