auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRemoveValueNoStoreEntryEqualCacheWriterEntry() throws Exception { final MockStore realStore = new MockStore(Collections.<String, String>emptyMap()); this.store = spy(realStore); final MockCacheWriter realCache = new MockCacheWriter(Collections.singletonMap("key", "value")); final Ehcache<String, String> ehcache = this.getEhcache(realCache); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(realStore.getMap().containsKey("key"), is(false)); assertThat(realCache.getEntries().containsKey("key"), is(true)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }

Target:
public void testRemoveValueNoStoreEntryEqualCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "value")); final Ehcache<String, String> ehcache = this.getEhcache(fakeWriter); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(fakeStore.getEntryMap().containsKey("key"), is(false)); assertThat(fakeWriter.getEntryMap().containsKey("key"), is(true)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
public Object answer(InvocationOnMock invocation) throws Throwable { if (MockUtil.isMock(throwable)) { throw throwable; } Throwable t = throwable.fillInStackTrace(); filter.filter(t); throw throwable; }

Target:
public Object answer(InvocationOnMock invocation) throws Throwable { if (MockUtil.isMock(throwable)) { throw throwable; } Throwable t = throwable.fillInStackTrace(); if (t == null) { throw throwable; } filter.filter(t); throw t; }
Source:
CallField field(String name, String[] values) { return new BufferedMultipleAtomicCallField(name, Stream.of(values)); }

Target:
CallField field(String name, String[] values) { return new BufferedMultipleAtomicCallField(name, values); }
Source:
private void onLoginSuccess() { funnel.logSuccess(); hideSoftKeyboard(LoginActivity.this); setResult(RESULT_LOGIN_SUCCESS); Prefs.setReadingListSyncEnabled(true); Prefs.shouldShowReadingListSyncMergePrompt(true); Prefs.setReadingListPagesDeletedIds(Collections.emptySet()); Prefs.setReadingListsDeletedIds(Collections.emptySet()); ReadingListSyncAdapter.manualSyncWithForce(); WikipediaApp.getInstance().getBus().post(new LoginLogoutEvent()); finish(); }

Target:
private void onLoginSuccess() { funnel.logSuccess(); hideSoftKeyboard(LoginActivity.this); setResult(RESULT_LOGIN_SUCCESS); Prefs.setReadingListSyncEnabled(true); Prefs.shouldShowReadingListSyncMergePrompt(true); Prefs.setReadingListPagesDeletedIds(Collections.emptySet()); Prefs.setReadingListsDeletedIds(Collections.emptySet()); ReadingListSyncAdapter.manualSyncWithForce(); finish(); }
Source:
public void testSetRotateM() { float[] matrix = new float[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; float[] expected = new float[]{ 0.9998687f, 0.01299483f, -0.00968048f, 0, -0.012931813f, 0.999895f, 0.006544677f, 0, 0.009764502f, -0.006418644f, 0.99993175f, 0, 0, 0, 0, 1 }; Matrix.setRotateM(matrix, 0, 1, 2, 3, 4); Assert.assertArrayEquals(expected, matrix, 0.001f); }

Target:
public void testSetRotateM() { float[] matrix = new float[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; float[] expected = new float[]{ 0.9998687f, 0.01299483f, -0.00968048f, 0, -0.012931813f, 0.999895f, 0.006544677f, 0, 0.009764502f, -0.006418644f, 0.99993175f, 0, 0, 0, 0, 1 }; Matrix.setRotateM(matrix, 0, 1, 2, 3, 4); assertThat(matrix).containsSequence(expected, withPrecision(0.0001f)); }
Source:
private Pattern wildcardToRegex(String filter) { String regex = "(?i)\\Q" + filter.trim().replaceAll("\\Q*\\E", Matcher.quoteReplacement("\\E.*?\\Q")) + "\\E"; regex = regex.replace("\\Q\\E", ""); return Pattern.compile(regex); }

Target:
private Pattern wildcardToRegex(String filter) { String trimmed = filter.trim(); if (trimmed.isEmpty()) { return null; } String regex = (trimmed.contains("*") ? "^" : "") + "\\Q" + trimmed.replaceAll("\\*", Matcher.quoteReplacement("\\E.*?\\Q")) + "\\E"; regex = regex.replaceAll(Pattern.quote("\\Q\\E"), ""); return Pattern.compile(regex, Pattern.CASE_INSENSITIVE); }
Source:
public void create() { if (getSourceCidrList() != null) { for (String cidr : getSourceCidrList()) { if (!NetUtils.isValidIp4Cidr(cidr) && !NetUtils.isValidIp6Cidr(cidr)) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source CIDRs formatting error " + cidr); } } } try { FirewallRule result = _firewallService.createIngressFirewallRule(this); if (result != null) { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } } catch (NetworkRuleConflictException ex) { s_logger.trace("Network Rule Conflict: ", ex); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } }

Target:
public void create() { if (getSourceCidrList() != null) { for (String cidr : getSourceCidrList()) { if (!NetUtils.isValidIp4Cidr(cidr) && !NetUtils.isValidIp6Cidr(cidr)) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source CIDRs formatting error " + cidr); } } } try { FirewallRule result = _firewallService.createIngressFirewallRule(this); if (result != null) { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } } catch (NetworkRuleConflictException ex) { s_logger.trace("Network Rule Conflict: ", ex); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex); } }
Source:
public void contentDispositionShouldBeRecognized() throws IOException { new RqMtFake( new RqFake(), new RqWithHeader( new RqFake(new ListOf<>(""), ""), contentDispositionHeader("form-data; name=\"field1\"") ), new RqWithHeader( new RqFake("", "", "field2Value"), contentDispositionHeader("form-data; name=\"field2\"") ) ); }

Target:
public void contentDispositionShouldBeRecognized() throws Exception { new RqMtFake( new RqFake(), new RqWithHeader( new RqFake(new ListOf<>(""), ""), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"field1\"" ).asString() ), new RqWithHeader( new RqFake("", "", "field2Value"), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"field2\"" ).asString() ) ); }
Source:
private CompiledQuery sqlTableBackup(SqlExecutionContext executionContext) throws SqlException { ObjList<CharSequence> tableNames = new ObjList<>(); while (true) { CharSequence tok = SqlUtil.fetchNext(lexer); if (null == tok) { throw SqlException.position(lexer.getPosition()).put(" expected a table name"); } CharSequence tableName = GenericLexer.unquote(tok); int status = engine.getStatus(executionContext.getCairoSecurityContext(), path, tableName, 0, tableName.length()); if (status != TableUtils.TABLE_EXISTS) { throw SqlException.position(lexer.getPosition()).put(" '").put(tableName).put("' is not a valid table"); } tableNames.add(tableName); tok = SqlUtil.fetchNext(lexer); if (null == tok || Chars.equals(tok, ';')) { break; } if (!Chars.equals(tok, ',')) { throw SqlException.position(lexer.getPosition()).put(" expected ','"); } } for (int n=0; n<tableNames.size(); n++) { backupTable(tableNames.get(n), executionContext); } return compiledQuery.ofRenameTable(); }

Target:
private CompiledQuery sqlTableBackup(SqlExecutionContext executionContext) throws SqlException { setupBackupRenamePath(); try { tableNames.clear(); while (true) { CharSequence tok = SqlUtil.fetchNext(lexer); if (null == tok) { throw SqlException.position(lexer.lastTokenPosition()).put(" expected a table name"); } CharSequence tableName = GenericLexer.unhack(GenericLexer.unquote(tok)); if (tableName == null) { throw SqlException.position(lexer.lastTokenPosition()).put(" expected a valid table name"); } int status = engine.getStatus(executionContext.getCairoSecurityContext(), path, tableName, 0, tableName.length()); if (status != TableUtils.TABLE_EXISTS) { throw SqlException.position(lexer.lastTokenPosition()).put(" '").put(tableName).put("' is not a valid table"); } tableNames.add(tableName); tok = SqlUtil.fetchNext(lexer); if (null == tok || Chars.equals(tok, ';')) { break; } if (!Chars.equals(tok, ',')) { throw SqlException.position(lexer.lastTokenPosition()).put(" expected ','"); } } for (int n = 0; n < tableNames.size(); n++) { backupTable(tableNames.get(n), executionContext); } return compiledQuery.ofBackupTable(); } finally { tableNames.clear(); } }
Source:
public boolean sendCommandsToRouter(final VirtualRouter router, final Commands cmds) throws AgentUnavailableException, ResourceUnavailableException { if (!checkRouterVersion(router)) { s_logger.debug("Router requires upgrade. Unable to send command to router:" + router.getId() + ", router template version : " + router.getTemplateVersion() + ", minimal required version : " + NetworkOrchestrationService.MinVRVersion.valueIn(router.getDataCenterId())); throw new ResourceUnavailableException("Unable to send command. Router requires upgrade", VirtualRouter.class, router.getId()); } Answer[] answers = null; try { answers = _agentMgr.send(router.getHostId(), cmds); } catch (final OperationTimedoutException e) { s_logger.warn("Timed out", e); throw new AgentUnavailableException("Unable to send commands to virtual router ", router.getHostId(), e); } catch (final OperationCancelledException e) { s_logger.warn("Operation cancelled", e); } if (answers == null || answers.length != cmds.size()) { return false; } boolean result = true; for (final Answer answer : answers) { if (!answer.getResult()) { result = false; break; } } return result; }

Target:
public boolean sendCommandsToRouter(final VirtualRouter router, final Commands cmds) throws AgentUnavailableException, ResourceUnavailableException { if (!checkRouterVersion(router)) { s_logger.debug("Router requires upgrade. Unable to send command to router:" + router.getId() + ", router template version : " + router.getTemplateVersion() + ", minimal required version : " + NetworkOrchestrationService.MinVRVersion.valueIn(router.getDataCenterId())); throw new ResourceUnavailableException("Unable to send command. Router requires upgrade", VirtualRouter.class, router.getId()); } Answer[] answers = null; try { answers = _agentMgr.send(router.getHostId(), cmds); } catch (final OperationTimedoutException e) { s_logger.warn("Timed out", e); throw new AgentUnavailableException("Unable to send commands to virtual router ", router.getHostId(), e); } catch (final OperationCancelledException e) { s_logger.warn("Operation cancelled", e); throw new AgentUnavailableException("Unable to send commands to virtual router ", router.getHostId(), e); } if (answers == null || answers.length != cmds.size()) { return false; } boolean result = true; for (final Answer answer : answers) { if (!answer.getResult()) { result = false; break; } } return result; }
Source:
public void handle(Handshake handshake) throws Exception { Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" ); this.handshake = handshake; ch.setVersion( handshake.getProtocolVersion() ); if ( handshake.getRequestedProtocol() == 2 && BungeeCord.getInstance().getConnectionThrottle().throttle( ( ( InetSocketAddress ) ch.getHandle().remoteAddress() ).getAddress() ) ) { if ( BungeeCord.getInstance().getConfig().isLogThrottled() ) { bungee.getLogger().log( Level.INFO, "{0} throttled", this ); } thisState = State.USERNAME; ch.setProtocol( Protocol.LOGIN ); disconnect( bungee.getTranslation( "join_throttle_kick", TimeUnit.MILLISECONDS.toSeconds( BungeeCord.getInstance().getConfig().getThrottle() ) ) ); return; } if ( handshake.getHost().contains( "\0" ) ) { String[] split = handshake.getHost().split( "\0", 2 ); handshake.setHost( split[0] ); extraDataInHandshake = "\0" + split[1]; } if ( handshake.getHost().endsWith( "." ) ) { handshake.setHost( handshake.getHost().substring( 0, handshake.getHost().length() - 1 ) ); } this.virtualHost = InetSocketAddress.createUnresolved( handshake.getHost(), handshake.getPort() ); bungee.getLogger().log( Level.INFO, "{0} has connected", this ); bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) ); switch ( handshake.getRequestedProtocol() ) { case 1: thisState = State.STATUS; ch.setProtocol( Protocol.STATUS ); break; case 2: thisState = State.USERNAME; ch.setProtocol( Protocol.LOGIN ); break; default: throw new IllegalArgumentException( "Cannot request protocol " + handshake.getRequestedProtocol() ); } }

Target:
public void handle(Handshake handshake) throws Exception { Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" ); this.handshake = handshake; ch.setVersion( handshake.getProtocolVersion() ); if ( handshake.getHost().contains( "\0" ) ) { String[] split = handshake.getHost().split( "\0", 2 ); handshake.setHost( split[0] ); extraDataInHandshake = "\0" + split[1]; } if ( handshake.getHost().endsWith( "." ) ) { handshake.setHost( handshake.getHost().substring( 0, handshake.getHost().length() - 1 ) ); } this.virtualHost = InetSocketAddress.createUnresolved( handshake.getHost(), handshake.getPort() ); bungee.getLogger().log( Level.INFO, "{0} has connected", this ); bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) ); switch ( handshake.getRequestedProtocol() ) { case 1: thisState = State.STATUS; ch.setProtocol( Protocol.STATUS ); break; case 2: thisState = State.USERNAME; ch.setProtocol( Protocol.LOGIN ); if ( BungeeCord.getInstance().getConnectionThrottle().throttle( ( ( InetSocketAddress ) ch.getHandle().remoteAddress() ).getAddress() ) ) { disconnect( bungee.getTranslation( "join_throttle_kick", TimeUnit.MILLISECONDS.toSeconds( BungeeCord.getInstance().getConfig().getThrottle() ) ) ); return; } break; default: throw new IllegalArgumentException( "Cannot request protocol " + handshake.getRequestedProtocol() ); } }
Source:
private boolean registerArchiveFormat(String ext) { ArchiveCommand.Format<ArchiveOutputStream> format = archiveFormats.get(ext); if (format == null) { return false; } try { ArchiveCommand.registerFormat(ext, format); if ("zip".equals(ext)) { setupZipCompressionLevel(); } return true; } catch (Exception e) { return false; } }

Target:
private boolean registerArchiveFormat(String ext) { ArchiveCommand.Format<ArchiveOutputStream> format = archiveFormats.get(ext); if (format != null) { try { ArchiveCommand.registerFormat(ext, format); if ("zip".equals(ext)) { setupZipCompressionLevel(); } return true; } catch (Exception e) { log.error("Error registering archive format: ", e); } } return false; }
Source:
private static String getAnnotationAttributeAsString(List<AnnotationValue> values, String attributeName, String defaultValue) { Optional<Object> propagation = values.stream() .filter(annotationValue -> annotationValue.name().equals(attributeName)) .map(AnnotationValue::value) .findFirst(); if (!propagation.isPresent()) { return defaultValue; } if (propagation.get() instanceof MemberSelectExpressionTree) { return ((MemberSelectExpressionTree) propagation.get()).identifier().name(); } else if (propagation.get() instanceof IdentifierTree) { return ((IdentifierTree) propagation.get()).name(); } return defaultValue; }

Target:
private static String getAnnotationAttributeAsString(List<AnnotationValue> values, String attributeName, String defaultValue) { return values.stream() .filter(annotationValue -> annotationValue.name().equals(attributeName)) .map(AnnotationValue::value) .filter(Tree.class::isInstance) .map(Tree.class::cast) .map(tree -> tree.is(Tree.Kind.MEMBER_SELECT) ? ((MemberSelectExpressionTree) tree).identifier() : tree) .filter(tree -> tree.is(Tree.Kind.IDENTIFIER)) .map(IdentifierTree.class::cast) .map(IdentifierTree::name) .findFirst() .orElse(defaultValue); }
Source:
public synchronized void addOrUpdate(final LineBreakpoint bId) { Breakpoint bp = truffleBreakpoints.get(bId); if (bp == null) { WebDebugger.log("LineBreakpoint: " + bId); bp = Breakpoint.newBuilder(bId.getURI()). lineIs(bId.getLine()). steppingLocation(SteppingLocation.BEFORE_STATEMENT). build(); debuggerSession.install(bp); truffleBreakpoints.put(bId, bp); } bp.setEnabled(bId.isEnabled()); }

Target:
public synchronized void addOrUpdate(final LineBreakpoint bId) { Breakpoint bp = truffleBreakpoints.get(bId); if (bp == null) { WebDebugger.log("LineBreakpoint: " + bId); bp = Breakpoint.newBuilder(bId.getURI()). lineIs(bId.getLine()). build(); debuggerSession.install(bp); truffleBreakpoints.put(bId, bp); } bp.setEnabled(bId.isEnabled()); }
Source:
public <M extends Metric> Tagger<M> forMetric(M metric) { Metadata metadata = metaDataCollection.get(metric); if (metadata != null) { return new TaggerImpl<M>(metric, metadata); } synchronized (this) { if (metaDataCollection.containsKey(metric)) { return new TaggerImpl<M>(metric, metaDataCollection.get(metric)); } Metadata thisMetricsMetadata = new Metadata(); Metadata oldMetaData = metaDataCollection.put(metric, thisMetricsMetadata); Preconditions.checkArgument(oldMetaData == null, "Concurrency issue adding metadata"); return new TaggerImpl<M>(metric, thisMetricsMetadata); } }

Target:
public <M extends Metric> Tagger<M> forMetric(M metric) { Metadata metadata = metaDataCollection.get(metric); if (metadata == null) { synchronized (this) { metadata = metaDataCollection.get(metric); if (metadata == null) { metadata = new Metadata(); Metadata oldMetaData = metaDataCollection.put(metric, metadata); Preconditions.checkArgument(oldMetaData == null, "Concurrency issue adding metadata"); } } } return new TaggerImpl<M>(metric, metadata); }
Source:
public void testParseDateFailed() { try { CommonUtils.parseFromUtcTime("this is obviously not a date"); fail("Parsing date should never be successfull here"); } catch (ParseException e) { } }

Target:
public void testParseDateFailed() throws ParseException { CommonUtils.parseFromUtcTime("this is obviously not a date"); }
Source:
IStorageProvider getStorageProvider(IResource resource, DiffSide side) throws CoreException; boolean isInSync(IResource resource) throws CoreException; public Optional<IFile> getFileBeforeRename(IFile sourceOrRemoteFile, DiffSide side); public Optional<IFile> getFileAfterRename(IFile originFile, DiffSide side); public static enum DiffSide { SOURCE, REMOTE, ORIGIN; }

Target:
IStorageProvider getStorageProvider(IResource resource, DiffSide side) throws CoreException; boolean isInSync(IResource resource) throws CoreException; public IFile getFileBeforeRename(IFile sourceOrRemoteFile, DiffSide side); public IFile getFileAfterRename(IFile originFile, DiffSide side); public static enum DiffSide { SOURCE, REMOTE, ORIGIN; }
Source:
public Object getValueParameter() { if (valueParameter == null) { return null; } else { return valueParameter; } }

Target:
public Object getValueParameter() { return valueParameter; }
Source:
public Token getCurrentToken() { Token token = new Token(); if (azureTokenUtils.findAndSetJWT()) { Token userToken = azureTokenUtils.getUserIdentityFromJWT(); if(userToken != null) { token.setUserIdentity(userToken.getUserIdentity()); token.setUserType(userToken.getUserType()); token.setId(userToken.getId()); } } return token; }

Target:
public Token getCurrentToken() { return azureTokenUtils.retrieveCurrentToken(); }
Source:
public void run() { while (true) { try { Thread.sleep(1000); } catch (InterruptedException e) { return; } synchronized (closedMonitor) { if (isClosed) { return; } } final ZooKeeper.States state = zkObjectHandler.getClient().getZookeeper().getState(); if (state == ZooKeeper.States.CONNECTED) { zkObjectHandler.connectionUp(); connectingCounter = 0; continue; } zkObjectHandler.connectionDown(); if (state == ZooKeeper.States.CONNECTING) { connectingCounter++; if (connectingCounter > 10) { log.fine("Long time in connecting, forcing a close of zookeeper,."); zkObjectHandler.close(); connectingCounter = 0; } continue; } if (state == ZooKeeper.States.CLOSED) { log.fine("Retrying connection to ZooKeeper."); try { zkObjectHandler.setZooKeeper( new ZooKeeper(connectString, SESSION_TIMEOUT, this)); } catch (IOException e) { log.log(Level.SEVERE, "RetryConnection failed for some reason:" + e.getMessage(), e); } try { Thread.sleep(10000); } catch (InterruptedException e) { return; } continue; } log.severe("Unknown state " + state + " closing...."); zkObjectHandler.close(); } }

Target:
public void run() { final ZooKeeper.States state = zkObjectHandler.getClient().getZookeeper().getState(); if (state == ZooKeeper.States.CONNECTED) { zkObjectHandler.connectionUp(); connectingCounter = 0; return; } zkObjectHandler.connectionDown(); if (state == ZooKeeper.States.CONNECTING) { connectingCounter++; if (connectingCounter > 10) { log.fine("Long time in connecting, forcing a close of zookeeper client."); zkObjectHandler.close(); connectingCounter = 0; } return; } if (state == ZooKeeper.States.CLOSED) { log.fine("Retrying connection to ZooKeeper."); try { zkObjectHandler.setZooKeeper( new ZooKeeper(connectString, SESSION_TIMEOUT, this)); } catch (IOException e) { log.log(Level.SEVERE, "RetryConnection failed for some reason:" + e.getMessage(), e); } return; } log.severe("Unknown state " + state + " closing...."); zkObjectHandler.close(); }
Source:
@Nullable public String getLicenseUrl() { return license.getLicenseUrl(); }

Target:
@NonNull public String getLicenseUrl() { return license.getLicenseUrl(); }
Source:
private int getOverlappingBaseCount(final BaseExclusionHelper read1exclusions, final BaseExclusionHelper read2exclusions) { if ( read2exclusions.read.getAlignmentStart() < read1exclusions.read.getAlignmentStart() ) { return getOverlappingBaseCount(read2exclusions, read1exclusions); } if ( read1exclusions.read.getAlignmentEnd() < read2exclusions.read.getAlignmentStart() || !read1exclusions.read.getReferenceIndex().equals(read2exclusions.read.getReferenceIndex()) ) return 0; final byte[] read1quals = read1exclusions.read.getBaseQualities(); final byte[] read2quals = read2exclusions.read.getBaseQualities(); final int overlap = read1exclusions.read.getAlignmentEnd() - read2exclusions.read.getAlignmentStart() + 1; int numHighQualityOverlappingBases = 0; for (int i = 0; i < overlap; i++) { if (read1quals[read1exclusions.firstTrailingClippedBaseIndex - overlap + i] >= MINIMUM_BASE_QUALITY && read2quals[read2exclusions.firstUnclippedBaseIndex + i] >= MINIMUM_BASE_QUALITY) { numHighQualityOverlappingBases++; } } return numHighQualityOverlappingBases; }

Target:
private int getOverlappingBaseCount(final BaseExclusionHelper read1exclusions, final BaseExclusionHelper read2exclusions) { if ( read2exclusions.read.getAlignmentStart() < read1exclusions.read.getAlignmentStart() ) { return getOverlappingBaseCount(read2exclusions, read1exclusions); } if ( read1exclusions.read.getAlignmentEnd() < read2exclusions.read.getAlignmentStart() || !read1exclusions.read.getReferenceIndex().equals(read2exclusions.read.getReferenceIndex()) ) return 0; final byte[] read1quals = read1exclusions.read.getBaseQualities(); final byte[] read2quals = read2exclusions.read.getBaseQualities(); final int indexOfOverlapInFirstRead = getOffsetAtReferencePosition(read1exclusions.read, read2exclusions.read.getAlignmentStart()) - 1; final int maxPossibleOverlap = read1exclusions.firstTrailingClippedBaseIndex - indexOfOverlapInFirstRead; final int actualOverlap = Math.min(maxPossibleOverlap, read2exclusions.firstTrailingClippedBaseIndex - read2exclusions.firstUnclippedBaseIndex); int numHighQualityOverlappingBases = 0; for (int i = 0; i < actualOverlap; i++) { final int posInRead1 = read1exclusions.firstTrailingClippedBaseIndex - actualOverlap + i; final int posInRead2 = read2exclusions.firstUnclippedBaseIndex + i; if (read1quals[posInRead1] >= MINIMUM_BASE_QUALITY && read2quals[posInRead2] >= MINIMUM_BASE_QUALITY) { numHighQualityOverlappingBases++; } } return numHighQualityOverlappingBases; }
Source:
TaskGroup(String containerId, List<String> taskNames) { this.containerId = containerId; Collections.sort(taskNames); this.taskNames.addAll(taskNames); }

Target:
TaskGroup(String containerId, List<String> taskNames) { this.containerId = containerId; this.taskNames.addAll(taskNames); Collections.sort(this.taskNames); }
Source:
public void shouldProperlyParseManifestFromJar() throws IOException { File jar = createHpiWithManifest(); final Manifest manifest = PluginManager.parsePluginManifest(jar.toURI().toURL()); assertThat("manifest should have been read from the sample", manifest, notNullValue()); assertAttribute(manifest, "Created-By", "Apache Maven"); assertAttribute(manifest, "Short-Name", "matrix-auth"); }

Target:
public void shouldProperlyParseManifestFromJar() throws IOException { File jar = createHpiWithManifest(); final Manifest manifest = PluginManager.parsePluginManifest(jar.toURI().toURL()); assertThat("manifest should have been read from the sample", manifest, notNullValue()); assertAttribute(manifest, "Created-By", "Apache Maven"); assertAttribute(manifest, "Short-Name", "matrix-auth"); assertAttribute(manifest, "Specification-Title", "Offers matrix-based security authorization strategies (global and per-project)."); assertAttribute(manifest, "Url", "<LINK_0>"); assertAttribute(manifest, "Plugin-Developers", null); }
Source:
public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); if(cursor!=null) { int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } else return null; }

Target:
public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); if(cursor != null) { int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } else { return null; } }
Source:
public void registerDefaults() { addTextColor(TextFormatting.BLACK, Color.BLACK); addTextColor(TextFormatting.DARK_BLUE, Color.of(0x0000AA)); addTextColor(TextFormatting.DARK_GREEN, Color.of(0x00AA00)); addTextColor(TextFormatting.DARK_AQUA, Color.of(0x00AAAA)); addTextColor(TextFormatting.DARK_RED, Color.of(0xAA0000)); addTextColor(TextFormatting.DARK_PURPLE, Color.of(0xAA00AA)); addTextColor(TextFormatting.GOLD, Color.of(0xFFAA00)); addTextColor(TextFormatting.GRAY, Color.of(0xAAAAAA)); addTextColor(TextFormatting.DARK_GRAY, Color.of(0x555555)); addTextColor(TextFormatting.BLUE, Color.of(0x5555FF)); addTextColor(TextFormatting.GREEN, Color.of(0x55FF55)); addTextColor(TextFormatting.AQUA, Color.of(0x55FFFF)); addTextColor(TextFormatting.RED, Color.of(0xFF5555)); addTextColor(TextFormatting.LIGHT_PURPLE, Color.of(0xFF55FF)); addTextColor(TextFormatting.YELLOW, Color.of(0xFFFF55)); addTextColor(TextFormatting.WHITE, Color.WHITE); addTextColor(TextFormatting.RESET, Color.WHITE); textColorMappings.put("none", TextColors.NONE); }

Target:
public void registerDefaults() { addTextColor(TextFormatting.BLACK, Color.BLACK); addTextColor(TextFormatting.DARK_BLUE, Color.ofRgb(0x0000AA)); addTextColor(TextFormatting.DARK_GREEN, Color.ofRgb(0x00AA00)); addTextColor(TextFormatting.DARK_AQUA, Color.ofRgb(0x00AAAA)); addTextColor(TextFormatting.DARK_RED, Color.ofRgb(0xAA0000)); addTextColor(TextFormatting.DARK_PURPLE, Color.ofRgb(0xAA00AA)); addTextColor(TextFormatting.GOLD, Color.ofRgb(0xFFAA00)); addTextColor(TextFormatting.GRAY, Color.ofRgb(0xAAAAAA)); addTextColor(TextFormatting.DARK_GRAY, Color.ofRgb(0x555555)); addTextColor(TextFormatting.BLUE, Color.ofRgb(0x5555FF)); addTextColor(TextFormatting.GREEN, Color.ofRgb(0x55FF55)); addTextColor(TextFormatting.AQUA, Color.ofRgb(0x55FFFF)); addTextColor(TextFormatting.RED, Color.ofRgb(0xFF5555)); addTextColor(TextFormatting.LIGHT_PURPLE, Color.ofRgb(0xFF55FF)); addTextColor(TextFormatting.YELLOW, Color.ofRgb(0xFFFF55)); addTextColor(TextFormatting.WHITE, Color.WHITE); addTextColor(TextFormatting.RESET, Color.WHITE); textColorMappings.put("none", TextColors.NONE); }
Source:
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { if (itemStackIn.hasCapability(CapabilityGuiProvider.GUI_PROVIDER_CAPABILITY, EnumFacing.UP)) { IGuiProvider provider = itemStackIn.getCapability(CapabilityGuiProvider.GUI_PROVIDER_CAPABILITY, hand == EnumHand.MAIN_HAND ? EnumFacing.UP : EnumFacing.DOWN); playerIn.openGui(provider); return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn); } return ActionResult.newResult(EnumActionResult.PASS, itemStackIn); }

Target:
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { if (itemStackIn.hasCapability(CapabilityGuiProvider.GUI_PROVIDER_CAPABILITY, EnumFacing.UP)) { IGuiProvider provider = itemStackIn.getCapability(CapabilityGuiProvider.GUI_PROVIDER_CAPABILITY, null); playerIn.openGui(provider, hand); return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn); } return ActionResult.newResult(EnumActionResult.PASS, itemStackIn); }
Source:
protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) { Rectangle constraint = (Rectangle) super.getConstraintFor(request, child); if (REQ_MOVE_CHILDREN.equals(request.getType())) { Optional<Dimension> optionalDim = Optional.of(child.getModel()).filter(Node.class::isInstance).map(model -> ((Node) model).getLayoutConstraint()).filter(Size.class::isInstance) .map(layoutConstraint -> new Dimension(((Size) layoutConstraint).getWidth(), ((Size) layoutConstraint).getHeight())); if (optionalDim.isPresent()) { constraint.setSize(optionalDim.get()); } } return constraint; }

Target:
protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) { Rectangle constraint = (Rectangle) super.getConstraintFor(request, child); if (REQ_MOVE_CHILDREN.equals(request.getType())) { Optional<Size> optionalSize = Optional.ofNullable(child.getModel()).filter(Node.class::isInstance).map(model -> ((Node) model).getLayoutConstraint()).filter(Size.class::isInstance) .map(Size.class::cast); if (optionalSize.isPresent()) { Dimension dimension = new Dimension(optionalSize.get().getWidth(), optionalSize.get().getHeight()); constraint.setSize(dimension); } } return constraint; }
Source:
protected TaskScheduled sendToEngine(Task task) { if (task.getId() == 2) { testFailed = true; this.task.cancel(true); return TaskScheduled.ERROR; } scheduledCounter += 1; if (scheduledCounter > scheduleLimit) { testFailed = false; this.task.cancel(true); } return TaskScheduled.SUCCESS; }

Target:
protected TaskScheduled sendToEngine(Task task) { if (task.isSourceUpdated() && !task.isPropagationForced()) { testFailed = true; this.task.cancel(true); return TaskScheduled.ERROR; } scheduledCounter += 1; if (scheduledCounter >= scheduleLimit) { testFailed = false; this.task.cancel(true); stop(); } return TaskScheduled.SUCCESS; }
Source:
public Configuration(Properties props) throws Exception { CuratorFramework curator = CuratorUtil.getCurator(props.getProperty(ConnectionProperties.ZOOKEEPER_CONNECT_PROP), Integer.parseInt(props.getProperty(ConnectionProperties.ZOOKEEPER_TIMEOUT_PROP))); String zooDir = props.getProperty(ConnectionProperties.ZOOKEEPER_ROOT_PROP); Connector conn = new ZooKeeperInstance(props.getProperty(ConnectionProperties.ACCUMULO_INSTANCE_PROP), props.getProperty(ConnectionProperties.ZOOKEEPER_CONNECT_PROP)).getConnector( props.getProperty(ConnectionProperties.ACCUMULO_USER_PROP), new PasswordToken(props.getProperty(ConnectionProperties.ACCUMULO_PASSWORD_PROP)) ); int oraclePort = Integer.parseInt(props.getProperty(OracleProperties.ORACLE_PORT_PROP, OracleProperties.ORACLE_DEFAULT_PORT + "")); curator.start(); init(curator, zooDir, conn, oraclePort); curator.close(); }

Target:
public Configuration(Properties props) throws Exception { try (CuratorFramework curator = CuratorUtil.getCurator(props.getProperty(ConnectionProperties.ZOOKEEPER_CONNECT_PROP), Integer.parseInt(props.getProperty(ConnectionProperties.ZOOKEEPER_TIMEOUT_PROP)))) { String zooDir = props.getProperty(ConnectionProperties.ZOOKEEPER_ROOT_PROP); Connector conn = new ZooKeeperInstance(props.getProperty(ConnectionProperties.ACCUMULO_INSTANCE_PROP), props.getProperty(ConnectionProperties.ZOOKEEPER_CONNECT_PROP)).getConnector( props.getProperty(ConnectionProperties.ACCUMULO_USER_PROP), new PasswordToken(props.getProperty(ConnectionProperties.ACCUMULO_PASSWORD_PROP)) ); int oraclePort = Integer.parseInt(props.getProperty(OracleProperties.ORACLE_PORT_PROP, OracleProperties.ORACLE_DEFAULT_PORT + "")); curator.start(); init(curator, zooDir, conn, oraclePort); } }
Source:
public static boolean deepEquals(Object obj1, Object obj2) { if (obj1 instanceof JSONArray) { if (!(obj2 instanceof JSONArray)) { return false; } return deepEqualArrays((JSONArray) obj1, (JSONArray) obj2); } else if (obj1 instanceof JSONObject) { if (!(obj2 instanceof JSONObject)) { return false; } return deepEqualObjects((JSONObject) obj1, (JSONObject) obj2); } else if (obj1 instanceof Number) { if (!(obj2 instanceof Number)) { return false; } else if (!obj1.getClass().equals(obj2.getClass())) { String obj1AsString = obj1 instanceof Double && (Double) obj1 >= 10000000 ? numberFormat.format(obj1) : JSONObject.numberToString((Number) obj1); String obj2AsString = obj2 instanceof Double && (Double) obj2 >= 10000000 ? numberFormat.format(obj2) : JSONObject.numberToString((Number) obj2); return obj1AsString.equals(obj2AsString); } } return Objects.equals(obj1, obj2); }

Target:
public static boolean deepEquals(Object obj1, Object obj2) { if (obj1 instanceof JSONArray) { if (!(obj2 instanceof JSONArray)) { return false; } return deepEqualArrays((JSONArray) obj1, (JSONArray) obj2); } else if (obj1 instanceof JSONObject) { if (!(obj2 instanceof JSONObject)) { return false; } return deepEqualObjects((JSONObject) obj1, (JSONObject) obj2); } else if (obj1 instanceof Number) { if (!(obj2 instanceof Number)) { return false; } else if (obj1.getClass() != obj2.getClass()) { return getAsBigDecimal(obj1).compareTo(getAsBigDecimal(obj2)) == 0; } } return Objects.equals(obj1, obj2); }
Source:
public void testFeatureAfterExcludingFolder() throws Exception { String fileNameForExcluding = "AppController.java"; String pathToJavaFile = format("%s/src/main/java/org/eclipse/qa/examples/AppController.java", PROJECT_NAME); String currentTimeInMs = Long.toString(System.currentTimeMillis()); doFileWatcherExcludeOperation( PROJECT_NAME + "/" + FOLDER_NAME_FOR_EXCLUDE, ADD_TO_FILE_WATCHER_EXCLUDES); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); editor.waitActive(); testProjectServiceClient.updateFile(testWorkspace.getId(), pathToJavaFile, currentTimeInMs); editor.selectTabByName("AppController"); editor.waitTextNotPresentIntoEditor(currentTimeInMs); editor.clickOnCloseFileIcon("AppController"); projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); editor.waitActive(); editor.waitTextIntoEditor(currentTimeInMs); }

