auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Optional<Comparable> getMeasureValue(Condition condition, QualityGateEvaluator.Measure measure) { Comparable result = null; if (condition.isOnLeakPeriod()) { if (measure.getLeakValue().isPresent()) { switch (measure.getType()) { case BOOL: result = Double.compare(measure.getLeakValue().getAsDouble(), 1.0) == 1; break; case INT: case RATING: result = (int) measure.getLeakValue().getAsDouble(); <START> break; <END> case FLOAT: case PERCENT: result = measure.getLeakValue().getAsDouble(); break; case MILLISEC: case WORK_DUR: result = (long) measure.getLeakValue().getAsDouble(); break; default: throw new IllegalArgumentException("Condition on leak period is not allowed for type " + measure.getType()); } } } else { switch (measure.getType()) { case BOOL: if (measure.getValue().isPresent()) { result = Double.compare(measure.getValue().getAsDouble(), 1.0) == 1; } break; case INT: case RATING: if (measure.getValue().isPresent()) { result = (int) measure.getValue().getAsDouble(); } break; case FLOAT: case PERCENT: if (measure.getValue().isPresent()) { result = measure.getValue().getAsDouble(); } break; case MILLISEC: case WORK_DUR: if (measure.getValue().isPresent()) { result = (long) measure.getValue().getAsDouble(); } break; case LEVEL: case STRING: case DISTRIB: result = measure.getStringValue().orElse(null); break; default: throw new IllegalArgumentException("Condition on leak period is not allowed for type " + measure.getType()); } } return Optional.ofNullable(result); }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') Refactor this method reduce Cognitive Complexity 21 15 allowed. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private static Optional<Comparable> getMeasureValue(Condition condition, QualityGateEvaluator.Measure measure) { if (condition.isOnLeakPeriod()) { return Optional.ofNullable(getLeakValue(measure)); } return Optional.ofNullable(getValue(measure)); }
Source:
<code>public void testGetKeyPairWhenResponseIs2xx() throws Exception { HttpRequest get = HttpRequest .builder() .method("GET") .endpoint("<LINK_0>") .addHeader("Accept", "application/json") .addHeader("X-Auth-Token", authToken).build(); HttpResponse getResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResource("/keypair_details.json")).build(); <START> NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, <END> responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse); assertEquals(apiWhenServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().get("testkeypair"), new ParseKeyPairTest().expected()); }</code><technical_language>Rename variable apiWhenKeyPairExist</technical_language>

Target:
public void testGetKeyPairWhenResponseIs2xx() throws Exception { HttpRequest get = HttpRequest .builder() .method("GET") .endpoint("<LINK_0>") .addHeader("Accept", "application/json") .addHeader("X-Auth-Token", authToken).build(); HttpResponse getResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResource("/keypair_details.json")).build(); NovaApi apiWhenKeyPairExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse); assertEquals(apiWhenKeyPairExists.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().get("testkeypair"), new ParseKeyPairTest().expected()); }
Source:
<code>public void testSimilarItems() { List<IDValue> recs = target("similarity/I0/I4/I6").request() .accept(MediaType.APPLICATION_JSON_TYPE).get(LIST_ID_VALUE_TYPE); Assert.assertEquals(9, recs.size()); <START> for (int i = 1; i < recs.size(); i++) { <END> Assert.assertTrue(recs.get(i).getValue() <= recs.get(i-1).getValue()); } Assert.assertEquals("I1", recs.get(1).getID()); Assert.assertEquals(0.5571406877613947, recs.get(2).getValue(), DOUBLE_EPSILON); }</code><technical_language>I end refactoring checks for ordering this show in more places</technical_language>

Target:
public void testSimilarItems() { List<IDValue> recs = target("similarity/I0/I4/I6").request() .accept(MediaType.APPLICATION_JSON_TYPE).get(LIST_ID_VALUE_TYPE); testTopByValue(9, recs, false); Assert.assertEquals("I1", recs.get(1).getID()); Assert.assertEquals(0.5852498930217405, recs.get(2).getValue(), DOUBLE_EPSILON); }
Source:
<code>public void commandComplete(GcodeCommand command) { <START> if (command.isError() && this.controller.isStreaming() && !this.isPaused()) { <END> try { this.pauseResume(); } catch (Exception e) { GUIHelpers.displayErrorDialog(e.getLocalizedMessage()); } } }</code><technical_language>isSendingFile() instead of controller.isStreaming() for null check</technical_language>

Target:
public void commandComplete(GcodeCommand command) { if (command.isError() && isSendingFile() && !this.isPaused()) { try { this.pauseResume(); } catch (Exception e) { GUIHelpers.displayErrorDialog(e.getLocalizedMessage()); } } }
Source:
<code>public static synchronized void trace(String msg) { <START> if (fTraceFile != null) { <END> return; } long currentTime = System.currentTimeMillis(); StringBuilder message = new StringBuilder("["); message.append(currentTime / 1000); message.append("."); message.append(String.format("%1$03d", currentTime % 1000)); message.append("] "); message.append("[TID="); message.append(String.format("%1$03d", Thread.currentThread().getId())); message.append("] "); message.append(msg); try { fTraceFile.write(message.toString()); fTraceFile.newLine(); fTraceFile.flush(); } catch (IOException e) { Activator.logError("Error writing to log file", e); } }</code><technical_language>if (fTraceFile == null)</technical_language>

Target:
public static synchronized void trace(String msg) { if (fTraceFile == null) { return; } long currentTime = System.currentTimeMillis(); StringBuilder message = new StringBuilder("["); message.append(currentTime / 1000); message.append("."); message.append(String.format("%1$03d", currentTime % 1000)); message.append("] "); message.append("[TID="); message.append(String.format("%1$03d", Thread.currentThread().getId())); message.append("] "); message.append(msg); try { fTraceFile.write(message.toString()); fTraceFile.newLine(); fTraceFile.flush(); } catch (IOException e) { Activator.logError("Error writing to log file", e); } }
Source:
<code>public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) throws Exception { Channel ch = ctx.channel(); NewHotRodDecoder decoder = ctx.pipeline().get(NewHotRodDecoder.class); CacheDecodeContext decodeCtx = decoder.decodeCtx; log.debug("Exception caught", t); if (t instanceof DecoderException) { t = t.getCause(); } if (t instanceof HotRodException) { ch.writeAndFlush(((HotRodException) t).response()); } else { ch.writeAndFlush(decodeCtx.createExceptionResponse(t)); <START> } <END> }</code><technical_language>Netty's practices, a write flush interested in future, ch.writeAndFlush(whatever, ch.voidPromise()) reduce allocation rates reuses promise. I if adopt a rule channels writes breaking</technical_language>

