auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Map<String, Set<String>> getComputerTags(Computer computer) { Set<LabelAtom> labels = null; try { labels = computer.getNode().getAssignedLabels(); } catch (NullPointerException e){ logger.fine("Could not retrieve labels"); } String nodeHostname = null; try { nodeHostname = computer.getHostName(); } catch (IOException | InterruptedException e) { logger.fine("Could not retrieve hostname"); } String nodeName; if (computer instanceof Jenkins.MasterComputer) { nodeName = "master"; } else { nodeName = computer.getName(); } Map<String, Set<String>> result = new HashMap<>(); Set<String> nodeNameValues = new HashSet<>(); nodeNameValues.add(nodeName); result.put("node_name", nodeNameValues); if(nodeHostname != null){ Set<String> nodeHostnameValues = new HashSet<>(); nodeHostnameValues.add(nodeHostname); result.put("node_hostname", nodeHostnameValues); } if(labels != null){ Set<String> nodeLabelsValues = new HashSet<>(); for (LabelAtom label: labels){ nodeLabelsValues.add(label.getName()); } result.put("node_label", nodeLabelsValues); } return result; }

Target:
public static Map<String, Set<String>> getComputerTags(Computer computer) { Set<LabelAtom> labels = null; try { labels = computer.getNode().getAssignedLabels(); } catch (NullPointerException e){ logger.fine("Could not retrieve labels"); } String nodeHostname = null; try { nodeHostname = computer.getHostName(); } catch (IOException | InterruptedException e) { logger.fine("Could not retrieve hostname"); } String nodeName = getNodeName(computer); Map<String, Set<String>> result = new HashMap<>(); Set<String> nodeNameValues = new HashSet<>(); nodeNameValues.add(nodeName); result.put("node_name", nodeNameValues); if(nodeHostname != null){ Set<String> nodeHostnameValues = new HashSet<>(); nodeHostnameValues.add(nodeHostname); result.put("node_hostname", nodeHostnameValues); } if(labels != null){ Set<String> nodeLabelsValues = new HashSet<>(); for (LabelAtom label: labels){ nodeLabelsValues.add(label.getName()); } result.put("node_label", nodeLabelsValues); } return result; }
Source:
public RequestOptions toRequestOptions() { final RequestOptions requestOptions = new RequestOptions(); requestOptions.setIfMatchETag(getIfMatchETag()); requestOptions.setIfNoneMatchETag(getIfNoneMatchETag()); requestOptions.setConsistencyLevel(getConsistencyLevel()); requestOptions.setIndexingDirective(indexingDirective); requestOptions.setSessionToken(sessionToken); return requestOptions; }

Target:
RequestOptions toRequestOptions() { final RequestOptions requestOptions = new RequestOptions(); requestOptions.setConsistencyLevel(getConsistencyLevel()); requestOptions.setSessionToken(sessionToken); return requestOptions; }
Source:
public List<Annotation> process(List<String> ensemblVariants) throws Exception { List<Annotation> annotations = new ArrayList<>(); for (String ensemblVariant : ensemblVariants) { annotations.add(annotationLineMapper.mapLine(ensemblVariant, UNUSED_LINE_NUMBER)); } return annotations; }

Target:
public List<Annotation> process(List<String> ensemblVariants) throws Exception { return ensemblVariants.stream() .map(ensemblVariant -> annotationLineMapper.mapLine(ensemblVariant, UNUSED_LINE_NUMBER)) .collect(Collectors.toList()); }
Source:
public PrestoSparkRow get() throws InterruptedException { PrestoSparkRow row; synchronized (monitor) { while (!finished && buffer.isEmpty()) { monitor.wait(); } if (finished) { return null; } row = buffer.poll(); } memoryManager.updateMemoryUsage(-row.getRetainedSize()); return row; }

Target:
public PrestoSparkRow get() throws InterruptedException { PrestoSparkRow row = null; synchronized (monitor) { while (buffer.isEmpty() && !finished) { monitor.wait(); } if (!buffer.isEmpty()) { row = buffer.poll(); } } if (row != null) { memoryManager.updateMemoryUsage(-row.getRetainedSize()); } return row; }
Source:
protected GenericRecord[] getTestData() { GenericRecord[] records = { new GenericRecordBuilder(SCHEMA) .set("afield", "foo bar") .build() }; return records; }

Target:
protected GenericRecord[] getTestData() { return new GenericRecord[]{ new GenericRecordBuilder(SCHEMA) .set("afield", "foo bar") .build()}; }
Source:
public static ByteString wrap(final byte[] array, int offset, int length) { return USE_ZEROCOPYBYTESTRING? ZeroCopyByteStringUtil.wrap(array, offset, length) : ByteString.copyFrom(array, offset, length); }

Target:
public static ByteString wrap(final byte[] array, int offset, int length) { if (USE_ZEROCOPYBYTESTRING && offset == 0 && length == array.length) { return ZeroCopyByteStringUtil.wrap(array); } else { return ByteString.copyFrom(array, offset, length); } }
Source:
public FluentInitializer withHighlightedDates(Collection<Date> dates) { if (dates != null) { highlightDates(dates); } return this; }

Target:
public FluentInitializer withHighlightedDates(Collection<Date> dates) { highlightDates(dates); return this; }
Source:
public void assertJdkDynamicProxyForGetTarget() { ElasticJob target = new TargetJob(); ProxyFactory pf = new ProxyFactory(target); pf.addInterface(ElasticJob.class); ElasticJob proxy = (ElasticJob) pf.getProxy(); assertTrue(AopUtils.isJdkDynamicProxy(proxy)); assertEquals(AopTargetUtils.getTarget(proxy), target); }

