auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Method find(final BeanInfo info) { Method foundMethod = null; boolean found = false; for (PropertyDescriptor descr : info.getPropertyDescriptors()) { if (descr.getName().equals(this.property) && (descr.getReadMethod() != null)) { foundMethod = descr.getReadMethod(); found = true; break; } } if (!found) { for (MethodDescriptor descr : info.getMethodDescriptors()) { if (descr.getName().equals(this.property) && (descr.getMethod().getParameterTypes().length == 0)) { foundMethod = descr.getMethod(); found = true; break; } } } if (found) { return foundMethod; } else { throw new IllegalArgumentException( String.format( "Object should have a getter for property '%s'", this.property ) ); } }

Target:
private Method find(final BeanInfo info) { Method found = null; for (PropertyDescriptor descr : info.getPropertyDescriptors()) { if (descr.getName().equals(this.property) && (descr.getReadMethod() != null)) { found = descr.getReadMethod(); break; } } if (found == null) { for (MethodDescriptor descr : info.getMethodDescriptors()) { if (descr.getName().equals(this.property) && (descr.getMethod().getParameterTypes().length == 0)) { found = descr.getMethod(); break; } } } if (found == null) { throw new IllegalArgumentException( String.format( "Object should have a getter for property '%s'", this.property ) ); } return found; }
Source:
public void putTicket(ImageTicket ticket) { BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest( "PUT", TICKETS_URI + ticket.getId(), HttpVersion.HTTP_1_1); StringEntity entity = new StringEntity(ImageTicketHelper.toJson(ticket), StandardCharsets.UTF_8); request.setEntity(entity); request.setHeader("content-length", String.valueOf(request.getEntity().getContentLength())); HttpEntity response = executeRequest(request); consumeEntity(response); }

Target:
public void putTicket(ImageTicket ticket) { BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest( "PUT", TICKETS_URI + ticket.getId(), HttpVersion.HTTP_1_1); StringEntity entity = new StringEntity(new Gson().toJson(ticket.toDict()), StandardCharsets.UTF_8); request.setEntity(entity); request.setHeader("content-length", String.valueOf(entity.getContentLength())); HttpEntity response = executeRequest(request); consumeResponse(response); }
Source:
private void showTotalTime(final TimeAcctAllocation alloc) { final TimeAcctAward a = alloc.getSum(); ui.getTotalAwardLabel() .setText(nf_dec.format(a.getTotalHours())); ui.getProgramAwardLabel().setText(nf_dec.format(a.getProgramHours())); ui.getPartnerAwardLabel().setText(nf_dec.format(a.getPartnerHours())); }

Target:
private void showTotalTime(final TimeAcctAllocation alloc) { final TimeAcctAward a = alloc.getSum(); ui.getTotalAwardLabel() .setText(nf.format(a.getTotalHours())); ui.getProgramAwardLabel().setText(nf.format(a.getProgramHours())); ui.getPartnerAwardLabel().setText(nf.format(a.getPartnerHours())); }
Source:
private void injectAgent() { LOG.info("pre injection"); String rootOfClass = ClassRootFinder.findClassRootOfClass(IdeaPatcher.class).substring(1); LOG.info("Injector use rootOfClass: " + rootOfClass); try { LiveInjector liveInjector = new LiveInjector(); liveInjector.inject(rootOfClass, true); } catch (Exception ex) { LOG.error("Error agent injection", ex); } LOG.info("post injection"); }

Target:
private void injectAgent() { LOG.info("Starting injection of IntelliJ-Patch"); LiveInjector liveInjector = new LiveInjector(); if (!liveInjector.isSupportedEnvironment()) { LOG.warn("Unsupported environment - agent injection only works on a sun-derived 1.6 or higher VM\""); return; } String agentSourceFile = ClassRootFinder.findClassRootOfClass(IdeaPatcher.class); LOG.info("Injector use agentSourceFile: " + agentSourceFile); if (!liveInjector.isInjectable(agentSourceFile)) { LOG.warn("Unable to inject Lombok Idea Patcher Agent as agent source is not valid"); return; } final BuildNumber currentBuild = ApplicationInfo.getInstance().getBuild(); Map<String, String> options = new HashMap<String, String>(); options.put("ideaBuild", currentBuild.asStringWithoutProductCode()); try { liveInjector.inject(agentSourceFile, options); } catch (Exception ex) { LOG.error("Error injecting Lombok Agent", ex); } }
Source:
public Api getApi() { if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) return null; return new Api(this); }

Target:
public Api getApi() { if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { return null; } return new Api(this); }
Source:
public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc, JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) { if (JettyAlpnSslEngineSubstitution.isAvailable()) { return isServer ? (SSLEngine) (Object) JettyAlpnSslEngineSubstitution.newServerEngine(engine, applicationNegotiator) : (SSLEngine) (Object) JettyAlpnSslEngineSubstitution.newClientEngine(engine, applicationNegotiator); } throw new RuntimeException("Unable to wrap SSLEngine of type " + engine.getClass().getName()); }

Target:
public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc, JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) { if (JettyAlpnSslEngineSubstitution.isAvailable()) { return isServer ? (SSLEngine) (Object) JettyAlpnSslEngineSubstitution.newServerEngine(engine, applicationNegotiator) : (SSLEngine) (Object) JettyAlpnSslEngineSubstitution.newClientEngine(engine, applicationNegotiator); } throw new IllegalStateException("Unable to wrap SSLEngine of type " + engine.getClass().getName()); }
Source:
public Boolean deleteCourse(String courseId) throws IOException { Map<String,String> postParams = new HashMap<>(); postParams.put("event", "delete"); String createdUrl = buildCanvasUrl("courses/" + courseId, Collections.emptyMap()); Response response = canvasMessenger.deleteFromCanvas(oauthToken, createdUrl, postParams); LOG.debug("response "+ response.toString()); if (response.getErrorHappened() || response.getResponseCode() != 200) { LOG.debug("Failed to delete course, error message: " + response.toString()); return false; } Optional<Delete> responseParsed = responseParser.parseToObject(Delete.class, response); if(responseParsed.isPresent()) { return responseParsed.get().getDelete(); } return false; }