Target:
public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) throws Exception { Channel ch = ctx.channel(); HotRodDecoder decoder = ctx.pipeline().get(HotRodDecoder.class); CacheDecodeContext decodeCtx = decoder.decodeCtx; log.debug("Exception caught", t); if (t instanceof DecoderException) { t = t.getCause(); } if (t instanceof HotRodException) { ch.writeAndFlush(((HotRodException) t).response(), ch.voidPromise()); } else { ch.writeAndFlush(decodeCtx.createExceptionResponse(t), ch.voidPromise()); } }
Source:
<code>public void testGetColumnsFromJSONArraySingleEntry() { String json = "{" + "\"array\": " + "[7]" + "}"; <START> YailList expecetdColumn = YailList.makeList(Arrays.asList("array", "7")); <END> YailList expected = YailList.makeList(Collections.singletonList(expecetdColumn)); YailList result = JsonUtil.getColumnsFromJSON(json); assertEquals(expected, result); }</code><technical_language>Minor spelling error: expecetdColumn expectedColumn</technical_language>

Target:
public void testGetColumnsFromJSONArraySingleEntry() { String json = "{" + "\"array\": " + "[7]" + "}"; YailList expectedColumn = YailList.makeList(Arrays.asList("array", "7")); YailList expected = YailList.makeList(Collections.singletonList(expectedColumn)); YailList result = JsonUtil.getColumnsFromJSON(json); assertEquals(expected, result); }
Source:
<code>public void resetLocalMembership(InstanceRegisteredEvent event) { afterStartUp = true; Member startUpPhaseLocalMember = atomicConsistentHash.get().getMembers().stream() .filter(Member::local) .findFirst() .orElseThrow(() -> new IllegalStateException( <START> "There should be no scenario were the local member does not exist." <END> )); updateMemberships(); atomicConsistentHash.updateAndGet(consistentHash -> consistentHash.without(startUpPhaseLocalMember)); }</code><technical_language>*"where" i.o. "were" I guess</technical_language>

Target:
public void resetLocalMembership(InstanceRegisteredEvent event) { registered = true; Member startUpPhaseLocalMember = atomicConsistentHash.get().getMembers().stream() .filter(Member::local) .findFirst() .orElseThrow(() -> new IllegalStateException( "There should be no scenario where the local member does not exist." )); updateMemberships(); atomicConsistentHash.updateAndGet(consistentHash -> consistentHash.without(startUpPhaseLocalMember)); }
Source:
<code>public void testNoServiceFound() throws Exception { when(mockRequest.params(QUERY_PARAM)).thenReturn("xml"); String res = (String) cqlTransformHandler.handle(mockRequest, mockResponse); <START> assertThat(res, is(SERVICE_NOT_FOUND)); <END> }</code><technical_language>test status code too? 404 right? write tests track of status codes this endpoint produce</technical_language>

Target:
public void testNoServiceFound() throws Exception { when(mockRequest.params(QUERY_PARAM)).thenReturn(OTHER_RETURN_ID); String res = Boon.toJson(cqlTransformHandler.handle(mockRequest, mockResponse)); assertThat(res, is(SERVICE_NOT_FOUND)); assertThat(mockResponse.status(), is(HttpStatus.NOT_FOUND_404)); }
Source:
<code>private ByteBuffer doPostTest(HttpRequest postRequest, List<ByteBuffer> contentToSend) throws InterruptedException { EmbeddedChannel channel = createChannel(); notificationSystem.reset(); postRequest.headers().set(RestUtils.Headers.AMBRY_CONTENT_TYPE, "application/octet-stream"); HttpUtil.setKeepAlive(postRequest, false); channel.writeInbound(postRequest); if (contentToSend != null) { for (ByteBuffer content : contentToSend) { channel.writeInbound(new DefaultHttpContent(Unpooled.wrappedBuffer(content))); } channel.writeInbound(LastHttpContent.EMPTY_LAST_CONTENT); } if (!notificationSystem.operationCompleted.await(1000, TimeUnit.MILLISECONDS)) { <START> fail("Post did not succeed after 100ms. There is an error or timeout needs to increase"); <END> } assertNotNull("Blob id operated on cannot be null", notificationSystem.blobIdOperatedOn); return router.getActiveBlobs().get(notificationSystem.blobIdOperatedOn).getBlob(); }</code><technical_language>fix this message 1000</technical_language>

Target:
private ByteBuffer doPostTest(HttpRequest postRequest, List<ByteBuffer> contentToSend) throws InterruptedException { EmbeddedChannel channel = createChannel(); notificationSystem.reset(); postRequest.headers().set(RestUtils.Headers.AMBRY_CONTENT_TYPE, "application/octet-stream"); HttpUtil.setKeepAlive(postRequest, false); channel.writeInbound(postRequest); if (contentToSend != null) { for (ByteBuffer content : contentToSend) { channel.writeInbound(new DefaultHttpContent(Unpooled.wrappedBuffer(content))); } channel.writeInbound(LastHttpContent.EMPTY_LAST_CONTENT); } if (!notificationSystem.operationCompleted.await(1000, TimeUnit.MILLISECONDS)) { fail("Post did not succeed after 1000ms. There is an error or timeout needs to increase"); } assertNotNull("Blob id operated on cannot be null", notificationSystem.blobIdOperatedOn); return router.getActiveBlobs().get(notificationSystem.blobIdOperatedOn).getBlob(); }
Source:
<code>public static Slice wrappedBuffer(ByteBuffer buffer) { if (buffer.isDirect()) { long address = getAddress(buffer); return new Slice(null, address + buffer.position(), buffer.limit() - buffer.position(), buffer.capacity(), buffer); } <START> if (buffer.hasArray()) { <END> return new Slice(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.limit() - buffer.position()); } throw new IllegalArgumentException("cannot wrap " + buffer.getClass().getName()); }</code><technical_language>remaining() method instead of size calculation (does thing)</technical_language>