Target:
public void assertJdkDynamicProxyForGetTarget() { ElasticJob target = new TargetJob(); ProxyFactory pf = new ProxyFactory(target); pf.addInterface(ElasticJob.class); ElasticJob proxy = (ElasticJob) pf.getProxy(); assertTrue(AopUtils.isJdkDynamicProxy(proxy)); assertThat(AopTargetUtils.getTarget(proxy), is(target)); }
Source:
private InstructorFeedbackResultsGroupByParticipantPanel buildGroupByParticipantPanel( String primaryParticipantIdentifier, String currentTeam, String additionalInfoId, int primaryParticipantIndex, Map.Entry<String, Map<String, List<FeedbackResponseAttributes>>> primaryToSecondaryToResponsesMap) { Map<String, List<FeedbackResponseAttributes>> giverToResponsesMap = primaryToSecondaryToResponsesMap.getValue(); List<InstructorFeedbackResultsSecondaryParticipantPanelBody> secondaryParticipantPanels = buildSecondaryParticipantPanels( additionalInfoId, primaryParticipantIndex, giverToResponsesMap); String primaryParticipantNameWithTeamNameAppended = bundle.appendTeamNameToName(bundle.getNameForEmail(primaryParticipantIdentifier), bundle.getTeamNameForEmail(primaryParticipantIdentifier)); InstructorFeedbackResultsGroupByParticipantPanel recipientPanel = buildInstructorFeedbackResultsGroupBySecondaryParticipantPanel( primaryParticipantIdentifier, primaryParticipantNameWithTeamNameAppended, secondaryParticipantPanels, null, false); return recipientPanel; }

Target:
private InstructorFeedbackResultsGroupByParticipantPanel buildGroupByParticipantPanel( String primaryParticipantIdentifier, String currentTeam, String additionalInfoId, int primaryParticipantIndex, Map.Entry<String, Map<String, List<FeedbackResponseAttributes>>> primaryToSecondaryToResponsesMap) { Map<String, List<FeedbackResponseAttributes>> giverToResponsesMap = primaryToSecondaryToResponsesMap.getValue(); List<InstructorFeedbackResultsSecondaryParticipantPanelBody> secondaryParticipantPanels = buildSecondaryParticipantPanels( additionalInfoId, primaryParticipantIndex, giverToResponsesMap); String primaryParticipantNameWithTeamNameAppended = bundle.appendTeamNameToName(bundle.getNameForEmail(primaryParticipantIdentifier), bundle.getTeamNameForEmail(primaryParticipantIdentifier)); InstructorFeedbackResultsGroupByParticipantPanel recipientPanel = buildInstructorFeedbackResultsGroupBySecondaryParticipantPanel( primaryParticipantIdentifier, primaryParticipantNameWithTeamNameAppended, secondaryParticipantPanels, null); return recipientPanel; }
Source:
public boolean close() { inMemoryChannels.clear(); if (recordManager != null) { try { logger.info("Closing Record Manager"); recordManager.close(); recordManager = null; } catch (IOException e) { } } return true; }

Target:
public boolean close() { inMemoryChannels.clear(); if (recordManager != null) { try { logger.info("Closing Record Manager"); recordManager.close(); recordManager = null; } catch (IOException e) { logger.warn("Error when closing Record Manager", e); } } return true; }
Source:
public void createsRedirectResponseWithURLAndStatus() throws IOException { final int status = HttpURLConnection.HTTP_MOVED_TEMP; final String url = "/"; MatcherAssert.assertThat( new RsPrint( new TkRedirect(url, status).act() ).print(), Matchers.equalTo( Joiner.on(NEWLINE).join( "HTTP/1.1 302 Moved Temporarily", LOCATION + url, "", "" ) ) ); }

Target:
public void createsRedirectResponseWithURLAndStatus() throws IOException { final String url = "/"; MatcherAssert.assertThat( new RsPrint( new TkRedirect(url, HttpURLConnection.HTTP_MOVED_TEMP).act() ).print(), Matchers.equalTo( Joiner.on(TkRedirectTest.NEWLINE).join( "HTTP/1.1 302 Moved Temporarily", String.format(TkRedirectTest.LOCATION, url), "", "" ) ) ); }
Source:
public BinaryContent transform(Metacard metacard, Map<String, Serializable> arguments) throws CatalogTransformerException { if (metacard == null) { throw new CatalogTransformerException("Cannot transform null metacard."); } String preview = "No preview text available."; if (metacard.getAttribute(Extracted.EXTRACTED_TEXT) != null && metacard.getAttribute(Extracted.EXTRACTED_TEXT).getValue() != null) { preview = StringEscapeUtils.escapeHtml4( metacard.getAttribute(Extracted.EXTRACTED_TEXT).getValue().toString()) .replaceAll("[\n|\r]", "<br>"); } else if (previewFromMetadata && xPathExpressions != null && StringUtils.isNotEmpty(metacard.getMetadata())) { String text = xPathExpressions .stream() .map(x -> evaluateXPath(metacard.getMetadata(), x)) .filter(Objects::nonNull) .findFirst() .orElse(""); if (StringUtils.isNotEmpty(text)) { preview = StringEscapeUtils.escapeHtml4(text).replaceAll("[\n|\r]", "<br>"); } } preview = String.format("<head><meta charset=\"utf-8\"/>%s</head>", preview); return new BinaryContentImpl(IOUtils.toInputStream(preview)); }

Target:
public BinaryContent transform(Metacard metacard, Map<String, Serializable> arguments) throws CatalogTransformerException { if (metacard == null) { throw new CatalogTransformerException("Cannot transform null metacard."); } String preview = getPreviewText(metacard); return new BinaryContentImpl(IOUtils.toInputStream(preview)); }
Source:
public Map<String, DbParameterAccessor> getAllProcedureParameters(String callableName) throws SQLException { DatabaseObject o; String name = callableName.toUpperCase(); DatabaseProcedure p = new DatabaseProcedure(getConnection(), getConnection().getSchema(), name); if (p.exists()) { o = p; } else { DatabaseFunction f = new DatabaseFunction(getConnection(), getConnection().getSchema(), name); if (f.exists()) { o = f; } else { throw new SQLException("Procedure/function " + name + " does not exist"); } } return o.getParams(); }

Target:
public Map<String, DbParameterAccessor> getAllProcedureParameters(String callableName) throws SQLException { return findStoredRoutine(buildDatabaseObjectName(callableName)).getParams(); }
Source:
public ImmutableList<Trade> trades(LocalDate valuationDate, ObservableValues marketData) { ImmutableList.Builder<Trade> result = ImmutableList.builder(); for (CurveGroupEntry entry : entries) { NodalCurveDefinition defn = entry.getCurveDefinition(); for (CurveNode node : defn.getNodes()) { result.add(node.trade(valuationDate, marketData)); } } return result.build(); }

