auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean delete(final String queryId) { final DAG<PhysicalVertex, StreamType.Direction> physicalPlan = physicalPlanMap.remove(queryId); try { planStore.delete(queryId); } catch (final IOException e) { e.printStackTrace(); } if (physicalPlan != null) { final Iterator<PhysicalVertex> iterator = GraphUtils.topologicalSort(physicalPlan); while (iterator.hasNext()) { final PhysicalVertex physicalVertex = iterator.next(); switch (physicalVertex.getType()) { case SOURCE: { final Source src = (Source)physicalVertex; try { src.close(); } catch (final Exception e) { e.printStackTrace(); } src.getEventGenerator().setOutputEmitter(null); break; } case OPERATOR_CHIAN: { final PartitionedQuery partitionedQuery = (PartitionedQuery)physicalVertex; partitionedQueryManager.delete(partitionedQuery); partitionedQuery.setOutputEmitter(null); break; } case SINK: { final Sink sink = (Sink)physicalVertex; try { sink.close(); } catch (final Exception e) { e.printStackTrace(); } break; } default: throw new RuntimeException("Invalid Vertex Type: " + physicalVertex.getType()); } } return true; } return false; }

Target:
public boolean delete(final String queryId) { try { planStore.delete(queryId); } catch (final IOException e) { e.printStackTrace(); return false; } return deleteQueryFromManager(queryId); }
Source:
protected void emitAnchorHref(String href) { String[] names = href.split("/"); String name = names[names.length - 1]; if (convertMarkupPageLinks && name.indexOf('.') == -1 && !ABSOLUTE_URL_PATTERN.matcher(href).matches()) { int split = href.indexOf('#'); if (split > 0) { href = getHtmlFilenameFormat().replace("$1", href.substring(0, split)) + href.substring(split); } else if (split == -1) { href = getHtmlFilenameFormat().replace("$1", href); } } writer.writeAttribute("href", makeUrlAbsolute(href)); }

Target:
protected void emitAnchorHref(String href) { if (getHtmlFilenameFormat() != null) { if (isRelativeMissingFileSuffix(href)) { int split = href.indexOf('#'); if (split > 0) { href = getHtmlFilenameFormat().replace("$1", href.substring(0, split)) + href.substring(split); } else if (split == -1) { href = getHtmlFilenameFormat().replace("$1", href); } } } writer.writeAttribute("href", makeUrlAbsolute(href)); }
Source:
static <T> Iterator<T> iterate(T seed, Function<? super T, ? extends T> f) { Objects.requireNonNull(f, "f is null"); return new AbstractIterator<T>() { Function<? super T, ? extends T> nextFunc = (s) -> seed; T previous = null; @Override public boolean hasNext() { return true; } @Override public T getNext() { previous = nextFunc.apply(previous); nextFunc = f; return previous; } }; }

Target:
static <T> Iterator<T> iterate(T seed, Function<? super T, ? extends T> f) { Objects.requireNonNull(f, "f is null"); return new AbstractIterator<T>() { Function<? super T, ? extends T> nextFunc = s -> { nextFunc = f; return seed; }; T current = null; @Override public boolean hasNext() { return true; } @Override public T getNext() { current = nextFunc.apply(current); return current; } }; }
Source:
public static PayReceive parsePayReceive(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "PAY": case "P": return PayReceive.PAY; case "RECEIVE": case "REC": case "R": return PayReceive.RECEIVE; default: throw new IllegalArgumentException("Unknown PayReceive value, must 'Pay' or 'Receive' but was '" + str + "'"); } }

Target:
public static PayReceive parsePayReceive(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "PAY": case "P": return PayReceive.PAY; case "RECEIVE": case "REC": case "R": return PayReceive.RECEIVE; default: throw new IllegalArgumentException( "Unknown PayReceive value, must be 'Pay' or 'Receive' but was '" + str + "'; " + "parser is case insensitive and also accepts 'P', 'Rec' and 'R'"); } }
Source:
private FanoutBucket asFanout(InMemoryNoteBucket bucket) throws IOException { if (bucket == null) return EMPTY_FANOUT; if (bucket instanceof FanoutBucket) return (FanoutBucket) bucket; FanoutBucket fanoutBucket = ((LeafBucket) bucket).split(); fanoutBucket.writeTree(inserter); return fanoutBucket; }

Target:
private FanoutBucket asFanout(InMemoryNoteBucket bucket) { if (bucket == null) return EMPTY_FANOUT; if (bucket instanceof FanoutBucket) return (FanoutBucket) bucket; FanoutBucket fanoutBucket = ((LeafBucket) bucket).split(); return fanoutBucket; }
Source:
void assertCorrectCount(RankedBitVector bv, long position) { { long expectedCount = countBits(bv, false, position); long computedCount = countBits(bv, false, position); Assert.assertEquals(expectedCount, computedCount); } { long expectedCount = countBits(bv, true, position); long computedCount = countBits(bv, true, position); Assert.assertEquals(expectedCount, computedCount); } }

Target:
void assertCorrectCount(RankedBitVector bv, long position) { long expectedCountBitsFalse = countBits(bv, false, position); long computedCountBitsFalse = bv.countBits(false, position); Assert.assertEquals(expectedCountBitsFalse, computedCountBitsFalse); long expectedCountBitsTrue = countBits(bv, true, position); long computedCountBitsTrue = bv.countBits(true, position); Assert.assertEquals(expectedCountBitsTrue, computedCountBitsTrue); }
Source:
public CacheConfiguration(int size, int ttl) { this.size = Math.max(10, Math.min(size, 1000)); this.ttl = Math.max(30, Math.min(ttl, 3600)); }