Target:
public static Slice wrappedBuffer(ByteBuffer buffer) { if (buffer.isDirect()) { long address = getAddress(buffer); return new Slice(null, address + buffer.position(), buffer.remaining(), buffer.capacity(), buffer); } if (buffer.hasArray()) { return new Slice(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining()); } throw new IllegalArgumentException("cannot wrap " + buffer.getClass().getName()); }
Source:
<code>public void clusterStops() { <START> if (graph.clusterByParentStation) clusterByParentStation(); <END> else clusterByProximity(); }</code><technical_language>newline clusterByParentStation();</technical_language>

Target:
public void clusterStops() { switch (graph.stopClusterMode) { case "parentStation": clusterByParentStation(); break; case "proximity": clusterByProximity(); break; default: clusterByProximity(); } }
Source:
<code>public void testReduceRows() { List<SomethingWithLocations> result = dbRule.getSharedHandle() .createQuery("SELECT something.id, name, location FROM something NATURAL JOIN something_location") .reduceRows(LinkedHashMapRowReducer.<Integer, SomethingWithLocations>of((map, rv) -> map.computeIfAbsent(rv.getColumn("id", Integer.class), id -> new SomethingWithLocations(rv.getRow(Something.class))) .locations .add(rv.getColumn("location", String.class)))) <START> .collect(toList()); <END> assertThat(result).containsExactly( new SomethingWithLocations(new Something(1, "tree")).at("outside"), new SomethingWithLocations(new Something(2, "apple")).at("tree").at("pie")); }</code><technical_language>example of point streams, this natural invocation a possibly unnecessary copy (especially if toSet)</technical_language>

Target:
public void testReduceRows() { List<SomethingWithLocations> result = dbRule.getSharedHandle() .createQuery("SELECT something.id, name, location FROM something NATURAL JOIN something_location") .<Integer, SomethingWithLocations>reduceRows((map, rv) -> map.computeIfAbsent(rv.getColumn("id", Integer.class), id -> new SomethingWithLocations(rv.getRow(Something.class))) .locations .add(rv.getColumn("location", String.class))) .collect(toList()); assertThat(result).containsExactly( new SomethingWithLocations(new Something(1, "tree")).at("outside"), new SomethingWithLocations(new Something(2, "apple")).at("tree").at("pie")); }
Source:
<code>protected StatEntry trainEpoch() { resetNetworks(); InitMdp<Observation> initMdp = refacInitMdp(); Observation obs = initMdp.getLastObs(); double reward = initMdp.getReward(); Double startQ = Double.NaN; double meanQ = 0; int numQ = 0; List<Double> scores = new ArrayList<>(); while (currentEpochStep < getConfiguration().getMaxEpochStep() && !getMdp().isDone()) { if (getStepCounter() % getConfiguration().getTargetDqnUpdateFreq() == 0) { updateTargetNetwork(); } QLStepReturn<Observation> stepR = trainStep(obs); if (!stepR.getMaxQ().isNaN()) { if (startQ.isNaN()) startQ = stepR.getMaxQ(); numQ++; meanQ += stepR.getMaxQ(); } if (stepR.getScore() != 0) scores.add(stepR.getScore()); reward += stepR.getStepReply().getReward(); obs = stepR.getStepReply().getObservation(); incrementStep(); } meanQ /= (numQ + 0.001); <START> StatEntry statEntry = new QLStatEntry(getStepCounter(), getCurrentEpochStep(), reward, currentEpochStep, scores, <END> getEgPolicy().getEpsilon(), startQ, meanQ); return statEntry; }</code><technical_language>effectively equal</technical_language>

Target:
protected StatEntry trainEpoch() { resetNetworks(); InitMdp<Observation> initMdp = refacInitMdp(); Observation obs = initMdp.getLastObs(); double reward = initMdp.getReward(); Double startQ = Double.NaN; double meanQ = 0; int numQ = 0; List<Double> scores = new ArrayList<>(); while (currentEpochStep < getConfiguration().getMaxEpochStep() && !getMdp().isDone()) { if (getStepCounter() % getConfiguration().getTargetDqnUpdateFreq() == 0) { updateTargetNetwork(); } QLStepReturn<Observation> stepR = trainStep(obs); if (!stepR.getMaxQ().isNaN()) { if (startQ.isNaN()) startQ = stepR.getMaxQ(); numQ++; meanQ += stepR.getMaxQ(); } if (stepR.getScore() != 0) scores.add(stepR.getScore()); reward += stepR.getStepReply().getReward(); obs = stepR.getStepReply().getObservation(); incrementStep(); } finishEpoch(obs); meanQ /= (numQ + 0.001); StatEntry statEntry = new QLStatEntry(getStepCounter(), getEpochCounter(), reward, currentEpochStep, scores, getEgPolicy().getEpsilon(), startQ, meanQ); return statEntry; }
Source:
<code>public void stop() throws CopycatException { log.info("Stopping table monitoring thread"); tableMonitorThread.shutdown(); try { <START> tableMonitorThread.join(10000); <END> } catch (InterruptedException e) { } log.debug("Trying to close database connection"); try { db.close(); } catch (SQLException e) { log.error("Failed to close database connection: ", e); } }</code><technical_language>define instance variable for timeout</technical_language>

Target:
public void stop() throws CopycatException { log.info("Stopping table monitoring thread"); tableMonitorThread.shutdown(); try { tableMonitorThread.join(MAX_TIMEOUT); } catch (InterruptedException e) { } log.debug("Trying to close database connection"); try { db.close(); } catch (SQLException e) { log.error("Failed to close database connection: ", e); } }
Source:
<code>public void apply(MouseEvent event) { ChangeTaskProgressRuler.Progress progress = myChangeScale.getProgress(event.getX()); int newProgress = progress.toPercents(); if (newProgress > 100) { newProgress = 100; } if (newProgress < 0) { newProgress = 0; } myMutator.setCompletionPercentage(newProgress); <START> String hintText = <END> newProgress + "% (" + progress.toUnits() + getChartDateGrid().getTimeUnitStack().encode(getTask().getDuration().getTimeUnit()) + ")"; myLastNotes = new TaskInteractionHintRenderer(hintText, event.getX(), event.getY() - 30); }</code><technical_language>MessageFormat class String.format method, sense i18n culture understanding of proper spacing numbers percent signs (no kidding). I create a new key formatting pattern {0} %({1}{2}) in ganttproject/data/resources/language/i18n.properties file. GanttLanguage is a handy singleton for accessing i18n keys passing arguments</technical_language>