Target:
public ImmutableList<Trade> trades(LocalDate valuationDate, ObservableValues marketData) { return entries.stream() .map(CurveGroupEntry::getCurveDefinition) .flatMap(curveDef -> curveDef.getNodes().stream()) .map(node -> node.trade(valuationDate, marketData)) .collect(toImmutableList()); }
Source:
public List<GeneratorSwitch> getGenerators() { if (this.contentFolders == null) { this.contentFolders = new ArrayList<>(); } Stream<Project> projects = template.getProjects().stream(); Stream<Project> projectsWithSourceFolder = projects.filter(λ -> Objects.nonNull(λ.getGeneratorSource())); Stream<Pair<Folder, Folder>> foldersWithSources = projectsWithSourceFolder .flatMap(λ -> λ.getFolders().stream().map(μ -> Pair.of(μ, λ.getGeneratorSource()))); Stream<Folder> allowedFolders = foldersWithSources.filter(λ -> !λ.getLeft().equals(λ.getRight())) .map(λ -> λ.getLeft()); Stream<Folder> generatableFolders = allowedFolders.filter(λ -> λ.getDerivative().isPresent() || λ.getDpi().isPresent() || λ.getImageScale().isPresent() || λ.getImageSize().isPresent()); Stream<GeneratorSwitch> taskGenerators = generatableFolders.map(λ -> new GeneratorSwitch(λ, contentFolders)); return new ArrayList<GeneratorSwitch>() { { taskGenerators.forEach(this::add); } }; }

Target:
public List<GeneratorSwitch> getGenerators() { if (this.contentFolders == null) { this.contentFolders = new ArrayList<>(); } return GeneratorSwitch.getGeneratorSwitches(template.getProjects().stream(), contentFolders); }
Source:
public void testJavaUnwrap() { Assert.assertEquals("Hello World", JavaStringEscapes.unwrapJavaString("\"Hello World\"")); Assert.assertEquals("Hello \"Bob\"", JavaStringEscapes.unwrapJavaString("\"Hello \\\"Bob\\\"\"")); try { JavaStringEscapes.unwrapJavaString("Hello World"); Assert.fail("Should have thrown"); } catch (Exception e) { } try { JavaStringEscapes.unwrapJavaString("\"Hello \\\"Bob\\\""); Assert.fail("Should have thrown"); } catch (Exception e) { } Assert.assertEquals("Hello World", JavaStringEscapes.unwrapJavaStringIfWrapped("\"Hello World\"")); Assert.assertEquals("Hello \"Bob\"", JavaStringEscapes.unwrapJavaStringIfWrapped("\"Hello \\\"Bob\\\"\"")); Assert.assertEquals("Hello World", JavaStringEscapes.unwrapJavaStringIfWrapped("Hello World")); try { JavaStringEscapes.unwrapJavaStringIfWrapped("\"Hello \\\"Bob\\\""); Assert.fail("Should have thrown"); } catch (Exception e) { } }

Target:
public void testJavaUnwrap() { Assert.assertEquals(JavaStringEscapes.unwrapJavaString("\"Hello World\""), "Hello World"); Assert.assertEquals(JavaStringEscapes.unwrapJavaString("\"Hello \\\"Bob\\\"\""), "Hello \"Bob\""); try { JavaStringEscapes.unwrapJavaString("Hello World"); Assert.fail("Should have thrown"); } catch (Exception e) { } try { JavaStringEscapes.unwrapJavaString("\"Hello \\\"Bob\\\""); Assert.fail("Should have thrown"); } catch (Exception e) { } Assert.assertEquals(JavaStringEscapes.unwrapJavaStringIfWrapped("\"Hello World\""), "Hello World"); Assert.assertEquals(JavaStringEscapes.unwrapJavaStringIfWrapped("\"Hello \\\"Bob\\\"\""), "Hello \"Bob\""); Assert.assertEquals(JavaStringEscapes.unwrapJavaStringIfWrapped("Hello World"), "Hello World"); try { JavaStringEscapes.unwrapJavaStringIfWrapped("\"Hello \\\"Bob\\\""); Assert.fail("Should have thrown"); } catch (Exception e) { } }
Source:
public static Status statusFromLifecycle(Lifecycle state) { if (state == null) return UNKNOWN; switch (state) { case CREATED: return ACCEPTED; case STARTING: return STARTING; case RUNNING: return RUNNING; case STOPPING: return STOPPING; case STOPPED: return STOPPED; case DESTROYED: return TERMINATED; case ON_FIRE: default: return UNKNOWN; } }

Target:
public static Status statusFromLifecycle(Lifecycle state) { if (state == null) return UNKNOWN; switch (state) { case CREATED: return ACCEPTED; case STARTING: return STARTING; case RUNNING: return RUNNING; case STOPPING: return STOPPING; case STOPPED: return STOPPED; case DESTROYED: return DESTROYED; case ON_FIRE: default: return UNKNOWN; } }
Source:
private void setAmbryHeadersForPut(JSONObject headers, String ttlInSecs, String serviceId, Container container, String contentType, String ownerId) throws JSONException { setAmbryHeadersForPut(headers, ttlInSecs, serviceId, container, contentType, ownerId, true, true); }

Target:
private void setAmbryHeadersForPut(JSONObject headers, String ttlInSecs, String serviceId, Container container, String contentType, String ownerId) throws JSONException { setAmbryHeadersForPut(headers, ttlInSecs, serviceId, container, contentType, ownerId, true); }
Source:
public void close() { asyncClient.close(); if (messageProcessor.get() != null) { messageProcessor.get().dispose(); } Disposable activeSubscription = messageProcessorSubscription.get(); if (activeSubscription != null) { activeSubscription.dispose(); } }

Target:
public void close() { asyncClient.close(); EmitterProcessor<ServiceBusReceivedMessageContext> processor = messageProcessor.getAndSet(null); if (processor != null) { processor.onComplete(); } }
Source:
public Tenant(String name, CanonicalPath path, Map<String, Object> properties) { super(name, path, properties); getId(); }

Target:
public Tenant(String name, CanonicalPath path, Map<String, Object> properties) { super(name, path, properties); }
Source:
public void createTopicWithMinMessage_ShouldPass() throws Exception { Users.signUpAndSignIn(); Topic topic = new Topic("subject", "ab"); Topics.createTopic(topic); }

Target:
public void createTopicWithMinMessage_ShouldPass() throws Exception { Users.signUpAndSignIn(); Topic topic = new Topic().withBody("ab"); Topics.createTopic(topic); }
Source:
public XYPair getLeftVector() { return new XYPair(this.x * (xLeftInverted ? -1 : 1), this.y * (yLeftInverted ? -1 : 1)); }

