auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ChangeDetail call() throws NoSuchChangeException, OrmException, EmailException, NoSuchEntityException, PatchSetInfoNotAvailableException, MissingObjectException, IncorrectObjectTypeException, IOException { final Change.Id changeId = patchSetId.getParentKey(); final ChangeControl control = changeControlFactory.validateFor(changeId); <START> if (!control.canAddPatchSet()) { <END> throw new NoSuchChangeException(changeId); } Change.Id cherryPickedChangeId = ChangeUtil.cherryPick(patchSetId, currentUser, message, destinationBranch, db, hooks, gitManager, patchSetInfoFactory, replication, myIdent); return changeDetailFactory.create(cherryPickedChangeId).call(); }</code><technical_language>check if user push a change for destination branch</technical_language>

Target:
public ChangeDetail call() throws OrmException, EmailException, NoSuchEntityException, PatchSetInfoNotAvailableException, MissingObjectException, IncorrectObjectTypeException, IOException, InvalidChangeOperationException, NoSuchChangeException, MergeException { final Change.Id changeId = patchSetId.getParentKey(); final ChangeControl control = changeControlFactory.validateFor(changeId); if (!control.getProjectControl().controlForRef(destinationBranch).canUpload()) { throw new InvalidChangeOperationException( "Not allowed to cherry pick " + changeId.toString() + " to " + destinationBranch); } Change.Id cherryPickedChangeId = ChangeUtil.cherryPick(patchSetId, currentUser, message, destinationBranch, db, hooks, gitManager, patchSetInfoFactory, replication, myIdent); return changeDetailFactory.create(cherryPickedChangeId).call(); }
Source:
<code>public void init() { if (JavaVersion.VERSION.getPlatform() != 8) throw new IllegalStateException(this + " not applicable for java " + JavaVersion.VERSION); try { alpnProtocols = SSLParameters.class.getMethod("setApplicationProtocols", String[].class); alpnProtocol = SSLEngine.class.getMethod("getApplicationProtocol"); return; } catch (NoSuchMethodException ignored) <START> { <END> } if (ALPN.class.getClassLoader() != null) throw new IllegalStateException(ALPN.class.getName() + " must be on JVM boot classpath"); if (LOG.isDebugEnabled()) ALPN.debug = true; }</code><technical_language>do a LOG.ignore exception if want</technical_language>

Target:
public void init() { if (JavaVersion.VERSION.getPlatform() != 8) throw new IllegalStateException(this + " not applicable for java " + JavaVersion.VERSION); try { alpnProtocols = SSLParameters.class.getMethod("setApplicationProtocols", String[].class); alpnProtocol = SSLEngine.class.getMethod("getApplicationProtocol"); if (LOG.isDebugEnabled()) LOG.debug("Using OpenJDK ALPN APIs instead of Jetty ALPN APIs"); return; } catch (NoSuchMethodException x) { LOG.ignore(x); } if (ALPN.class.getClassLoader() != null) throw new IllegalStateException(ALPN.class.getName() + " must be on JVM boot classpath"); if (LOG.isDebugEnabled()) ALPN.debug = true; }
Source:
<code>public static List<StreamReadsRequest> getReadRequests(final String readGroupSetId, String references) { final Iterable<Contig> contigs = Contig.parseContigsFromCommandLine(references); return FluentIterable.from(contigs) .transformAndConcat(new Function<Contig, Iterable<Contig>>() { @Override public Iterable<Contig> apply(Contig contig) { <START> return contig.getShards(5000000L); <END> } }) .transform(new Function<Contig, StreamReadsRequest>() { @Override public StreamReadsRequest apply(Contig shard) { return StreamReadsRequest.newBuilder() .setReadGroupSetId(readGroupSetId) .setStart(shard.start) .setEnd(shard.end) .setReferenceName(shard.referenceName) .build(); } }).toList(); }</code><technical_language>I Nicole Dion previously discussed issues hardcoding it, a final constant manipulating better</technical_language>

Target:
public static List<StreamReadsRequest> getReadRequests(final String readGroupSetId, String references) { final Iterable<Contig> contigs = Contig.parseContigsFromCommandLine(references); return FluentIterable.from(contigs) .transformAndConcat(new Function<Contig, Iterable<Contig>>() { @Override public Iterable<Contig> apply(Contig contig) { return contig.getShards(SHARD_SIZE); } }) .transform(new Function<Contig, StreamReadsRequest>() { @Override public StreamReadsRequest apply(Contig shard) { return StreamReadsRequest.newBuilder() .setReadGroupSetId(readGroupSetId) .setStart(shard.start) .setEnd(shard.end) .setReferenceName(shard.referenceName) .build(); } }).toList(); }
Source:
<code>private YailList getYailListPropertyHelper(Callable<YailList> propertyCallable) { try { return threadRunner .submit(propertyCallable) <START> .get(); END> } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } return new YailList(); }</code><technical_language>This potentially block UI thread for long enough time ANR appears, depending size of file read</technical_language>

Target:
private YailList getYailListPropertyHelper(Callable<YailList> propertyCallable) { try { return threadRunner .submit(propertyCallable) .get(); } catch (InterruptedException e) { Log.e(this.getClass().getName(), e.getMessage()); } catch (ExecutionException e) { Log.e(this.getClass().getName(), e.getMessage()); } return new YailList(); }
Source:
<code>private static String getUserIdUrl(String encodedUsername) { <START> String communityUrl = new UrlBuilder(Configuration.DEFAULT_LANGUAGE).getUrlForWiki("community"); <END> return String.format("%s/api.php?action=query&list=users&ususers=%s&format=json&cb=%d", communityUrl, encodedUsername, DateTime.now().getMillis()); }</code><technical_language>is a variable named COMMUNITY_WIKI here</technical_language>