Target:
public CacheConfiguration(int size, int ttl) { this.size = Math.max(0, Math.min(size, 1000)); this.ttl = Math.max(0, Math.min(ttl, 3600)); this.userCache = CacheBuilder.newBuilder() .maximumSize(getSize()) .expireAfterWrite(getTtl(), TimeUnit.SECONDS) .build(); this.groupCache = CacheBuilder.newBuilder() .maximumSize(getSize()) .expireAfterWrite(getTtl(), TimeUnit.SECONDS) .build(); }
Source:
public void updateBuildingInfo() { IStatementParameter[] params = new IStatementParameter[pattern.maxParams]; for (int i = 0; i < params.length; i++) { params[i] = pattern.get(i); } FilledTemplate patternTemplate = pattern.get().createTemplate(this, params); if (patternTemplate == null) { buildingInfo = null; } else { Template blueprintTemplate = new Template(); blueprintTemplate.size = patternTemplate.size; blueprintTemplate.offset = BlockPos.ORIGIN; int sx = patternTemplate.sizeX; int sy = patternTemplate.sizeY; int sz = patternTemplate.sizeZ; blueprintTemplate.data = new BitSet(); for (int x = 0; x < sx; x++) { for (int y = 0; y < sy; y++) { for (int z = 0; z < sz; z++) { blueprintTemplate.data.set(blueprintTemplate.posToIndex(x, y, z), patternTemplate.get(x, y, z) ^ inverted); } } } buildingInfo = blueprintTemplate.new BuildingInfo(patternTemplate.min, Rotation.NONE); } }

Target:
public void updateBuildingInfo() { IStatementParameter[] params = new IStatementParameter[pattern.maxParams]; for (int i = 0; i < params.length; i++) { params[i] = pattern.get(i); } FilledTemplate patternTemplate = pattern.get().createTemplate(this, params); if (patternTemplate == null) { buildingInfo = null; } else { Template blueprintTemplate = new Template(); blueprintTemplate.size = patternTemplate.size; blueprintTemplate.offset = BlockPos.ORIGIN; blueprintTemplate.data = patternTemplate; if (inverted) { blueprintTemplate.data.invert(); } buildingInfo = blueprintTemplate.new BuildingInfo(patternTemplate.min, Rotation.NONE); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); ChatDisplayer chatDisplayer = (ChatDisplayer) findViewById(R.id.chatView); presenter = new ChatPresenter( Dependencies.INSTANCE.getLoginService(), Dependencies.INSTANCE.getChatService(), chatDisplayer, getIntent().getStringExtra(NAME_EXTRA), (Channel.Access) getIntent().getSerializableExtra(ACCESS_EXTRA), Dependencies.INSTANCE.getFirebaseAnalytics(), new AndroidNavigator(this) ); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); ChatDisplayer chatDisplayer = (ChatDisplayer) findViewById(R.id.chatView); Channel channel = new Channel(getIntent().getStringExtra(NAME_EXTRA), Channel.Access.valueOf(getIntent().getStringExtra(ACCESS_EXTRA))); presenter = new ChatPresenter( Dependencies.INSTANCE.getLoginService(), Dependencies.INSTANCE.getChatService(), chatDisplayer, channel, Dependencies.INSTANCE.getFirebaseAnalytics(), new AndroidNavigator(this) ); }
Source:
public void success(Result<String> emailResult) { mCallbackObject.get().onSuccess(createIdpResponse(emailResult.data)); }

Target:
public void success(Result<String> emailResult) { onSuccess(createIdpResponse(emailResult.data)); }
Source:
public void testMergeDisabled() throws Exception { ElasticsearchBeyonder.start(client, "elasticsearch"); String expectedMapping = getMapping("twitter"); ElasticsearchBeyonder.start(client, "models/mergedisabled", false, false); String actualMapping = getMapping("twitter"); assertThat(actualMapping, is(expectedMapping)); }

Target:
public void testMergeDisabled() throws Exception { ElasticsearchBeyonder.start(client); String expectedMapping = getMapping("twitter"); ElasticsearchBeyonder.start(client, "models/mergedisabled", false, false); String actualMapping = getMapping("twitter"); assertThat(actualMapping, is(expectedMapping)); }
Source:
public static void setUp() { Map<String, String> config = Maps.newHashMap(); config.put("schema.registry.url", "http://localhost"); KafkaAvroSerializer avroSerializer = new KafkaAvroSerializer(new MockSchemaRegistryClient()); avroSerializer.configure(config, false); simpleRecord1AsBytes = avroSerializer.serialize("temp", simpleRecord1); }

Target:
public static void setUp() { Map<String, String> config = Maps.newHashMap(); config.put(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, "http://localhost:8081"); KafkaAvroSerializer avroSerializer = new KafkaAvroSerializer(new MockSchemaRegistryClient()); avroSerializer.configure(config, false); simpleRecordConfluentBytes = avroSerializer.serialize("temp", simpleRecord); }
Source:
public WebSocketClientHandshaker13(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); this.allowExtensions = allowExtensions; this.performMasking = performMasking; this.allowMaskMismatch = allowMaskMismatch; }

Target:
WebSocketClientHandshaker13(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); this.allowExtensions = allowExtensions; this.performMasking = performMasking; this.allowMaskMismatch = allowMaskMismatch; }
Source:
public List<Task> getActiveTasks() { giant.lock(); try { final ImmutableList.Builder<Task> listBuilder = ImmutableList.builder(); for (final TaskStuff taskStuff : tasks.values()) { if (taskStuff.getStatus().isRunnable() && taskStuff.getTask() != null) { listBuilder.add(taskStuff.getTask()); } } return listBuilder.build(); } finally { giant.unlock(); } }

Target:
public List<Task> getActiveTasks() { giant.lock(); try { final ImmutableList.Builder<Task> listBuilder = ImmutableList.builder(); for (final TaskStuff taskStuff : tasks.values()) { if (taskStuff.getStatus().isRunnable()) { listBuilder.add(taskStuff.getTask()); } } return listBuilder.build(); } finally { giant.unlock(); } }
Source:
public void exitClassifierSetType(ClassifierSetTypeContext ctx) { final int nbTypes = (ctx.getChildCount() + 1) / 2 - 1; final TypeLiteral[] types = new TypeLiteral[nbTypes]; for (int i = nbTypes - 1; i >= 0; --i) { types[i] = popTypeLiteral(); } final TypeSetLiteral classifierSetType = builder.typeSetLiteral(Arrays.asList(types)); startPositions.put(classifierSetType, Integer.valueOf(ctx.start.getStartIndex())); endPositions.put(classifierSetType, Integer.valueOf(ctx.stop.getStopIndex() + 1)); push(classifierSetType); }