Target:
public XYPair getLeftVector() { return new XYPair( this.leftJoystickAxis.x * (getLeftStickXInversion() ? -1 : 1), this.leftJoystickAxis.y * (getLeftStickYInversion() ? -1 : 1)); }
Source:
public void subscribe(Subscriber<? super Message<?>> subscriber) { this.subscribers.add(subscriber); this.flux.doFinally((signal) -> this.subscribers.remove(subscriber)) .retry() .subscribe(subscriber); this.publishers.values() .forEach((connectableFlux) -> this.disposables.put(connectableFlux, connectableFlux.connect())); }

Target:
public void subscribe(Subscriber<? super Message<?>> subscriber) { this.processor .doFinally((s) -> this.subscribedSignal.onNext(this.processor.hasDownstreams())) .subscribe(subscriber); this.subscribedSignal.onNext(this.processor.hasDownstreams()); }
Source:
public List<FeedbackResponseAttributes> getFeedbackResponsesFromGiverForSessionWithinRange (String giverEmail, String feedbackSessionName, String courseId, long range) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, giverEmail); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackSessionName); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); Collection<FeedbackResponse> frList = getFeedbackResponseEntitiesFromGiverForSessionWithinRange(giverEmail, feedbackSessionName, courseId, range); List<FeedbackResponseAttributes> fraList = new ArrayList<FeedbackResponseAttributes>(); for (FeedbackResponse fr : frList) { try { fraList.add(new FeedbackResponseAttributes(fr)); } catch (JDOUserException jdoException) { log.info("Skip counting of respondent for deleted response: " + jdoException.getMessage()); } } return fraList; }

Target:
public List<FeedbackResponseAttributes> getFeedbackResponsesFromGiverForSessionWithinRange (String giverEmail, String feedbackSessionName, String courseId, long range) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, giverEmail); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackSessionName); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); Collection<FeedbackResponse> frList = getFeedbackResponseEntitiesFromGiverForSessionWithinRange(giverEmail, feedbackSessionName, courseId, range); List<FeedbackResponseAttributes> fraList = new ArrayList<FeedbackResponseAttributes>(); for (FeedbackResponse fr : frList) { if (!JDOHelper.isDeleted(fr)) { fraList.add(new FeedbackResponseAttributes(fr)); } } return fraList; }
Source:
public void initTraceState(Map<String, Object> state) { if (state.containsKey(Constants.HAWKULAR_APM_TRACEID)) { setTraceId(state.get(Constants.HAWKULAR_APM_TRACEID).toString()); } else { log.severe("Trace id has not been propagated"); } if (state.containsKey(Constants.HAWKULAR_APM_TXN)) { setTransaction(state.get(Constants.HAWKULAR_APM_TXN).toString()); } if (state.containsKey(Constants.HAWKULAR_APM_LEVEL)) { setReportingLevel(state.get(Constants.HAWKULAR_APM_LEVEL).toString()); } }

Target:
public void initTraceState(Map<String, Object> state) { Object traceId = state.get(Constants.HAWKULAR_APM_TRACEID); Object transaction = state.get(Constants.HAWKULAR_APM_TXN); Object level = state.get(Constants.HAWKULAR_APM_LEVEL); if (traceId != null) { setTraceId(traceId.toString()); } else { log.severe("Trace id has not been propagated"); } if (transaction != null) { setTransaction(transaction.toString()); } if (level != null) { setReportingLevel(level.toString()); } }
Source:
public void testIPv4EncodeProxyV2() { HAProxyMessageEncoder encoder = new HAProxyMessageEncoder(); EmbeddedChannel ch = new EmbeddedChannel(encoder); HAProxyMessage message = new HAProxyMessage( HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4, "192.168.0.1", "192.168.0.11", 56324, 443); assertTrue(ch.writeOutbound(message)); ByteBuf byteBuf = ch.readOutbound(); byte[] headerBytes = ByteBufUtil.getBytes(byteBuf, 0, 12); assertArrayEquals(BINARY_PREFIX, headerBytes); byte commandByte = byteBuf.getByte(12); assertEquals(0x02, (commandByte & 0xf0) >> 4); assertEquals(0x01, commandByte & 0x0f); byte transportByte = byteBuf.getByte(13); assertEquals(0x01, (transportByte & 0xf0) >> 4); assertEquals(0x01, transportByte & 0x0f); int sourceAddrLength = byteBuf.getUnsignedShort(14); assertEquals(12, sourceAddrLength); byte[] sourceAddr = ByteBufUtil.getBytes(byteBuf, 16, 4); assertArrayEquals(new byte[] { (byte) 0xc0, (byte) 0xa8, 0x00, 0x01}, sourceAddr); byte[] destAddr = ByteBufUtil.getBytes(byteBuf, 20, 4); assertArrayEquals(new byte[] { (byte) 0xc0, (byte) 0xa8, 0x00, 0x0b}, destAddr); int sourcePort = byteBuf.getUnsignedShort(24); assertEquals(56324, sourcePort); int destPort = byteBuf.getUnsignedShort(26); assertEquals(443, destPort); }

Target:
public void testIPv4EncodeProxyV2() { EmbeddedChannel ch = new EmbeddedChannel(INSTANCE); HAProxyMessage message = new HAProxyMessage( HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, HAProxyProxiedProtocol.TCP4, "192.168.0.1", "192.168.0.11", 56324, 443); assertTrue(ch.writeOutbound(message)); ByteBuf byteBuf = ch.readOutbound(); byte[] headerBytes = ByteBufUtil.getBytes(byteBuf, 0, 12); assertArrayEquals(BINARY_PREFIX, headerBytes); byte commandByte = byteBuf.getByte(12); assertEquals(0x02, (commandByte & 0xf0) >> 4); assertEquals(0x01, commandByte & 0x0f); byte transportByte = byteBuf.getByte(13); assertEquals(0x01, (transportByte & 0xf0) >> 4); assertEquals(0x01, transportByte & 0x0f); int sourceAddrLength = byteBuf.getUnsignedShort(14); assertEquals(12, sourceAddrLength); byte[] sourceAddr = ByteBufUtil.getBytes(byteBuf, 16, 4); assertArrayEquals(new byte[] { (byte) 0xc0, (byte) 0xa8, 0x00, 0x01 }, sourceAddr); byte[] destAddr = ByteBufUtil.getBytes(byteBuf, 20, 4); assertArrayEquals(new byte[] { (byte) 0xc0, (byte) 0xa8, 0x00, 0x0b }, destAddr); int sourcePort = byteBuf.getUnsignedShort(24); assertEquals(56324, sourcePort); int destPort = byteBuf.getUnsignedShort(26); assertEquals(443, destPort); byteBuf.release(); assertFalse(ch.finish()); }
Source:
private static void usage(PrintStream s) { s.println("usage: Client [options] <torrent>"); s.println(); s.println("Available options:"); s.println(" -h,--help Show this help and exit."); s.println(" -o,--output DIR Read/write data to directory DIR."); s.println(" -i,--iface IFACE Bind to interface IFACE."); s.println(" -s,--seed SECONDS Time to seed after downloading (default: infinitely)."); s.println(" -d,--max-download KB/SEC Max download rate (default: infinitely)."); s.println(" -u,--max-upload KB/SEC Max upload rate (default: infinitely)."); s.println(); }