Target:
public Boolean deleteCourse(String courseId) throws IOException { Map<String,String> postParams = new HashMap<>(); postParams.put("event", "delete"); String createdUrl = buildCanvasUrl("courses/" + courseId, Collections.emptyMap()); Response response = canvasMessenger.deleteFromCanvas(oauthToken, createdUrl, postParams); LOG.debug("response "+ response.toString()); if (response.getErrorHappened() || response.getResponseCode() != 200) { LOG.debug("Failed to delete course, error message: " + response.toString()); return false; } Optional<Delete> responseParsed = responseParser.parseToObject(Delete.class, response); return responseParsed.map(r -> r.getDelete()).orElse(false); }
Source:
private Iterable<NameKey> scan() { if (matchPrefix != null) { return projectCache.byName(matchPrefix); } else if (type == FilterType.PARENT_CANDIDATES) { SortedSet<Project.NameKey> parents = new TreeSet<Project.NameKey>(); for (NameKey pName : projectCache.all()) { ProjectState e = projectCache.get(pName); if (e == null) { continue; } ProjectState parentState = e.getParentState(); if (parentState != null && !parents.contains(parentState.getProject().getNameKey())) { ProjectControl parentCtrl = parentState.controlFor(currentUser); if (parentCtrl.isVisible() || parentCtrl.isOwner()) { parents.add(parentState.getProject().getNameKey()); } } } return parents; } else { return projectCache.all(); } }

Target:
private Iterable<NameKey> scan() { if (matchPrefix != null) { return projectCache.byName(matchPrefix); } else { return projectCache.all(); } }
Source:
private void handlePutRequest(Request request) throws IOException { try { PutRequest putRequest = PutRequest.readFrom(new DataInputStream(request.getInputStream())); MessageFormatInputStream stream = new MessageFormatInputStream(new BlobId(putRequest.getBlobId()), putRequest.getBlobProperties(), putRequest.getUsermetadata(), putRequest.getData(), putRequest.getBlobProperties().getBlobSize()); MessageInfo info = new MessageInfo(new BlobId(putRequest.getBlobId()), stream.getSize(), putRequest.getBlobProperties().getTimeToLive()); ArrayList<MessageInfo> infoList = new ArrayList<MessageInfo>(); infoList.add(info); MessageFormatWriteSet writeset = new MessageFormatWriteSet(stream, infoList); blobStore.put(writeset); PutResponse response = new PutResponse(putRequest.getCorrelationId(), putRequest.getClientId(), (short)0); requestResponseChannel.sendResponse(response, request); } catch (StoreException e) { } catch (Exception e) { } }

Target:
private void handlePutRequest(Request request) throws IOException { try { PutRequest putRequest = PutRequest.readFrom(new DataInputStream(request.getInputStream())); MessageFormatInputStream stream = new PutMessageFormatInputStream(putRequest.getBlobId(), putRequest.getBlobProperties(), putRequest.getUsermetadata(), putRequest.getData(), putRequest.getBlobProperties().getBlobSize()); MessageInfo info = new MessageInfo(putRequest.getBlobId(), stream.getSize(), putRequest.getBlobProperties().getTimeToLiveInMs()); ArrayList<MessageInfo> infoList = new ArrayList<MessageInfo>(); infoList.add(info); MessageFormatWriteSet writeset = new MessageFormatWriteSet(stream, infoList); blobStore.put(writeset); PutResponse response = new PutResponse(putRequest.getCorrelationId(), putRequest.getClientId(), (short)0); requestResponseChannel.sendResponse(response, request); } catch (StoreException e) { } catch (Exception e) { } }
Source:
private void checkImportedModel(){ new ModelExplorer().openModelEditor(WORK_PROJECT_NAME, NAME_VIEW_MODEL + ".xmi"); RelationalModelEditor editor = new RelationalModelEditor(NAME_VIEW_MODEL + ".xmi"); TableEditor tableEditor = editor.openTableEditor(); tableEditor.openTab(TableEditor.Tabs.FOREIGN_KEYS); collector.checkThat("Foreign key 1 name in source is badly set", tableEditor.getCellText(1,"ForeignKey1", "Name In Source"), is("ForeignKey1Source")); collector.checkThat("Foreign key 2 name in source is badly set", tableEditor.getCellText(1,"ForeignKey2", "Name In Source"), is("ForeignKey2Source")); collector.checkThat("Column of Foreign key 1 is badly set", tableEditor.getCellText(1,"ForeignKey1", "Columns"), is("fk_Column1 : string(4000)")); collector.checkThat("Column of Foreign key 2 is badly set", tableEditor.getCellText(1,"ForeignKey2", "Columns"), is("fk_Column2 : string(4000)")); collector.checkThat("Unique Key of Foreign key 1 is badly set", tableEditor.getCellText(1,"ForeignKey1", "Unique Key"), containsString("PrimaryKey")); collector.checkThat("Unique Key of Foreign key 2 is badly set", tableEditor.getCellText(1,"ForeignKey2", "Unique Key"), containsString("UniqueConstraint")); ProblemsView problemsView = new ProblemsView(); collector.checkThat("Errors in imported source model", problemsView.getProblems(ProblemType.ERROR, new ProblemsResourceMatcher(NAME_VIEW_MODEL + ".xmi")), empty()); collector.checkThat("Errors in imported VDB", problemsView.getProblems(ProblemType.ERROR, new ProblemsResourceMatcher(NAME_VDB + ".vdb")), empty()); }