Target:
public void exitClassifierSetType(ClassifierSetTypeContext ctx) { final int nbTypes = (ctx.getChildCount() + 1) / 2 - 1; final TypeLiteral[] types = new TypeLiteral[nbTypes]; for (int i = nbTypes - 1; i >= 0; i--) { types[i] = popTypeLiteral(); } final TypeSetLiteral classifierSetType = builder.typeSetLiteral(Arrays.asList(types)); startPositions.put(classifierSetType, Integer.valueOf(ctx.start.getStartIndex())); endPositions.put(classifierSetType, Integer.valueOf(ctx.stop.getStopIndex() + 1)); push(classifierSetType); }
Source:
private void expandFetchTags() throws TransportException { final Map<String, Ref> haveRefs = localRefs(); for (final Ref r : conn.getRefs()) { if (!isTag(r)) { continue; } final Ref local = haveRefs.get(r.getName()); ObjectId localId = local != null ? local.getObjectId() : null; if (localId == null || !localId.equals(r.getObjectId())) { wantTag(r); } } }

Target:
private void expandFetchTags() throws TransportException { final Map<String, Ref> haveRefs = localRefs(); for (final Ref r : conn.getRefs()) { if (!isTag(r)) { continue; } ObjectId id = r.getObjectId(); if (id == null) { continue; } final Ref local = haveRefs.get(r.getName()); if (local == null || !id.equals(local.getObjectId())) { wantTag(r); } } }
Source:
public void convertAll() { File[] inputFiles = inputDir.listFiles(); if (inputFiles == null) { inputFiles = new File[] {}; } Arrays.sort(inputFiles, new ProblemFileComparator()); for (File inputFile : inputFiles) { if (acceptInputFile(inputFile)) { convert(inputFile); } } }

Target:
public void convertAll() { File[] inputFiles = inputDir.listFiles(); if (inputFiles == null) { throw new IllegalStateException("Unable to list files in a directory (" + inputDir.getAbsolutePath() + ")."); } Arrays.sort(inputFiles, new ProblemFileComparator()); for (File inputFile : inputFiles) { if (acceptInputFile(inputFile)) { convert(inputFile); } } }
Source:
private List<Assignment> queryForAssignments(Assignment assignment) { String query = ""; if (assignment.getUserName() != null && !assignment.getUserName().equals("")) { query += "userName:\"" + assignment.getUserName() + "\""; } if (assignment.getProjectName() != null && !assignment.getProjectName().equals("")) { query += "projectName:\"" + assignment.getProjectName() + "\""; } preparePersistenceAccess(); List<Assignment> result = queryService.queryByString(Assignment.class, query); revokePersistenceAccess(); return result; }

Target:
private List<Assignment> queryForAssignments(Assignment assignment) { QueryRequest request = QueryRequest.create(); if (assignment.getUserName() != null && !assignment.getUserName().equals("")) { request.addParameter("userName", assignment.getUserName()); } if (assignment.getProjectName() != null && !assignment.getProjectName().equals("")) { request.addParameter("projectName", assignment.getProjectName()); } preparePersistenceAccess(); List<Assignment> result = queryService.query(Assignment.class, request); revokePersistenceAccess(); return result; }
Source:
public CatalogProtos.HistogramProto getProto() { CatalogProtos.HistogramProto.Builder builder = CatalogProtos.HistogramProto.newBuilder(); if (this.lastAnalyzed != null) { builder.setLastAnalyzed(this.lastAnalyzed); } if (this.buckets != null) { for (HistogramBucket bucket : buckets) { builder.addBuckets(bucket.getProto()); } } return builder.build(); }

Target:
public CatalogProtos.HistogramProto getProto() { CatalogProtos.HistogramProto.Builder builder = CatalogProtos.HistogramProto.newBuilder(); if (this.lastAnalyzed != null) { builder.setLastAnalyzed(this.lastAnalyzed); } if (this.dataType != null) { builder.setDataType(this.dataType); } if (this.buckets != null) { for (HistogramBucket bucket : buckets) { builder.addBuckets(bucket.getProto()); } } return builder.build(); }
Source:
public void testCallWebServiceFromProcess() throws Exception { Map<String, Object> params = new HashMap<>(); params.put("serviceUrl", TestConfig.getBaseHttpURL() + "/kie-server-test-web-service/AcmeDemoInterface?wsdl"); Long pid = processClient.startProcess(WS_CONTAINER_ID, PROCESS_ID_WS, params); assertThat(pid).isNotNull(); ProcessInstance pi = queryClient.findProcessInstanceById(pid); assertThat(pi.getState()).isEqualTo(STATE_COMPLETED); }

Target:
public void testCallWebServiceFromProcess() throws Exception { Map<String, Object> params = new HashMap<>(); params.put("serviceUrl", TestConfig.getWebServiceHttpURL()); Long pid = processClient.startProcess(WS_CONTAINER_ID, PROCESS_ID_WS, params); assertThat(pid).isNotNull(); ProcessInstance pi = queryClient.findProcessInstanceById(pid); assertThat(pi.getState()).isEqualTo(STATE_COMPLETED); }
Source:
public void createContest(CodingcontestDto dto){ Challenge challenge = new Challenge(); challenge.setName(dto.getName()); challenge.setCanonicalName("ccc-" + dto.getLocation() + "-" + dto.getGameName()); challenge.setChallengeTemplate(null); challenge.setStartDate(ZonedDateTime.ofInstant(dto.getStartTime().toInstant(), ZoneId.systemDefault())); challenge = challengeRepository.save(challenge); for(ParticipationDto participation: dto.getParticipations()){ User user = mapParticipationDto(participation); user.addInvitedChallenge(challenge); userRepository.save(user); } }

Target:
public void createContest(CodingcontestDto dto) { UUID id = UUID.fromString(dto.getUuid()); Challenge challenge = challengeRepository.findOne(id); if (challenge == null) { challenge.setId(id); challenge.setName(dto.getName()); challenge.setCanonicalName("ccc-" + dto.getLocation() + "-" + dto.getGameName()); challenge.setChallengeTemplate(challengeTemplateRepository.findOneByNick(dto.getGameName())); challenge.setStartDate(ZonedDateTime.ofInstant(dto.getStartTime().toInstant(), ZoneId.systemDefault())); challenge = challengeRepository.save(challenge); } for (ParticipationDto participation : dto.getParticipations()) { User user = mapParticipationDto(participation); user.addInvitedChallenge(challenge); userRepository.save(user); } }
Source:
public String toString() { return String.format("%s%s%s%s%s", checkpointId, SEPARATOR, changelogOffset); }

