auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected final void startZoomThread(long startTime, long endTime) { try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:ZoomThreadCreated").setCategory(getViewId()).build()) { long clampedStartTime = (fStartTime == Long.MAX_VALUE ? startTime : Math.min(Math.max(startTime, fStartTime), fEndTime)); long clampedEndTime = (fEndTime == Long.MIN_VALUE ? endTime : Math.max(Math.min(endTime, fEndTime), fStartTime)); fDirty.incrementAndGet(); boolean restart = false; ZoomThread zoomThread = fZoomThread; if (zoomThread != null) { zoomThread.cancel(); if (zoomThread.fZoomStartTime == clampedStartTime && zoomThread.fZoomEndTime == clampedEndTime) { restart = true; } } long resolution = Long.max(1, (clampedEndTime - clampedStartTime) / getTimeGraphViewer().getTimeSpace()); zoomThread = createZoomThread(clampedStartTime, clampedEndTime, resolution, restart); fZoomThread = zoomThread; if (zoomThread != null) { zoomThread.setScopeId(log.getId()); synchronized (fZoomThreadResultLock) { zoomThread.start(); fDirty.incrementAndGet(); } } } finally { if (fDirty.decrementAndGet() < 0) { Activator.getDefault().logError(DIRTY_UNDERFLOW_ERROR, new Throwable()); } } }

Target:
protected final void startZoomThread(long startTime, long endTime) { try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:ZoomThreadCreated").setCategory(getViewId()).build()) { long clampedStartTime = (fStartTime == Long.MAX_VALUE ? startTime : Math.min(Math.max(startTime, fStartTime), fEndTime)); long clampedEndTime = (fEndTime == Long.MIN_VALUE ? endTime : Math.max(Math.min(endTime, fEndTime), fStartTime)); fDirty.incrementAndGet(); boolean restart = false; ZoomThread zoomThread = fZoomThread; if (zoomThread != null) { zoomThread.cancel(); if (zoomThread.fZoomStartTime == clampedStartTime && zoomThread.fZoomEndTime == clampedEndTime) { restart = true; } } int timeSpace = getTimeGraphViewer().getTimeSpace(); if (timeSpace > 0) { long resolution = Long.max(1, (clampedEndTime - clampedStartTime) / timeSpace); zoomThread = createZoomThread(clampedStartTime, clampedEndTime, resolution, restart); } else { zoomThread = null; } fZoomThread = zoomThread; if (zoomThread != null) { zoomThread.setScopeId(log.getId()); synchronized (fZoomThreadResultLock) { zoomThread.start(); fDirty.incrementAndGet(); } } } finally { if (fDirty.decrementAndGet() < 0) { Activator.getDefault().logError(DIRTY_UNDERFLOW_ERROR, new Throwable()); } } }
Source:
public void apply(DirCacheEntry ent) { ObjectInserter inserter = repo.newObjectInserter(); if (ent.getFileMode() != FileMode.REGULAR_FILE) ent.setFileMode(FileMode.REGULAR_FILE); ent.setLastModified(System.currentTimeMillis()); try { Attributes attr = LfsFactory.getAttributesForPath(repo, ent.getPathString()); try (LfsInputStream lfs = LfsFactory.getInstance() .applyCleanFilter(repo, new ByteArrayInputStream(content.array(), 0, content.limit()), content.limit(), attr.get(Constants.ATTR_MERGE))) { ent.setLength(lfs.getLength()); ent.setObjectId(inserter.insert(Constants.OBJ_BLOB, lfs.getLength(), lfs)); inserter.flush(); } } catch (IOException ex) { throw new RuntimeException(ex); } }

Target:
public void apply(DirCacheEntry ent) { ObjectInserter inserter = repo.newObjectInserter(); if (ent.getFileMode() != FileMode.REGULAR_FILE) ent.setFileMode(FileMode.REGULAR_FILE); ent.setLength(content.limit()); ent.setLastModified(System.currentTimeMillis()); try { ByteArrayInputStream in = new ByteArrayInputStream( content.array(), 0, content.limit()); ent.setObjectId( inserter.insert(Constants.OBJ_BLOB, content.limit(), in)); inserter.flush(); } catch (IOException ex) { throw new RuntimeException(ex); } }
Source:
public List<TmfAnalysisOutputElement> getAvailableOutputs() { List<TmfAnalysisOutputElement> list = new ArrayList<TmfAnalysisOutputElement>(); IAnalysisModuleHelper helper = TmfAnalysisManager.getAnalysisModule(fAnalysisId); if (helper == null) { return list; } IPath path = getProject().getTracesFolder().getPath(); if (fResource instanceof IFolder) { path = ((IFolder) fResource).getFullPath(); } ITmfProjectModelElement parent = getParent(); if (parent instanceof TmfTraceElement) { ITmfTrace trace = ((TmfTraceElement) parent).getTrace(); if (trace != null) { IAnalysisModule module = trace.getAnalysisModule(fAnalysisId); for (IAnalysisOutput output : module.getOutputs()) { if (fResource instanceof IFolder) { IFolder newresource = ResourcesPlugin.getWorkspace().getRoot().getFolder(path.append(output.getName())); TmfAnalysisOutputElement out = new TmfAnalysisOutputElement(output.getName(), newresource, this, output); list.add(out); } } } } return list; }

Target:
public List<TmfAnalysisOutputElement> getAvailableOutputs() { List<TmfAnalysisOutputElement> list = new ArrayList<TmfAnalysisOutputElement>(); IAnalysisModuleHelper helper = TmfAnalysisManager.getAnalysisModule(fAnalysisId); if (helper == null) { return list; } IPath path = getProject().getTracesFolder().getPath(); if (fResource instanceof IFolder) { path = ((IFolder) fResource).getFullPath(); } ITmfProjectModelElement parent = getParent(); if (parent instanceof TmfTraceElement) { ITmfTrace trace = ((TmfTraceElement) parent).getTrace(); if (trace == null) { return list; } IAnalysisModule module = trace.getAnalysisModule(fAnalysisId); if (module == null) { return list; } for (IAnalysisOutput output : module.getOutputs()) { if (fResource instanceof IFolder) { IFolder newresource = ResourcesPlugin.getWorkspace().getRoot().getFolder(path.append(output.getName())); TmfAnalysisOutputElement out = new TmfAnalysisOutputElement(output.getName(), newresource, this, output); list.add(out); } } } return list; }
Source:
public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException { Jenkins j = Jenkins.getInstance(); j.checkPermission(Jenkins.ADMINISTER); j.setDisableRememberMe(json.optBoolean("disableRememberMe", false)); j.setSecurityRealm(SecurityRealm.all().newInstanceFromRadioList(json, "realm")); j.setAuthorizationStrategy(AuthorizationStrategy.all().newInstanceFromRadioList(json, "authorization")); if (json.has("markupFormatter")) { j.setMarkupFormatter(req.bindJSON(MarkupFormatter.class, json.getJSONObject("markupFormatter"))); } else { j.setMarkupFormatter(null); } if (!isSlaveAgentPortEnforced()) { try { j.setSlaveAgentPort(new ServerTcpPort(json.getJSONObject("slaveAgentPort")).getPort()); } catch (IOException e) { throw new hudson.model.Descriptor.FormException(e, "slaveAgentPortType"); } } Set<String> agentProtocols = new TreeSet<>(); if (json.has("agentProtocol")) { Object protocols = json.get("agentProtocol"); if (protocols instanceof JSONArray) { for (int i = 0; i < ((JSONArray) protocols).size(); i++) { agentProtocols.add(((JSONArray) protocols).getString(i)); } } else { agentProtocols.add(protocols.toString()); } } j.setAgentProtocols(agentProtocols); boolean result = true; for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)){ result &= configureDescriptor(req,json,d); } return result; }