Target:
public void testFeatureAfterExcludingFolder() throws Exception { String fileNameForExcluding = "AppController.java"; String pathToJavaFile = format("%s/src/main/java/org/eclipse/qa/examples/AppController.java", PROJECT_NAME); String currentTimeInMillis = Long.toString(System.currentTimeMillis()); doFileWatcherExcludeOperation( PROJECT_NAME + "/" + FOLDER_NAME_FOR_EXCLUDE, ADD_TO_FILE_WATCHER_EXCLUDES); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); editor.waitActive(); testProjectServiceClient.updateFile(testWorkspace.getId(), pathToJavaFile, currentTimeInMillis); editor.selectTabByName("AppController"); editor.waitTextNotPresentIntoEditor(currentTimeInMillis); editor.clickOnCloseFileIcon("AppController"); projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); editor.waitActive(); editor.waitTextIntoEditor(currentTimeInMillis); }
Source:
protected void beforeSpringSecurityFilterChain(ServletContext servletContext) { Dynamic forwardedHeaderFilter = servletContext.addFilter("forwardedHeaderFilter", ForwardedHeaderFilter.class); forwardedHeaderFilter.setAsyncSupported(true); forwardedHeaderFilter.addMappingForUrlPatterns(EnumSet.of(REQUEST, FORWARD, ASYNC), false, "*"); }