Target:
public String toString() { return String.format("%s%s%s", checkpointId, SEPARATOR, changelogOffset); }
Source:
public Config newConfig() { return newConfig(String.valueOf(System.currentTimeMillis())); }

Target:
public Config newConfig() { String id = this.getProviderId() + "." + System.currentTimeMillis(); return new Config(id, null, null, null); }
Source:
private static <T> T getField(Object object, String fieldName, Class<T> fieldType, T defaultValue) { try { Field field = object.getClass().getDeclaredField(fieldName); field.setAccessible(true); return fieldType.cast(field.get(object)); } catch (NoSuchFieldException e) { } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } return defaultValue; }

Target:
private static <T> T getField(Object object, String fieldName, Class<T> fieldType, T defaultValue) { Field field; try { field = object.getClass().getDeclaredField(fieldName); field.setAccessible(true); return fieldType.cast(field.get(object)); } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { } return defaultValue; }
Source:
public boolean isValid(CruiseConfig preprocessedConfig) { preprocessedRole = preprocessedConfig.server().security().getRoles().findByNameAndType(role.getName(), role.getClass()); preprocessedRole.validateTree(RolesConfigUpdateValidator.validationContextWithSecurityConfig(preprocessedConfig)); List<ConfigErrors> allErrors = ErrorCollector.getAllErrors(preprocessedRole); BasicCruiseConfig.copyErrors(preprocessedRole, role); return allErrors.isEmpty(); }

Target:
public boolean isValid(CruiseConfig preprocessedConfig) { preprocessedRole = preprocessedConfig.server().security().getRoles().findByNameAndType(role.getName(), role.getClass()); preprocessedRole.validateTree(RolesConfigUpdateValidator.validationContextWithSecurityConfig(preprocessedConfig)); List<ConfigErrors> allErrors = ErrorCollector.getAllErrors(preprocessedRole); boolean isEmpty = allErrors.isEmpty(); if (!isEmpty) { BasicCruiseConfig.copyErrors(preprocessedRole, role); } return isEmpty; }
Source:
public void updateModel(@NonNull Model model) { this.shouldUpdate.set(true); modelLock.writeLock().lock(); if (replicatedModel instanceof MultiLayerNetwork) { replicatedModel.setParams(model.params().unsafeDuplication(true)); Updater updater = ((MultiLayerNetwork) model).getUpdater(); INDArray view = updater.getStateViewArray(); if (view != null) { updater = ((MultiLayerNetwork) replicatedModel).getUpdater(); INDArray viewD = view.dup(); Nd4j.getExecutioner().commit(); updater.setStateViewArray((MultiLayerNetwork) replicatedModel, viewD, false); } } else if (replicatedModel instanceof ComputationGraph) { replicatedModel.setParams(model.params().unsafeDuplication(true)); ComputationGraphUpdater updater = ((ComputationGraph) model).getUpdater(); INDArray view = updater.getStateViewArray(); if (view != null) { INDArray viewD = view.dup(); Nd4j.getExecutioner().commit(); updater = ((ComputationGraph) replicatedModel).getUpdater(); updater.setStateViewArray(viewD); } } Nd4j.getExecutioner().commit(); modelLock.writeLock().unlock(); }

Target:
public void updateModel(@NonNull Model model) { this.shouldUpdate.set(true); try { modelLock.writeLock().lock(); if (replicatedModel instanceof MultiLayerNetwork) { replicatedModel.setParams(model.params().unsafeDuplication(true)); Updater updater = ((MultiLayerNetwork) model).getUpdater(); INDArray view = updater.getStateViewArray(); if (view != null) { updater = ((MultiLayerNetwork) replicatedModel).getUpdater(); INDArray viewD = view.dup(); Nd4j.getExecutioner().commit(); updater.setStateViewArray((MultiLayerNetwork) replicatedModel, viewD, false); } } else if (replicatedModel instanceof ComputationGraph) { replicatedModel.setParams(model.params().unsafeDuplication(true)); ComputationGraphUpdater updater = ((ComputationGraph) model).getUpdater(); INDArray view = updater.getStateViewArray(); if (view != null) { INDArray viewD = view.dup(); Nd4j.getExecutioner().commit(); updater = ((ComputationGraph) replicatedModel).getUpdater(); updater.setStateViewArray(viewD); } } Nd4j.getExecutioner().commit(); } finally { modelLock.writeLock().unlock(); } }
Source:
public boolean updateDatamodel(Item item) { boolean modified = false; if (item != null && item instanceof WSDataModelItem && accept(item)) { WSDataModelItem modelItem = (WSDataModelItem) item; EList<ReferenceFileItem> resources = modelItem.getReferenceResources(); for (ReferenceFileItem fileItem : resources) { if (fileItem.getExtension().equals("xsd")) { ByteArray content = fileItem.getContent(); String xsdSchema = doUpdate(content.getInnerContent()); if (xsdSchema != null) { try { byte[] byteContent = xsdSchema.getBytes("utf-8"); content.setInnerContent(byteContent); modelItem.getWsDataModel().setXsdSchema(new String(byteContent, "utf-8")); } catch (UnsupportedEncodingException e) { LOG.error("Failed to Encodes/Decodes string by 'utf-8' encoding.", e); } modified = true; } break; } } if (modified) { RepositoryResourceUtil.saveItem(item); } } return modified; }

Target:
public boolean updateDatamodel(Item item) { boolean modified = false; if (item != null && item instanceof WSDataModelItem && accept(item)) { WSDataModelItem modelItem = (WSDataModelItem) item; EList<ReferenceFileItem> resources = modelItem.getReferenceResources(); for (ReferenceFileItem fileItem : resources) { if (fileItem.getExtension().equals("xsd")) { ByteArray content = fileItem.getContent(); String xsdSchema = doUpdate(content.getInnerContent()); if (xsdSchema != null) { try { byte[] byteContent = xsdSchema.getBytes("utf-8"); content.setInnerContent(byteContent); modelItem.getWsDataModel().setXsdSchema(new String(byteContent, "utf-8")); } catch (UnsupportedEncodingException e) { LOG.error("Failed to encode/decode string by 'utf-8' encoding.", e); } modified = true; } break; } } if (modified) { RepositoryResourceUtil.saveItem(item); } } return modified; }
Source:
private static boolean isAccessor(MethodDeclarationTree tree) { return ((BlockTree) tree.body()).statements().size() == 1 && (tree.name().text().startsWith("set") || tree.name().text().startsWith("get") || tree.name().text().startsWith("is")); }