Target:
public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException { Jenkins j = Jenkins.get(); j.checkPermission(Jenkins.ADMINISTER); j.setDisableRememberMe(json.optBoolean("disableRememberMe", false)); j.setSecurityRealm(SecurityRealm.all().newInstanceFromRadioList(json, "realm")); j.setAuthorizationStrategy(AuthorizationStrategy.all().newInstanceFromRadioList(json, "authorization")); if (json.has("markupFormatter")) { j.setMarkupFormatter(req.bindJSON(MarkupFormatter.class, json.getJSONObject("markupFormatter"))); } else { j.setMarkupFormatter(null); } if (!isSlaveAgentPortEnforced()) { try { j.setSlaveAgentPort(new ServerTcpPort(json.getJSONObject("slaveAgentPort")).getPort()); } catch (IOException e) { throw new hudson.model.Descriptor.FormException(e, "slaveAgentPortType"); } } Set<String> agentProtocols = new TreeSet<>(); if (json.has("agentProtocol")) { Object protocols = json.get("agentProtocol"); if (protocols instanceof JSONArray) { for (int i = 0; i < ((JSONArray) protocols).size(); i++) { agentProtocols.add(((JSONArray) protocols).getString(i)); } } else { agentProtocols.add(protocols.toString()); } } j.setAgentProtocols(agentProtocols); boolean result = true; for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)){ result &= configureDescriptor(req,json,d); } return result; }
Source:
public Collection<KeyValueAnnotation> requestAnnotations() { KeyValueAnnotation uriAnnotation = KeyValueAnnotation.create( "http.uri", serverRequest.getUri().toString()); return Arrays.asList(uriAnnotation); }

Target:
public Collection<KeyValueAnnotation> requestAnnotations() { KeyValueAnnotation uriAnnotation = KeyValueAnnotation.create( TraceKeys.HTTP_URL, serverRequest.getUri().toString()); return Arrays.asList(uriAnnotation); }
Source:
public boolean onTouch(View v, MotionEvent event) { if (scrollView != null) { fixScrollEventY(event); scrollView.onTouchEvent(event); } return false; }

Target:
public boolean onTouch(View v, MotionEvent event) { return mSwipeTouchListenerStrategy.onTouch(scrollView, gestureDetector, event); }
Source:
protected FileHeader getNewHeader( FileHeader oldHeader ) { FileHeader result = new FileHeader(); FileHeader newHeader = getFileHeader(); FileHeaderTransformer transformer = getTransformer(); boolean modified = false; result.setDescription( oldHeader.getDescription() ); result.setCopyright( new Copyright( oldHeader.getCopyright() ) ); result.setLicense( oldHeader.getLicense() ); if ( isUpdateDescription() && !transformer.isDescriptionEquals( oldHeader, newHeader ) ) { LOG.debug( "description has changed from to [{}]", oldHeader.getDescription(), newHeader.getDescription() ); modified = true; result.setDescription( newHeader.getDescription() ); } if ( isUpdateCopyright() && !transformer.isCopyrightEquals( oldHeader, newHeader ) ) { LOG.debug( "copyright has changed from to []", oldHeader.getCopyright(), newHeader.getCopyright() ); modified = true; result.setCopyright( new Copyright( newHeader.getCopyright() ) ); } if ( isUpdateLicense() && !transformer.isLicenseEquals( oldHeader, newHeader ) ) { LOG.debug( "license has changed from to [{}]", oldHeader.getLicense(), newHeader.getLicense() ); modified = true; result.setLicense( newHeader.getLicense() ); } if ( !modified ) { result = null; } return result; }

Target:
protected FileHeader getNewHeader( FileHeader oldHeader ) { FileHeader result = new FileHeader(); FileHeader newHeader = getFileHeader(); FileHeaderTransformer transformer = getTransformer(); boolean modified = false; result.setDescription( oldHeader.getDescription() ); result.setCopyright( new Copyright( oldHeader.getCopyright() ) ); result.setLicense( oldHeader.getLicense() ); if ( isUpdateDescription() && !transformer.isDescriptionEquals( oldHeader, newHeader ) ) { LOG.debug( "description has changed from to [{}]", oldHeader.getDescription(), newHeader.getDescription() ); modified = true; result.setDescription( newHeader.getDescription() ); } if ( isUpdateCopyright() && !transformer.isCopyrightEquals( oldHeader, newHeader ) ) { LOG.debug( "copyright has changed from to [{}]", oldHeader.getCopyright(), newHeader.getCopyright() ); modified = true; result.setCopyright( new Copyright( newHeader.getCopyright() ) ); } if ( isUpdateLicense() && !transformer.isLicenseEquals( oldHeader, newHeader ) ) { LOG.debug( "license has changed from to [{}]", oldHeader.getLicense(), newHeader.getLicense() ); modified = true; result.setLicense( newHeader.getLicense() ); } if ( !modified ) { result = null; } return result; }
Source:
public static AnalyzedTokenInfo map(com.azure.search.documents.implementation.models.AnalyzedTokenInfo obj) { if (obj == null) { return null; } AnalyzedTokenInfo analyzedTokenInfo = new AnalyzedTokenInfo(); int _endOffset = obj.getEndOffset(); PrivateFieldAccessHelper.set(analyzedTokenInfo, "endOffset", _endOffset); int _startOffset = obj.getStartOffset(); PrivateFieldAccessHelper.set(analyzedTokenInfo, "startOffset", _startOffset); int _position = obj.getPosition(); PrivateFieldAccessHelper.set(analyzedTokenInfo, "position", _position); String _token = obj.getToken(); PrivateFieldAccessHelper.set(analyzedTokenInfo, "token", _token); return analyzedTokenInfo; }