Target:
public void apply(MouseEvent event) { ChangeTaskProgressRuler.Progress progress = myChangeScale.getProgress(event.getX()); int newProgress = progress.toPercents(); if (newProgress > 100) { newProgress = 100; } if (newProgress < 0) { newProgress = 0; } myMutator.setCompletionPercentage(newProgress); String hintText = getHintText(newProgress, progress.toUnits()); myLastNotes = new TaskInteractionHintRenderer(hintText, event.getX(), event.getY() - 30); }
Source:
<code>public JsonFieldTransformer(String json) { List<Field> l = new ArrayList<>(); try { JSONArray jarr = new JSONArray(json); if (jarr.size() > 0) { JSONObject jo = jarr.getJSONObject(0); if (jo.has("fields")) { l = fromJsonArray(jo.getJSONArray("fields")); } else { l = fromJsonArrayStr(json); } } } catch (Exception e) { try { <START> JSONObject jo = new JSONObject(json); <END> if (jo.has("fields")) { l = fromJsonArray(jo.getJSONArray("fields")); } else { l.add(fromJsonStr(json)); } } catch (Exception ex) { throw new DotStateException(ex); } } this.list = ImmutableList.copyOf(l); }</code><technical_language>This variable name changed more significant</technical_language>

Target:
public JsonFieldTransformer(String json) { List<Field> l = new ArrayList<>(); try { JSONArray jarr = new JSONArray(json); if (jarr.size() > 0) { JSONObject jo = jarr.getJSONObject(0); if (jo.has("fields")) { l = fromJsonArray(jo.getJSONArray("fields")); } else { l = fromJsonArrayStr(json); } } } catch (Exception e) { try { final JSONObject fieldJsonObject = new JSONObject(json); if (fieldJsonObject.has("fields")) { l = fromJsonArray(fieldJsonObject.getJSONArray("fields")); } else { l.add(fromJsonStr(json)); } } catch (Exception ex) { throw new DotStateException(ex); } } this.list = ImmutableList.copyOf(l); }
Source:
<code><START> public ProgramEnrollment getFirstObject() { return results.get(0); } <END></code><technical_language>if ProgramEnrollmentList length is 0 ? I suppose exception</technical_language>

Target:
public ProgramEnrollment getFirstObject() { if (results.size() > 0) { return results.get(0); } else { return null; } }
Source:
<code>public FEELFnResult<Boolean> invoke(@ParameterName( "list" ) List list) { if ( list == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null")); } boolean result = false; for ( final Object element : list ) { if (element != null && !(element instanceof Boolean)) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "an element in the list is not a Boolean")); } else { <START> result |= element != null && element == Boolean.TRUE; <END> } } return FEELFnResult.ofResult( result ); }</code><technical_language>@baldimir Need a small correction here. spec says: > return true if item is true, else false if items false, else null previous implementation wrong, good opportunity fix</technical_language>

Target:
public FEELFnResult<Boolean> invoke(@ParameterName( "list" ) List list) { if ( list == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null")); } boolean result = false; boolean containsNull = false; for ( final Object element : list ) { if (element != null && !(element instanceof Boolean)) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "an element in the list is not a Boolean")); } else { if (element != null) { result |= (Boolean) element; } else if (!containsNull) { containsNull = true; } } } if (containsNull && !result) { return FEELFnResult.ofResult( null ); } else { return FEELFnResult.ofResult( result ); } }
Source:
<code>public void testSingleSplit() throws IOException, InterruptedException { FileSplit fileSplit = new FileSplit( <START> new Path("file", "", testAvroFile.getAbsolutePath()), <END> 0, testAvroFile.length(), new String[0]); AvroRecordReader recordReader = new AvroRecordReader(); recordReader.initializeInternal(fileSplit, new Configuration()); Truth.assertThat(remainingRecordCount(recordReader)).isEqualTo(RECORD_COUNT); recordReader.close(); }</code><technical_language>Set authority null: java new Path("file", null, testAvroFile.getAbsolutePath())</technical_language>

Target:
public void testSingleSplit() throws IOException, InterruptedException { FileSplit fileSplit = new FileSplit( new Path("file", null, testAvroFile.getAbsolutePath()), 0, testAvroFile.length(), new String[0]); AvroRecordReader recordReader = new AvroRecordReader(); recordReader.initializeInternal(fileSplit, new Configuration()); Truth.assertThat(remainingRecordCount(recordReader)).isEqualTo(RECORD_COUNT); recordReader.close(); }
Source:
<code>public Object execute(final ExecutionEvent event) throws ExecutionException { final List<RefNode> nodes = getSelectedNodes(event); final List<RefNode> unmergedNodes = new ArrayList<RefNode>(); final Shell shell = getShell(event); try { new ProgressMonitorDialog(shell).run(false, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { monitor.beginTask(UIText.DeleteBranchCommand_DeletingBranchesProgress, nodes.size()); for (RefNode refNode : nodes) { int result = deleteBranch(refNode, refNode .getObject(), false); if (result == DeleteBranchOperation.REJECTED_CURRENT) { throw new CoreException( Activator .createErrorStatus( UIText.DeleteBranchCommand_CannotDeleteCheckedOutBranch, null)); } else if (result == DeleteBranchOperation.REJECTED_UNMERGED) { unmergedNodes.add(refNode); } else monitor.worked(1); } if (!unmergedNodes.isEmpty()) { <START> @SuppressWarnings("unchecked") <END> MessageDialog messageDialog = new UnmergedBranchDialog( shell, unmergedNodes); if (messageDialog.open() == Window.OK) { for (RefNode node : unmergedNodes) { deleteBranch(node, node.getObject(), true); monitor.worked(1); } } } } catch (CoreException ex) { throw new InvocationTargetException(ex); } finally { monitor.done(); } } }); } catch (InvocationTargetException e1) { Activator.handleError( UIText.RepositoriesView_BranchDeletionFailureMessage, e1 .getCause(), true); } catch (InterruptedException e1) { } return null; }</code><technical_language>required if UnmergedBranchDialog<RefNode></technical_language>

Target:
public Object execute(final ExecutionEvent event) throws ExecutionException { final List<RefNode> nodes = getSelectedNodes(event); final List<RefNode> unmergedNodes = new ArrayList<RefNode>(); final Shell shell = getShell(event); try { new ProgressMonitorDialog(shell).run(false, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { monitor.beginTask(UIText.DeleteBranchCommand_DeletingBranchesProgress, nodes.size()); for (RefNode refNode : nodes) { int result = deleteBranch(refNode, refNode .getObject(), false); if (result == DeleteBranchOperation.REJECTED_CURRENT) { throw new CoreException( Activator .createErrorStatus( UIText.DeleteBranchCommand_CannotDeleteCheckedOutBranch, null)); } else if (result == DeleteBranchOperation.REJECTED_UNMERGED) { unmergedNodes.add(refNode); } else monitor.worked(1); } if (!unmergedNodes.isEmpty()) { MessageDialog messageDialog = new UnmergedBranchDialog<RefNode>( shell, unmergedNodes); if (messageDialog.open() == Window.OK) { for (RefNode node : unmergedNodes) { deleteBranch(node, node.getObject(), true); monitor.worked(1); } } } } catch (CoreException ex) { throw new InvocationTargetException(ex); } finally { monitor.done(); } } }); } catch (InvocationTargetException e1) { Activator.handleError( UIText.RepositoriesView_BranchDeletionFailureMessage, e1 .getCause(), true); } catch (InterruptedException e1) { } return null; }
Source:
<code>public void mergesDedicatedRows() { accumulator.accumulateBatch(SweepBatch.of( ImmutableList.of(), DEDICATED_ROWS_1, PROGRESS_TIMESTAMP + 177)); accumulator.accumulateBatch(SweepBatch.of( ImmutableList.of(), DEDICATED_ROWS_2, PROGRESS_TIMESTAMP + 288)); SweepBatchWithPartitionInfo batchWithPartitionInfo = accumulator.toSweepBatch(); assertThat(batchWithPartitionInfo.sweepBatch()).satisfies(batch -> { assertThat(batch.dedicatedRows()).isEqualTo(DedicatedRows.of( ImmutableList.of(SWEEPABLE_CELLS_ROW_1, SWEEPABLE_CELLS_ROW_2))); assertThat(batch.lastSweptTimestamp()).isEqualTo(PROGRESS_TIMESTAMP + 288); }); <START> assertThat(batchWithPartitionInfo.finePartitions()).isEqualTo(ImmutableSet.of()); <END> }</code><technical_language>This is a bug, delete rows references dedicated rows</technical_language>