Target:
private static String getUserIdUrl(String encodedUsername) { String communityUrl = UrlBuilder.createUrlBuilderForWikiAndLang(COMMUNITY_WIKI, Configuration.DEFAULT_LANGUAGE).getUrl(); return String.format("%s/api.php?action=query&list=users&ususers=%s&format=json&cb=%d", communityUrl, encodedUsername, DateTime.now().getMillis()); }
Source:
<code>public void test1() throws Exception { File src = new File("src/org/zkoss/zktest/test2/ZK3848_lang_addon_Test1.xml"); File dst = new File("debug/classes/metainfo/zk/lang-addon.xml"); String name = "metainfo/zk/lang-addon.xml"; String elName = "addon-name"; String elDepends = "depends"; Path zkPath = dst.toPath().getParent(); if (!Files.exists(zkPath)) Files.createDirectories(zkPath); Files.copy(src.toPath(), dst.toPath(), StandardCopyOption.REPLACE_EXISTING); boolean throwError = false; try { clToTest.getDependentXMLResources(name, elName, elDepends); } catch (Exception ex) { <START> Assert.assertEquals("In file:/Users/klyve/prj/zkmaster/zk/zktest/debug/classes/metainfo/zk/lang-addon.xml, you are extending component decimalbox which is defined in 'zkplus', 'zkbind', please define <depends>element", ex.getMessage()); <END> throwError = true; } finally { Files.delete(dst.toPath()); Path metainfoPath = zkPath.getParent(); Files.delete(zkPath); Files.delete(metainfoPath); } if (!throwError) { throw new Exception(); } }</code><technical_language>passes computer... Hamcrest java Assert.assertThat(result.get(0), containsString("you extending ..."))</technical_language>

Target:
public void test1() throws Exception { File src = new File("src/org/zkoss/zktest/test2/ZK3848_lang_addon_Test1.xml"); File dst = new File("debug/classes/metainfo/zk/lang-addon.xml"); String name = "metainfo/zk/lang-addon.xml"; String elName = "addon-name"; String elDepends = "depends"; Path zkPath = dst.toPath().getParent(); if (!Files.exists(zkPath)) Files.createDirectories(zkPath); Files.copy(src.toPath(), dst.toPath(), StandardCopyOption.REPLACE_EXISTING); boolean throwError = false; try { clToTest.getDependentXMLResources(name, elName, elDepends); } catch (Exception ex) { Assert.assertThat(ex.getMessage(), containsString("you are extending component decimalbox which is defined in 'zkplus', 'zkbind', please define <depends> element")); throwError = true; } finally { Files.delete(dst.toPath()); Path metainfoPath = zkPath.getParent(); Files.delete(zkPath); Files.delete(metainfoPath); } if (!throwError) { throw new Exception("An exception is expected"); } }
Source:
<code>public void doLastPhaseActions(FacesContext context, boolean outgoingResponseIsRedirect) { Map<Object, Object> contextMap = context.getAttributes(); PreviousNextFlashInfoManager flashManager = getCurrentFlashManager(contextMap, false); if (null == flashManager) { return; } if (this.isKeepMessages()) { this.saveAllMessages(context); } releaseCurrentFlashManager(contextMap); if (outgoingResponseIsRedirect) { FlashInfo previousRequestFlashInfo = flashManager.getPreviousRequestFlashInfo(); previousRequestFlashInfo.setIsRedirect(true); flashManager.expireNext_MovePreviousToNext(); } else { FlashInfo flashInfo = flashManager.getPreviousRequestFlashInfo(); if (null != flashInfo && flashInfo.getLifetimeMarker() == LifetimeMarker.SecondTimeThru) { flashManager.expirePrevious(); } } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "---------------------------------------"); } setCookie(context, flashManager, flashManager.encode(), false); <START> System.out.println(flashManager.innerMap.size()); <END> }</code><technical_language>@spyrkob this System.out needs removed</technical_language>

Target:
public void doLastPhaseActions(FacesContext context, boolean outgoingResponseIsRedirect) { Map<Object, Object> contextMap = context.getAttributes(); PreviousNextFlashInfoManager flashManager = getCurrentFlashManager(contextMap, false); if (null == flashManager) { return; } if (this.isKeepMessages()) { this.saveAllMessages(context); } releaseCurrentFlashManager(contextMap); if (outgoingResponseIsRedirect) { FlashInfo previousRequestFlashInfo = flashManager.getPreviousRequestFlashInfo(); previousRequestFlashInfo.setIsRedirect(true); flashManager.expireNext_MovePreviousToNext(); } else { FlashInfo flashInfo = flashManager.getPreviousRequestFlashInfo(); if (null != flashInfo && flashInfo.getLifetimeMarker() == LifetimeMarker.SecondTimeThru) { flashManager.expirePrevious(); } } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "---------------------------------------"); } setCookie(context, flashManager, flashManager.encode(), false); }
Source:
<code>public String[] deployBPMNPackage(String filePath, String fileName) throws Exception{ String url = preURL+"repository/deployments"; HttpHost target = new HttpHost("localhost",port,"http"); <START> <END> CredentialsProvider credProvider = new BasicCredentialsProvider(); DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getCredentialsProvider().setCredentials( new AuthScope(target.getHostName(),target.getPort()), new UsernamePasswordCredentials(username,password) ); try { HttpPost httpPost = new HttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addBinaryBody("file", new File(filePath), ContentType.MULTIPART_FORM_DATA,fileName); HttpEntity multipart = builder.build(); httpPost.setEntity(multipart); HttpResponse response = httpClient.execute(httpPost); try { String status = response.getStatusLine().toString(); String responseData = EntityUtils.toString(response.getEntity()); JSONObject jsonResponseObject = new JSONObject(responseData); if (status.contains("201") || status.contains("200")) { String deploymentID = jsonResponseObject.getString("id"); String name = jsonResponseObject.getString("name"); return new String[] { status, deploymentID, name }; } if(status.contains("500")){ String errorMessage = jsonResponseObject.getString("errorMessage"); return new String {status,errorMessage}; } return new String[] { status, null, null }; } catch (Exception message) { log.error("Response Data", message); } } catch (Exception message) { log.error("Data Post Failure", message); } return new String[] { null, null, null }; }</code><technical_language>Avoid localhost obtain is a parameter instantiating class</technical_language>