Target:
public static AnalyzedTokenInfo map(com.azure.search.documents.implementation.models.AnalyzedTokenInfo obj) { if (obj == null) { return null; } AnalyzedTokenInfo analyzedTokenInfo = new AnalyzedTokenInfo(); int endOffset = obj.getEndOffset(); PrivateFieldAccessHelper.set(analyzedTokenInfo, "endOffset", endOffset); int startOffset = obj.getStartOffset(); PrivateFieldAccessHelper.set(analyzedTokenInfo, "startOffset", startOffset); int position = obj.getPosition(); PrivateFieldAccessHelper.set(analyzedTokenInfo, "position", position); String token = obj.getToken(); PrivateFieldAccessHelper.set(analyzedTokenInfo, "token", token); return analyzedTokenInfo; }
Source:
default <U> Validation<E, U> ap(Validation<E, ? extends Function<? super T, ? extends U>> validation) { Objects.requireNonNull(validation, "validation is null"); if (isValid()) { if (validation.isValid()) { final Function<? super T, ? extends U> f = validation.get(); final U u = f.apply(this.get()); return valid(u); } else { final Seq<? extends E> errors = validation.getErrors(); return invalid(errors); } } else { if (validation.isValid()) { final Seq<? extends E> errors = this.getErrors(); return invalid(errors); } else { final Seq<? extends E> errors1 = validation.getErrors(); final Seq<? extends E> errors2 = this.getErrors(); Seq<E> specificErrors = List.ofAll(errors1); Seq<E> finalErrors = specificErrors.appendAll(errors2); return invalid(finalErrors); } } }

Target:
default <U> Validation<E, U> ap(Validation<E, ? extends Function<? super T, ? extends U>> validation) { Objects.requireNonNull(validation, "validation is null"); if (isValid()) { if (validation.isValid()) { final Function<? super T, ? extends U> f = validation.get(); final U u = f.apply(this.get()); return valid(u); } else { final Seq<E> errors = validation.getErrors(); return invalid(errors); } } else { if (validation.isValid()) { final Seq<E> errors = this.getErrors(); return invalid(errors); } else { Seq<E> specificErrors = List.ofAll(validation.getErrors()); Seq<E> finalErrors = specificErrors.appendAll(this.getErrors()); return invalid(finalErrors); } } }
Source:
private File createWindowsGitSSH(File key, String user) throws IOException { File ssh = createTempFile("ssh", ".bat"); File sshexe = getSSHExecutable(); try (PrintWriter w = new PrintWriter(ssh, this.encoding)) { w.println("@echo off"); w.println("\"" + sshexe.getAbsolutePath() + "\" -i \"" + key.getAbsolutePath() +"\" -l \"" + user + "\" -o StrictHostKeyChecking=no %* "); } ssh.setExecutable(true, true); return ssh; }

Target:
private File createWindowsGitSSH(File key, String user) throws IOException { File ssh = createTempFile("ssh", ".bat"); File sshexe = getSSHExecutable(); try (PrintWriter w = new PrintWriter(ssh, encoding)) { w.println("@echo off"); w.println("\"" + sshexe.getAbsolutePath() + "\" -i \"" + key.getAbsolutePath() +"\" -l \"" + user + "\" -o StrictHostKeyChecking=no %* "); } ssh.setExecutable(true, true); return ssh; }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((m_nodeId == null) ? 0 : m_nodeId.hashCode()); result = prime * result + ((getNamespace() == null) ? 0 : getNamespace().hashCode()); return result; }

Target:
public int hashCode() { return Objects.hash(m_nodeId, m_namespace); }
Source:
private boolean needPack(Collection<ReceiveCommand> commands) { for (final ReceiveCommand cmd : commands) { if (cmd.getType() != ReceiveCommand.Type.DELETE) return true; } return false; }

Target:
private boolean needPack(Collection<ReceiveCommand> commands) { for (ReceiveCommand cmd : commands) { if (cmd.getType() != ReceiveCommand.Type.DELETE) return true; } return false; }
Source:
public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!deCompMap.containsKey(name) || deCompMap.get(name) == DecompressorType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.BYTES) { obj = in.get(name); } else { LOG.error("Input field '" + name + "' should be of type BYTES to decompress. It's currently of type" + "'" + field.getSchema().getType().toString()); break; } byte[] outValue = new byte[0]; DecompressorType type = deCompMap.get(name); if (type == DecompressorType.SNAPPY) { outValue = Snappy.uncompress(obj); } else if (type == DecompressorType.ZIP) { outValue = unzip(obj); } else if (type == DecompressorType.GZIP) { outValue = ungzip(obj); } if (outValue != null) { if (outFieldType == Schema.Type.BYTES) { builder.set(name, outValue); } else if (outFieldType == Schema.Type.STRING) { builder.set(name, new String(outValue, "UTF-8")); } } } } emitter.emit(builder.build()); }

Target:
public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!deCompMap.containsKey(name) || deCompMap.get(name) == DecompressorType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.BYTES) { obj = in.get(name); } else { LOG.error("Input field '" + name + "' should be of type BYTES to decompress. It is currently of type " + "'" + field.getSchema().getType().toString() + "'"); break; } byte[] outValue = new byte[0]; DecompressorType type = deCompMap.get(name); if (type == DecompressorType.SNAPPY) { outValue = Snappy.uncompress(obj); } else if (type == DecompressorType.ZIP) { outValue = unzip(obj); } else if (type == DecompressorType.GZIP) { outValue = ungzip(obj); } if (outValue != null) { if (outFieldType == Schema.Type.BYTES) { builder.set(name, outValue); } else if (outFieldType == Schema.Type.STRING) { builder.set(name, new String(outValue, "UTF-8")); } } } } emitter.emit(builder.build()); }
Source:
public void testRunStreamTask() throws Exception { final Map<String, String> config = new HashMap<>(); config.put(ApplicationConfig.APP_PROCESSOR_ID_GENERATOR_CLASS, UUIDGenerator.class.getName()); config.put(TaskConfig.TASK_CLASS(), "org.apache.samza.test.processor.IdentityStreamTask"); LocalApplicationRunner runner = new LocalApplicationRunner(new MapConfig(config)); StreamProcessor sp = mock(StreamProcessor.class); ArgumentCaptor<StreamProcessorLifecycleListener> captor = ArgumentCaptor.forClass(StreamProcessorLifecycleListener.class); doAnswer(i -> { StreamProcessorLifecycleListener listener = captor.getValue(); listener.onStart(); listener.onShutdown(); return null; }).when(sp).start(); LocalApplicationRunner spy = spy(runner); doReturn(sp).when(spy).createStreamProcessor(anyObject(), anyObject(), captor.capture()); spy.run(null); assertEquals(ApplicationStatus.SuccessfulFinish, spy.status(null)); }