Target:
private static boolean isAccessor(MethodDeclarationTree tree) { String methodName = tree.name().text(); return ((BlockTree) tree.body()).statements().size() == 1 && (methodName.startsWith("set") || methodName.startsWith("get") || methodName.startsWith("is")); }
Source:
public void testExtendedModuleCreated() throws TmfAnalysisException { XmlAnalysisModuleSource source = new XmlAnalysisModuleSource(); Iterable<IAnalysisModuleHelper> modules = source.getAnalysisModules(); File testXmlFile = TmfXmlTestFiles.VALID_FILE_EXTENDED.getFile(); if ((testXmlFile == null) || !testXmlFile.exists()) { fail("XML test file does not exist"); } XmlUtils.addXmlFile(testXmlFile); XmlAnalysisModuleSource.notifyModuleChange(); modules = source.getAnalysisModules(); ITmfTrace trace = XmlUtilsTest.initializeTrace(TEST_TRACE); try { IAnalysisModuleHelper helper = findModule(modules, MY_MODULE); assertNotNull(helper); IAnalysisModule newModule = helper.newModule(trace); try { assertTrue(newModule instanceof ExternalAnalysisModuleStub); assertEquals(MY_MODULE, newModule.getId()); } finally { if (newModule != null) { newModule.dispose(); } } helper = findModule(modules, ABC_MODULE); assertNotNull(helper); newModule = helper.newModule(trace); try { assertTrue(newModule instanceof ExternalAnalysisModuleStub); assertEquals(ABC_MODULE, newModule.getId()); } finally { if (newModule != null) { newModule.dispose(); } } } finally { trace.dispose(); } }

Target:
public void testExtendedModuleCreated() throws TmfAnalysisException { XmlAnalysisModuleSource source = new XmlAnalysisModuleSource(); File testXmlFile = TmfXmlTestFiles.VALID_FILE_EXTENDED.getFile(); if ((testXmlFile == null) || !testXmlFile.exists()) { fail("XML test file does not exist"); } XmlUtils.addXmlFile(testXmlFile); XmlAnalysisModuleSource.notifyModuleChange(); Iterable<IAnalysisModuleHelper> modules = source.getAnalysisModules(); ITmfTrace trace = XmlUtilsTest.initializeTrace(TEST_TRACE); try { IAnalysisModuleHelper helper = findModule(modules, MY_MODULE); assertNotNull(helper); IAnalysisModule newModule = helper.newModule(trace); try { assertTrue("Extended module class", newModule instanceof ExternalAnalysisModuleStub); assertEquals("Extended module ID", MY_MODULE, newModule.getId()); } finally { if (newModule != null) { newModule.dispose(); } } helper = findModule(modules, ABC_MODULE); assertNotNull(helper); newModule = helper.newModule(trace); try { assertTrue("Extended module class", newModule instanceof ExternalAnalysisModuleStub); assertEquals("Extended module ID", ABC_MODULE, newModule.getId()); } finally { if (newModule != null) { newModule.dispose(); } } } finally { trace.dispose(); } }
Source:
public static boolean isStringAssignable(TypeKind kind, boolean isPrimitive, String in) { NumberFormatValidator validator = VALIDATORS.get( kind ); return validator != null ? validator.validate( isPrimitive, in ) : false; }

Target:
public static boolean isStringAssignable(TypeKind kind, boolean isPrimitive, String in) { NumberFormatValidator validator = VALIDATORS.get( kind ); return validator != null && validator.validate( isPrimitive, in ); }
Source:
protected IMemoryBlockRetrieval createMemoryBlockRetrieval(String model, ILaunchConfiguration config, DsfSession session) { DsfMemoryBlockRetrieval memRetrieval = null; try { memRetrieval = new DsfMemoryBlockRetrieval(model, config, session); } catch (DebugException e) { DsfPlugin.getDefault().getLog().log(e.getStatus()); } return memRetrieval; }

Target:
protected IMemoryBlockRetrieval createMemoryBlockRetrieval(String model, ILaunchConfiguration config, DsfSession session) throws DebugException { return new DsfMemoryBlockRetrieval(model, config, session); }
Source:
public void unparse( SqlWriter writer, int leftPrec, int rightPrec) { switch (typeName) { case BOOLEAN: writer.keyword( value == null ? "UNKNOWN" : (Boolean) value ? "TRUE" : "FALSE"); break; case NULL: writer.keyword("NULL"); break; case CHAR: case DECIMAL: case DOUBLE: case BINARY: throw Util.unexpected(typeName); case SYMBOL: if (value instanceof Enum) { Enum enumVal = (Enum) value; writer.keyword(enumVal.toString()); } else { writer.keyword(String.valueOf(value)); } break; default: writer.literal(String.valueOf(value)); } }

Target:
public void unparse( SqlWriter writer, int leftPrec, int rightPrec) { switch (typeName) { case BOOLEAN: writer.keyword( value == null ? "UNKNOWN" : (Boolean) value ? "TRUE" : "FALSE"); break; case NULL: writer.keyword("NULL"); break; case CHAR: case DECIMAL: case DOUBLE: case BINARY: throw Util.unexpected(typeName); case SYMBOL: if (value instanceof Enum) { Enum enumVal = (Enum) value; writer.keyword(enumVal.toString()); } else { writer.keyword(String.valueOf(value)); } break; default: writer.literal(value.toString()); } }
Source:
public void verifyVisibilityUI (PerformTouchAction touchAction) { String LightboxHeaderDisplayValue = lightboxHeader.getCssValue("display"); String LightboxFooterDisplayValue = lightboxFooter.getCssValue("display"); int duration = 500; int waitAfter = 5000; boolean lastDisplayVisibility = true; if (LightboxHeaderDisplayValue.contains(LightboxFooterDisplayValue)) { if (LightboxHeaderDisplayValue == "none") { PageObjectLogging.log("verifyVisibilityUI", "Lightbox header and footer are not visible", true); lastDisplayVisibility = false; } else { PageObjectLogging.log("verifyVisibilityUI", "Lightbox header and footer are visible", true); lastDisplayVisibility = true; } } else { PageObjectLogging.log("verifyVisibilityUI", "Visibility of lightbox header is different than lightbox footer", false); } touchAction.tapOnPointXY(50, 50, duration, waitAfter); lastDisplayVisibility = verifyChangesInUI(lastDisplayVisibility); touchAction.tapOnPointXY(50, 50, duration, waitAfter); lastDisplayVisibility = verifyChangesInUI(lastDisplayVisibility); }