Target:
private void checkImportedModel(){ new ModelExplorer().openModelEditor(WORK_PROJECT_NAME, NAME_VIEW_MODEL + ".xmi"); RelationalModelEditor editor = new RelationalModelEditor(NAME_VIEW_MODEL + ".xmi"); TableEditor tableEditor = editor.openTableEditor(); tableEditor.openTab(TableEditor.Tabs.FOREIGN_KEYS); collector.checkThat("Foreign key 1 name in source is badly set", tableEditor.getCellText(1,"ForeignKey1", "Name In Source"), is("ForeignKey1Source")); collector.checkThat("Foreign key 2 name in source is badly set", tableEditor.getCellText(1,"ForeignKey2", "Name In Source"), is("ForeignKey2Source")); collector.checkThat("Column of Foreign key 1 is badly set", tableEditor.getCellText(1,"ForeignKey1", "Columns"), is("fk_Column1 : string(4000)")); collector.checkThat("Column of Foreign key 2 is badly set", tableEditor.getCellText(1,"ForeignKey2", "Columns"), is("fk_Column2 : string(4000)")); collector.checkThat("Unique Key of Foreign key 1 is badly set", tableEditor.getCellText(1,"ForeignKey1", "Unique Key"), containsString("PrimaryKey")); collector.checkThat("Unique Key of Foreign key 2 is badly set", tableEditor.getCellText(1,"ForeignKey2", "Unique Key"), containsString("UniqueConstraint")); ProblemsView problemsView = new ProblemsView(); collector.checkThat("Errors in imported view model", problemsView.getProblems(ProblemType.ERROR, new ProblemsResourceMatcher(NAME_VIEW_MODEL + ".xmi")), empty()); collector.checkThat("Errors in imported VDB", problemsView.getProblems(ProblemType.ERROR, new ProblemsResourceMatcher(NAME_VDB + ".vdb")), empty()); }
Source:
protected boolean parseHeader(ParsableByteArray data) throws UnsupportedFormatException { if (!hasParsedAudioDataHeader) { int header = data.readUnsignedByte(); audioFormat = (header >> 4) & 0x0F; int sampleRateIndex = (header >> 2) & 0x03; int encodingSize = header & 0x01; if (sampleRateIndex < 0 || sampleRateIndex >= AUDIO_SAMPLING_RATE_TABLE.length) { throw new UnsupportedFormatException("Invalid sample rate index: " + sampleRateIndex); } if (audioFormat == AUDIO_FORMAT_ALAW || audioFormat == AUDIO_FORMAT_ULAW) { String type = (audioFormat == AUDIO_FORMAT_ALAW) ? MimeTypes.AUDIO_ALAW : MimeTypes.AUDIO_ULAW; int encoding = (encodingSize == 1) ? C.ENCODING_PCM_16BIT : C.ENCODING_PCM_8BIT; int minSize = AudioTrack.getMinBufferSize(8000, AudioFormat.CHANNEL_OUT_MONO, encoding); Format format = Format.createAudioSampleFormat(null, type, null, minSize * 4, minSize, 1, 8000, encoding, null, null, 0, null); output.format(format); hasOutputFormat = true; hasParsedAudioDataHeader = true; } else if (audioFormat != AUDIO_FORMAT_AAC ) { throw new UnsupportedFormatException("Audio format not supported: " + audioFormat); } hasParsedAudioDataHeader = true; } else { data.skipBytes(1); } return true; }

Target:
protected boolean parseHeader(ParsableByteArray data) throws UnsupportedFormatException { if (!hasParsedAudioDataHeader) { int header = data.readUnsignedByte(); audioFormat = (header >> 4) & 0x0F; int sampleRateIndex = (header >> 2) & 0x03; int encodingSize = header & 0x01; if (sampleRateIndex < 0 || sampleRateIndex >= AUDIO_SAMPLING_RATE_TABLE.length) { throw new UnsupportedFormatException("Invalid sample rate index: " + sampleRateIndex); } if (audioFormat == AUDIO_FORMAT_ALAW || audioFormat == AUDIO_FORMAT_ULAW) { String type = (audioFormat == AUDIO_FORMAT_ALAW) ? MimeTypes.AUDIO_ALAW : MimeTypes.AUDIO_ULAW; int encoding = (encodingSize == 1) ? C.ENCODING_PCM_16BIT : C.ENCODING_PCM_8BIT; Format format = Format.createAudioSampleFormat(null, type, null, Format.NO_VALUE, Format.NO_VALUE, 1, 8000, encoding, null, null, 0, null); output.format(format); hasOutputFormat = true; } else if (audioFormat != AUDIO_FORMAT_AAC ) { throw new UnsupportedFormatException("Audio format not supported: " + audioFormat); } hasParsedAudioDataHeader = true; } else { data.skipBytes(1); } return true; }
Source:
private static SortedSet<MediaType> parse(final String text) { final SortedSet<MediaType> list = new TreeSet<>(); final String[] parts = new UncheckedText( new Lowered(text) ).asString().split(","); for (final String name : parts) { if (!name.isEmpty()) { list.add(new MediaType(name)); } } return list; }

Target:
private static SortedSet<MediaType> parse(final String text) { final SortedSet<MediaType> list = new TreeSet<>(); final Iterable<Text> parts = new Split( new UncheckedText(new Lowered(text)), "," ); for (final Text part : parts) { final String name = new UncheckedText(part).asString(); if (!name.isEmpty()) { list.add(new MediaType(name)); } } return list; }
Source:
private void traverseNodesForDynamicFiltering(List<PlanNode> nodes) { for (PlanNode node : nodes) { if (node instanceof JoinNode) { JoinNode joinNode = (JoinNode) node; for (TaskId task : allTasks) { dynamicFilterService.registerTask(stateMachine.getSession().getQueryId().toString(), joinNode.getId().toString(), stateMachine.getStageId().getId(), task.getId()); } } traverseNodesForDynamicFiltering(node.getSources()); } }

Target:
private void traverseNodesForDynamicFiltering(List<PlanNode> nodes) { for (PlanNode node : nodes) { if (node instanceof JoinNode) { JoinNode joinNode = (JoinNode) node; dynamicFilterService.registerTasks(joinNode.getId().toString(), allTasks); } traverseNodesForDynamicFiltering(node.getSources()); } }
Source:
public void increaseCapacity() { if (!credential.equals(pool.getPrefillCredential())) return; int created = 1; boolean create = true; while (create && !pool.isFull()) { if (pool.isShutdown()) { return; } int currentSize = listeners.size(); create = pool.getCapacity().getIncrementer() .shouldCreate(currentSize, pool.getConfiguration().getMaxSize(), created); if (create) { try { ConnectionListener cl = pool.createConnectionListener(credential, this); if (Tracer.isEnabled()) Tracer.createConnectionListener(pool.getConfiguration().getId(), this, cl, cl.getManagedConnection(), false, false, true, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); boolean added = false; if (listeners.size() < pool.getConfiguration().getMaxSize()) { if (log.isTraceEnabled()) log.trace("Capacity fill: cl=" + cl); listeners.add(cl); created++; added = true; } if (!added) { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, true, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); pool.destroyConnectionListener(cl); return; } } catch (ResourceException re) { log.unableFillPool(re); return; } } } }