Target:
public void testRunStreamTask() throws Exception { final Map<String, String> config = new HashMap<>(); config.put(ApplicationConfig.APP_PROCESSOR_ID_GENERATOR_CLASS, UUIDGenerator.class.getName()); config.put(TaskConfig.TASK_CLASS(), "org.apache.samza.test.processor.IdentityStreamTask"); LocalApplicationRunner runner = new LocalApplicationRunner(new MapConfig(config)); StreamProcessor sp = mock(StreamProcessor.class); ArgumentCaptor<StreamProcessorLifecycleListener> captor = ArgumentCaptor.forClass(StreamProcessorLifecycleListener.class); doAnswer(i -> { StreamProcessorLifecycleListener listener = captor.getValue(); listener.onStart(); listener.onShutdown(); return null; }).when(sp).start(); LocalApplicationRunner spy = spy(runner); doReturn(sp).when(spy).createStreamProcessor(anyObject(), anyObject(), captor.capture()); spy.runTask(); assertEquals(ApplicationStatus.SuccessfulFinish, spy.status(null)); }
Source:
public void lowerBound() { Map<String, TrackingToken> newTokens = new HashMap<>(); newTokens.put("token1", new GlobalSequenceTrackingToken(1)); newTokens.put("token2", new GlobalSequenceTrackingToken(2)); Map<String, TrackingToken> expectedTokens = new HashMap<>(); expectedTokens.put("token1", new GlobalSequenceTrackingToken(0)); expectedTokens.put("token2", new GlobalSequenceTrackingToken(0)); ; MultiSourceTrackingToken newMultiToken = (MultiSourceTrackingToken) testSubject .lowerBound(new MultiSourceTrackingToken(newTokens)); assertEquals(new MultiSourceTrackingToken(expectedTokens), newMultiToken); }

Target:
public void lowerBound() { Map<String, TrackingToken> newTokens = new HashMap<>(); newTokens.put("token1", new GlobalSequenceTrackingToken(1)); newTokens.put("token2", new GlobalSequenceTrackingToken(2)); Map<String, TrackingToken> expectedTokens = new HashMap<>(); expectedTokens.put("token1", new GlobalSequenceTrackingToken(0)); expectedTokens.put("token2", new GlobalSequenceTrackingToken(0)); MultiSourceTrackingToken newMultiToken = (MultiSourceTrackingToken) testSubject .lowerBound(new MultiSourceTrackingToken(newTokens)); assertEquals(new MultiSourceTrackingToken(expectedTokens), newMultiToken); }
Source:
private Message getMessage(TopicPartition topicPartition, long offset, SimpleConsumer consumer) { LOG.debug("fetching message topic partition offset {}", topicPartition.getTopic(), topicPartition.getPartition(), offset); final int MAX_MESSAGE_SIZE_BYTES = mConfig.getMaxMessageSizeBytes(); final String clientName = getClientName(topicPartition); kafka.api.FetchRequest request = new FetchRequestBuilder().clientId(clientName) .addFetch(topicPartition.getTopic(), topicPartition.getPartition(), offset, MAX_MESSAGE_SIZE_BYTES) .build(); FetchResponse response = consumer.fetch(request); if (response.hasError()) { consumer.close(); throw new RuntimeException("Error fetching offset data. Reason: " + response.errorCode(topicPartition.getTopic(), topicPartition.getPartition())); } MessageAndOffset messageAndOffset = response.messageSet( topicPartition.getTopic(), topicPartition.getPartition()).iterator().next(); byte[] keyBytes = null; if (messageAndOffset.message().hasKey()) { ByteBuffer key = messageAndOffset.message().key(); keyBytes = new byte[key.limit()]; key.get(keyBytes); } byte[] payloadBytes = null; if (!messageAndOffset.message().isNull()) { ByteBuffer payload = messageAndOffset.message().payload(); payloadBytes = new byte[payload.limit()]; payload.get(payloadBytes); } Long timestamp = null; if (mConfig.useKafkaTimestamp()) { timestamp = mKafkaMessageTimestampFactory.create(mKafkaTimestampClassName).getTimestamp(messageAndOffset); } return new Message(topicPartition.getTopic(), topicPartition.getPartition(), messageAndOffset.offset(), keyBytes, payloadBytes, timestamp); }

Target:
private Message getMessage(TopicPartition topicPartition, long offset, SimpleConsumer consumer) { LOG.debug("fetching message topic partition offset {}", topicPartition.getTopic(), topicPartition.getPartition(), offset); final int MAX_MESSAGE_SIZE_BYTES = mConfig.getMaxMessageSizeBytes(); final String clientName = getClientName(topicPartition); kafka.api.FetchRequest request = new FetchRequestBuilder().clientId(clientName) .addFetch(topicPartition.getTopic(), topicPartition.getPartition(), offset, MAX_MESSAGE_SIZE_BYTES) .build(); FetchResponse response = consumer.fetch(request); if (response.hasError()) { consumer.close(); throw new RuntimeException("Error fetching offset data. Reason: " + response.errorCode(topicPartition.getTopic(), topicPartition.getPartition())); } MessageAndOffset messageAndOffset = response.messageSet( topicPartition.getTopic(), topicPartition.getPartition()).iterator().next(); byte[] keyBytes = null; if (messageAndOffset.message().hasKey()) { ByteBuffer key = messageAndOffset.message().key(); keyBytes = new byte[key.limit()]; key.get(keyBytes); } byte[] payloadBytes = null; if (!messageAndOffset.message().isNull()) { ByteBuffer payload = messageAndOffset.message().payload(); payloadBytes = new byte[payload.limit()]; payload.get(payloadBytes); } long timestamp = (mConfig.useKafkaTimestamp()) ? mKafkaMessageTimestampFactory.getKafkaMessageTimestamp().getTimestamp(messageAndOffset) : 0l; return new Message(topicPartition.getTopic(), topicPartition.getPartition(), messageAndOffset.offset(), keyBytes, payloadBytes, timestamp); }
Source:
public GlusterServer mapRow(ResultSet rs, int rowNum) throws SQLException { GlusterServer glusterServer = new GlusterServer(); glusterServer.setId(getGuidDefaultEmpty(rs, "server_id")); glusterServer.setGlusterServerUuid(getGuidDefaultEmpty(rs, "gluster_server_uuid")); String knownAddresses = rs.getString("known_addresses"); if (!StringUtils.isBlank(knownAddresses)) { String[] knownAddressArray = knownAddresses.split(","); ArrayList<String> knownAddressList = new ArrayList<>(); for (String addr : knownAddressArray) { knownAddressList.add(addr); } glusterServer.setKnownAddresses(knownAddressList); } return glusterServer; }