Target:
public String[] deployBPMNPackage(String filePath, String fileName) throws Exception { String url = serviceURL + "repository/deployments"; HttpHost target = new HttpHost(hostname, port, "http"); DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getCredentialsProvider().setCredentials( new AuthScope(target.getHostName(), target.getPort()), new UsernamePasswordCredentials(username, password) ); HttpPost httpPost = new HttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addBinaryBody("file", new File(filePath), ContentType.MULTIPART_FORM_DATA, fileName); HttpEntity multipart = builder.build(); httpPost.setEntity(multipart); HttpResponse response = httpClient.execute(httpPost); String status = response.getStatusLine().toString(); String responseData = EntityUtils.toString(response.getEntity()); JSONObject jsonResponseObject = new JSONObject(responseData); if (status.contains(Integer.toString(HttpStatus.SC_CREATED)) || status.contains(Integer.toString(HttpStatus.SC_OK))) { String deploymentID = jsonResponseObject.getString("id"); String name = jsonResponseObject.getString("name"); return new String[]{status, deploymentID, name}; } else if (status.contains(Integer.toString(HttpStatus.SC_INTERNAL_SERVER_ERROR))) { String errorMessage = jsonResponseObject.getString("errorMessage"); throw new RestClientException(errorMessage); } else { throw new RestClientException("Failed to deploy package " + fileName); } }
Source:
<code>private CounterConfiguration createCounterConfiguration(String json) throws IOException { JsonNode jsonNode = invocationHelper.getMapper().readValue(json, JsonNode.class); boolean strongCounter = jsonNode.has("strong-counter"); <START> boolean weakCounter = jsonNode.has("weak-counter"); <END> GlobalConfiguration cacheManagerConfiguration = invocationHelper.getRestCacheManager().getInstance().getCacheManagerConfiguration(); GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); GlobalConfigurationBuilder globalConfigurationBuilder = builder.read(cacheManagerConfiguration); CounterManagerConfigurationBuilder topBuilder = new CounterManagerConfigurationBuilder(globalConfigurationBuilder); if (strongCounter) { StrongCounterConfigurationBuilder counterBuilder = new StrongCounterConfigurationBuilder(topBuilder); invocationHelper.getJsonReader().readJson(counterBuilder, json); return ConvertUtil.parsedConfigToConfig(counterBuilder.create()); } else if (weakCounter) { WeakCounterConfigurationBuilder counterBuilder = new WeakCounterConfigurationBuilder(topBuilder); invocationHelper.getJsonReader().readJson(counterBuilder, json); return ConvertUtil.parsedConfigToConfig(counterBuilder.create()); } return null; }</code><technical_language>check for this in JSON object a URL scheme v2/counters/strong/{counterName}. reduces verbosity of JSON payload provides a clear separation of weak/strong counters</technical_language>

Target:
private CounterConfiguration createCounterConfiguration(String json) throws IOException { JsonNode jsonNode = invocationHelper.getMapper().readValue(json, JsonNode.class); boolean strongCounter = jsonNode.has("strong-counter"); boolean weakCounter = jsonNode.has("weak-counter"); if (strongCounter) { StrongCounterConfigurationBuilder counterBuilder = new StrongCounterConfigurationBuilder(null); invocationHelper.getJsonReader().readJson(counterBuilder, json); return ConvertUtil.parsedConfigToConfig(counterBuilder.create()); } else if (weakCounter) { WeakCounterConfigurationBuilder counterBuilder = new WeakCounterConfigurationBuilder(null); invocationHelper.getJsonReader().readJson(counterBuilder, json); return ConvertUtil.parsedConfigToConfig(counterBuilder.create()); } return null; }
Source:
<code>private Collection<T> getFilteredChildren() { if (fFilteredChildren == null) { <START> fFilteredChildren = new ConcurrentLinkedQueue<T>(getChildren()); <END> } return fFilteredChildren; }</code><technical_language>I tell, modifies this is created in sort code, arguably replace fFilteredChildren reference. If so, ArrayList wrapped Collections.unmodifiableList() faster safer</technical_language>

Target:
private Collection<T> getFilteredChildren() { if (fFilteredChildren == null) { synchronized (fChildrenLock) { if (fFilteredChildren == null) { fFilteredChildren = Collections.unmodifiableCollection(getChildren()); } } } return fFilteredChildren; }
Source:
<code>private static MethodHandle unmapJava7Or8(MethodHandles.Lookup lookup) throws ReflectiveOperationException { Class<?> directBufferClass = Class.forName("java.nio.DirectByteBuffer"); Method m = directBufferClass.getMethod("cleaner"); <START> m.setAccessible(true); <END> MethodHandle directBufferCleanerMethod = lookup.unreflect(m); Class<?> cleanerClass = directBufferCleanerMethod.type().returnType(); MethodHandle cleanMethod = lookup.findVirtual(cleanerClass, "clean", MethodType.methodType(void.class)); MethodHandle nonNullTest = lookup.findStatic(ByteBufferUtils.class, "nonNull", MethodType.methodType(boolean.class, Object.class) ).asType(MethodType.methodType(boolean.class, cleanerClass)); MethodHandle noop = MethodHandles.dropArguments(MethodHandles.constant( Void.class, null ).asType(MethodType.methodType(void.class)), 0, cleanerClass); MethodHandle unmapper = MethodHandles.filterReturnValue( directBufferCleanerMethod, MethodHandles.guardWithTest(nonNullTest, cleanMethod, noop) ).asType(MethodType.methodType(void.class, ByteBuffer.class)); return unmapper; }</code><technical_language>potential bad impacts making method globally accessible in class? more precisely, is a limit accessibility grant object of interest</technical_language>

Target:
private static MethodHandle unmapJava7Or8(MethodHandles.Lookup lookup) throws ReflectiveOperationException { Class<?> directBufferClass = Class.forName("java.nio.DirectByteBuffer"); Method m = directBufferClass.getMethod("cleaner"); m.setAccessible(true); MethodHandle directBufferCleanerMethod = lookup.unreflect(m); Class<?> cleanerClass = directBufferCleanerMethod.type().returnType(); MethodHandle cleanMethod = lookup.findVirtual(cleanerClass, "clean", MethodType.methodType(void.class)); MethodHandle nonNullTest = lookup.findStatic(Objects.class, "nonNull", MethodType.methodType(boolean.class, Object.class) ).asType(MethodType.methodType(boolean.class, cleanerClass)); MethodHandle noop = MethodHandles.dropArguments(MethodHandles.constant( Void.class, null ).asType(MethodType.methodType(void.class)), 0, cleanerClass); MethodHandle unmapper = MethodHandles.filterReturnValue( directBufferCleanerMethod, MethodHandles.guardWithTest(nonNullTest, cleanMethod, noop) ).asType(MethodType.methodType(void.class, ByteBuffer.class)); return unmapper; }
Source:
<code>public AssertionError failure(String message) { <START> return prettyPrintedWithoutAssertJRelatedElementsFromStackTraceIfNeeded(new AssertionError(message)); <END> }</code><technical_language>Call assertionErrorCreator.assertionError(String) instead of building AssertionError. Basically AssertionError built AssertionErrorCreator</technical_language>