Target:
public void increaseCapacity() { if (!credential.equals(pool.getPrefillCredential())) return; int created = 1; boolean create = true; while (create && !pool.isFull()) { if (pool.isShutdown()) { return; } int currentSize = listeners.size(); create = pool.getCapacity().getIncrementer() .shouldCreate(currentSize, pool.getConfiguration().getMaxSize(), created); if (create) { try { ConnectionListener cl = pool.createConnectionListener(credential, this); if (Tracer.isEnabled()) Tracer.createConnectionListener(pool.getConfiguration().getId(), this, cl, cl.getManagedConnection(), false, false, true, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); boolean added = false; if (listeners.size() < pool.getConfiguration().getMaxSize()) { if (log.isTraceEnabled()) log.trace("Capacity fill: cl=" + cl); listeners.add(cl); created++; added = true; } if (!added) { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, true, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); pool.destroyConnectionListener(cl); return; } } catch (ResourceException re) { log.unableFillPool(pool.getConfiguration().getId(), re); return; } } } }
Source:
public IReconcilingStrategy getReconcilingStrategy(String contentType) { if(fReconcilers.size() == 1) { return fReconcilers.get(0).getReconcilingStrategy(contentType); } List<IReconcilingStrategy> strategies = new ArrayList<>(); for (IReconciler iReconciler : fReconcilers) { IReconcilingStrategy strategy = iReconciler.getReconcilingStrategy(contentType); if(strategy != null) { strategies.add(strategy); } } return new CompositeReconcilerStrategy(strategies); }

Target:
public IReconcilingStrategy getReconcilingStrategy(String contentType) { List<IReconcilingStrategy> strategies = new ArrayList<>(); for (IReconciler iReconciler : fReconcilers) { IReconcilingStrategy strategy = iReconciler.getReconcilingStrategy(contentType); if(strategy != null) { strategies.add(strategy); } } if(strategies.size() == 1) { return strategies.get(0); } return new CompositeReconcilerStrategy(strategies); }
Source:
public void processStandbyChange(TopologyDescriptor newConfig) { if (newConfig.getTopologyConfigId() != topologyDescriptor.getTopologyConfigId()) { log.error("Detected changes in the topology. The new topology descriptor doesn't have the same " + "siteConfigId as the current one {}", newConfig, topologyDescriptor); return; } Map<String, ClusterDescriptor> newStandbys = newConfig.getStandbyClusters(); Map<String, ClusterDescriptor> currentStandbys = topologyDescriptor.getStandbyClusters(); newStandbys.keySet().retainAll(currentStandbys.keySet()); Set<String> standbysToRemove = currentStandbys.keySet(); standbysToRemove.removeAll(newStandbys.keySet()); for (String siteID : standbysToRemove) { stopLogReplicationRuntime(siteID); topologyDescriptor.removeStandbySite(siteID); } for (String clusterId : newConfig.getStandbyClusters().keySet()) { if (runtimeToRemoteCluster.get(clusterId) == null) { ClusterDescriptor clusterInfo = newConfig.getStandbyClusters().get(clusterId); topologyDescriptor.addStandbySite(clusterInfo); startLogReplicationRuntime(clusterInfo); } } }

Target:
public void processStandbyChange(TopologyDescriptor newConfig) { if (newConfig.getTopologyConfigId() != topology.getTopologyConfigId()) { log.error("Detected changes in the topology. The new topology descriptor doesn't have the same " + "siteConfigId as the current one {}", newConfig, topology); return; } Map<String, ClusterDescriptor> newStandbys = newConfig.getStandbyClusters(); Map<String, ClusterDescriptor> currentStandbys = topology.getStandbyClusters(); newStandbys.keySet().retainAll(currentStandbys.keySet()); Set<String> standbysToRemove = currentStandbys.keySet(); standbysToRemove.removeAll(newStandbys.keySet()); for (String siteID : standbysToRemove) { stopLogReplicationRuntime(siteID); topology.removeStandbySite(siteID); } for (String clusterId : newConfig.getStandbyClusters().keySet()) { if (runtimeToRemoteCluster.get(clusterId) == null) { ClusterDescriptor clusterInfo = newConfig.getStandbyClusters().get(clusterId); topology.addStandbySite(clusterInfo); startLogReplicationRuntime(clusterInfo); } } }
Source:
public void setup() throws InjectionException { final Configuration conf = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(Parameters.MiniBatches.class, Integer.toString(miniBatchesPerEpoch)) .build(); final Injector injector = Tang.Factory.getTang().newInjector(conf); mockMemoryStore = mock(MemoryStore.class); injector.bindVolatileInstance(MemoryStore.class, mockMemoryStore); doAnswer(invocation -> { return values; }).when(mockMemoryStore).getAll(); doAnswer(invocation -> { final Integer id = invocation.getArgumentAt(0, Integer.class); final Pair<Integer, Integer> pair = new Pair<>(id, values.get(id)); return pair; }).when(mockMemoryStore).get(anyObject()); trainingDataSplitter = injector.getInstance(TrainingDataSplitter.class); }

Target:
public void setup() throws InjectionException { final Configuration conf = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(Parameters.MiniBatches.class, Integer.toString(MINI_BATCHES_PER_EPOCH)) .build(); final Injector injector = Tang.Factory.getTang().newInjector(conf); mockMemoryStore = mock(MemoryStore.class); injector.bindVolatileInstance(MemoryStore.class, mockMemoryStore); doAnswer(invocation -> values).when(mockMemoryStore).getAll(); doAnswer(invocation -> { final Integer id = invocation.getArgumentAt(0, Integer.class); final Pair<Integer, Integer> pair = new Pair<>(id, values.get(id)); return pair; }).when(mockMemoryStore).get(anyObject()); trainingDataSplitter = injector.getInstance(TrainingDataSplitter.class); }
Source:
public void testReplaceInvalidEmptyStringMacAddressesWithNullDoNotTouchNullValues() { VmNetworkInterface mock = createMockedVmNetworkInterfaceWithMacAddress(null); underTest.replaceInvalidEmptyStringMacAddressesWithNull(singletonList(mock)); verify(mock, Mockito.never()).setMacAddress(Mockito.any()); }

Target:
public void testReplaceInvalidEmptyStringMacAddressesWithNullDoNotTouchNullValues() { when(mock.getMacAddress()).thenReturn(null); underTest.replaceInvalidEmptyStringMacAddressesWithNull(singletonList(mock)); verify(mock, Mockito.never()).setMacAddress(Mockito.any()); }
Source:
private void deleteCommand(@NotNull final String wsId, @NotNull final String commandName, @NotNull AsyncCallback<WorkspaceDto> callback) { String url = null; try { url = baseHttpUrl + '/' + wsId + "/command/" + URLEncoder.encode(commandName, "UTF-8"); } catch (UnsupportedEncodingException ignored) { } asyncRequestFactory.createDeleteRequest(url) .header(ACCEPT, APPLICATION_JSON) .loader(loaderFactory.newLoader("Deleting command...")) .send(newCallback(callback, dtoUnmarshallerFactory.newUnmarshaller(WorkspaceDto.class))); }