Target:
public GlusterServer mapRow(ResultSet rs, int rowNum) throws SQLException { GlusterServer glusterServer = new GlusterServer(); glusterServer.setId(getGuidDefaultEmpty(rs, "server_id")); glusterServer.setGlusterServerUuid(getGuidDefaultEmpty(rs, "gluster_server_uuid")); String knownAddresses = rs.getString("known_addresses"); if (StringUtils.isNotBlank(knownAddresses)) { String[] knownAddressArray = knownAddresses.split(","); ArrayList<String> knownAddressList = new ArrayList<>(); for (String addr : knownAddressArray) { knownAddressList.add(addr); } glusterServer.setKnownAddresses(knownAddressList); } return glusterServer; }
Source:
public Scan getScan() { return scan; }

Target:
public Scan getScan() { try { return new Scan(scan); } catch(IOException e) { throw new AssertionError("Scan should not throw IOException anymore", e); } }
Source:
public void testAdd() throws OseeCoreException { MockJoinAccessor joinAccessor = new MockJoinAccessor(); TransactionJoinQuery join = new TransactionJoinQuery(joinAccessor, -1L, 999); Assert.assertEquals(0, join.size()); Assert.assertEquals(true, join.isEmpty()); join.add(1234L, 5678); Assert.assertEquals(1, join.size()); Assert.assertEquals(false, join.isEmpty()); join.add(1234L, 5678); Assert.assertEquals(1, join.size()); Assert.assertEquals(false, join.wasStored()); join.store(); Assert.assertEquals(true, join.wasStored()); Assert.assertNull(joinAccessor.getConnection()); Assert.assertEquals(999, joinAccessor.getQueryId()); List<Object[]> data = joinAccessor.getDataList(); Assert.assertEquals(1, data.size()); Object[] entry = data.get(0); Assert.assertEquals(3, entry.length); Assert.assertEquals(999, entry[0]); Assert.assertEquals(1234L, entry[1]); Assert.assertEquals(5678, entry[2]); }

Target:
public void testAdd() throws OseeCoreException { MockJoinAccessor joinAccessor = new MockJoinAccessor(); TransactionJoinQuery join = new TransactionJoinQuery(joinAccessor, -1L, 999); Assert.assertEquals(0, join.size()); Assert.assertEquals(true, join.isEmpty()); join.add(1234L, 5678); Assert.assertEquals(1, join.size()); Assert.assertEquals(false, join.isEmpty()); join.add(1234L, 5678); Assert.assertEquals(1, join.size()); Assert.assertEquals(false, join.wasStored()); join.store(); Assert.assertEquals(true, join.wasStored()); Assert.assertNull(joinAccessor.getConnection()); Assert.assertEquals(999, joinAccessor.getQueryId()); List<Object[]> data = joinAccessor.getDataList(); Assert.assertEquals(1, data.size()); Object[] entry = data.get(0); Assert.assertEquals(4, entry.length); Assert.assertEquals(999, entry[0]); Assert.assertEquals(1234L, entry[1]); Assert.assertEquals(5678, entry[2]); Assert.assertEquals(SQL3DataType.BIGINT, entry[3]); }
Source:
public void testFailJoiningNodeDifferentSchemasOnDynamicIndexes() throws Exception { prepareTestGrid(); IgniteEx ig = startGrid(1); ig.cluster().state(ClusterState.ACTIVE); createTable(ig.cache(POI_CACHE_NAME), WRONG_SCHEMA_NAME); try { startGrid(0); fail("Node should start with fail"); } catch (Exception e) { assertThat(X.cause(e, IgniteSpiException.class).getMessage(), containsString("Failed to join node to the active cluster")); } }

Target:
public void testFailJoiningNodeDifferentSchemasOnDynamicIndexes() throws Exception { prepareTestGrid(); IgniteEx ig = startGrid(1); ig.cluster().state(ClusterState.ACTIVE); createTable(ig.cache(POI_CACHE_NAME), WRONG_SCHEMA_NAME, CacheConfiguration.DFLT_QUERY_PARALLELISM); try { startGrid(0); fail("Node should start with fail"); } catch (Exception e) { assertThat(X.cause(e, IgniteSpiException.class).getMessage(), containsString("schema 'DOMAIN' from joining node differs to 'DOMAIN_1'")); } }
Source:
public void testP2PStateTransitionEnabled() { enableP2PInCluster(CLUSTER_NAME, _configAccessor, true); long startTime = System.currentTimeMillis(); MockHelixTaskExecutor.resetStats(); for (String ins : _instances) { _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, false); Assert.assertTrue(_clusterVerifier.verifyByPolling()); verifyP2PEnabled(startTime); _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, true); Assert.assertTrue(_clusterVerifier.verifyByPolling()); verifyP2PEnabled(startTime); } double ratio = ((double) p2pTrigged) / ((double) total); Assert.assertTrue(ratio == 1, String .format("Only %d out of %d percent transitions to Master were triggered by expected host!", p2pTrigged, total)); Assert.assertEquals(MockHelixTaskExecutor.duplicatedMessagesInProgress, 0, "There are duplicated transition messages sent while participant is handling the state-transition!"); Assert.assertEquals(MockHelixTaskExecutor.duplicatedMessages, 0, "There are duplicated transition messages sent at same time!"); }