Target:
public AssertionError failure(String message) { return prettyPrintedWithoutAssertJRelatedElementsFromStackTraceIfNeeded(assertionErrorCreator.assertionError(message)); }
Source:
<code>private GoogleClientSecrets loadClientSecretFromJson() throws IOException { try (InputStream in = new FileInputStream(new File(TestProperties.TEST_GMAIL_API_FOLDER, "client_secret.json"))) { <START> return GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); <END> } catch (FileNotFoundException e) { throw new RuntimeException("You need to set up your Gmail API credentials." + Const.EOL + "See docs/development.md section \"Deploying to a staging server\".", e); } }</code><technical_language>InputStreamReader is AutoClosable. part of above</technical_language>

Target:
private GoogleClientSecrets loadClientSecretFromJson() throws IOException { try (InputStreamReader in = new InputStreamReader(new FileInputStream( new File(TestProperties.TEST_GMAIL_API_FOLDER, "client_secret.json")))) { return GoogleClientSecrets.load(JSON_FACTORY, in); } catch (FileNotFoundException e) { throw new RuntimeException("You need to set up your Gmail API credentials." + Const.EOL + "See docs/development.md section \"Deploying to a staging server\".", e); } }
Source:
<code>private static boolean isUnknownSymbol(PythonFile pythonFile, Map<String, Symbol> symbolsByName, StringLiteral stringLiteral) { <START> if (stringLiteral.stringElements().stream().anyMatch(StringElement::isInterpolated)) { return false; } return !symbolsByName.containsKey(stringLiteral.trimmedQuotesValue()) && !BuiltinSymbols.all().contains(stringLiteral.trimmedQuotesValue()) && !isInitFileExportingModule(pythonFile, stringLiteral.trimmedQuotesValue()); <END> }</code><technical_language>_subjective, minor_ a bit weird out of conditions inlined a single expression, if statement. I in return split if statements</technical_language>

Target:
private static boolean isUnknownSymbol(PythonFile pythonFile, Map<String, Symbol> symbolsByName, StringLiteral stringLiteral) { String name = stringLiteral.trimmedQuotesValue(); return stringLiteral.stringElements().stream().noneMatch(StringElement::isInterpolated) && !symbolsByName.containsKey(name) && !BuiltinSymbols.all().contains(name) && !isInitFileExportingModule(pythonFile, name); }
Source:
<code>private void fetchChildren(List<OCFile> files) { int i; for (i=0; i < files.size() && !mCancellation; i++) { OCFile newFile = files.get(i); if (newFile.isDirectory()) { fetchData(newFile.getRemotePath(), newFile.getFileId()); <START> FileDataStorageManager storageManager = new FileDataStorageManager(getAccount(), getContext().getContentResolver()); <END> storageManager.saveFolderSize(newFile.getFileId()); } } if (mCancellation && i <files.size()) Log_OC.d(TAG, "Leaving synchronization before synchronizing " + files.get(i).getRemotePath() + " because cancelation request"); }</code><technical_language>is need for creating a new storageManager instance; getStorageManager() returns instance valid for synchronization process</technical_language>

Target:
private void fetchChildren(List<OCFile> files) { int i; for (i=0; i < files.size() && !mCancellation; i++) { OCFile newFile = files.get(i); if (newFile.isDirectory()) { fetchData(newFile.getRemotePath(), newFile.getFileId()); getStorageManager().calculateFolderSize(newFile.getFileId()); } } if (mCancellation && i <files.size()) Log_OC.d(TAG, "Leaving synchronization before synchronizing " + files.get(i).getRemotePath() + " because cancelation request"); }
Source:
<code>public QueryPlan explainAndPrepare(LensSessionHandle sessionHandle, String query, LensConf lensConf, String queryName) throws LensException { try { LOG.info("ExlainAndPrepare: " + sessionHandle.toString() + " query: " + query); acquire(sessionHandle); PreparedQueryContext prepared = prepareQuery(sessionHandle, query, lensConf, SubmitOp.EXPLAIN_AND_PREPARE); prepared.setQueryName(queryName); QueryPlan plan = prepared.getSelectedDriver().explainAndPrepare(prepared).toQueryPlan(); plan.setPrepareHandle(prepared.getPrepareHandle()); return plan; } catch (LensException e) { QueryPlan plan; <START> if (e.getCause().getMessage() != null) <END> plan = new QueryPlan(true, e.getCause().getMessage()); else plan = new QueryPlan(true, e.getMessage()); return plan; } catch (UnsupportedEncodingException e) { throw new LensException(e); } finally { release(sessionHandle); } }</code><technical_language>null check for e.getCause()</technical_language>

Target:
public QueryPlan explainAndPrepare(LensSessionHandle sessionHandle, String query, LensConf lensConf, String queryName) throws LensException { try { LOG.info("ExlainAndPrepare: " + sessionHandle.toString() + " query: " + query); acquire(sessionHandle); PreparedQueryContext prepared = prepareQuery(sessionHandle, query, lensConf, SubmitOp.EXPLAIN_AND_PREPARE); prepared.setQueryName(queryName); QueryPlan plan = prepared.getSelectedDriver().explainAndPrepare(prepared).toQueryPlan(); plan.setPrepareHandle(prepared.getPrepareHandle()); return plan; } catch (LensException e) { LOG.info("Explain and prepare failed", e); QueryPlan plan; if (e.getCause() != null && e.getCause().getMessage() != null) { plan = new QueryPlan(true, e.getCause().getMessage()); } else { plan = new QueryPlan(true, e.getMessage()); } return plan; } catch (UnsupportedEncodingException e) { throw new LensException(e); } finally { release(sessionHandle); } }
Source:
<code>public boolean intersects( Envelope other ) { if ( isValid() && other.isValid() && getDimension() == other.getDimension() ) { boolean result = true; for ( int i = 0; i < min.length; i++ ) { <START> result = result && other.min[i] <= max[i] && other.max[i] >= min[i]; <END> } return result; } else { return false; } }</code><technical_language>I a shortcut in covers. If ans false, return immediately. do here</technical_language>