Target:
private static void usage(PrintStream s) { s.println("usage: Client [options] <torrent>"); s.println(); s.println("Available options:"); s.println(" -h,--help Show this help and exit."); s.println(" -o,--output DIR Read/write data to directory DIR."); s.println(" -i,--iface IFACE Bind to interface IFACE."); s.println(" -s,--seed SECONDS Time to seed after downloading (default: infinitely)."); s.println(" -d,--max-download KB/SEC Max download rate (default: unlimited)."); s.println(" -u,--max-upload KB/SEC Max upload rate (default: unlimited)."); s.println(); }
Source:
public Row next() throws IOException { resultsMeter.mark(); Timer.Context timerContext = resultsTimer.time(); try { return responseQueueReader.getNextMergedRow(); } finally { timerContext.close(); } }

Target:
public Row next() throws IOException { Timer.Context timerContext = resultsTimer.time(); Row row = responseQueueReader.getNextMergedRow(); if (row != null) { resultsMeter.mark(); } timerContext.close(); return row; }
Source:
public void testConcCreateDestroy() throws Exception { IgnoredException.addIgnoredException("RegionDestroyedException"); IgnoredException.addIgnoredException("IndexInvalidException"); final int ops = 40; final String hKey = KEY + "hash"; final String lKey = KEY + "list"; final String zKey = KEY + "zset"; final String sKey = KEY + "set"; class ConcCreateDestroy extends ClientTestBase { protected ConcCreateDestroy(int port) { super(port); } @Override public void run() throws InterruptedException { Jedis jedis = new Jedis(LOCALHOST, port, JEDIS_TIMEOUT); Random r = new Random(); for (int i = 0; i < ops; i++) { int n = r.nextInt(4); if (n == 0) { if (r.nextBoolean()) { jedis.hset(hKey, randString(), randString()); } else { jedis.del(hKey); } } else { if (r.nextBoolean()) { jedis.sadd(sKey, randString()); } else { jedis.del(sKey); } } } } } AsyncInvocation<Void> i = client1.invokeAsync(new ConcCreateDestroy(server1Port)); client2.invoke(new ConcCreateDestroy(server2Port)); i.await(); }

Target:
public void testConcCreateDestroy() throws Exception { IgnoredException.addIgnoredException("RegionDestroyedException"); IgnoredException.addIgnoredException("IndexInvalidException"); final int ops = 40; final String hKey = KEY + "hash"; final String sKey = KEY + "set"; class ConcCreateDestroy extends ClientTestBase { protected ConcCreateDestroy(int port) { super(port); } @Override public void run() { Jedis jedis = new Jedis(LOCALHOST, port, JEDIS_TIMEOUT); Random r = new Random(); for (int i = 0; i < ops; i++) { int n = r.nextInt(4); if (n == 0) { if (r.nextBoolean()) { jedis.hset(hKey, randString(), randString()); } else { jedis.del(hKey); } } else { if (r.nextBoolean()) { jedis.sadd(sKey, randString()); } else { jedis.del(sKey); } } } } } AsyncInvocation<Void> i = client1.invokeAsync(new ConcCreateDestroy(server1Port)); client2.invoke(new ConcCreateDestroy(server2Port)); i.await(); }
Source:
public void run(TransformContext context, GtfsMutableRelationalDao dao) { ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices(); for (Trip trip: dao.getAllTrips()) { StopTime oldTime = new StopTime(); boolean starting = true; for (StopTime newTime: dao.getStopTimesForTrip(trip)) { if (starting) { starting = false; oldTime = newTime; } if(newTime.getArrivalTime() - oldTime.getDepartureTime() > 5 * MINUTES_PER_HOUR * SECONDS_PER_MINUTE){ _log.error("Trip on Route is scheduled for unrealistic transit time between trip at {}, and trip at {}", trip.getId(), trip.getRoute(), oldTime.getId(), humanReadableTime(oldTime.getDepartureTime()), newTime.getId(), humanReadableTime(newTime.getArrivalTime())); es.publishMessage(getTopic(), "Trip " + trip.getId() + " on Route "+ trip.getRoute() +" is scheduled for unrealistic transit time when traveling between stoptime" + oldTime.getId()+ " at " + oldTime.getDepartureTime() + ", and stoptime" + newTime.getId() + " at " + newTime.getDepartureTime()); _log.error("Trip "+trip.getId().getId()+" on Route "+trip.getRoute().getId().getId()+" is scheduled for unrealistic transit time between trip "+ oldTime.getId()+" at "+humanReadableTime(oldTime.getDepartureTime())+", and trip "+newTime.getId()+" at " + humanReadableTime(newTime.getArrivalTime())); } oldTime= newTime; } } }

Target:
public void run(TransformContext context, GtfsMutableRelationalDao dao) { ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices(); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); for (Trip trip: dao.getAllTrips()) { StopTime oldTime = new StopTime(); boolean starting = true; for (StopTime newTime: dao.getStopTimesForTrip(trip)) { if (starting) { starting = false; oldTime = newTime; } if(newTime.getArrivalTime() - oldTime.getDepartureTime() > 5 * MINUTES_PER_HOUR * SECONDS_PER_MINUTE){ Date departure = new Date(oldTime.getDepartureTime()*1000); Date arrival = new Date(newTime.getArrivalTime()*1000); String message = "Trip " + trip.getId().getId() + " on Route "+ trip.getRoute().getId() + " is scheduled for unrealistic transit time when traveling between stoptime" + oldTime.getId()+ " at " + sdf.format(departure) + ", and stoptime" + newTime.getId() + " at " + sdf.format(arrival); es.publishMessage(getTopic(), message); } oldTime= newTime; } } }
Source:
protected ResourceBasedNode<?> getResourceBasedNode() { List<?> selection = projectExplorer.getSelection().getAllElements(); if (selection != null && selection.size() >= 1) { Object o = selection.get(0); if (o instanceof ResourceBasedNode<?>) { ResourceBasedNode<?> node = (ResourceBasedNode<?>)o; if (node.isLeaf() && isResourceAndStorableNode(node.getParent())) { return (ResourceBasedNode<?>)node.getParent(); } return isResourceAndStorableNode(node) ? node : null; } } return null; }