Target:
public void testP2PStateTransitionEnabled() { enableP2PInCluster(CLUSTER_NAME, _configAccessor, true); long startTime = System.currentTimeMillis(); MockHelixTaskExecutor.resetStats(); for (String ins : _instances) { _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, false); Assert.assertTrue(_clusterVerifier.verifyByPolling()); verifyP2PEnabled(startTime); _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, true); Assert.assertTrue(_clusterVerifier.verifyByPolling()); verifyP2PEnabled(startTime); } Assert.assertEquals(p2pTrigged, total); Assert.assertEquals(MockHelixTaskExecutor.duplicatedMessagesInProgress, 0, "There are duplicated transition messages sent while participant is handling the state-transition!"); Assert.assertEquals(MockHelixTaskExecutor.duplicatedMessages, 0, "There are duplicated transition messages sent at same time!"); }
Source:
public void testSetProperties() throws Exception { CrateConnection conn = new CrateConnection(clientHandle()); conn.connect(); Properties properties = new Properties(); properties.setProperty("prop1", "value1"); properties.setProperty("prop2", "value2"); conn.setClientInfo(properties); assertThat(conn.getClientInfo().size(), is(2)); conn.setClientInfo(new Properties()); assertThat(conn.getClientInfo().size(), is(0)); conn.setClientInfo("prop1", "value1"); conn.setClientInfo("prop2", "value2"); conn.setClientInfo("prop1", null); assertThat(conn.getClientInfo().size(), is(1)); conn.close(); try { conn.setClientInfo(properties); fail("This line should not be reached. The connection must be open to set properties"); } catch (Throwable e) { assertEquals(e.getClass(), SQLClientInfoException.class); } }

Target:
public void testSetProperties() throws Exception { CrateConnection conn = new CrateConnection(clientHandle()); conn.connect(); Properties properties = new Properties(); properties.setProperty("prop1", "value1"); properties.setProperty("prop2", "value2"); conn.setClientInfo(properties); assertThat(conn.getClientInfo().size(), is(2)); conn.setClientInfo(new Properties()); assertThat(conn.getClientInfo().size(), is(0)); conn.setClientInfo("prop1", "value1"); conn.setClientInfo("prop2", "value2"); conn.setClientInfo("prop1", null); assertThat(conn.getClientInfo().size(), is(1)); conn.close(); }
Source:
public void clickOnVideoCloseButton() { scrollToAdsElement(videoCloseButton(slotName), 60); videoCloseButton(slotName).click(); PageObjectLogging.log("clickOnVideoCloseButton", "close video button clicked", true, driver); }

Target:
public void clickOnVideoCloseButton() { scrollToAdVideo(getVideoCloseButton(slotName)); getVideoCloseButton(slotName).click(); PageObjectLogging.log("clickOnVideoCloseButton", "close video button clicked", true, driver); }
Source:
void on(@Where(field = "head.value", equals = "42") Organization organization) { fail(FilteredStateSubscriberWhere.class.getSimpleName() + " should not be able to receive any updates."); }

Target:
void on( @Where(field = "head.value", equals = "42") Organization organization) { halt(); }
Source:
public int hashCode() { return layout.hashCode(); }

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (layout != null ? layout.hashCode() : 0); return result; }
Source:
public String update(Request request, Response response)throws IOException { String configId = request.params(CONFIG_ID_PARAM); SecretConfig oldSecretConfig = fetchEntityFromConfig(configId); SecretConfig newSecretConfig = buildEntityFromRequestBody(request); if (isRenameAttempt(oldSecretConfig.getId(), newSecretConfig.getId())) { throw haltBecauseRenameOfEntityIsNotSupported(getEntityType().getEntityNameLowerCase()); } if (isPutRequestStale(request, oldSecretConfig)) { throw haltBecauseEtagDoesNotMatch(); } final HttpLocalizedOperationResult operationResult = new HttpLocalizedOperationResult(); configService.update(currentUsername(), etagFor(newSecretConfig), newSecretConfig, operationResult); return handleCreateOrUpdateResponse(request, response, fetchEntityFromConfig(configId), operationResult); }

Target:
public String update(Request request, Response response) { String configId = request.params(CONFIG_ID_PARAM); SecretConfig oldSecretConfig = fetchEntityFromConfig(configId); SecretConfig newSecretConfig = buildEntityFromRequestBody(request); if (isRenameAttempt(oldSecretConfig.getId(), newSecretConfig.getId())) { throw haltBecauseRenameOfEntityIsNotSupported(getEntityType().getEntityNameLowerCase()); } if (isPutRequestStale(request, oldSecretConfig)) { throw haltBecauseEtagDoesNotMatch(); } final HttpLocalizedOperationResult operationResult = new HttpLocalizedOperationResult(); configService.update(currentUsername(), etagFor(newSecretConfig), newSecretConfig, operationResult); return handleCreateOrUpdateResponse(request, response, fetchEntityFromConfig(configId), operationResult); }
Source:
public SamzaSqlRelMessage convertToRelMessage(KV<Object, Object> samzaMessage) { List<String> payloadFieldNames = new ArrayList<>(); List<Object> payloadFieldValues = new ArrayList<>(); Object value = samzaMessage.getValue(); if (value instanceof IndexedRecord) { fetchFieldNamesAndValuesFromIndexedRecord((IndexedRecord) value, payloadFieldNames, payloadFieldValues, payloadSchema); } else if (value == null) { payloadFieldNames.addAll(payloadSchema.getFields().stream().map(Schema.Field::name).collect(Collectors.toList())); IntStream.range(0, payloadFieldNames.size()).forEach(x -> payloadFieldValues.add(null)); } else { String msg = "Avro message converter doesn't support messages of type " + value.getClass(); LOG.error(msg); throw new SamzaException(msg); } Object key = samzaMessage.getKey(); if (key instanceof IndexedRecord) { Validate.isTrue(keySchema != null, "key is an IndexedRecord but could not obtain schema."); List<String> keyFieldNames = new ArrayList<>(); List<Object> keyFieldValues = new ArrayList<>(); fetchFieldNamesAndValuesFromIndexedRecord((IndexedRecord) key, keyFieldNames, keyFieldValues, keySchema); key = new SamzaSqlRelRecord(keyFieldNames, keyFieldValues); } return new SamzaSqlRelMessage(key, payloadFieldNames, payloadFieldValues); }