Target:
private void deleteCommand(@NotNull final String wsId, @NotNull final String commandName, @NotNull AsyncCallback<WorkspaceDto> callback) { final String url = baseHttpUrl + '/' + wsId + "/command/" + URL.encodePathSegment(commandName); asyncRequestFactory.createDeleteRequest(url) .header(ACCEPT, APPLICATION_JSON) .loader(loaderFactory.newLoader("Deleting command...")) .send(newCallback(callback, dtoUnmarshallerFactory.newUnmarshaller(WorkspaceDto.class))); }
Source:
private void validateJob(JobKey key) throws SchedulerException { JobDetail detail = scheduler.getJobDetail(key); if (detail == null) { throw new MotechSchedulerException(String.format("Job doesn't exist:\n %s\n %s", key.getName(), key.getGroup())); } JobDataMap map = detail.getJobDataMap(); if (map != null && map.get(EVENT_METADATA) != null && !(Boolean) ((Map<String, Object>) map.get(EVENT_METADATA)).get(UI_DEFINED)) { throw new MotechSchedulerException(String.format("Job is not ui defined:\n %s\n %s", key.getName(), key.getGroup())); } }

Target:
private void validateJob(JobKey key) throws SchedulerException { JobDetail detail = scheduler.getJobDetail(key); if (detail == null) { throw new MotechSchedulerException(String.format("Job doesn't exist:\n %s\n %s", key.getName(), key.getGroup())); } JobDataMap map = detail.getJobDataMap(); if (map != null && !isJobUIDefined(map)) { throw new MotechSchedulerException(String.format("Job is not ui defined:\n %s\n %s", key.getName(), key.getGroup())); } }
Source:
private String getApplicationName(final CloudTrailEvent event, String instanceId) { AmazonEC2Client ec2Client = cachingClientProvider.getClient(AmazonEC2Client.class, event.getEventData().getUserIdentity().getAccountId(), Region.getRegion(Regions.fromName(event.getEventData().getAwsRegion()))); DescribeInstanceAttributeRequest describeInstanceAttributeRequest = new DescribeInstanceAttributeRequest(); describeInstanceAttributeRequest.setInstanceId(instanceId); describeInstanceAttributeRequest.setAttribute("userData"); DescribeInstanceAttributeResult describeInstanceAttributeResult; try { describeInstanceAttributeResult = ec2Client.describeInstanceAttribute(describeInstanceAttributeRequest); } catch (AmazonServiceException e) { LOG.error(e.getMessage()); return null; } String userData = describeInstanceAttributeResult.getInstanceAttribute().getUserData(); byte[] bytesUserData = Base64.decode(userData); String decodedUserData = new String(bytesUserData); Matcher matcher = pattern.matcher(decodedUserData); if (!matcher.find()) { LOG.error("No application_id defined for this instance {}, " + "please change the userData configuration for this instance and add this information.", instanceId); } try { return matcher.group(2); } catch (IndexOutOfBoundsException e) { LOG.error("No application_id defined for this instance {}, " + "please change the userData configuration for this instance and add this information.", instanceId); return null; } }

Target:
private String getApplicationName(final CloudTrailEvent event, String instanceId) { AmazonEC2Client ec2Client = cachingClientProvider.getClient(AmazonEC2Client.class, event.getEventData().getUserIdentity().getAccountId(), Region.getRegion(Regions.fromName(event.getEventData().getAwsRegion()))); DescribeInstanceAttributeRequest describeInstanceAttributeRequest = new DescribeInstanceAttributeRequest(); describeInstanceAttributeRequest.setInstanceId(instanceId); describeInstanceAttributeRequest.setAttribute("userData"); DescribeInstanceAttributeResult describeInstanceAttributeResult; try { describeInstanceAttributeResult = ec2Client.describeInstanceAttribute(describeInstanceAttributeRequest); } catch (AmazonServiceException e) { LOG.error(e.getMessage()); violationStore.save(format("InstanceId: %s doesn't have any userData.",instanceId)); return null; } String userData = describeInstanceAttributeResult.getInstanceAttribute().getUserData(); byte[] bytesUserData = Base64.decode(userData); String decodedUserData = new String(bytesUserData); Matcher matcher = pattern.matcher(decodedUserData); if (!matcher.find()) { violationStore.save(format("No application_id defined for this instance %s, " + "please change the userData configuration for this instance and add this information.", instanceId)); } try { return matcher.group(2); } catch (IndexOutOfBoundsException e) { violationStore.save(format("No application_id defined for this instance %s, " + "please change the userData configuration for this instance and add this information.", instanceId)); return null; } }
Source:
private void addAdapterDeclaration(final Element parentElement, final AdapterDeclaration adapterDecl) { Element adatperElement = createElement(LibraryElementTags.ADAPTER_DECLARATION_ELEMENT); setNameTypeCommentAttribute(adatperElement, adapterDecl, adapterDecl.getType()); if (null != adapterDecl.getAdapterFB()) { exportXandY(adapterDecl.getAdapterFB(), adatperElement); } parentElement.appendChild(adatperElement); }

Target:
private void addAdapterDeclaration(final Element parentElement, final AdapterDeclaration adapterDecl) { Element adapterElement = createElement(LibraryElementTags.ADAPTER_DECLARATION_ELEMENT); setNameTypeCommentAttribute(adapterElement, adapterDecl, adapterDecl.getType()); if (null != adapterDecl.getAdapterFB()) { exportXandY(adapterDecl.getAdapterFB(), adapterElement); } parentElement.appendChild(adapterElement); }
Source:
public List<RecoveryStatus> getLogSorts() { List<RecoveryStatus> result = new ArrayList<>(); synchronized (currentWork) { for (Entry<String,LogProcessor> entries : currentWork.entrySet()) { RecoveryStatus status = new RecoveryStatus(); status.name = entries.getKey(); try { double progress = entries.getValue().getBytesCopied() / walBlockSize; status.progress = Math.max(progress, 99.0); } catch (IOException ex) { log.warn("Error getting bytes read"); } status.runtime = (int) entries.getValue().getSortTime(); result.add(status); } return result; } }