Target:
protected ResourceBasedNode<?> getResourceBasedNode() { List<?> selection = projectExplorer.getSelection().getAllElements(); if (selection != null && !selection.isEmpty()) { Object o = selection.get(0); if (o instanceof ResourceBasedNode<?>) { ResourceBasedNode<?> node = (ResourceBasedNode<?>)o; if (node.isLeaf() && isResourceAndStorableNode(node.getParent())) { return (ResourceBasedNode<?>)node.getParent(); } return isResourceAndStorableNode(node) ? node : null; } } return null; }
Source:
public void setMap(final Map<String,T> map) { this.map= checkNotNull(map); }

Target:
public void setMap(final Map<String,T> map) { if (null == this.map) { this.map = Maps.newHashMap(checkNotNull(map)); } else { throw new UnsupportedOperationException("MapQueryResult is immutable"); } this.map= checkNotNull(map); }
Source:
private List<TargetFilterPredicate> composeFilterPredicateList() { final List<TargetFilterPredicate> result = new ArrayList<>(3); if (minimumTargetSize > 0 || maximumTargetSize < Integer.MAX_VALUE) { result.add(new ExtremeTargetSize()); } if (minimumGCContent > 0.0 || maximumGCContent < 1.0) { result.add(new ExtremeTargetGCContent()); } if (maximumRepeatContent < 1.0) { result.add(new ExtremeTargetRepeatContent()); } if (maximumCoverageMean < Double.POSITIVE_INFINITY || minimumCoverageMean > Double.NEGATIVE_INFINITY) { result.add(new ExtremeCoverageMean()); } if (maximumCoverageVariance < Double.POSITIVE_INFINITY || minimumCoverageVariance > Double.NEGATIVE_INFINITY) { result.add(new ExtremeCoverageVariance()); } if (!excludeIntervals.isEmpty()) { result.add(new ExcludeTargetList(excludeIntervals)); } return result; }

Target:
private List<TargetFilterPredicate> composeFilterPredicateList() { final List<TargetFilterPredicate> result = new ArrayList<>(3); if (minimumTargetSize > 0 || maximumTargetSize < Integer.MAX_VALUE) { result.add(new ExtremeTargetSize()); } if (minimumGCContent > 0.0 || maximumGCContent < 1.0) { result.add(new ExtremeTargetGCContent()); } if (maximumRepeatContent < 1.0) { result.add(new ExtremeTargetRepeatContent()); } if (maximumCoverageMean < Double.POSITIVE_INFINITY || minimumCoverageMean > Double.NEGATIVE_INFINITY) { result.add(new ExtremeCoverageMean()); } if (maximumCoverageVariance < Double.POSITIVE_INFINITY || minimumCoverageVariance > Double.NEGATIVE_INFINITY) { result.add(new ExtremeCoverageVariance()); } if (maximumCoverageInterquartileRange < Double.POSITIVE_INFINITY) { result.add(new ExtremeCoverageInterquartileRange()); } if (!excludedIntervals.isEmpty()) { result.add(new ExcludedTargetList(excludedIntervals)); } return result; }
Source:
private RelNode possiblyWrapRootWithOuterLimitFromContext( RelRoot root ) { Object outerLimitObj = plannerContext.getQueryContext().get(PlannerContext.CTX_SQL_OUTER_LIMIT); if (outerLimitObj == null) { return null; } Long outerLimit = DimensionHandlerUtils.convertObjectToLong(outerLimitObj, true); if (outerLimit == null) { return null; } return LogicalSort.create( root.rel, root.collation, makeDecimalLiteral(0), makeDecimalLiteral(outerLimit) ); }

Target:
private RelNode possiblyWrapRootWithOuterLimitFromContext( RelRoot root ) { Object outerLimitObj = plannerContext.getQueryContext().get(PlannerContext.CTX_SQL_OUTER_LIMIT); Long outerLimit = DimensionHandlerUtils.convertObjectToLong(outerLimitObj, true); if (outerLimit == null) { return root.rel; } return LogicalSort.create( root.rel, root.collation, makeBigIntLiteral(0), makeBigIntLiteral(outerLimit) ); }
Source:
public boolean deleteExpiredObjectsByKey(String key) { try { ExpiredObject expiredObject = getExpiredObject(key); this.persistenceEntryManager.remove(expiredObject); LOG.debug("Removed expired_objects successfully: ", key); return true; } catch (Exception e) { LOG.error("Failed to remove expired_objects: ", key, e); } return false; }

Target:
public boolean deleteExpiredObjectsByKey(String key) { try { this.persistenceEntryManager.remove(getDnForExpiredObj(key)); LOG.debug("Removed expired_objects successfully: ", key); return true; } catch (Exception e) { LOG.error("Failed to remove expired_objects: ", key, e); } return false; }
Source:
public void initialize() throws ConfigurationException { String dSetupValue = System.getProperty("setup"); if (dSetupValue != null) { String filePath = CarbonUtils.getCarbonHome() + File.separator + "repository" + File.separator + "conf" + File.separator + "datasources" + File.separator + MASTER_DATASOURCE_FILE_NAME; log.info("Initializing message broker RDBMS store..."); DataSourceConfiguration configuration = new DataSourceConfiguration(); if (!mbStoreInitialized) { configuration.loadDbConfiguration(filePath); mbStoreInitialized = true; } setMBStoreRdbmsConfiguration(configuration); setupMBStoreRdbmsDatabase(); } }