Target:
public SamzaSqlRelMessage convertToRelMessage(KV<Object, Object> samzaMessage) { List<String> payloadFieldNames = new ArrayList<>(); List<Object> payloadFieldValues = new ArrayList<>(); Object value = samzaMessage.getValue(); if (value instanceof IndexedRecord) { fetchFieldNamesAndValuesFromIndexedRecord((IndexedRecord) value, payloadFieldNames, payloadFieldValues, payloadSchema); } else if (value == null) { payloadFieldNames.addAll(payloadSchema.getFields().stream().map(Schema.Field::name).collect(Collectors.toList())); IntStream.range(0, payloadFieldNames.size()).forEach(x -> payloadFieldValues.add(null)); } else { String msg = "Avro message converter doesn't support messages of type " + value.getClass(); LOG.error(msg); throw new SamzaException(msg); } return new SamzaSqlRelMessage(samzaMessage.getKey(), payloadFieldNames, payloadFieldValues); }
Source:
public Vector<T> prependAll(Iterable<? extends T> elements) { Objects.requireNonNull(elements, "elements is null"); if (!elements.iterator().hasNext()) { return this; } else if (isEmpty()) { return ofAll(elements); } else { Vector<T> result = this; for (T element : seq(elements).reverse()) { result = result.prepend(element); } return result; } }

Target:
public Vector<T> prependAll(Iterable<? extends T> elements) { Objects.requireNonNull(elements, "elements is null"); if (isEmpty()) { return ofAll(elements); } else { Vector<T> result = this; for (T element : seq(elements).reverse()) { result = result.prepend(element); } return result.isEmpty() ? empty() : result; } }
Source:
public void testJoin() throws Exception { Multimap<User, Article> joined = HashMultimap.create(); h.createQuery("SELECT * FROM user NATURAL JOIN author NATURAL JOIN article") .map(JoinRowMapper.forTypes(User.class, Article.class)) .forEach(jr -> joined.put(jr.get(User.class), jr.get(Article.class))); Multimap<User, Article> expected = HashMultimap.create(); expected.put(u(1), a(2)); expected.put(u(3), a(1)); expected.put(u(3), a(3)); assertThat(joined, is(expected)); }

Target:
public void testJoin() throws Exception { Multimap<User, Article> joined = HashMultimap.create(); h.createQuery("SELECT * FROM user NATURAL JOIN author NATURAL JOIN article") .map(JoinRowMapper.forTypes(User.class, Article.class)) .forEach(jr -> joined.put(jr.get(User.class), jr.get(Article.class))); assertThat(joined, is(getExpected())); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mediaFiles == null) ? 0 : mediaFiles.hashCode()); result = prime * result + order; result = prime * result + ((orderlabel == null) ? 0 : orderlabel.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mediaFiles == null) ? 0 : mediaFiles.hashCode()); result = prime * result + order; result = prime * result + ((orderlabel == null) ? 0 : orderlabel.hashCode()); result = prime * result + (Objects.isNull(type) ? 0 : type.hashCode()); return result; }
Source:
CompletableFuture<Void> closeAsync(Throwable cause) { if (!isReleasing()) { state = TaskSlotState.RELEASING; if (!isEmpty()) { tasks.values().forEach(task -> task.failExternally(cause)); } final CompletableFuture<Void> cleanupFuture = FutureUtils .waitForAll(tasks.values().stream().map(TaskSlotPayload::getTerminationFuture).collect(Collectors.toList())) .thenRun(memoryManager::shutdown); verifyAllManagedMemoryIsReleasedAfter(cleanupFuture); FutureUtils.forward(cleanupFuture, closingFuture); } return closingFuture; }

Target:
CompletableFuture<Void> closeAsync(Throwable cause) { if (!isReleasing()) { state = TaskSlotState.RELEASING; if (!isEmpty()) { tasks.values().forEach(task -> task.failExternally(cause)); } final CompletableFuture<Void> shutdownFuture = FutureUtils .waitForAll(tasks.values().stream().map(TaskSlotPayload::getTerminationFuture).collect(Collectors.toList())) .thenRun(memoryManager::shutdown); verifyAllManagedMemoryIsReleasedAfter(shutdownFuture); FutureUtils.forward(shutdownFuture, closingFuture); } return closingFuture; }
Source:
private void markExpiredCommandAsFailure(Guid cmdId) { CommandEntity cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity != null && cmdEntity.getCommandStatus() == CommandStatus.ACTIVE) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, (-1) * cmdEntity.getCommandParameters().getLifeInMinutes()); if (cmdEntity.getCreatedAt().getTime() < cal.getTime().getTime()) { coco.updateCommandStatus(cmdId, CommandStatus.FAILED); } } }

Target:
private void markExpiredCommandAsFailure(Guid cmdId) { CommandEntity cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity != null && cmdEntity.getCommandStatus() == CommandStatus.ACTIVE) { Calendar cal = Calendar.getInstance(); Integer cmdLifeTimeInMin = cmdEntity.getCommandParameters().getLifeInMinutes(); cal.add(Calendar.MINUTE, (-1) * (cmdLifeTimeInMin == null ? Config.<Integer>getValue(ConfigValues.CoCoLifeInMinutes) : cmdLifeTimeInMin)); if (cmdEntity.getCreatedAt().getTime() < cal.getTime().getTime()) { log.info("Marking expired command as Failed: command '{}({})' that started at '{}' has been marked as Failed.", cmdEntity.getCommandParameters().getCommandType(), cmdEntity.getCommandParameters().getCommandId(), cmdEntity.getCreatedAt()); coco.updateCommandStatus(cmdId, CommandStatus.FAILED); } } }
Source:
public void testReconnectModeASYNCTwoMembers() { hazelcastFactory.newInstances(getConfig(), 2); CountDownLatch connectedLatch = new CountDownLatch(1); ClientConfig clientConfig = new ClientConfig(); clientConfig.addListenerConfig(new ListenerConfig((LifecycleListener) event -> { if (event.getState().equals(CLIENT_CONNECTED)) { connectedLatch.countDown(); } })); clientConfig.getConnectionStrategyConfig().setReconnectMode(ASYNC); HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig); assertTrue(client.getLifecycleService().isRunning()); assertOpenEventually(connectedLatch); IMap<Integer, Integer> map = client.getMap(randomMapName()); map.put(1, 5); hazelcastFactory.shutdownAllMembers(); HazelcastInstance[] instances = hazelcastFactory.newInstances(getConfig(), 2); assertTrueEventually(() -> { Set<Member> actualMembers = client.getCluster().getMembers(); Set<Member> expectedMembers = instances[0].getCluster().getMembers(); assertEquals(expectedMembers, actualMembers); }); assertTrueEventually(() -> { try { map.get(1); } catch (HazelcastClientOfflineException e) { assertTrue(false); } }); }