Target:
protected void beforeSpringSecurityFilterChain(ServletContext servletContext) { Dynamic forwardedHeaderFilter = servletContext.addFilter("forwardedHeaderFilter", ForwardedHeaderFilter.class); forwardedHeaderFilter.setAsyncSupported(true); forwardedHeaderFilter.addMappingForUrlPatterns(EnumSet.of(REQUEST, ERROR, ASYNC), false, "*"); }
Source:
public ParsedMessage parse(Message message) throws Exception { String[] partitions = extractPartitions(message); MessageTransformers msgTransformer = ReflectionUtil .createMessageTransformer(mConfig.getMessageTransformerClass(), mConfig); byte[] transformedMsg = msgTransformer.transform(message.getPayload()); return new ParsedMessage(message.getTopic(), message.getKafkaPartition(), message.getOffset(), transformedMsg, partitions); }

Target:
public ParsedMessage parse(Message message) throws Exception { String[] partitions = extractPartitions(message); return new ParsedMessage(message.getTopic(), message.getKafkaPartition(), message.getOffset(), message.getKafkaKey(), message.getPayload(), partitions); }
Source:
public void sendBannerChange(Location location, CompoundTag nbt) throws NullPointerException { sendBlockEntityChange(location, nbt, GlowBlockEntity.BANNER); }