Target:
public boolean intersects( Envelope other ) { boolean intersects = getDimension() == other.getDimension(); for ( int i = 0; i < min.length && intersects; i++ ) { intersects = other.min[i] <= max[i] && other.max[i] >= min[i]; } return intersects; }
Source:
<code>public synchronized @NonNull HTNode readNode(int seqNumber) throws ClosedChannelException { int offset = seqNumber & CACHE_MASK; HTNode readNode = fNodeCache[offset]; if (readNode != null && readNode.getSequenceNumber() == seqNumber) { return readNode; } try { seekFCToNodePos(fFileChannelIn, seqNumber); readNode = HTNode.readNode(fConfig, fFileChannelIn); fNodeCache[offset] = readNode; return readNode; } catch (ClosedChannelException e) { throw e; } catch (IOException e) { Activator.getDefault().logError(e.getMessage(), e); <START> throw new IllegalStateException(e); <END> } }</code><technical_language>unrelated this patch</technical_language>

Target:
public synchronized @NonNull HTNode readNode(int seqNumber) throws ClosedChannelException { int offset = seqNumber & CACHE_MASK; HTNode readNode = fNodeCache[offset]; if (readNode != null && readNode.getSequenceNumber() == seqNumber) { return readNode; } try { seekFCToNodePos(fFileChannelIn, seqNumber); readNode = HTNode.readNode(fConfig, fFileChannelIn); fNodeCache[offset] = readNode; return readNode; } catch (ClosedChannelException e) { throw e; } catch (IOException e) { Activator.getDefault().logError(e.getMessage(), e); throw new IllegalStateException(); } }
Source:
<code>private void initializeAnimator() { final long singleButtonDuration = NoteLength.QUARTER.toMilliseconds(beatsPerMinute); final int singleButtonWidth = scrollingView.getMeasuredWidth() / NUMBER_OF_NOTES_IN_TRACK_VIEW; <START> final int buttonsInTrack = scrollingView.getTrackGrid().getTactCount() * 4; <END> scrollingAnimator = ObjectAnimator.ofInt(this, "globalPlayPosition", singleButtonWidth * buttonsInTrack); scrollingAnimator.setDuration(singleButtonDuration * buttonsInTrack); scrollingAnimator.setInterpolator(new LinearInterpolator()); scrollingAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { playButton.setImageResource(R.drawable.ic_stop_24dp); playLine.setVisibility(View.VISIBLE); scrollingView.setPlaying(true); scrollingView.smoothScrollToPosition(0); scrollingView.getTrackGrid().startPlayback(pianoView); } @Override public void onAnimationEnd(Animator animation) { playButton.setImageResource(R.drawable.ic_play); playLine.setVisibility(View.GONE); scrollingView.setPlaying(false); scrollingView.getTrackGrid().stopPlayback(pianoView); scrollingView.smoothScrollToPosition(0); } }); }</code><technical_language>I TrackRowView.QUARTER_COUNT instead of 4</technical_language>

Target:
private void initializeAnimator() { final long singleButtonDuration = NoteLength.QUARTER.toMilliseconds(beatsPerMinute); final int singleButtonWidth = scrollingView.getMeasuredWidth() / NUMBER_OF_NOTES_IN_TRACK_VIEW; final int buttonsInTrack = scrollingView.getTrackGrid().getTactCount() * TrackRowView.QUARTER_COUNT; scrollingAnimator = ObjectAnimator.ofInt(this, "globalPlayPosition", singleButtonWidth * buttonsInTrack); scrollingAnimator.setDuration(singleButtonDuration * buttonsInTrack); scrollingAnimator.setInterpolator(new LinearInterpolator()); scrollingAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { playButton.setImageResource(R.drawable.ic_stop_24dp); playLine.setVisibility(View.VISIBLE); scrollingView.setPlaying(true); scrollingView.smoothScrollToPosition(0); scrollingView.getTrackGrid().startPlayback(pianoView); } @Override public void onAnimationEnd(Animator animation) { playButton.setImageResource(R.drawable.ic_play); playLine.setVisibility(View.GONE); scrollingView.setPlaying(false); scrollingView.getTrackGrid().stopPlayback(pianoView); scrollingView.smoothScrollToPosition(0); } }); }
Source:
<code>public void releaseMacsOnCommit(List<String> macs) { CompensationContext compensationContext = this.commandContext.getCompensationContext(); ReleaseMacsCompensationListener compensationListener = this.compensationListener; log.debug("Registering macs: to be released in case of successful execution", <START> Arrays.toString(macs.toArray())); <END> compensationListener.macsToReleaseOnCommit.addAll(macs); log.debug("Registering compensation listener {}" + compensationListener); compensationContext.addListener(compensationListener); }</code><technical_language>rely AbstractCollection..toString</technical_language>

Target:
public void releaseMacsOnCommit(List<String> macs) { CompensationContext compensationContext = this.commandContext.getCompensationContext(); ReleaseMacsCompensationListener compensationListener = this.compensationListener; log.debug("Registering macs: to be released in case of successful execution", macs); compensationListener.macsToReleaseOnCommit.addAll(macs); log.debug("Registering compensation listener {}" + compensationListener); compensationContext.addListener(compensationListener); }
Source:
<code>protected boolean validatePMAgentPort() { Integer port = getParameters().getAgent().getPort(); if (port == null) { <START> String portStr; <END> if (getParameters().getAgent().getOptionsMap().containsKey(PORT)) { portStr = getParameters().getAgent().getOptionsMap().get(PORT); if (StringUtils.isNumeric(portStr)) { port = Integer.valueOf(portStr); } else { return false; } } else { return true; } } return port == null || ValidationUtils.validatePort(port); }</code><technical_language>this step deeper line 40 String portStr = getParameters().getAgent().getOptionsMap().get(PORT);</technical_language>