Target:
public void testReconnectModeASYNCTwoMembers() { hazelcastFactory.newInstances(getConfig(), 2); CountDownLatch connectedLatch = new CountDownLatch(1); ClientConfig clientConfig = new ClientConfig(); clientConfig.addListenerConfig(new ListenerConfig((LifecycleListener) event -> { if (event.getState().equals(CLIENT_CONNECTED)) { connectedLatch.countDown(); } })); clientConfig.getConnectionStrategyConfig().setReconnectMode(ASYNC); HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig); assertTrue(client.getLifecycleService().isRunning()); assertOpenEventually(connectedLatch); IMap<Integer, Integer> map = client.getMap(randomMapName()); map.put(1, 5); hazelcastFactory.shutdownAllMembers(); HazelcastInstance[] instances = hazelcastFactory.newInstances(getConfig(), 2); assertTrueEventually(() -> { Set<Member> actualMembers = client.getCluster().getMembers(); Set<Member> expectedMembers = instances[0].getCluster().getMembers(); assertEquals(expectedMembers, actualMembers); }); assertTrueEventually(() -> { try { map.get(1); } catch (HazelcastClientOfflineException e) { fail(); } }); }
Source:
public Quantifier() { this(true); normalizer = new Normalizer(); wordSplitPat = new Pattern[25]; wordSplitPat[0] = Pattern.compile("-(\\D)"); wordSplitPat[1] = Pattern.compile("(\\S)-"); wordSplitPat[2] = Pattern.compile("(\\d)-(\\d|\\.\\d)"); wordSplitPat[3] = Pattern.compile("(\\d),(\\d)"); wordSplitPat[4] = Pattern.compile("\\$(\\d)"); wordSplitPat[5] = Pattern.compile("(\\d)\\$"); wordSplitPat[6] = Pattern.compile("(\\d)%"); }

Target:
public Quantifier() { this(true); }
Source:
public void flush() throws IOException { flushCurrentLogs(); flushRotatedLogs(); }

Target:
public void flush() throws IOException { entryLogManager.flush(); }
Source:
public CoreMessage putStringProperty(final String key, final String value) { messageChanged(); checkProperties().putSimpleStringProperty(SimpleString.toSimpleString(key, getPropertyKeysPool()), SimpleString.toSimpleString(value, getPropertyValuesPool())); return this; }

Target:
public CoreMessage putStringProperty(final String key, final String value) { return putStringProperty(key(key), value(value)); }
Source:
public void refresh() { try { List<String> lines = Files.readAllLines(Paths.get(sessionCredentials), Charset.defaultCharset()); Properties props = new Properties(); for (String line : lines) { String[] tokens = line.split("="); props.put(tokens[0], tokens[1]); } sessionToken = props.getProperty("sessionToken"); accessKey = props.getProperty("accessKey"); secretKey = props.getProperty("secretKey"); } catch (IOException e) { throw new RuntimeException("cannot refresh AWS credentials", e); } }

Target:
public void refresh() { try { Properties props = new Properties(); InputStream is = new FileInputStream(new File(sessionCredentials)); props.load(is); is.close(); sessionToken = props.getProperty("sessionToken"); accessKey = props.getProperty("accessKey"); secretKey = props.getProperty("secretKey"); } catch (IOException e) { throw new RuntimeException("cannot refresh AWS credentials", e); } }
Source:
public void insertHash(long hash) { long numBlocks = bitset.length / BYTES_PER_BLOCK; long lowHash = hash >>> 32; int blockIndex = (int)(lowHash * numBlocks >> 32); int key = (int)hash; int[] mask = setMask(key); for (int i = 0; i < BITS_SET_PER_BLOCK; i++) { int value = intBuffer.get(blockIndex * (BYTES_PER_BLOCK / 4) + i); value |= mask[i]; intBuffer.put(blockIndex * (BYTES_PER_BLOCK / 4) + i, value); } }

Target:
public void insertHash(long hash) { long numBlocks = bitset.length / BYTES_PER_BLOCK; long lowHash = hash >>> 32; int blockIndex = (int)((lowHash * numBlocks) >> 32); int key = (int)hash; int[] mask = setMask(key); for (int i = 0; i < BITS_SET_PER_BLOCK; i++) { int value = intBuffer.get(blockIndex * (BYTES_PER_BLOCK / 4) + i); value |= mask[i]; intBuffer.put(blockIndex * (BYTES_PER_BLOCK / 4) + i, value); } }
Source:
List<Interval> intervalsFor(DateTime start, DateTime end) { long startMillis = millisBackToNearestBin(start); long endMillis = end.getMillis(); if(endMillis - startMillis > 31537000000l){ log.error("Cannot create intervals for a total duration greater than a year"); throw new IllegalArgumentException("Cannot create intervals for a total duration greater than a year. This is to protect us from out of memory errors"); } ImmutableList.Builder<Interval> intervals = ImmutableList.builder(); while (startMillis < endMillis) { Interval interval = new Interval(new DateTime(startMillis, DateTimeZones.UTC), new DateTime(startMillis + BIN_MILLIS - 1, DateTimeZones.UTC)); intervals.add(interval); startMillis += (BIN_MILLIS); } return intervals.build(); }

Target:
List<Interval> intervalsFor(DateTime start, DateTime end) { long startMillis = millisBackToNearestBin(start); long endMillis = end.getMillis(); if (endMillis - startMillis > MAX_ALLOWED_TOTAL_INTERVAL) { log.error("Cannot create intervals for a total duration greater than " + PeriodFormat.getDefault().print(Duration.millis(MAX_ALLOWED_TOTAL_INTERVAL).toPeriod())); throw new IllegalArgumentException( "Cannot create intervals for a total duration greater than " + PeriodFormat.getDefault().print(Duration.millis(MAX_ALLOWED_TOTAL_INTERVAL).toPeriod()) + ". This is to protect us from out of memory errors."); } ImmutableList.Builder<Interval> intervals = ImmutableList.builder(); while (startMillis < endMillis) { Interval interval = new Interval(new DateTime(startMillis, DateTimeZones.UTC), new DateTime(startMillis + BIN_MILLIS - 1, DateTimeZones.UTC)); intervals.add(interval); startMillis += (BIN_MILLIS); } return intervals.build(); }