Target:
public void initialize() throws ConfigurationException { String dSetupValue = System.getProperty("setup"); if (dSetupValue != null) { String filePath = CarbonUtils.getCarbonHome() + File.separator + "repository" + File.separator + "conf" + File.separator + "datasources" + File.separator + MASTER_DATA_SOURCE_FILE_NAME; log.info("Creating schema for RDBMS message store."); DataSourceConfiguration configuration = new DataSourceConfiguration(); if (!isMBStoreDatabaseConfigurationLoaded) { configuration.loadDbConfiguration(filePath); isMBStoreDatabaseConfigurationLoaded = true; } setMBStoreRdbmsConfiguration(configuration); if(isMessageStoreDataSourceSet) { setupMBStoreRdbmsDatabase(messageStoreDataSource); } if(isContextStoreDatasourceSet) { setupMBStoreRdbmsDatabase(contextStoreDataSource); } } }
Source:
public void getUserPhonesShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserService userService = adapter.create(UserService.class); userService.getUserPhones(new RetrofitPromise<List<Phone>>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/phones", MOCK_URL)); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); }

Target:
public void getUserPhonesShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserService userService = adapter.create(UserService.class); userService.getUserPhones(new RetrofitPromise<List<Phone>>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/phones", MOCK_URL)); }
Source:
private long computeMemorySizeInBytes(AbstractNode root) { if (root.getLevel() == 0) { return ABSTRACT_NODE_INSTANCE_SIZE + ENVELOPE_INSTANCE_SIZE + root.getChildBoundables().stream().mapToLong(child -> computeMemorySizeInBytes((ItemBoundable) child)).sum(); } else { return ABSTRACT_NODE_INSTANCE_SIZE + ENVELOPE_INSTANCE_SIZE + root.getChildBoundables().stream().mapToLong(child -> computeMemorySizeInBytes((AbstractNode) child)).sum(); } }

Target:
private long computeMemorySizeInBytes(AbstractNode root) { if (root.getLevel() == 0) { return ABSTRACT_NODE_INSTANCE_SIZE + ENVELOPE_INSTANCE_SIZE + root.getChildBoundables().stream().mapToLong(child -> computeMemorySizeInBytes((ItemBoundable) child)).sum(); } return ABSTRACT_NODE_INSTANCE_SIZE + ENVELOPE_INSTANCE_SIZE + root.getChildBoundables().stream().mapToLong(child -> computeMemorySizeInBytes((AbstractNode) child)).sum(); }
Source:
public void visit(SystemStreamPartition systemStreamPartition, StartpointTimestamp startpointTimestamp) { Long timestampInStartpoint = startpointTimestamp.getTimestampOffset(); TopicPartition topicPartition = toTopicPartition(systemStreamPartition); Map<TopicPartition, Long> topicPartitionsToTimeStamps = ImmutableMap.of(topicPartition, timestampInStartpoint); LOG.info("Looking up the offsets of the topic partition: by timestamp: {}.", topicPartition, timestampInStartpoint); Map<TopicPartition, OffsetAndTimestamp> topicPartitionToOffsetTimestamps = kafkaConsumer.offsetsForTimes(topicPartitionsToTimeStamps); if (topicPartitionToOffsetTimestamps.get(topicPartition) == null) { LOG.info("Timestamp does not exist for partition: {}. Seeking the kafka consumer to the end offset.", topicPartition); synchronized (kafkaConsumer) { kafkaConsumer.seekToEnd(ImmutableList.of(topicPartition)); } } else { OffsetAndTimestamp offsetAndTimeStamp = topicPartitionToOffsetTimestamps.get(topicPartition); LOG.info("Updating the consumer fetch offsets of the topic partition: to {}.", topicPartition, offsetAndTimeStamp.offset()); synchronized (kafkaConsumer) { kafkaConsumer.seek(topicPartition, offsetAndTimeStamp.offset()); } } proxy.addTopicPartition(systemStreamPartition, kafkaConsumer.position(topicPartition)); }

Target:
public void visit(SystemStreamPartition systemStreamPartition, StartpointTimestamp startpointTimestamp) { Long timestampInStartpoint = startpointTimestamp.getTimestampOffset(); TopicPartition topicPartition = toTopicPartition(systemStreamPartition); Map<TopicPartition, Long> topicPartitionsToTimeStamps = ImmutableMap.of(topicPartition, timestampInStartpoint); LOG.info("Looking up the offsets of the topic partition: by timestamp: {}.", topicPartition, timestampInStartpoint); Map<TopicPartition, OffsetAndTimestamp> topicPartitionToOffsetTimestamps = new HashMap<>(); synchronized (kafkaConsumer) { topicPartitionToOffsetTimestamps = kafkaConsumer.offsetsForTimes(topicPartitionsToTimeStamps); } if (topicPartitionToOffsetTimestamps.get(topicPartition) == null) { LOG.info("Timestamp does not exist for partition: {}. Seeking the kafka consumer to the end offset.", topicPartition); synchronized (kafkaConsumer) { kafkaConsumer.seekToEnd(ImmutableList.of(topicPartition)); proxy.addTopicPartition(systemStreamPartition, kafkaConsumer.position(topicPartition)); } } else { synchronized (kafkaConsumer) { OffsetAndTimestamp offsetAndTimeStamp = topicPartitionToOffsetTimestamps.get(topicPartition); LOG.info("Updating the consumer fetch offsets of the topic partition: to {}.", topicPartition, offsetAndTimeStamp.offset()); kafkaConsumer.seek(topicPartition, offsetAndTimeStamp.offset()); proxy.addTopicPartition(systemStreamPartition, kafkaConsumer.position(topicPartition)); } } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); mDispatcher.register(this); setContentView(R.layout.plugin_detail_activity); String pluginName; if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); pluginName = getIntent().getStringExtra(KEY_PLUGIN_NAME); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); pluginName = savedInstanceState.getString(KEY_PLUGIN_NAME); } mPlugin = mPluginStore.getSitePluginByName(mSite, pluginName); mPluginInfo = PluginUtils.getPluginInfo(mPluginStore, mPlugin); if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, Duration.SHORT); finish(); return; } if (mPlugin == null) { ToastUtils.showToast(this, R.string.plugin_not_found, Duration.SHORT); finish(); return; } if (mPluginInfo == null) { mDispatcher.dispatch(PluginActionBuilder.newFetchPluginInfoAction(mPlugin.getSlug())); } Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setElevation(0); } setupViews(); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); mDispatcher.register(this); String pluginName; if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); pluginName = getIntent().getStringExtra(KEY_PLUGIN_NAME); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); pluginName = savedInstanceState.getString(KEY_PLUGIN_NAME); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, Duration.SHORT); finish(); return; } mPlugin = mPluginStore.getSitePluginByName(mSite, pluginName); if (mPlugin == null) { ToastUtils.showToast(this, R.string.plugin_not_found, Duration.SHORT); finish(); return; } mPluginInfo = PluginUtils.getPluginInfo(mPluginStore, mPlugin); if (mPluginInfo == null) { mDispatcher.dispatch(PluginActionBuilder.newFetchPluginInfoAction(mPlugin.getSlug())); } setContentView(R.layout.plugin_detail_activity); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(mPlugin.getDisplayName()); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setElevation(0); } setupViews(); }
Source:
public static boolean runJobs(List<Jobby> jobs, HadoopDruidIndexerConfig config) { boolean succeeded = true; ObjectMapper objectMapper = new ObjectMapper(); for (Jobby job : jobs) { String hadoopJobId = job.submitAndGetHadoopJobId(); String hadoopJobIdFileName = config.getHadoopJobIdFileName(); if (hadoopJobIdFileName != null) { try { objectMapper.writeValue(new OutputStreamWriter( new FileOutputStream(new File(hadoopJobIdFileName)), StandardCharsets.UTF_8), hadoopJobId); log.info("MR job id is written to jobId file"); } catch (IOException e) { log.error("Error wriritng job id to jobId file. Exception %s ", Throwables.getStackTraceAsString(e)); } } if (!job.run()) { succeeded = false; break; } } if (!config.getSchema().getTuningConfig().isLeaveIntermediate()) { if (succeeded || config.getSchema().getTuningConfig().isCleanupOnFailure()) { Path workingPath = config.makeIntermediatePath(); log.info("Deleting path[%s]", workingPath); try { Configuration conf = injectSystemProperties(new Configuration()); config.addJobProperties(conf); workingPath.getFileSystem(conf).delete(workingPath, true); } catch (IOException e) { log.error(e, "Failed to cleanup path[%s]", workingPath); } } } return succeeded; }