Target:
public void sendBannerChange(Location location, CompoundTag nbt) { sendBlockEntityChange(location, nbt, GlowBlockEntity.BANNER); }
Source:
protected void checkAccessControl() { if (authType.getLevel() < getMinAuthLevel().getLevel()) { throw new UnauthorizedAccessException(); } if (getMinAuthLevel() == AuthType.PUBLIC) { return; } if (authType == AuthType.ALL_ACCESS) { return; } if (!checkSpecificAccessControl()) { throw new UnauthorizedAccessException(); } }

Target:
public void checkAccessControl() { if (authType.getLevel() < getMinAuthLevel().getLevel()) { throw new UnauthorizedAccessException(); } if (authType == AuthType.ALL_ACCESS) { return; } checkSpecificAccessControl(); }
Source:
public <T> T retryTransaction(final TransactionCallback<T> callback, final int quietTries, final int maxTries) { try { return RetryUtils.retry(() -> getDBI().inTransaction(callback), shouldRetry, quietTries, maxTries, null, null); } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public <T> T retryTransaction(final TransactionCallback<T> callback, final int quietTries, final int maxTries) { try { return RetryUtils.retry(() -> getDBI().inTransaction(callback), shouldRetry, quietTries, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
public void start() throws SamzaException { LOG.info("Restore started"); this.taskStorageManagers.values().forEach(taskStorageManager -> taskStorageManager.init()); this.systemConsumers.values().forEach(systemConsumer -> systemConsumer.start()); ExecutorService executorService = Executors.newFixedThreadPool(this.parallelRestoreThreadPoolSize, new ThreadFactoryBuilder().setNameFormat(RESTORE_THREAD_NAME).build()); List<Future> futureList = new ArrayList<>(this.taskStorageManagers.entrySet().size()); this.taskStorageManagers.entrySet().forEach(task -> { futureList.add( executorService.submit(new TaskRestoreRunnable(this.samzaContainerMetrics, task.getKey(), task.getValue()))); }); for (Future future : futureList) { try { future.get(); } catch (Exception e) { LOG.error("Exception when restoring ", e); throw new SamzaException("Exception when restoring ", e); } } executorService.shutdown(); this.systemConsumers.values().forEach(systemConsumer -> systemConsumer.stop()); LOG.info("Restore complete"); }

Target:
public void start() throws SamzaException { LOG.info("Restore started"); this.taskStorageManagers.values().forEach(taskStorageManager -> taskStorageManager.init()); this.systemConsumers.values().forEach(systemConsumer -> systemConsumer.start()); ExecutorService executorService = Executors.newFixedThreadPool(this.parallelRestoreThreadPoolSize, new ThreadFactoryBuilder().setNameFormat(RESTORE_THREAD_NAME).build()); List<Future> taskRestoreFutures = new ArrayList<>(this.taskStorageManagers.entrySet().size()); this.taskStorageManagers.forEach((taskInstance, taskStorageManager) -> { taskRestoreFutures.add( executorService.submit(new TaskRestoreCallable(this.samzaContainerMetrics, taskInstance, taskStorageManager))); }); for (Future future : taskRestoreFutures) { try { future.get(); } catch (Exception e) { LOG.error("Exception when restoring ", e); throw new SamzaException("Exception when restoring ", e); } } executorService.shutdown(); this.systemConsumers.values().forEach(systemConsumer -> systemConsumer.stop()); LOG.info("Restore complete"); }
Source:
public String build(final Path directory, final String name, final String dockerfile, final ProgressHandler handler, final BuildParam... params) throws DockerException, InterruptedException, IOException { checkNotNull(handler, "handler"); WebTarget resource = noTimeoutResource().path("build"); for (final BuildParam param : params) { resource = resource.queryParam(param.name(), param.value); } if (name != null) { resource = resource.queryParam("t", name); } if (dockerfile != null) { resource = resource.queryParam("dockerfile", dockerfile); } log.debug("Auth Config {}", authConfig); AuthRegistryConfig authRegistryConfig; if (authConfig == null) { authRegistryConfig = AuthRegistryConfig.EMPTY; } else { authRegistryConfig = new AuthRegistryConfig(authConfig.serverAddress(), authConfig.username(), authConfig.password(), authConfig.email(), authConfig.serverAddress()); } try (final CompressedDirectory compressedDirectory = CompressedDirectory.create(directory); final InputStream fileStream = Files.newInputStream(compressedDirectory.file()); final ProgressStream build = request(POST, ProgressStream.class, resource, resource.request(APPLICATION_JSON_TYPE) .header("X-Registry-Config", authRegistryHeader(authRegistryConfig)), Entity.entity(fileStream, "application/tar"))) { String imageId = null; while (build.hasNextMessage(POST, resource.getUri())) { final ProgressMessage message = build.nextMessage(POST, resource.getUri()); final String id = message.buildImageId(); if (id != null) { imageId = id; } handler.progress(message); } return imageId; } }

Target:
public String build(final Path directory, final String name, final String dockerfile, final ProgressHandler handler, final BuildParam... params) throws DockerException, InterruptedException, IOException { checkNotNull(handler, "handler"); WebTarget resource = noTimeoutResource().path("build"); for (final BuildParam param : params) { resource = resource.queryParam(param.name(), param.value()); } if (name != null) { resource = resource.queryParam("t", name); } if (dockerfile != null) { resource = resource.queryParam("dockerfile", dockerfile); } log.debug("Auth Config {}", authConfig); AuthRegistryConfig authRegistryConfig; if (authConfig == null) { authRegistryConfig = AuthRegistryConfig.EMPTY; } else { authRegistryConfig = new AuthRegistryConfig(authConfig.serverAddress(), authConfig.username(), authConfig.password(), authConfig.email(), authConfig.serverAddress()); } try (final CompressedDirectory compressedDirectory = CompressedDirectory.create(directory); final InputStream fileStream = Files.newInputStream(compressedDirectory.file()); final ProgressStream build = request(POST, ProgressStream.class, resource, resource.request(APPLICATION_JSON_TYPE) .header("X-Registry-Config", authRegistryHeader(authRegistryConfig)), Entity.entity(fileStream, "application/tar"))) { String imageId = null; while (build.hasNextMessage(POST, resource.getUri())) { final ProgressMessage message = build.nextMessage(POST, resource.getUri()); final String id = message.buildImageId(); if (id != null) { imageId = id; } handler.progress(message); } return imageId; } }
Source:
static boolean validatePinningAndMigration(List<String> reasons, VmStatic vmStaticData, String cpuPinning) { final boolean cpuPinMigrationEnabled = Boolean.TRUE.equals(Config.<Boolean> getValue(ConfigValues.CpuPinMigrationEnabled)); if (!cpuPinMigrationEnabled && (vmStaticData.getMigrationSupport() == MigrationSupport.MIGRATABLE || vmStaticData.getMigrationSupport() == MigrationSupport.IMPLICITLY_NON_MIGRATABLE) && StringUtils.isNotEmpty(cpuPinning)) { reasons.add(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_AND_MIGRATABLE.toString()); return false; } if (vmStaticData.isAutoStartup() && (vmStaticData.getMigrationSupport() != MigrationSupport.MIGRATABLE && vmStaticData.getDedicatedVmForVdsList().size() != 1)) { reasons.add(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_PINNED_TO_HOST.toString()); return false; } return true; }

Target:
static boolean validatePinningAndMigration(List<String> reasons, VmStatic vmStaticData, String cpuPinning) { final boolean cpuPinMigrationEnabled = Boolean.TRUE.equals(Config.<Boolean> getValue(ConfigValues.CpuPinMigrationEnabled)); if (!cpuPinMigrationEnabled && (vmStaticData.getMigrationSupport() == MigrationSupport.MIGRATABLE || vmStaticData.getMigrationSupport() == MigrationSupport.IMPLICITLY_NON_MIGRATABLE) && StringUtils.isNotEmpty(cpuPinning)) { reasons.add(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_AND_MIGRATABLE.toString()); return false; } if (vmStaticData.isAutoStartup() && (vmStaticData.getMigrationSupport() != MigrationSupport.MIGRATABLE && vmStaticData.getDedicatedVmForVdsList().size() == 1)) { reasons.add(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_PINNED_TO_HOST.toString()); return false; } return true; }
Source:
public void validate_shouldRejectAVisitIfItHasLessThanMinOccursOfAnAttributeWhenExpectedExactlyOne() throws Exception { executeDataSet("org/openmrs/validator/include/VisitValidatorTest-additionalAttributeType1.xml"); Visit visit = makeVisit(); try { ValidateUtil.validate(visit); } catch (ValidationException e) { Errors errors = e.getErrors(); assertEquals(1, errors.getErrorCount()); assertEquals("error.required", errors.getFieldError("activeAttributes").getCode()); } }

Target:
public void validate_shouldRejectAVisitIfItHasLessThanMinOccursOfAnAttributeWhenExpectedExactlyOne() throws Exception { executeDataSet("org/openmrs/validator/include/VisitValidatorTest-additionalAttributeType1.xml"); Visit visit = makeVisit(); try { ValidateUtil.validate(visit); fail(); } catch (ValidationException e) { Errors errors = e.getErrors(); assertEquals(1, errors.getErrorCount()); assertEquals("error.required", errors.getFieldError("activeAttributes").getCode()); } }
Source:
public boolean needsQuoting(String alias, String identifierQuoteString) { boolean result = false; if (alias != null && identifierQuoteString != null) { if (alias.indexOf(identifierQuoteString) == -1) { for (int i = 0; i < SPECIAL_ALIAS_CHARACTERS.length(); i++) { char specialCharacter = SPECIAL_ALIAS_CHARACTERS.charAt(i); if (alias.indexOf(specialCharacter) != -1) { result = true; break; } } } } if (logger.isDebugEnabled()) { logger.debug("needsQuoting(" + alias + "," + identifierQuoteString + ") = " + result); } return result; }

Target:
protected boolean needsQuoting(String alias, String identifierQuoteString) { boolean result = false; if (alias != null && identifierQuoteString != null) { if (alias.indexOf(identifierQuoteString) == -1) { for (int i = 0; i < SPECIAL_ALIAS_CHARACTERS.length(); i++) { char specialCharacter = SPECIAL_ALIAS_CHARACTERS.charAt(i); if (alias.indexOf(specialCharacter) != -1) { result = true; break; } } } } if (logger.isDebugEnabled()) { logger.debug("needsQuoting(" + alias + "," + identifierQuoteString + ") = " + result); } return result; }
Source:
public ResultSet getColumns() throws SQLException { ResultSet rs = getMetaData().getProcedureColumns(null, name.getSchemaName(), name.getObjectName(), "%"); return rs; }

Target:
public ResultSet getColumns() throws SQLException { return getDbMetaData().getProcedureColumns(null, name.getSchemaName(), name.getObjectName(), "%"); }