Target:
public List<RecoveryStatus> getLogSorts() { List<RecoveryStatus> result = new ArrayList<>(); synchronized (currentWork) { for (Entry<String,LogProcessor> entries : currentWork.entrySet()) { RecoveryStatus status = new RecoveryStatus(); status.name = entries.getKey(); try { double progress = entries.getValue().getBytesCopied() / walBlockSize; status.progress = Math.min(progress, 99.9); } catch (IOException ex) { log.warn("Error getting bytes read"); } status.runtime = (int) entries.getValue().getSortTime(); result.add(status); } return result; } }
Source:
public boolean navigatePreviousComponent() { boolean ret = false; int index = pager.getCurrentItem(); if (index > 0) { PageViewStateCallback curView = (PageViewStateCallback) pagerAdapter.instantiateItem(pager, index); if (curView != null) curView.onPageDisappear(); pager.setCurrentItem(index - 1); ret = true; } return ret; }

Target:
public void navigatePreviousComponent() { int index = pager.getCurrentItem(); if (index > 0) { PageViewStateCallback curView = (PageViewStateCallback) pagerAdapter.instantiateItem(pager, index); if (curView != null) curView.onPageDisappear(); pager.setCurrentItem(index - 1); } }
Source:
public ValidationResult isSnapshotStatusOK(Snapshot snapshot) { Snapshot snap = snapshotDao.get(snapshot.getId()); if (snap != null && snap.getStatus() != SnapshotStatus.OK) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_INVALID_SNAPSHOT_STATUS, String.format("$SnapshotStatus %1$s", snap.getStatus())); } return ValidationResult.VALID; }

Target:
public ValidationResult isSnapshotStatusOK(Snapshot snapshot) { return isSnapshotInStatus(snapshot, SnapshotStatus.OK, EngineMessage.ACTION_TYPE_FAILED_INVALID_SNAPSHOT_STATUS); }
Source:
public void handlePut(RestRequest restRequest, RestResponseChannel restResponseChannel) { ThrowingConsumer<RequestPath> routingAction = requestPath -> { if (requestPath.matchesOperation(Operations.UPDATE_TTL)) { ttlUpdateHandler.handle(restRequest, restResponseChannel, (r, e) -> { if (e instanceof RouterException && ((RouterException) e).getErrorCode() == RouterErrorCode.BlobUpdateNotAllowed) { restResponseChannel.setHeader(Headers.ALLOW, TTL_UPDATE_REJECTED_ALLOW_HEADER_VALUE); } submitResponse(restRequest, restResponseChannel, null, e); }); } else if (requestPath.matchesOperation(Operations.UNDELETE) && frontendConfig.enableUndelete) { undeleteHandler.handle(restRequest, restResponseChannel, (r, e) -> { if (e instanceof RouterException) { e = new RestServiceException(e.getMessage(), RestServiceErrorCode.getRestServiceErrorCode(((RouterException) e).getErrorCode()), true); } submitResponse(restRequest, restResponseChannel, null, e); }); } else { throw new RestServiceException("Unrecognized operation: " + requestPath.getOperationOrBlobId(false), RestServiceErrorCode.BadRequest); } }; preProcessAndRouteRequest(restRequest, restResponseChannel, frontendMetrics.putPreProcessingMetrics, routingAction); }

Target:
public void handlePut(RestRequest restRequest, RestResponseChannel restResponseChannel) { ThrowingConsumer<RequestPath> routingAction = requestPath -> { if (requestPath.matchesOperation(Operations.UPDATE_TTL)) { ttlUpdateHandler.handle(restRequest, restResponseChannel, (r, e) -> { if (e instanceof RouterException && ((RouterException) e).getErrorCode() == RouterErrorCode.BlobUpdateNotAllowed) { restResponseChannel.setHeader(Headers.ALLOW, TTL_UPDATE_REJECTED_ALLOW_HEADER_VALUE); } submitResponse(restRequest, restResponseChannel, null, e); }); } else if (requestPath.matchesOperation(Operations.UNDELETE) && frontendConfig.enableUndelete) { restRequest.setArg(SEND_FAILURE_REASON, Boolean.TRUE); undeleteHandler.handle(restRequest, restResponseChannel, (r, e) -> { submitResponse(restRequest, restResponseChannel, null, e); }); } else { throw new RestServiceException("Unrecognized operation: " + requestPath.getOperationOrBlobId(false), RestServiceErrorCode.BadRequest); } }; preProcessAndRouteRequest(restRequest, restResponseChannel, frontendMetrics.putPreProcessingMetrics, routingAction); }
Source:
default void mutateBasedOnUserAgent(Entry entry, ManipulateEntry m, ContainerRequestContext containerContext) { try { final List<String> strings = containerContext.getHeaders().get("User-Agent"); strings.forEach(s -> { final String[] split = s.split("/"); if (split[0].equals("Dockstore-CLI")) { com.github.zafarkhaja.semver.Version clientVersion = com.github.zafarkhaja.semver.Version.valueOf(split[1]); com.github.zafarkhaja.semver.Version v16 = com.github.zafarkhaja.semver.Version.valueOf("1.6.0"); if (clientVersion.lessThanOrEqualTo(v16)) { m.manipulate(entry); } } }); } catch (Exception e) { LOG.debug("encountered a user agent that we could not parse, meh", e); } }

Target:
default void mutateBasedOnUserAgent(Entry entry, ManipulateEntry m, ContainerRequestContext containerContext) { try { final List<String> strings = containerContext.getHeaders().getOrDefault("User-Agent", Lists.newArrayList()); strings.forEach(s -> { final String[] split = s.split("/"); if (split[0].equals("Dockstore-CLI")) { com.github.zafarkhaja.semver.Version clientVersion = com.github.zafarkhaja.semver.Version.valueOf(split[1]); com.github.zafarkhaja.semver.Version v16 = com.github.zafarkhaja.semver.Version.valueOf("1.6.0"); if (clientVersion.lessThanOrEqualTo(v16)) { m.manipulate(entry); } } }); } catch (Exception e) { LOG.debug("encountered a user agent that we could not parse, meh", e); } }
Source:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!JarRuntimeInfo.class.isAssignableFrom(obj.getClass())) { return false; } JdbcRuntimeInfo other = (JdbcRuntimeInfo) obj; return super.equals(obj) && this.driverClassName.equals(other.driverClassName); }

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if (this == obj) { return true; } if (!(obj instanceof JdbcRuntimeInfo)) { return false; } JdbcRuntimeInfo other = (JdbcRuntimeInfo) obj; return super.equals(obj) && this.driverClassName.equals(other.driverClassName); }
Source:
@Override public E element() { lock.lock(); try { if (queue.isEmpty()) { throw new NoSuchElementException(); } return queue.peek(); } catch (IOException e) { QueueFile.<Error>getSneakyThrowable(e); return null; } finally { lock.unlock(); } }