Target:
public void mergesDedicatedRows() { accumulator.accumulateBatch(SweepBatch.of( ImmutableList.of(), DEDICATED_ROWS_1, PROGRESS_TIMESTAMP + 177)); accumulator.accumulateBatch(SweepBatch.of( ImmutableList.of(), DEDICATED_ROWS_2, PROGRESS_TIMESTAMP + 288)); SweepBatchWithPartitionInfo batchWithPartitionInfo = accumulator.toSweepBatch(); assertThat(batchWithPartitionInfo.sweepBatch()).satisfies(batch -> { assertThat(batch.dedicatedRows()).isEqualTo(DedicatedRows.of( ImmutableList.of(SWEEPABLE_CELLS_ROW_1, SWEEPABLE_CELLS_ROW_2))); assertThat(batch.lastSweptTimestamp()).isEqualTo(PROGRESS_TIMESTAMP + 288); }); assertThat(batchWithPartitionInfo.finePartitions()).isEqualTo(ImmutableSet.of( SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 177), SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 288))); }
Source:
<code>public void createTable(ConnectorTableMetadata tableMetadata) { try { createTable(tableMetadata, tableMetadata.getTable().getTableName()); } catch (SQLException e) { if (DUPLICATE_TABLE_SQLSTATE.equals(e.getSQLState())) { throw new PrestoException(ALREADY_EXISTS, e); } <START> else { <END> throw new PrestoException(JDBC_ERROR, e); } } }</code><technical_language>Nit: else is redundant</technical_language>

Target:
public void createTable(ConnectorTableMetadata tableMetadata) { try { createTable(tableMetadata, tableMetadata.getTable().getTableName()); } catch (SQLException e) { if (DUPLICATE_TABLE_SQLSTATE.equals(e.getSQLState())) { throw new PrestoException(ALREADY_EXISTS, e); } throw new PrestoException(JDBC_ERROR, e); } }
Source:
<code>public void onServerStopped() throws IOException { <START> SpongeImpl.postState(GameState.SERVER_STOPPED, SpongeEventFactory.createGameStoppedServerEvent(Sponge.getCauseStackManager().getCurrentCause())); <END> if (this.game.getServiceProvider().sqlService() instanceof SqlServiceImpl) { ((SqlServiceImpl) this.game.getServiceProvider().sqlService()).close(); } SpongeImpl.getConfigSaveManager().flush(); }</code><technical_language>reverted SpongeImpl</technical_language>

Target:
public void onServerStopped() throws IOException { SpongeCommon.postState(GameState.SERVER_STOPPED, SpongeEventFactory.createGameStoppedServerEvent(Sponge.getCauseStackManager().getCurrentCause())); ((SpongeSqlManager) this.game.getServiceProvider().sqlService()).close(); SpongeImpl.getConfigSaveManager().flush(); }
Source:
<code>public Response deactivate(Action action) { HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(((BackendDisksResource) collection).parentId, <START> Guid.createGuidFromString(id)); <END> return performAction(VdcActionType.HotUnPlugDiskFromVm, params); }</code><technical_language>Instead of Guid.createGuidFromString(id)), user 'guid' (the ID is saved a Guid for convenience)</technical_language>