Target:
public void verifyVisibilityUI (PerformTouchAction touchAction) { String LightboxHeaderDisplayValue = lightboxHeader.getCssValue("display"); String LightboxFooterDisplayValue = lightboxFooter.getCssValue("display"); int duration = 500; int waitAfter = 5000; boolean lastDisplayVisibility = true; if (LightboxHeaderDisplayValue.contains(LightboxFooterDisplayValue)) { if ("none".equals(LightboxHeaderDisplayValue)) { PageObjectLogging.log("verifyVisibilityUI", "Lightbox header and footer are not visible", true); lastDisplayVisibility = false; } else { PageObjectLogging.log("verifyVisibilityUI", "Lightbox header and footer are visible", true); lastDisplayVisibility = true; } } else { PageObjectLogging.log("verifyVisibilityUI", "Visibility of lightbox header is different than lightbox footer", false); } touchAction.tapOnPointXY(50, 50, duration, waitAfter); lastDisplayVisibility = verifyChangesInUI(lastDisplayVisibility); touchAction.tapOnPointXY(50, 50, duration, waitAfter); lastDisplayVisibility = verifyChangesInUI(lastDisplayVisibility); }
Source:
public void onExecute(CommandSender sender, String[] args) { if (!(sender instanceof Player) || !(sender.hasPermission("slimefun.command.backpack"))) { SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true); return; } if (args.length != 3) { SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack <Player> <Number>")); return; } Player p = (Player) sender; String ownerName = args[1]; int id = Integer.parseInt(args[2]); OfflinePlayer owner = Bukkit.getPlayer(ownerName); if (owner == null) { owner = Bukkit.getOfflinePlayer(ownerName); if (!owner.hasPlayedBefore()) { SlimefunPlugin.getLocal().sendMessage(sender, "guide.backpack.player-never-joined"); return; } } PlayerProfile.get(owner, profile -> { if (!profile.getBackpack(id).isPresent()) { SlimefunPlugin.getLocal().sendMessage(sender, "guide.backpack.backpack-does-not-exist"); return; } PlayerBackpack bp = profile.getBackpack(id).get(); ItemStack item = SlimefunItems.BACKPACK_MEDIUM; ItemMeta meta = item.getItemMeta(); List lore = meta.getLore(); lore.set(2, ChatColor.GRAY + "ID: " + profile.getUUID().toString() + "#" + id); meta.setLore(lore); item.setItemMeta(meta); Slimefun.runSync(() -> p.getInventory().addItem(item)); }); }

Target:
public void onExecute(CommandSender sender, String[] args) { if (!(sender instanceof Player) || !sender.hasPermission("slimefun.command.backpack")) { SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true); return; } if (args.length != 3) { SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack <Player> <ID>")); return; } final Player p = (Player) sender; if (!PatternUtils.NUMERIC.matcher(args[2]).matches()) { SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.invalid-id"); return; } final int id = Integer.parseInt(args[2]); final OfflinePlayer owner = Bukkit.getOfflinePlayer(args[1]); if (!owner.hasPlayedBefore()) { SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.player-never-joined"); return; } PlayerProfile.get(owner, profile -> { if (!profile.getBackpack(id).isPresent()) { SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.backpack-does-not-exist"); return; } Slimefun.runSync(() -> { ItemStack item = SlimefunItems.RESTORED_BACKPACK.clone(); SlimefunPlugin.getBackpackListener().setBackpackId(p, item, 2, id); p.getInventory().addItem(item); SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.restored-backpack-given"); }); }); }
Source:
public static int[] cellsToColumns(List<Cell> cells, int cellsPerColumn) { return cells.stream().mapToInt(c -> c.getColumn().getIndex()).distinct().toArray(); }

Target:
public static int[] cellsToColumns(List<Cell> cells, int cellsPerColumn) { return SDR.asColumnList(cells); }
Source:
public void addMatch(VolcanoRuleMatch match) { final String matchName = match.toString(); if (!matchList.names.add(matchName)) { return; } LOGGER.trace("{} Rule-match queued: {}", matchList.toString(), matchName); matchList.offer(match); matchList.matchMap.put(planner.getSubset(match.rels[0]), match); }

Target:
public void addMatch(VolcanoRuleMatch match) { final String matchName = match.toString(); if (!matchList.names.add(matchName)) { return; } LOGGER.trace("Rule-match queued: {}", matchName); matchList.offer(match); matchList.matchMap.put(planner.getSubset(match.rels[0]), match); }
Source:
public static void checkArgument(boolean expression, @Nullable Object message) { try { Preconditions.checkArgument(expression, message); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage(), e); } }

Target:
public static void checkArgument(boolean expression, @Nullable Object message) { if (!expression) { throw new BadRequestException(String.valueOf(message)); } }
Source:
public void initialize(Config aConfig, Config aRuntime) { LOG.log(Level.INFO, aRuntime.toString()); this.config = aConfig; this.runtime = aRuntime; this.controller = getController(); this.updateTopologyManager = new UpdateTopologyManager(config, runtime, Optional.<IScalable>of(this)); }

Target:
public void initialize(Config aConfig, Config aRuntime) { this.config = aConfig; this.runtime = aRuntime; this.controller = getController(); this.updateTopologyManager = new UpdateTopologyManager(config, runtime, Optional.<IScalable>of(this)); }
Source:
public void blueprintEvent(BlueprintEvent event) { if (LOG.isDebugEnabled()) { String eventTypeString; switch (event.getType()) { case BlueprintEvent.CREATING: eventTypeString = "CREATING"; break; case BlueprintEvent.CREATED: eventTypeString = "CREATED"; break; case BlueprintEvent.DESTROYING: eventTypeString = "DESTROYING"; break; case BlueprintEvent.DESTROYED: eventTypeString = "DESTROYED"; break; case BlueprintEvent.GRACE_PERIOD: eventTypeString = "GRACE_PERIOD"; break; case BlueprintEvent.WAITING: eventTypeString = "WAITING"; break; case BlueprintEvent.FAILURE: eventTypeString = "FAILURE"; break; default: eventTypeString = "UNKNOWN"; } LOG.debug(String.format("blueprintEvent{ replay=%b type=%s bundle=%s } : ", event.isReplay(), eventTypeString, event.getBundle().getSymbolicName())); } if (!event.isReplay() && this.getBundleContext().getBundle().getBundleId() == event.getBundle().getBundleId()) { if (event.getType() == BlueprintEvent.CREATED) { try { this.start(); } catch (Exception startEx) { LOG.error("Error occurred starting Camel: " + this, startEx); } } else if (event.getType() == BlueprintEvent.DESTROYING) { try { this.stop(); } catch (Exception stopEx) { LOG.warn("Error occurred stopping Camel: " + this, stopEx); } } } }

Target:
public void blueprintEvent(BlueprintEvent event) { if (LOG.isDebugEnabled()) { String eventTypeString; switch (event.getType()) { case BlueprintEvent.CREATING: eventTypeString = "CREATING"; break; case BlueprintEvent.CREATED: eventTypeString = "CREATED"; break; case BlueprintEvent.DESTROYING: eventTypeString = "DESTROYING"; break; case BlueprintEvent.DESTROYED: eventTypeString = "DESTROYED"; break; case BlueprintEvent.GRACE_PERIOD: eventTypeString = "GRACE_PERIOD"; break; case BlueprintEvent.WAITING: eventTypeString = "WAITING"; break; case BlueprintEvent.FAILURE: eventTypeString = "FAILURE"; break; default: eventTypeString = "UNKNOWN"; } LOG.debug(String.format("blueprintEvent{ replay=%b type=%s bundle=%s } : ", event.isReplay(), eventTypeString, event.getBundle().getSymbolicName())); } if (!event.isReplay() && this.getBundleContext().getBundle().getBundleId() == event.getBundle().getBundleId()) { if (event.getType() == BlueprintEvent.CREATED) { try { this.maybeStart(); } catch (Exception startEx) { LOG.error("Error occurred starting Camel: " + this, startEx); } } else if (event.getType() == BlueprintEvent.DESTROYING) { try { this.stop(); } catch (Exception stopEx) { LOG.warn("Error occurred stopping Camel: " + this, stopEx); } } } }
Source:
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(intent); handleSignInResult(result, false); }