Target:
@Override public E element() { lock.lock(); try { if (queue.isEmpty()) { throw new NoSuchElementException(); } return queue.peek(); } catch (IOException e) { throw QueueFile.<Error>getSneakyThrowable(e); } finally { lock.unlock(); } }
Source:
public Process runServer() throws IOException { final String serverConsoleLogPath = "/Users/amartinezman/Desktop/gm" + File.separator + host + "_" + port + "_consolelog"; File logPath = new File(getCorfuServerLogPath(host, port)); if (!logPath.exists()) { logPath.mkdir(); } ProcessBuilder builder = new ProcessBuilder(); builder.command("sh", "-c", "bin/corfu_replication_server " + getOptionsString()); builder.directory(new File(CORFU_PROJECT_DIR)); Process corfuReplicationServerProcess = builder.start(); StreamGobbler streamGobbler = new StreamGobbler(corfuReplicationServerProcess.getInputStream(), serverConsoleLogPath); Executors.newSingleThreadExecutor().submit(streamGobbler); return corfuReplicationServerProcess; }

Target:
public Process runServer() throws IOException { final String serverConsoleLogPath = CORFU_LOG_PATH + File.separator + host + "_" + port + "_consolelog"; File logPath = new File(getCorfuServerLogPath(host, port)); if (!logPath.exists()) { logPath.mkdir(); } ProcessBuilder builder = new ProcessBuilder(); builder.command("sh", "-c", "bin/corfu_replication_server " + getOptionsString()); builder.directory(new File(CORFU_PROJECT_DIR)); Process corfuReplicationServerProcess = builder.start(); StreamGobbler streamGobbler = new StreamGobbler(corfuReplicationServerProcess.getInputStream(), serverConsoleLogPath); Executors.newSingleThreadExecutor().submit(streamGobbler); return corfuReplicationServerProcess; }
Source:
private KeyHashIdentifier getReferenceToLockKey(KeyHashIdentifier lockKey) { KeyHashIdentifier referenceToLockKey = null; synchronized (weakReferencesTolocks) { for (KeyHashIdentifier keyInSet : weakReferencesTolocks.keySet()) { if (keyInSet.equals(lockKey)) { referenceToLockKey = keyInSet; break; } } } return referenceToLockKey; }

Target:
private KeyHashIdentifier getReferenceToLockKey(KeyHashIdentifier lockKey) { synchronized (weakReferencesTolocks) { for (KeyHashIdentifier keyInSet : weakReferencesTolocks.keySet()) { if (keyInSet.equals(lockKey)) { return keyInSet; } } } return null; }
Source:
private void processVotes(final Song previousSong) { AtomicInteger nettoVotes = new AtomicInteger(); this.votes.values().stream().forEach((vote) -> { if (vote.equals(Vote.LIKE)) { nettoVotes.incrementAndGet(); } else { nettoVotes.decrementAndGet(); } }); if (nettoVotes.get() < 0) { final RoomDAO roomDAO = this.roomDAOProvider.get(); final Room room = roomDAO.findById(id); previousSong.addExclusionRoom(room); } this.votes.clear(); }

Target:
private void processVotes(final Song previousSong) { int nettoVotes = this.votes.values().stream() .mapToInt(Vote::getValue) .sum(); if (nettoVotes < 0) { final RoomDAO roomDAO = this.roomDAOProvider.get(); final Room room = roomDAO.findById(id); previousSong.addExclusionRoom(room); } this.votes.clear(); }
Source:
public static boolean isValidOverBlackListPatterns(String input, String... blackListPatterns) { if (ArrayUtils.isEmpty(blackListPatterns)) { throw new IllegalArgumentException("Should provide at least one black list pattern"); } boolean isValid = false; if (input != null) { for (String key : blackListPatterns) { if (validatorConfig.getPattern(key) != null) { isValid = !validatorConfig.getPattern(key).matcher(input).matches(); if (!isValid) { break; } } } } return isValid; }

Target:
public static boolean isValidOverBlackListPatterns(String input, String... blackListPatterns) { if (ArrayUtils.isEmpty(blackListPatterns)) { throw new IllegalArgumentException("Should provide at least one black list pattern"); } if (StringUtils.isEmpty(input)) { return true; } boolean isValid = false; for (String key : blackListPatterns) { if (validatorConfig.getPattern(key) != null) { isValid = !validatorConfig.getPattern(key).matcher(input).matches(); if (!isValid) { break; } } } return isValid; }
Source:
public void onButtonPressed(ThingUID bridge, LIRCButtonEvent buttonEvent) { if (remoteName.equals(buttonEvent.getRemote())) { logger.debug("Remote {}: Button pressed times.", remoteName, buttonEvent.getButton(), buttonEvent.getRepeats() + 1); updateStatus(ThingStatus.ONLINE); updateState(CHANNEL_BUTTON, new StringType(buttonEvent.getButton())); } }

Target:
public void onButtonPressed(ThingUID bridge, LIRCButtonEvent buttonEvent) { if (remoteName.equals(buttonEvent.getRemote())) { logger.debug("Remote {}: Button pressed times.", remoteName, buttonEvent.getButton(), buttonEvent.getRepeats() + 1); updateStatus(ThingStatus.ONLINE); triggerChannel(LIRCBindingConstants.CHANNEL_EVENT, buttonEvent.getButton()); } }
Source:
private static void logCodeMiningProviderException(Throwable e) { if (e != null && (e instanceof CancellationException || (e.getCause() != null && e.getCause() instanceof CancellationException))) { return; } try { String PLUGIN_ID= "org.eclipse.jface.text"; ILog log= Platform.getLog(Platform.getBundle(PLUGIN_ID)); log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e)); } catch (Exception ex) { } }

Target:
private static void logCodeMiningProviderException(Throwable e) { if (e != null && (e instanceof CancellationException || (e.getCause() != null && e.getCause() instanceof CancellationException))) { return; } String PLUGIN_ID= "org.eclipse.jface.text"; Bundle plugin= Platform.getBundle(PLUGIN_ID); if (plugin != null) { ILog log= Platform.getLog(plugin); log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e)); } else { e.printStackTrace(); } }
Source:
protected void ExecuteVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); List<GlusterBrickEntity> bricksList = getParameters().getBricks(); List<String> brickNames = new ArrayList<String>(); for (GlusterBrickEntity brick : bricksList) { brickNames.add(brick.getQualifiedName()); } result = getBroker().glusterVolumeRemoveBrickStatus(volumeName, (String[])brickNames.toArray(), getParameters().getReplicaCount()); proceedProxyReturnValue(); GlusterVolumeTaskStatusEntity entity = result.getStatusDetails(); entity.setStatusTime(new Date()); setReturnValue(entity); }