Target:
public Response deactivate(Action action) { HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(((BackendDisksResource) collection).parentId, guid); return performAction(VdcActionType.HotUnPlugDiskFromVm, params); }
Source:
<code>protected void doExecute(Runnable task) { if (shutdownStarted.get()) { throw new RejectedExecutionException("Pool is shutdown"); } long seed = Math.abs(task.hashCode() ^ Clock.lastKnownTimeNanos()); <START> Worker w1 = schedulers[(int)(seed % schedulers.length)]; <END> if (w1.taskQueue.isEmpty()) { w1.addTask(task); } else { Worker w2 = schedulers[(int)((seed + 1) % schedulers.length)]; if (w1.taskQueue.size() < w2.taskQueue.size()) { w1.addTask(task); } else { w2.addTask(task); } } }</code><technical_language>know, this, grab size() queues is wrap task in another runnable. task execed in 100ms put queue. .size() real expensive more items in queue are. I assume .size()</technical_language>

Target:
protected void doExecute(Runnable task) { if (shutdownStarted.get()) { throw new RejectedExecutionException("Pool is shutdown"); } schedulers[(int)(Math.abs(stripeGenerator.getStripe(task)) % schedulers.length)].addTask(task); }
Source:
<code>private static void findAndCopySQLiteMetaFile(AbstractFile sqliteFile, String metaFileName) throws NoCurrentCaseException, TskCoreException, IOException { <START> if(sqliteFile.getParentPath().contains("carvedfiles")) { <END> return; } Case openCase = Case.getCurrentCaseThrows(); SleuthkitCase sleuthkitCase = openCase.getSleuthkitCase(); Services services = new Services(sleuthkitCase); FileManager fileManager = services.getFileManager(); List<AbstractFile> metaFiles = fileManager.findFilesExactName(sqliteFile.getParent().getId(), metaFileName); if (metaFiles != null) { for (AbstractFile metaFile : metaFiles) { String localDiskPath = openCase.getTempDirectory() + File.separator + sqliteFile.getId() + metaFile.getName(); File localMetaFile = new File(localDiskPath); if (!localMetaFile.exists()) { ContentUtils.writeToFile(metaFile, localMetaFile); } } } }</code><technical_language>This exact match. I .equals("$carvedfiles") - test</technical_language>

Target:
private static void findAndCopySQLiteMetaFile(AbstractFile sqliteFile, String metaFileName) throws NoCurrentCaseException, TskCoreException, IOException { if(sqliteFile.getParentPath().equalsIgnoreCase("/$carvedfiles/")) { return; } Case openCase = Case.getCurrentCaseThrows(); SleuthkitCase sleuthkitCase = openCase.getSleuthkitCase(); Services services = new Services(sleuthkitCase); FileManager fileManager = services.getFileManager(); List<AbstractFile> metaFiles = fileManager.findFilesExactName(sqliteFile.getParent().getId(), metaFileName); if (metaFiles != null) { for (AbstractFile metaFile : metaFiles) { String localDiskPath = openCase.getTempDirectory() + File.separator + sqliteFile.getId() + metaFile.getName(); File localMetaFile = new File(localDiskPath); if (!localMetaFile.exists()) { ContentUtils.writeToFile(metaFile, localMetaFile); } } } }
Source:
<code>private DruidCoordinatorRuntimeParams setupParamsForMaintenancePriority(int priority) { mockDruidServer(druidServer1, "1", "normal", 30L, 100L, ImmutableMap.of(segment1.getIdentifier(), segment1, segment3.getIdentifier(), segment3)); mockDruidServer(druidServer2, "2", "normal", 30L, 100L, ImmutableMap.of(segment2.getIdentifier(), segment2, segment3.getIdentifier(), segment3)); mockDruidServer(druidServer3, "3", "normal", 0L, 100L, Collections.emptyMap()); EasyMock.replay(druidServer4); mockCoordinator(coordinator); BalancerStrategy strategy = EasyMock.createMock(BalancerStrategy.class); EasyMock.expect(strategy.pickSegmentToMove(ImmutableList.of(new ServerHolder(druidServer2, peon2, true)))) .andReturn(new BalancerSegmentHolder(druidServer2, segment2)); EasyMock.expect(strategy.pickSegmentToMove(anyObject())) .andReturn(new BalancerSegmentHolder(druidServer1, segment1)); EasyMock.expect(strategy.findNewSegmentHomeBalancer(anyObject(), anyObject())).andReturn(new ServerHolder(druidServer3, peon3)).anyTimes(); replay(strategy); return defaultRuntimeParamsBuilder( ImmutableList.of(druidServer1, druidServer2, druidServer3), ImmutableList.of(peon1, peon2, peon3), ImmutableList.of(false, true, false) ) .withDynamicConfigs( <START> CoordinatorDynamicConfig.builder() <END> .withMaxSegmentsToMove( 1 ).withMaintenanceModeSegmentsPriority(priority).build() ) .withBalancerStrategy(strategy) .build(); }</code><technical_language>Formatting</technical_language>

Target:
private DruidCoordinatorRuntimeParams setupParamsForMaintenancePriority(int priority) { mockDruidServer(druidServer1, "1", "normal", 30L, 100L, Arrays.asList(segment1, segment3)); mockDruidServer(druidServer2, "2", "normal", 30L, 100L, Arrays.asList(segment2, segment3)); mockDruidServer(druidServer3, "3", "normal", 0L, 100L, Collections.emptyList()); EasyMock.replay(druidServer4); mockCoordinator(coordinator); BalancerStrategy strategy = EasyMock.createMock(BalancerStrategy.class); EasyMock.expect(strategy.pickSegmentToMove(ImmutableList.of(new ServerHolder(druidServer2, peon2, true)))) .andReturn(new BalancerSegmentHolder(druidServer2, segment2)); EasyMock.expect(strategy.pickSegmentToMove(anyObject())) .andReturn(new BalancerSegmentHolder(druidServer1, segment1)); EasyMock.expect(strategy.findNewSegmentHomeBalancer(anyObject(), anyObject())) .andReturn(new ServerHolder(druidServer3, peon3)) .anyTimes(); replay(strategy); return defaultRuntimeParamsBuilder( ImmutableList.of(druidServer1, druidServer2, druidServer3), ImmutableList.of(peon1, peon2, peon3), ImmutableList.of(false, true, false) ) .withDynamicConfigs( CoordinatorDynamicConfig.builder() .withMaxSegmentsToMove(1) .withMaintenanceModeSegmentsPriority(priority) .build() ) .withBalancerStrategy(strategy) .build(); }
Source:
<code><START> public boolean equals(Object o) <END> { if (this == o) { return true; } if (o == null || !getClass().equals(o.getClass())) { return false; } final ImmutableDruidDataSource that = (ImmutableDruidDataSource) o; if (!this.name.equals(that.name)) { return false; } if (!this.properties.equals(that.properties)) { return false; } if (!this.idToSegments.equals(that.idToSegments)) { return false; } return this.segmentsHolder.equals(that.segmentsHolder); }</code><technical_language>in a future PR this is changed compare metadata. I trouble some tests pass otherwise</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || !getClass().equals(o.getClass())) { return false; } final ImmutableDruidDataSource that = (ImmutableDruidDataSource) o; if (!this.name.equals(that.name)) { return false; } if (!this.properties.equals(that.properties)) { return false; } return this.idToSegments.equals(that.idToSegments); }
Source:
<code>public static boolean validatePort(int port) { <START> return ((port >= 1) && (port <= 65535)); <END> }</code><technical_language>constant for port range</technical_language>