Target:
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { if (requestCode == RNGoogleSigninModule.RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(intent); handleSignInResult(result, false); } }
Source:
private Iterable<org.atlasapi.media.entity.Image> transformImages(Set<Image> images) { Set<org.atlasapi.media.entity.Image> resultImages = new HashSet<>(); if (images == null) { return resultImages; } for (Image image : images) { org.atlasapi.media.entity.Image transformedImage = new org.atlasapi.media.entity.Image( image.getUri() ); transformedImage.setHeight(image.getHeight()); transformedImage.setWidth(image.getWidth()); if (image.getType() != null) { transformedImage.setType(ImageType.valueOf(image.getImageType().toUpperCase())); } resultImages.add( transformedImage ); } return resultImages; }

Target:
private Iterable<org.atlasapi.media.entity.Image> transformImages(Set<Image> images) { if (images == null) { return ImmutableList.of(); } return Collections2.transform(images, new Function<Image, org.atlasapi.media.entity.Image>() { @Override public org.atlasapi.media.entity.Image apply(Image input) { org.atlasapi.media.entity.Image transformedImage = new org.atlasapi.media.entity.Image( input.getUri() ); transformedImage.setHeight(input.getHeight()); transformedImage.setWidth(input.getWidth()); if (input.getType() != null) { transformedImage.setType(ImageType.valueOf(input.getImageType().toUpperCase())); } return transformedImage; } }); }
Source:
public void testTopMenuForAnonymousUserShouldNotBeEmpty() { Collection<MenuEntry> menuEntries = gerritTopMenusWithModule(anonymousUserModule).getTopMenuBar(null); assertTrue(!menuEntries.isEmpty()); }

Target:
public void testTopMenuForAnonymousUserShouldNotBeEmpty() { Collection<MenuEntry> menuEntries = gerritTopMenusWithModule(anonymousUserModule).getTopMenuBar(null); assertThat(menuEntries).isNotEmpty(); }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_kill_the_virus_tutorials); ButterKnife.bind(this); imgVirus3 = findViewById(R.id.img_virus_3); initializeViews(); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_kill_the_virus_tutorial); ButterKnife.bind(this); initializeViews(); }
Source:
private Call createRawCall() { OkHttpClient client = api.client(); if (readTimeout != -1 && connectTimeout != -1) { client = client.newBuilder() .connectTimeout(connectTimeout, TimeUnit.SECONDS) .readTimeout(readTimeout, TimeUnit.SECONDS) .build(); } return client.newCall(builder.request()); }

Target:
private Call createRawCall() { OkHttpClient client = api.client(); if (readTimeout > 0 && connectTimeout > 0) { client = client.newBuilder() .connectTimeout(connectTimeout, TimeUnit.SECONDS) .readTimeout(readTimeout, TimeUnit.SECONDS) .build(); } return client.newCall(builder.request()); }
Source:
public static String byteArrayToString(byte[] value) { return new String(value); }

Target:
public static String byteArrayToString(byte[] value) { if (value == null) throw new NullPointerException("Byte array cannot be null."); return new String(value); }
Source:
public <T> T fromJson(String json, TypeToken<T> typeOfT) throws JsonSyntaxException { return fromJson(json, typeOfT.getType()); }