Target:
protected void ExecuteVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); List<GlusterBrickEntity> bricksList = getParameters().getBricks(); String[] brickNames = new String[bricksList.size()]; for (int count = 0; count < bricksList.size(); count++) { brickNames[count] = bricksList.get(count).getQualifiedName(); } result = getBroker().glusterVolumeRemoveBrickStatus(volumeName, brickNames); proceedProxyReturnValue(); GlusterVolumeTaskStatusEntity entity = result.getStatusDetails(); entity.setStatusTime(new Date()); setReturnValue(entity); }
Source:
void testIsUsAchBankForeignFormCanadaBank() { achService.setPaymentWorksFormModeService(buildMockPaymentWorksFormModeService(true)); pmwVendor.setBankAddressCountry(PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.CANADA.getPmwCountryOptionAsString()); boolean actualIsUsBankAccount = achService.isUsAchBank(pmwVendor, reportData); assertFalse(actualIsUsBankAccount); assertEquals(0, reportData.getRecordsThatCouldNotBeProcessedSummary().getRecordCount()); assertEquals(0, reportData.getPmwVendorAchsThatCouldNotBeProcessed().size()); assertEquals(1, reportData.getRecordsWithForeignAchSummary().getRecordCount()); List<PaymentWorksBatchReportVendorItem> foreignAchItems = reportData.getForeignAchItems(); assertEquals(1, foreignAchItems.size()); List<String> foreignAchErrorMessages = foreignAchItems.get(0).getErrorMessages(); assertEquals(1, foreignAchErrorMessages.size()); String actualErrorMmessage = foreignAchErrorMessages.get(0); assertEquals("The bank has a country code of Canada. We can only create ACH records for banks that have a US address", actualErrorMmessage); }

Target:
void testIsUsAchBankForeignFormCanadaBank() { achService.setPaymentWorksFormModeService(buildMockPaymentWorksFormModeService(true)); pmwVendor.setBankAddressCountry(PaymentWorksConstants.PaymentWorksPurchaseOrderCountryFipsOption.CANADA.getPmwCountryOptionAsString()); boolean actualIsUsBankAccount = achService.isUsAchBank(pmwVendor, reportData); assertFalse(actualIsUsBankAccount); assertEquals(0, reportData.getRecordsThatCouldNotBeProcessedSummary().getRecordCount()); assertEquals(0, reportData.getPmwVendorAchsThatCouldNotBeProcessed().size()); assertEquals(1, reportData.getRecordsWithForeignAchSummary().getRecordCount()); List<PaymentWorksBatchReportVendorItem> foreignAchItems = reportData.getForeignAchItems(); assertEquals(1, foreignAchItems.size()); List<String> foreignAchErrorMessages = foreignAchItems.get(0).getErrorMessages(); assertEquals(1, foreignAchErrorMessages.size()); String actualErrorMessage = foreignAchErrorMessages.get(0); assertEquals("The bank has a country code of Canada. We can only create ACH records for banks that have a US address", actualErrorMessage); }
Source:
public void setFirstReference(PDOMLinkage linkage, PDOMName name) throws CoreException { if (linkage.equals(getLinkage())) setFirstReference(name); else new PDOMExternalReferencesList(getPDOM(), record + FIRST_EXTREF_OFFSET).setFirstReference(linkage, name); }

Target:
public void setFirstReference(PDOMLinkage linkage, PDOMName name) throws CoreException { if (linkage.equals(getLinkage())) { setFirstReference(name); } else { new PDOMExternalReferencesList(getPDOM(), record + FIRST_EXTREF_OFFSET).setFirstReference(linkage, name); } }
Source:
@Test public void checkDockerExists() { boolean dockerExists = new File("./Docker").exists() || new File("./docker/Docker").exists(); assertTrue(dockerExists); }

Target:
@Test public void checkDockerExists() { boolean dockerExists = new File("./Dockerfile").exists() || new File("./docker/Dockerfile").exists(); assertTrue(dockerExists); }
Source:
public void testSchemaMetadataScan() throws SQLException { long ts = nextTimestamp(); ensureTableCreated(getUrl(), CUSTOM_ENTITY_DATA_FULL_NAME, null, ts); ensureTableCreated(getUrl(), PTSDB_NAME, null, ts); Properties props = new Properties(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5)); Connection conn = DriverManager.getConnection(getUrl(), props); DatabaseMetaData dbmd = conn.getMetaData(); ResultSet rs; rs = dbmd.getSchemas(null, CUSTOM_ENTITY_DATA_SCHEMA_NAME); assertTrue(rs.next()); assertEquals(rs.getString(1),CUSTOM_ENTITY_DATA_SCHEMA_NAME); assertEquals(rs.getString(2),null); assertFalse(rs.next()); rs = dbmd.getSchemas(null, null); assertTrue(rs.next()); assertEquals(rs.getString("TABLE_SCHEM"),CUSTOM_ENTITY_DATA_SCHEMA_NAME); assertEquals(rs.getString("TABLE_CATALOG"),null); assertFalse(rs.next()); }

Target:
public void testSchemaMetadataScan() throws SQLException { Properties props = new Properties(); props.setProperty(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.toString(true)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute("CREATE SCHEMA " + CUSTOM_ENTITY_DATA_SCHEMA_NAME); DatabaseMetaData dbmd = conn.getMetaData(); ResultSet rs; rs = dbmd.getSchemas(null, CUSTOM_ENTITY_DATA_SCHEMA_NAME); assertTrue(rs.next()); assertEquals(rs.getString(1),CUSTOM_ENTITY_DATA_SCHEMA_NAME); assertEquals(rs.getString(2),null); assertFalse(rs.next()); rs = dbmd.getSchemas(null, null); assertTrue(rs.next()); assertEquals(rs.getString("TABLE_SCHEM"),CUSTOM_ENTITY_DATA_SCHEMA_NAME); assertEquals(rs.getString("TABLE_CATALOG"),null); assertFalse(rs.next()); }