Target:
public static boolean runJobs(List<Jobby> jobs, HadoopDruidIndexerConfig config) { boolean succeeded = true; for (Jobby job : jobs) { if (!job.run()) { succeeded = false; break; } } if (!config.getSchema().getTuningConfig().isLeaveIntermediate()) { if (succeeded || config.getSchema().getTuningConfig().isCleanupOnFailure()) { Path workingPath = config.makeIntermediatePath(); log.info("Deleting path[%s]", workingPath); try { Configuration conf = injectSystemProperties(new Configuration()); config.addJobProperties(conf); workingPath.getFileSystem(conf).delete(workingPath, true); } catch (IOException e) { log.error(e, "Failed to cleanup path[%s]", workingPath); } } } return succeeded; }
Source:
private void maybeAddCluster() throws IOException { for (Map.Entry<String, HelixAdmin> entry : adminForDc.entrySet()) { String dcName = entry.getKey(); HelixAdmin admin = entry.getValue(); if (!admin.getClusters().contains(clusterName)) { info("Adding cluster in {}", clusterName, dcName); admin.addCluster(clusterName); admin.addStateModelDef(clusterName, LeaderStandbySMD.name, LeaderStandbySMD.build()); } } }

Target:
private void maybeAddCluster() { for (Map.Entry<String, HelixAdmin> entry : adminForDc.entrySet()) { String dcName = entry.getKey(); HelixAdmin admin = entry.getValue(); if (!admin.getClusters().contains(clusterName)) { info("Adding cluster in {}", clusterName, dcName); admin.addCluster(clusterName); admin.addStateModelDef(clusterName, LeaderStandbySMD.name, LeaderStandbySMD.build()); } } }
Source:
public URL[] getRedirectURLs(RepoObject repoObject) throws RepoException { try { String[] paths = mfs.getPaths(getObjectLocationString(repoObject.getBucketName(), repoObject.getChecksum()), true); int pathCount = paths.length; URL[] urls = new URL[pathCount]; for (int i = 0; i < pathCount; i++) { urls[i] = new URL(paths[i]); } return urls; } catch (Exception e) { log.error("Exception: + " + e.getMessage() + " when trying to fetch the reproxy url for object :" ); log.error("key ----> " + repoObject.getKey()); log.error("bucket name ----> " + repoObject.getBucketName()); log.error("content checksum ----> " + repoObject.getChecksum()); log.error("version number ----> " + repoObject.getVersionNumber()); log.error("Content exists in mogile? ----> " + this.objectExists(repoObject)); throw new RepoException(e); } }

Target:
public URL[] getRedirectURLs(RepoObject repoObject) throws RepoException { try { String[] paths = mfs.getPaths(getObjectLocationString(repoObject.getBucketName(), repoObject.getChecksum()), true); int pathCount = paths.length; URL[] urls = new URL[pathCount]; for (int i = 0; i < pathCount; i++) { urls[i] = new URL(paths[i]); } return urls; } catch (Exception e) { log.error("Exception: when trying to fetch reproxy url, key: , bucket name: , content checksum: , version number: ", e.getMessage(), repoObject.getKey(), repoObject.getBucketName(), repoObject.getChecksum(), repoObject.getVersionNumber()); throw new RepoException(e); } }
Source:
public void parse(InputStream in) throws IOException { BufferedReader br = asReader(in); String txt; while ((txt = br.readLine()) != null) { txt = txt.trim(); if (txt.length() > 0 && !txt.startsWith("#")) { int patternEndSpace = txt.indexOf(' '); int patternEndTab = txt.indexOf('\t'); final int patternEnd; if (patternEndSpace == -1) patternEnd = patternEndTab; else if (patternEndTab == -1) patternEnd = patternEndSpace; else patternEnd = Math.min(patternEndSpace, patternEndTab); if (patternEnd > -1) rules.add(new AttributesRule(txt.substring(0, patternEnd), txt.substring(patternEnd + 1).trim())); } } }

Target:
public void parse(InputStream in) throws IOException { BufferedReader br = asReader(in); String txt; while ((txt = br.readLine()) != null) { txt = txt.trim(); if (txt.length() > 0 && !txt.startsWith("#") && !txt.startsWith("!") ) { int patternEndSpace = txt.indexOf(' '); int patternEndTab = txt.indexOf('\t'); final int patternEnd; if (patternEndSpace == -1) patternEnd = patternEndTab; else if (patternEndTab == -1) patternEnd = patternEndSpace; else patternEnd = Math.min(patternEndSpace, patternEndTab); if (patternEnd > -1) rules.add(new AttributesRule(txt.substring(0, patternEnd), txt.substring(patternEnd + 1).trim())); } } }