Target:
public static boolean validatePort(int port) { return ((port >= BusinessEntitiesDefinitions.NETWORK_MIN_LEGAL_PORT) && (port <= BusinessEntitiesDefinitions.NETWORK_MAX_LEGAL_PORT)); }
Source:
<code><START> public LookupStrategy getPackageLookupStrategy(String packageName) { <END> LookupStrategy lookupStrategy = lookupStrategies.get().get(packageName); if (lookupStrategy == null) { if (isSystemPackage(packageName)) { lookupStrategy = PARENT_ONLY; } else { lookupStrategy = CHILD_FIRST; } lookupStrategies.get().put(packageName, lookupStrategy); } return lookupStrategy; }</code><technical_language>beware, this is initializing map, populating it. need do change for tis class</technical_language>

Target:
public LookupStrategy getPackageLookupStrategy(String packageName) { LookupStrategy lookupStrategy = lookupStrategies.get(packageName); if (lookupStrategy == null) { synchronized (this) { lookupStrategy = lookupStrategies.get(packageName); if (lookupStrategy == null) { if (isSystemPackage(packageName)) { lookupStrategy = PARENT_ONLY; } else { lookupStrategy = CHILD_FIRST; } lookupStrategies.put(packageName, lookupStrategy); } } } return lookupStrategy; }
Source:
<code>public void updateWorkerAnnouncement(Worker newWorker) throws Exception { synchronized (lock) { if (!started) { <START> log.error("Cannot update worker! Not Started!"); <END> return; } announcer.update(getAnnouncementsPathForWorker(), jsonMapper.writeValueAsBytes(newWorker)); } }</code><technical_language>I this throw exception, people succeeded in disabling a worker in fact not</technical_language>

Target:
public void updateWorkerAnnouncement(Worker newWorker) throws Exception { synchronized (lock) { if (!started) { throw new ISE("Cannot update worker! Not Started!"); } this.worker = newWorker; announcer.update(getAnnouncementsPathForWorker(), jsonMapper.writeValueAsBytes(newWorker)); } }
Source:
<code>public void testFileAsStringNamedPipe() throws Exception { Random random = new Random(); long n = random.nextLong(); n = n == Long.MIN_VALUE ? 0 : Math.abs(n); String tmpDir = System.getProperty("java.io.tmpdir"); String fifoName = "fifo-" + n + ".tmp"; File fifo = new File(tmpDir, fifoName); Thread producerThread = null; try { Process mkFifoCommand = new ProcessBuilder("mkfifo", fifo.getCanonicalPath()).start(); mkFifoCommand.waitFor(); final String testFileContent = "This is test"; producerThread = new Thread(() -> { <START> try { <END> Files.write(fifo.toPath(), testFileContent.getBytes()); } catch (IOException e) { e.printStackTrace(); } }, "FIFO-Producer"); producerThread.start(); assertEquals(testFileContent, Utils.readFileAsString(fifo.getCanonicalPath())); } finally { Files.deleteIfExists(fifo.toPath()); if (producerThread != null) { producerThread.join(60 * 1000); assertFalse(producerThread.isAlive()); } } }</code><technical_language>Hmm, goal of this</technical_language>

Target:
public void testFileAsStringNamedPipe() throws Exception { Random random = new Random(); long n = random.nextLong(); n = n == Long.MIN_VALUE ? 0 : Math.abs(n); String tmpDir = System.getProperty("java.io.tmpdir"); String fifoName = "fifo-" + n + ".tmp"; File fifo = new File(tmpDir, fifoName); Thread producerThread = null; try { Process mkFifoCommand = new ProcessBuilder("mkfifo", fifo.getCanonicalPath()).start(); mkFifoCommand.waitFor(); final String testFileContent = "This is test"; producerThread = new Thread(() -> { try { Files.write(fifo.toPath(), testFileContent.getBytes()); } catch (IOException e) { fail("Error when producing to fifo : " + e.getMessage()); } }, "FIFO-Producer"); producerThread.start(); assertEquals(testFileContent, Utils.readFileAsString(fifo.getCanonicalPath())); } finally { Files.deleteIfExists(fifo.toPath()); if (producerThread != null) { producerThread.join(30 * 1000); assertFalse(producerThread.isAlive()); } } }
Source:
<code>public void testRouterClosedDuringOperation() throws Exception { ServerErrorCode[] serverErrorCodes = new ServerErrorCode[9]; Arrays.fill(serverErrorCodes, ServerErrorCode.No_Error); initialize(9, false); writeBlobRecordToServers(serverErrorCodes); future = router.deleteBlob(blobIdString, new ClientCallback()); router.close(); try { future.get(); fail("Deletion should be unsuccessful. Exception is expected."); } catch (Exception e) { assertEquals("RouterErrorCode should be RouterClosed", RouterErrorCode.RouterClosed, ((RouterException) e.getCause()).getErrorCode()); } <START> assertCloseCleanup(); <END> }</code><technical_language>tests call assertCloseCleanup() end, simply move a method is annotated @After</technical_language>