Target:
protected boolean validatePMAgentPort() { Integer port = getParameters().getAgent().getPort(); if (port == null) { if (getParameters().getAgent().getOptionsMap().containsKey(PORT)) { String portStr = getParameters().getAgent().getOptionsMap().get(PORT); if (StringUtils.isNumeric(portStr)) { port = Integer.valueOf(portStr); } else { return false; } } else { return true; } } return port == null || ValidationUtils.validatePort(port); }
Source:
<code>public void run() { Platform.runLater(new Runnable() { @Override <START> public void run() { <END> synchronized (GameWindow.LOCK) { final Timer newTimer = new Timer(); try { InternalTicker.this.step(); if (timer != null) { timer.cancel(); } } finally { if (running) { scheduleTime = scheduleTime.plusNanos(NANOS_PER_TICK); newTimer.schedule(new InternalTicker(newTimer), Date.from(scheduleTime)); } else { newTimer.cancel(); } } } } }); }</code><technical_language>Actually... I run game moment? Exception in thread "JavaFX Application Thread" java.lang.Error: Unresolved compilation problem: method run() of type new Runnable(){} override a superclass method nl.tudelft.ti2206.group9.level.InternalTicker$1.run(InternalTicker.java:56) com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295) com.sun.javafx.application.PlatformImpl$$Lambda$48/610250873.run(Unknown Source) java.security.AccessController.doPrivileged(Native Method) com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294) com.sun.javafx.application.PlatformImpl$$Lambda$46/237061348.run(Unknown Source) com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) com.sun.glass.ui.win.WinApplication._runLoop(Native Method) com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101) com.sun.glass.ui.win.WinApplication$$Lambda$36/2117255219.run(Unknown Source) java.lang.Thread.run(Thread.java:745)</technical_language>

Target:
public void run() { Platform.runLater(new Runnable() { public void run() { synchronized (GameWindow.LOCK) { final Timer newTimer = new Timer(); try { InternalTicker.this.step(); if (timer != null) { timer.cancel(); } } finally { if (running) { scheduleTime = scheduleTime.plusNanos( NANOS_PER_TICK); newTimer.schedule(new InternalTicker(newTimer), Date.from(scheduleTime)); } else { newTimer.cancel(); } } } } }); }
Source:
<code>protected Object filterOutboundMessage(Object msg) { <START> if (msg instanceof ByteBuf || msg instanceof FileRegion || msg instanceof SpliceOutTask) { <END> return msg; } throw new UnsupportedOperationException( "unsupported message type: " + StringUtil.simpleClassName(msg) + EXPECTED_TYPES); }</code><technical_language>Do want lose copy-once optimization? filterOutboundMessage is called enqueue time. a heap buffer copied (maybe preferable if pooling is enabled?). copy immediately socket write option require multiple copies of bytes flushed in socket write call (extra bytes copied channel is OP_WRITE again). I envisioning some type of change, I thinking is preferable copy enqueue time if pooling is enabled. copying immediately write (potentially extra copies, pooling required)</technical_language>

Target:
protected Object filterOutboundMessage(Object msg) { if (msg instanceof ByteBuf) { return UnixChannelUtil.copyIfNonDirect((ByteBuf) msg, alloc()); } if (msg instanceof FileRegion || msg instanceof SpliceOutTask) { return msg; } throw new UnsupportedOperationException( "unsupported message type: " + StringUtil.simpleClassName(msg) + EXPECTED_TYPES); }
Source:
<code>private ISeries createSeries() { IBarSeries series = (IBarSeries) fChart.getSeriesSet().createSeries(SeriesType.BAR, Messages.AbstractSegmentStoreDensityViewer_SeriesLabel); series.setVisible(true); series.setBarPadding(0); <START> Color color = getColorForRGB(BAR_COLOR); series.setBarColor(color); <END> return series; }</code><technical_language>inline call</technical_language>

Target:
private ISeries createSeries() { IBarSeries series = (IBarSeries) fChart.getSeriesSet().createSeries(SeriesType.BAR, Messages.AbstractSegmentStoreDensityViewer_SeriesLabel); series.setVisible(true); series.setBarPadding(0); series.setBarColor(getColorForRGB(BAR_COLOR)); return series; }
Source:
<code>public Function(StreamInput in) throws IOException { info = new FunctionInfo(in); if (in.getVersion().onOrAfter(Version.V_4_1_0)) { filter = Symbols.nullableFromStream(in); } else { filter = null; } arguments = List.copyOf(Symbols.listFromStream(in)); <START> if (in.getVersion().onOrAfter(Version.V_4_1_0) && in.readBoolean()) { <END> signature = new Signature(in); } else { signature = null; } }</code><technical_language>4.2</technical_language>

Target:
public Function(StreamInput in) throws IOException { info = new FunctionInfo(in); if (in.getVersion().onOrAfter(Version.V_4_1_0)) { filter = Symbols.nullableFromStream(in); } else { filter = null; } arguments = List.copyOf(Symbols.listFromStream(in)); if (in.getVersion().onOrAfter(Version.V_4_2_0) && in.readBoolean()) { signature = new Signature(in); } else { signature = null; } }
Source:
<code>public void shouldThrowExceptionHttpClient() throws Exception { String name = "name"; when(rapidProHttpClient.executeGet("/groups", MediaFormat.JSON, null)).thenThrow(new RapidProClientException("Exception")); <START> Group fromWebservice = groupWebService.getGroupByName(name); <END> }</code><technical_language>variable is pointless (test this)</technical_language>

Target:
public void shouldThrowExceptionHttpClient() throws Exception { String name = "name"; when(rapidProHttpClient.executeGet("/groups", MediaFormat.JSON, null)).thenThrow(new RapidProClientException("Exception")); groupWebService.getGroupByName(name); }
Source:
<code>private void placeDateBox() { containerTable.setWidget(constantRowIndex, currentColumnMax, dateBox); <START> containerTable.getColumnFormatter().setWidth(currentColumnMax, dateRequired ? "100px" : "0px"); END> currentColumnMax++; }</code><technical_language>CSS</technical_language>