Target:
public <T> T fromJson(String json, TypeToken<T> typeOfT) throws JsonSyntaxException { if (json == null) { return null; } StringReader reader = new StringReader(json); T target = fromJson(reader, typeOfT); return target; }
Source:
public void testQueryElementNoFollowing() throws Exception { final String xpath = " final RootNode rootNode = getRootNode("InputXpathMapperAst.java"); final DetailAST[] actual = convertToArray(getXpathItems(xpath, rootNode)); assertEquals("Invalid number of nodes", 0, actual.length); }

Target:
public void testQueryElementNoFollowing() throws Exception { final String xpath = " final RootNode rootNode = getRootNode("InputXpathMapperAst.java"); final DetailAST[] actual = convertToArray(getXpathItems(xpath, rootNode)); assertThat("Invalid number of nodes", actual.length, equalTo(0)); }
Source:
public void dispose() { app.getChildren().remove(windowModel); coolBarManager.dispose(); menuManager.dispose(); statusLineManager.dispose(); windowModel.getContext().deactivate(); windowModel.getContext().dispose(); ((Shell) windowModel.getWidget()).dispose(); }

Target:
public void dispose() { coolBarManager.dispose(); menuManager.dispose(); statusLineManager.dispose(); windowModel.getContext().deactivate(); windowModel.getContext().dispose(); ((Shell) windowModel.getWidget()).dispose(); app.getChildren().remove(windowModel); }
Source:
public AMQPClientConnectionFactory(ActiveMQServer server, String containerId, Map<Symbol, Object> connectionProperties, int ttl) { this.server = server; this.containerId = containerId; this.connectionProperties = connectionProperties; this.ttl = ttl; this.useLegacyQueueName = false; }

Target:
public AMQPClientConnectionFactory(ActiveMQServer server, String containerId, Map<Symbol, Object> connectionProperties, int ttl) { this.server = server; this.containerId = containerId; this.connectionProperties = connectionProperties; this.ttl = ttl; this.useCoreSubscriptionNaming = false; }
Source:
public void handle(MotechEvent event) { LOGGER.info("Handling the motech event with subject: {}", event.getSubject()); Map<String, Object> eventParams = event.getParameters(); eventParams.putAll(event.getMetadata()); retryNumber = 0; TasksEventParser parser = null; if (eventParams != null) { parser = taskService.findCustomParser((String) eventParams.get(TasksEventParser.CUSTOM_PARSER_EVENT_KEY)); } String triggerSubject = parser == null ? event.getSubject() : parser.parseEventSubject(event.getSubject(), eventParams); Map<String, Object> parameters = parser == null ? eventParams : parser.parseEventParameters(event.getSubject(), eventParams); List<Task> tasks = taskService.findActiveTasksForTriggerSubject(triggerSubject); for (Task task : tasks) { handleTask(task, parameters, false, retryNumber); } }

Target:
public void handle(MotechEvent event) { LOGGER.info("Handling the motech event with subject: {}", event.getSubject()); Map<String, Object> eventParams = event.getParameters(); eventParams.putAll(event.getMetadata()); TasksEventParser parser = null; if (eventParams != null) { parser = taskService.findCustomParser((String) eventParams.get(TasksEventParser.CUSTOM_PARSER_EVENT_KEY)); } String triggerSubject = parser == null ? event.getSubject() : parser.parseEventSubject(event.getSubject(), eventParams); Map<String, Object> parameters = parser == null ? eventParams : parser.parseEventParameters(event.getSubject(), eventParams); List<Task> tasks = taskService.findActiveTasksForTriggerSubject(triggerSubject); for (Task task : tasks) { checkAndHandleTask(task, parameters, false); } }
Source:
public Fails(VdcBllMessages expected, String... variableReplacements) { matcher = CoreMatchers.allOf( not(isValid()), new WithMessage(expected), hasVariableReplacements(variableReplacements)); }

Target:
public Fails(VdcBllMessages expected, String... variableReplacements) { matcher = allOf( not(isValid()), new WithMessage(expected), hasVariableReplacements(variableReplacements)); }
Source:
public void rollback() { super.rollback(); if (macAddressChanged) { MacPoolManager.getInstance().addMac(oldIface.getMacAddress()); MacPoolManager.getInstance().freeMac(getInterface().getMacAddress()); } }

Target:
public void rollback() { super.rollback(); if (macShouldBeChanged) { MacPoolManager.getInstance().addMac(oldIface.getMacAddress()); MacPoolManager.getInstance().freeMac(getMacAddress()); } }
Source:
protected ICalBuilder begin() { cal.addProperty(ICalProperties.BEGIN_ICALENDAR); cal.addProperty(new Property(ICalBean.PROP_VERSION, "2.1")); return this; }

Target:
protected ICalBuilder begin() { m_ical.addProperty(ICalProperties.PROP_BEGIN_ICALENDAR); m_ical.addProperty(ICalProperties.PROP_VERSION_2_1); return this; }
Source:
public static RequestDTO jsonNodeToRequest(JsonNode jsonNode) { ObjectMapper mapper = new ObjectMapper(); final RequestDTO requestDTO = mapper.convertValue(jsonNode, RequestDTO.class); return requestDTO; }

Target:
public static RequestDTO jsonNodeToRequest(JsonNode jsonNode) { return OBJECT_MAPPER.convertValue(jsonNode, RequestDTO.class); }
Source:
CachedFileChannel loadFileChannel(long logId) throws IOException { lock.readLock().lock(); try { CachedFileChannel cachedFileChannel = fileChannels.get(logId); if (cachedFileChannel != null) { boolean retained = cachedFileChannel.tryRetain(); assert(retained); return cachedFileChannel; } } finally { lock.readLock().unlock(); } lock.writeLock().lock(); try { File file = fileLoader.load(logId); FileChannel newFc = new RandomAccessFile(file, "r").getChannel(); CachedFileChannel cachedFileChannel = new CachedFileChannel(logId, newFc); fileChannels.put(logId, cachedFileChannel); boolean retained = cachedFileChannel.tryRetain(); assert(retained); return cachedFileChannel; } finally { lock.writeLock().unlock(); } }

Target:
CachedFileChannel loadFileChannel(long logId) throws IOException { CachedFileChannel cachedFileChannel = null; do { fileChannels.computeIfAbsent(logId, logFileId -> { CachedFileChannel cfc = null; try { File file = fileLoader.load(logFileId); FileChannel newFc = new RandomAccessFile(file, "r").getChannel(); cfc = new CachedFileChannel(logFileId, newFc); } catch (IOException ioe){ throw new UncheckedIOException(ioe); } return cfc; }); cachedFileChannel = fileChannels.get(logId); if (cachedFileChannel != null) { boolean retained = cachedFileChannel.tryRetain(); if (!retained) { cachedFileChannel = null; } } } while(cachedFileChannel == null); return cachedFileChannel; }