Target:
public void testRouterClosedDuringOperation() throws Exception { ServerErrorCode[] serverErrorCodes = new ServerErrorCode[9]; Arrays.fill(serverErrorCodes, ServerErrorCode.No_Error); setServerResponse(false); presetServerErrorCode(serverErrorCodes); future = router.deleteBlob(blobIdString, new ClientCallback()); router.close(); try { future.get(); fail("Deletion should be unsuccessful. Exception is expected."); } catch (ExecutionException e) { assertEquals("RouterErrorCode should be RouterClosed", RouterErrorCode.RouterClosed, ((RouterException) e.getCause()).getErrorCode()); } }
Source:
<code>public Response getFirmwareStatus(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) String language, @PathParam("thingUID") @ApiParam(value = "thing") String thingUID) throws IOException { ThingUID thingUIDObject = new ThingUID(thingUID); FirmwareStatusInfo info = firmwareUpdateService.getFirmwareStatusInfo(thingUIDObject); if (info == null) { <START> return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Firmware status info not found"); <END> } return Response.ok().entity(buildFirmwareDTO(info)).build(); }</code><technical_language>This match API response description..</technical_language>

Target:
public Response getFirmwareStatus(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) String language, @PathParam("thingUID") @ApiParam(value = "thing") String thingUID) throws IOException { ThingUID thingUIDObject = new ThingUID(thingUID); FirmwareStatusInfo info = firmwareUpdateService.getFirmwareStatusInfo(thingUIDObject); if (info == null) { return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Firmware status info not found."); } return Response.ok().entity(buildFirmwareStatusDTO(info)).build(); }
Source:
<code>public byte[] encoded() { byte[] bytes; try { bytes = new Base64().encode(this.jwto.toString()); } catch (final IOException ignore) { <START> bytes = new byte[] {}; <END> } return bytes; }</code><technical_language>@semantosoph this a bit weird. so? throw unchecked exception here</technical_language>

Target:
public byte[] encoded() throws IOException { return new Base64().encode(this.jwto.toString()); }
Source:
<code>public <R extends HttpRequest> R bindToRequest(R request, Object input) { <START> checkArgument(checkNotNull(input, "input") instanceof Map<?,?>, "this binder is only valid for Maps!"); <END> checkNotNull(request, "request"); Map<String, String> userMetadata = Maps2.transformKeys((Map<String, String>) input, FN); Map<String, String> deletedMetadata = Maps.transformValues(userMetadata, FN2); return (R) request.toBuilder().replaceHeaders(Multimaps.forMap(deletedMetadata)).build(); }</code><technical_language>Remove of checks, null instanceof X == false: checkArgument(input instanceof Map<?,?>, "input a non-null java.util.Map");</technical_language>

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(input instanceof Map<?,?>, "this binder is only valid for Maps!"); checkNotNull(request, "request"); Map<String, String> userMetadata = Maps2.transformKeys((Map<String, String>) input, transformHeaders); Map<String, String> deletedMetadata = Maps.transformValues(userMetadata, transformValues); return (R) request.toBuilder().replaceHeaders(Multimaps.forMap(deletedMetadata)).build(); }
Source:
<code>public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { <START> return OffsetDateTime.parse(defaultStr, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss[.SSS]x")); <END> } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default OffsetTime value: " + defaultStr, e); } }</code><technical_language>a end of week home</technical_language>

Target:
public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { OffsetTime time = OffsetTime.parse(defaultStr, new DateTimeFormatterBuilder() .appendPattern("[yyyy-MM-dd ]HH:mm:ss") .appendFraction(ChronoField.NANO_OF_SECOND, 0, 9, true) .appendPattern("x") .toFormatter()); return javaToSqlArg(fieldType, time); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default OffsetTime value: " + defaultStr, e); } }
Source:
<code>public void incrementRetryCounter(Collection<String> succeededUris) { this.retryCounter++; <START> this.succeededUris = ImmutableSet.copyOf(succeededUris); <END> }</code><technical_language>this append operation? i if want create new collection for retry, poor allocation rate :) appending set enough, sacrificing internal immutability</technical_language>

Target:
public void incrementRetryCounter(Collection<String> succeededUris) { this.retryCounter++; this.succeededUris.addAll(succeededUris); }
Source:
<code>public synchronized SecretKey loadSecretKeyForDecryption(String keyVersion) throws GeneralSecurityException, IOException { if (keyVersion.equals(VERSION_USER_DEFINED)) { return getSecretKey(AuthenticationSettings.INSTANCE.getSecretKeyData()); } if (keyVersion.equals(VERSION_ANDROID_KEY_STORE)) { if (Build.VERSION.SDK_INT >= 18) { return readSecretKeyFromKeyStoreForDecryption(); } else { <START> throw new IllegalArgumentException( <END> String.format( "keyVersion '%s' is not supported in this SDK. AndroidKeyStore is supported API18 and above.", keyVersion)); } } throw new IllegalArgumentException("keyVersion = " + keyVersion); }</code><technical_language>throw this: - throw new IllegalStateException("Secret key provided for API < 18. " + "Use AuthenticationSettings.INSTANCE.setSecretKey()");</technical_language>

Target:
synchronized SecretKey loadSecretKeyForDecryption(String keyVersion) throws GeneralSecurityException, IOException { if (mSecretKeyFromAndroidKeyStore != null) { return mSecretKeyFromAndroidKeyStore; } return getKey(keyVersion); }
Source:
<code>public ITree parse(final StringReader reader) throws CommandSyntaxException { ResourceLocation location = ResourceLocation.read(reader); <START> return TreeManager.treeRoot.getIndividualTemplates().stream().filter(a -> a.getGenome().getActiveAllele(TreeChromosomes.SPECIES).getRegistryName().equals(location)).findFirst().orElseThrow(() -> new SimpleCommandExceptionType(new LiteralMessage("Invalid Bee Type: " + location)).create()); <END> }</code><technical_language>TreeManager.treeRoot.templateAsIndividual(TreeManager.treeRoot.getTemplate(location.toString()))</technical_language>

Target:
public ITree parse(final StringReader reader) throws CommandSyntaxException { ResourceLocation location = ResourceLocation.read(reader); return TreeManager.treeRoot.templateAsIndividual(TreeManager.treeRoot.getTemplate(location.toString())); }