Target:
private void placeDateBox() { containerTable.setWidget(constantRowIndex, currentColumnMax, dateBox); containerTable.getColumnFormatter().setStyleName(currentColumnMax, dateRequired ? "dateBoxColumnWidth" : "dateBoxShrink"); currentColumnMax++; }
Source:
<code>public Response newPayment(@Auth Account account, @Valid CreateTelephonePaymentRequest createTelephonePaymentRequest) { Response connectorResponse = createTelephonePaymentService.getConnectorResponse(account, createTelephonePaymentRequest); <START> TelephonePaymentResponse telephonePaymentResponse = createTelephonePaymentService <END> .create(connectorResponse); return connectorResponse.getStatus() == HttpStatus.SC_CREATED ? Response.status(201).entity(telephonePaymentResponse).build() : Response.status(200).entity(telephonePaymentResponse).build(); }</code><technical_language>feels this done createTelephonePaymentService</technical_language>

Target:
public Response newPayment(@Auth Account account, @Valid CreateTelephonePaymentRequest createTelephonePaymentRequest) { Response connectorResponse = createTelephonePaymentService.getConnectorResponse(account, createTelephonePaymentRequest); TelephonePaymentResponse telephonePaymentResponse = createTelephonePaymentService .create(connectorResponse); return Response.status(connectorResponse.getStatus()).entity(telephonePaymentResponse).build(); }
Source:
<code><START> @Override public int getItemViewType(int position) { <END> if (position == mTasksUncompleted.size()) { return VIEW_TYPE_COMPLETED_TASKS_HEADER; } else { return VIEW_TYPE_TASK; } }</code><technical_language>suggestion @Override public int getItemViewType(int position) { move @Override annotation a separate line method declaration for code style consistency</technical_language>

Target:
public int getItemViewType(int position) { if (position == mTasksUncompleted.size()) { return VIEW_TYPE_COMPLETED_TASKS_HEADER; } else { return VIEW_TYPE_TASK; } }
Source:
<code>protected void preFinish() { bot.waitUntil(shellIsActive( UIText.FeatureFinishHandler_rewordSquashedCommitMessage)); String text = bot.styledText().getText(); text = text.substring(text.indexOf('\n')); bot.styledText().setText(SQUASHED_COMMENT_SUMMARY + text); <START> bot.button("Reword").click(); <END> }</code><technical_language>UIText.RebaseInteractiveHandler_EditMessageDialogOkButton</technical_language>

Target:
protected void preFinish() { bot.waitUntil(shellIsActive( UIText.FeatureFinishHandler_rewordSquashedCommitMessage)); String text = bot.styledText().getText(); text = text.substring(text.indexOf('\n')); bot.styledText().setText(SQUASHED_COMMENT_SUMMARY + text); bot.button(UIText.RebaseInteractiveHandler_EditMessageDialogOkButton) .click(); }
Source:
<code>public void moveMigratedFiles( File migrationDir, File storeDir, String versionToUpgradeFrom, String versionToMigrateTo ) throws IOException { if ( deleteObsoleteIndexes ) { deleteIndexes( schemaIndexDirectory ); } <START> deleteIndexes( LuceneLabelScanDirectory.getLuceneStoreDirectory( storeDir ) ); <END> }</code><technical_language>This gonna delete label scan store if is a nice thing. In time, gonna create new index part of migration for guys people forced wait startup, while expecting is ready fly. I proposed behaviour differs time is complaints in sounds a correct do. WDYT</technical_language>

Target:
public void moveMigratedFiles( File migrationDir, File storeDir, String versionToUpgradeFrom, String versionToMigrateTo ) throws IOException { if ( deleteObsoleteIndexes ) { deleteIndexes( schemaIndexDirectory ); } deleteIndexes( getLuceneStoreDirectory( storeDir ) ); }
Source:
<code>public static State getState(String stateString) { <START> if(stateString.equalsIgnoreCase(MachineStates.IN_USE)) return IN_USE; <END> if(stateString.equalsIgnoreCase(MachineStates.AVAILABLE)) return AVAILABLE; if(stateString.equalsIgnoreCase(MachineStates.ALMOST_DONE)) return ALMOST_DONE; if(stateString.equalsIgnoreCase(MachineStates.END_CYCLE)) return END_CYCLE; if(stateString.equalsIgnoreCase(MachineStates.READY)) return READY; return null; }</code><technical_language>stored strings in enum, loop instead</technical_language>

Target:
public static State getState(String stateString) { for(State state : values()) { if(stateString.equalsIgnoreCase(state.toString())) return state; } return null; }
Source:
<code>public void setCarrier(Context context) { String carrier = Util.getCarrier(context); if (carrier != null) { <START> putToMobile(Parameters.CARRIER, carrier); <END> } }</code><technical_language>rename putToMobile thing? I a hangover earlier versions sounds a bit odd..</technical_language>

Target:
public void setCarrier(Context context) { String carrier = Util.getCarrier(context); if (carrier != null) { addToMobileContext(Parameters.CARRIER, carrier); } }
Source:
<code>public void validate(JsonValue value) { super.validate(value); Id testId = new Id(value.asString()); <START> boolean isValueExist = ids.contains(testId); <END> if (!isValueExist) { throw new IllegalArgumentException(testId + " is not exist in next rule id list: " + ids + "."); } }</code><technical_language>exists a more grammatically correct name. I problem understanding you, codebase stay readable possible</technical_language>

Target:
public void validate(JsonValue value) { super.validate(value); Id testId = new Id(value.asString()); if (!searchIds.contains(testId)) { throw new IllegalArgumentException(testId + " is not a valid Id"); } }
Source:
<code>void pushGradients(final int inputSize, final LayerParameter[] parameterGradients) { for (int i = 0; i < parameterGradients.length; ++i) { parameterGradients[i].getWeightParam().divi(inputSize); <START> parameterGradients[i].getBiasParam().divi(inputSize); <END> if (layers[i].isLearnable()) { parameterWorker.push(i, parameterGradients[i]); } } }</code><technical_language>move L174~175 L176. If layer is learnable, divide weight & bias gradient inputSize</technical_language>

Target:
void pushGradients(final int inputSize, final LayerParameter[] parameterGradients) { for (int i = 0; i < parameterGradients.length; ++i) { if (layers[i].isLearnable()) { parameterGradients[i].getWeightParam().divi(inputSize); parameterGradients[i].getBiasParam().divi(inputSize); parameterWorker.push(i, parameterGradients[i]); } } }
Source:
<code>public void resume() { super.resume(); currentFailureStartTime = null; currentRecoveryStartTime = null; lastPublished = LastPublished.NONE; executorQueued.set(false); executorTime = 0; ScheduledTask task = new ScheduledTask(MutableMap.of("period", getConfig(POLL_PERIOD)), pollingTaskFactory); scheduledTask = ((EntityInternal)entity).getExecutionContext().submit(task); <START> } <END></code><technical_language>Duplicated logic in setEntity(). Forgivable for a small snippet though. scheduledTask is leaked canceled if resume() setEntity() is inadvertently invoked multiple times</technical_language>

Target:
public void resume() { currentFailureStartTime = null; currentRecoveryStartTime = null; lastPublished = LastPublished.NONE; executorQueued.set(false); executorTime = 0; super.resume(); doStartPolling(); }
Source:
<code>public static void setQueries(List<String> queries, Configuration conf) throws IOException { Preconditions.checkNotNull(queries); Preconditions.checkArgument(!queries.isEmpty()); <START> conf.set(QUERIES_KEY, JSONArray.toJSONString(queries)); <END> }</code><technical_language>This a good candidate for HadoopUtils.writeListToConfigAsJson(..), inverse method</technical_language>

Target:
public static void setQueries(List<String> queries, Configuration conf) throws IOException { Preconditions.checkNotNull(queries); Preconditions.checkArgument(!queries.isEmpty()); HadoopUtils.writeStringListToConfAsJson(QUERIES_KEY, queries, conf); }
Source:
<code>public void run(TransformContext context, GtfsMutableRelationalDao dao) { int removed = 0; int total = 0; for (Trip trip : dao.getAllTrips()) { List<StopTime> stopTimes = dao.getStopTimesForTrip(trip); int tripLength = stopTimes.size(); <START> for (int i =1; i < tripLength; i++) { <END> total++; StopTime stopTime = stopTimes.get(i); if (isNonRevenue(stopTime) && !isFirstOrLast(i, tripLength)){ dao.removeEntity(stopTime); removed++; } } } _log.info("removed=" + removed + " total=" + total); UpdateLibrary.clearDaoCache(dao); }</code><technical_language>I this 0-indexed, total wrong</technical_language>

Target:
public void run(TransformContext context, GtfsMutableRelationalDao dao) { int removedStopTimeCount = 0; int totalStopTimeCount = 0; for (Trip trip : dao.getAllTrips()) { List<StopTime> stopTimes = dao.getStopTimesForTrip(trip); int tripLength = stopTimes.size(); for (int i =0; i < tripLength; i++) { totalStopTimeCount++; StopTime stopTime = stopTimes.get(i); if (isNonRevenue(stopTime) && !isFirstOrLast(i, tripLength)) { dao.removeEntity(stopTime); removedStopTimeCount++; } } } _log.info("removed=" + removedStopTimeCount + " total=" + totalStopTimeCount); UpdateLibrary.clearDaoCache(dao); }
Source:
<code>public void testQueryAllElementsWithAttribute() throws Exception { final String xpath = " final DetailAST rootAst = getRootAst("InputXpathMapperAst.java"); final RootNode rootNode = new RootNode(rootAst); final List<Item> nodes = getXpathItems(xpath, rootNode); <START> assertEquals(17, nodes.size()); <END> }</code><technical_language>@timurt , please rebase, TC validate this, violate missed cases you</technical_language>

Target:
public void testQueryAllElementsWithAttribute() throws Exception { final String xpath = " final RootNode rootNode = getRootNode("InputXpathMapperAst.java"); final List<Item> nodes = getXpathItems(xpath, rootNode); assertEquals("Invalid number of nodes", 17, nodes.size()); }
Source:
<code>public WorkflowAction findAction(final String id, final User user) throws DotDataException, DotSecurityException { final WorkflowAction workflowAction = this.workFlowFactory.findAction(id); if(null != workflowAction){ if (!SYSTEM_WORKFLOW_ID.equals(workflowAction.getSchemeId())) { if (!hasValidLicense() && !this.getFriendClass().isFriend()) { throw new DotSecurityException( "You must have a valid license to see any available action."); <START> } <END> } } return workflowAction; }</code><technical_language>i18n</technical_language>

Target:
public WorkflowAction findAction(final String id, final User user) throws DotDataException, DotSecurityException { final WorkflowAction workflowAction = this.workFlowFactory.findAction(id); if(null != workflowAction){ if (!SYSTEM_WORKFLOW_ID.equals(workflowAction.getSchemeId())) { if (!hasValidLicense() && !this.getFriendClass().isFriend()) { throw new DotSecurityException("Workflow-Actions-License-required"); } } } return workflowAction; }
Source:
<code>public void TestGameStarLogo_001_gameStarLogoPresentOnBigResolution() { <START> String url = urlBuilder.getUrlForPath(wikiName, ""); <END> GlobalNavigationPageObject globalNavigation = new GlobalNavigationPageObject(driver); globalNavigation.getUrl(url); globalNavigation.resizeWindow(bigResolution); Assertion.assertTrue(globalNavigation.GameStarLinkDisplay(), "GameStar Logo should be visible"); }</code><technical_language>method getUrlForWiki (so need add empty string for article path)</technical_language>

Target:
public void TestGameStarLogo_001_gameStarLogoPresentOnBigResolution() { HomePageObject homePage = new HomePageObject(driver); VenusGlobalNavPageObject globalNav = new VenusGlobalNavPageObject(driver); homePage.openWikiPage(urlBuilder.getUrlForWiki(deWikiName)); homePage.resizeWindow(SHOW_LOGO_RESOLUTION); Assertion.assertTrue(globalNav.isGameStarLogoDisplayed(), "GameStar Logo should be visible"); }
Source:
<code>public String toString() { <START> return "EmailAddress{" + <END> "value='" + value + '\'' + '}'; }</code><technical_language>Change string "EmailAddress{" + + "}"</technical_language>

Target:
public String toString() { return "EmailAddress{" + value + "}"; }